From d84a5980023b84f2ff79816fdf6f1e609f6aea0c Mon Sep 17 00:00:00 2001 From: Sanath Kumar Gampa Date: Thu, 24 Mar 2022 09:17:53 +0530 Subject: [PATCH] nvethernet: MACSEC MTU update Issue: If MTU is increased after Supplicant is initialized we are not updating the MACSEC MTU so the frames will get dropped as the MACSEC MTU is lesser than the frames received Fix: Changes to update the MACSEC MTU along with MAC MTU Bug 3577143 Change-Id: I8cdd8ce331cbf40139e6f486439113d5b29a0687 Signed-off-by: Sanath Kumar Gampa Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2686289 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/net/ethernet/nvidia/nvethernet/ether_linux.c | 6 ++++++ drivers/net/ethernet/nvidia/nvethernet/macsec.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c index 3f3d2e58..a10fa076 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c @@ -3930,6 +3930,12 @@ static int ether_change_mtu(struct net_device *ndev, int new_mtu) /* Macsec is supported, reduce MTU */ if ((osi_core->mac == OSI_MAC_HW_EQOS && osi_core->mac_ver == OSI_EQOS_MAC_5_30) || (osi_core->mac == OSI_MAC_HW_MGBE && osi_core->mac_ver == OSI_MGBE_MAC_3_10)) { + ret = osi_macsec_update_mtu(osi_core, new_mtu); + if (ret < 0) { + dev_err(pdata->dev, "Failed to set MACSEC MTU to %d\n", + new_mtu); + return -EINVAL; + } ndev->mtu -= MACSEC_TAG_ICV_LEN; netdev_info(pdata->ndev, "Macsec: Reduced MTU: %d Max: %d\n", ndev->mtu, ndev->max_mtu); diff --git a/drivers/net/ethernet/nvidia/nvethernet/macsec.c b/drivers/net/ethernet/nvidia/nvethernet/macsec.c index 4d76c5a5..9dc87ace 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/macsec.c +++ b/drivers/net/ethernet/nvidia/nvethernet/macsec.c @@ -211,7 +211,7 @@ int macsec_open(struct macsec_priv_data *macsec_pdata, macsec_pdata->is_irq_allocated |= OSI_BIT(1); /* Invoke OSI HW initialization, initialize standard BYP entries */ - ret = osi_macsec_init(pdata->osi_core); + ret = osi_macsec_init(pdata->osi_core, pdata->osi_core->mtu); if (ret < 0) { dev_err(dev, "osi_macsec_init failed, %d\n", ret); goto err_osi_init;