From: Dmitry Bogdanov Date: Tue, 10 Mar 2020 15:22:25 +0000 (+0300) Subject: net: macsec: invoke mdo_upd_secy callback when mac address changed X-Git-Tag: baikal/mips/sdk5.9~14142^2~19^2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=a6d6aef9e0d6da8df4d289c414f938ff5b2d3cbf;p=kernel.git net: macsec: invoke mdo_upd_secy callback when mac address changed Notify the offload engine about MAC address change to reconfigure it accordingly. Fixes: 37ce3272dda3 ("net: macsec: hardware offloading infrastructure") Signed-off-by: Dmitry Bogdanov Signed-off-by: Mark Starovoytov Signed-off-by: Igor Russkikh Signed-off-by: David S. Miller --- diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 66c6392251bc3..6ec6fc191a6e4 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3274,6 +3274,19 @@ static int macsec_set_mac_address(struct net_device *dev, void *p) out: ether_addr_copy(dev->dev_addr, addr->sa_data); macsec->secy.sci = dev_to_sci(dev, MACSEC_PORT_ES); + + /* If h/w offloading is available, propagate to the device */ + if (macsec_is_offloaded(macsec)) { + const struct macsec_ops *ops; + struct macsec_context ctx; + + ops = macsec_get_ops(macsec, &ctx); + if (ops) { + ctx.secy = &macsec->secy; + macsec_offload(ops->mdo_upd_secy, &ctx); + } + } + return 0; }