blob: ab7986b59e88fabaa09b48c6cab8a692b0dda945 [file] [log] [blame]
developer7e32f7e2022-05-18 21:10:08 +08001From 09f4136c5d6b4c5144a965bd086009863d58ff08 Mon Sep 17 00:00:00 2001
2From: Dmitry Bogdanov <dbogdanov@marvell.com>
3Date: Tue, 10 Mar 2020 18:22:25 +0300
4Subject: net: macsec: invoke mdo_upd_secy callback when mac address changed
5
6Notify the offload engine about MAC address change to reconfigure it
7accordingly.
8
9Fixes: 3cf3227a21d1 ("net: macsec: hardware offloading infrastructure")
10Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
11Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
12Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
13Signed-off-by: David S. Miller <davem@davemloft.net>
14---
15 drivers/net/macsec.c | 13 +++++++++++++
16 1 file changed, 13 insertions(+)
17
18diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
19index 66c6392251bc3..6ec6fc191a6e4 100644
20--- a/drivers/net/macsec.c
21+++ b/drivers/net/macsec.c
22@@ -3274,6 +3274,19 @@ static int macsec_set_mac_address(struct net_device *dev, void *p)
23 out:
24 ether_addr_copy(dev->dev_addr, addr->sa_data);
25 macsec->secy.sci = dev_to_sci(dev, MACSEC_PORT_ES);
26+
27+ /* If h/w offloading is available, propagate to the device */
28+ if (macsec_is_offloaded(macsec)) {
29+ const struct macsec_ops *ops;
30+ struct macsec_context ctx;
31+
32+ ops = macsec_get_ops(macsec, &ctx);
33+ if (ops) {
34+ ctx.secy = &macsec->secy;
35+ macsec_offload(ops->mdo_upd_secy, &ctx);
36+ }
37+ }
38+
39 return 0;
40 }
41
42--
43cgit 1.2.3-1.el7
44