[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 8 Aug 2023 17:14:29 +0300
From: "Radu Pirea (NXP OSS)" <radu-nicolae.pirea@....nxp.com>
To: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
sd@...asysnail.net
Cc: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
"Radu Pirea (NXP OSS)" <radu-nicolae.pirea@....nxp.com>
Subject: [PATCH] net: macsec: use TX SCI as MAC address
According to IEEE 802.1AE the SCI comprises the MAC address and the port
identifier.
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@....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
Powered by blists - more mailing lists