From: Sabrina Dubroca <sd@queasysnail.net>
To: "Radu Pirea (NXP OSS)" <radu-nicolae.pirea@oss.nxp.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: macsec: use TX SCI as MAC address
Date: Tue, 8 Aug 2023 17:22:11 +0200 [thread overview]
Message-ID: <ZNJdo6bow7uK8bTn@hog> (raw)
In-Reply-To: <20230808141429.220830-1-radu-nicolae.pirea@oss.nxp.com>
2023-08-08, 17:14:29 +0300, Radu Pirea (NXP OSS) wrote:
> According to IEEE 802.1AE the SCI comprises the MAC address and the port
> identifier.
I don't think the SCI needs to be composed of the actual device's MAC
address. 8.2.1 says that the MAC address *can* be used to compose the
SCI, but doesn't mandate it.
If you want the SCI to match the device's MAC address, why not use
IFLA_MACSEC_PORT instead?
> If a new MACsec interface is created with a specific TX SCI, use that
> SCI to set the MAC address of the new interface.
>
> Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
> ---
> drivers/net/macsec.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
> index 984dfa5d6c11..6db69daf880d 100644
> --- a/drivers/net/macsec.c
> +++ b/drivers/net/macsec.c
> @@ -4103,12 +4103,14 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
> /* need to be already registered so that ->init has run and
> * the MAC addr is set
> */
> - if (data && data[IFLA_MACSEC_SCI])
> + if (data && data[IFLA_MACSEC_SCI]) {
> sci = nla_get_sci(data[IFLA_MACSEC_SCI]);
> - else if (data && data[IFLA_MACSEC_PORT])
> + eth_hw_addr_set(dev, (u8 *)&sci);
> + } else if (data && data[IFLA_MACSEC_PORT]) {
> sci = dev_to_sci(dev, nla_get_be16(data[IFLA_MACSEC_PORT]));
> - else
> + } else {
> sci = dev_to_sci(dev, MACSEC_PORT_ES);
> + }
>
> if (rx_handler && sci_exists(real_dev, sci)) {
> err = -EBUSY;
> --
> 2.34.1
>
--
Sabrina
next prev parent reply other threads:[~2023-08-08 18:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 14:14 [PATCH] net: macsec: use TX SCI as MAC address Radu Pirea (NXP OSS)
2023-08-08 15:22 ` Sabrina Dubroca [this message]
2023-08-09 6:37 ` Radu Pirea (OSS)
2023-08-09 12:10 ` Sabrina Dubroca
2023-08-09 13:35 ` Radu Pirea (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=ZNJdo6bow7uK8bTn@hog \
--to=sd@queasysnail.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=radu-nicolae.pirea@oss.nxp.com \
/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;
as well as URLs for NNTP newsgroup(s).