developer | 7e32f7e | 2022-05-18 21:10:08 +0800 | [diff] [blame] | 1 | From 09f4136c5d6b4c5144a965bd086009863d58ff08 Mon Sep 17 00:00:00 2001 |
| 2 | From: Dmitry Bogdanov <dbogdanov@marvell.com> |
| 3 | Date: Tue, 10 Mar 2020 18:22:25 +0300 |
| 4 | Subject: net: macsec: invoke mdo_upd_secy callback when mac address changed |
| 5 | |
| 6 | Notify the offload engine about MAC address change to reconfigure it |
| 7 | accordingly. |
| 8 | |
| 9 | Fixes: 3cf3227a21d1 ("net: macsec: hardware offloading infrastructure") |
| 10 | Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com> |
| 11 | Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com> |
| 12 | Signed-off-by: Igor Russkikh <irusskikh@marvell.com> |
| 13 | Signed-off-by: David S. Miller <davem@davemloft.net> |
| 14 | --- |
| 15 | drivers/net/macsec.c | 13 +++++++++++++ |
| 16 | 1 file changed, 13 insertions(+) |
| 17 | |
| 18 | diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c |
| 19 | index 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 | -- |
| 43 | cgit 1.2.3-1.el7 |
| 44 | |