From: Andrew Lunn <andrew@lunn.ch>
To: "Radu Pirea (NXP OSS)" <radu-nicolae.pirea@oss.nxp.com>
Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
richardcochran@gmail.com, sd@queasysnail.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC net-next v1 4/5] net: macsec: introduce mdo_insert_tx_tag
Date: Fri, 11 Aug 2023 19:42:14 +0200 [thread overview]
Message-ID: <ee545162-7695-4089-804d-64438e1de620@lunn.ch> (raw)
In-Reply-To: <20230811153249.283984-5-radu-nicolae.pirea@oss.nxp.com>
On Fri, Aug 11, 2023 at 06:32:48PM +0300, Radu Pirea (NXP OSS) wrote:
> Offloading MACsec in PHYs requires inserting the SecTAG and the ICV in
> the ethernet frame. This operation will increase the frame size with 32
> bytes. If the frames are sent at line rate, the PHY will not have enough
> room to insert the SecTAG and the ICV.
>
> To mitigate this scenario, the PHY offer to use require a specific
> ethertype with some padding bytes present in the ethernet frame. This
> ethertype and its associated bytes will be replaced by the SecTAG and ICV.
I think this could be worded better, to take into account different
implementations. As far as i understand, some PHYs include a MAC,
which reassembles the frame, and then places the frame into a queue
for processing. After processing, a second MAC does the actual send on
the wire. The queue allows for some number of back to back frames
without having problems. The PHY then uses flow control pause to slow
down the SoC MAC when there is a long burst of line rate frames which
would otherwise overflow the queue.
So:
> If the frames are sent at line rate, the PHY will not have enough
> room to insert the SecTAG and the ICV.
This probably want to clarify that a PHY which does not buffer....
> To mitigate this scenario, the PHY offer to use require a specific
and here you want to say some PHYs offer, since not all PHYs will do
this.
> + if (macsec->offload == MACSEC_OFFLOAD_OFF) {
> + dev->needed_headroom -= ops->needed_headroom;
> + dev->needed_headroom += MACSEC_NEEDED_HEADROOM;
> + dev->needed_tailroom -= ops->needed_tailroom;
> + dev->needed_tailroom += MACSEC_NEEDED_TAILROOM;
> + } else {
> + dev->needed_headroom -= MACSEC_NEEDED_HEADROOM;
> + dev->needed_headroom += ops->needed_headroom;
> + dev->needed_tailroom -= MACSEC_NEEDED_TAILROOM;
> + dev->needed_tailroom += ops->needed_tailroom;
> + }
It is not obvious to me what this is doing. Should this actually be in
macsec_dev_init()? My main problem is why there is an else condition?
> +static struct sk_buff *insert_tx_tag(struct sk_buff *skb,
> + struct net_device *dev)
> +{
> + struct macsec_dev *macsec = macsec_priv(dev);
> + const struct macsec_ops *ops;
> + struct macsec_context ctx;
> + int err;
> +
> + if (!macsec_is_offloaded(macsec))
> + return ERR_PTR(-EINVAL);
Hasn't this already been checked in macsec_start_xmit()?
> +
> + ops = macsec_get_ops(macsec, &ctx);
> + if (!ops)
> + return ERR_PTR(-EINVAL);
> +
> + if (!ops->mdo_insert_tx_tag)
> + return skb;
You are in the hot path here. You don't expect this to change from
frame to frame. So could you evaluate this once and store it
somewhere? Maybe in macsec_dev ?
Andrew
next prev parent reply other threads:[~2023-08-11 17:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 15:32 [RFC net-next v1 0/5] Add MACsec support for TJA11XX C45 PHYs Radu Pirea (NXP OSS)
2023-08-11 15:32 ` [RFC net-next v1 1/5] net: macsec: declare macsec_pn_wrapped shim Radu Pirea (NXP OSS)
2023-08-11 15:32 ` [RFC net-next v1 2/5] net: phy: remove MACSEC guard Radu Pirea (NXP OSS)
2023-08-11 16:59 ` Andrew Lunn
2023-08-14 15:35 ` Sabrina Dubroca
2023-08-14 15:50 ` Andrew Lunn
2023-08-11 15:32 ` [RFC net-next v1 3/5] net: phy: nxp-c45-tja11xx add MACsec support Radu Pirea (NXP OSS)
2023-08-11 17:10 ` Andrew Lunn
2023-08-16 8:18 ` Radu Pirea (OSS)
2023-08-12 18:01 ` Simon Horman
2023-08-11 15:32 ` [RFC net-next v1 4/5] net: macsec: introduce mdo_insert_tx_tag Radu Pirea (NXP OSS)
2023-08-11 17:42 ` Andrew Lunn [this message]
2023-08-16 10:12 ` Radu Pirea (OSS)
2023-08-12 18:07 ` Simon Horman
2023-08-16 10:19 ` Radu Pirea (OSS)
2023-08-16 20:40 ` Sabrina Dubroca
2023-08-17 8:25 ` Radu Pirea (OSS)
2023-08-17 10:31 ` Sabrina Dubroca
2023-08-17 11:19 ` Radu Pirea (OSS)
2023-08-11 15:32 ` [RFC net-next v1 5/5] net: phy: nxp-c45-tja11xx: implement mdo_insert_tx_tag Radu Pirea (NXP OSS)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee545162-7695-4089-804d-64438e1de620@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=radu-nicolae.pirea@oss.nxp.com \
--cc=richardcochran@gmail.com \
--cc=sd@queasysnail.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®