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 <sgampa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2686289
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sanath Kumar Gampa
2022-03-24 09:17:53 +05:30
committed by Revanth Kumar Uppala
parent 5f6dd1210b
commit d84a598002
2 changed files with 7 additions and 1 deletions

View File

@@ -3930,6 +3930,12 @@ static int ether_change_mtu(struct net_device *ndev, int new_mtu)
/* Macsec is supported, reduce MTU */ /* Macsec is supported, reduce MTU */
if ((osi_core->mac == OSI_MAC_HW_EQOS && osi_core->mac_ver == OSI_EQOS_MAC_5_30) || 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)) { (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; ndev->mtu -= MACSEC_TAG_ICV_LEN;
netdev_info(pdata->ndev, "Macsec: Reduced MTU: %d Max: %d\n", netdev_info(pdata->ndev, "Macsec: Reduced MTU: %d Max: %d\n",
ndev->mtu, ndev->max_mtu); ndev->mtu, ndev->max_mtu);

View File

@@ -211,7 +211,7 @@ int macsec_open(struct macsec_priv_data *macsec_pdata,
macsec_pdata->is_irq_allocated |= OSI_BIT(1); macsec_pdata->is_irq_allocated |= OSI_BIT(1);
/* Invoke OSI HW initialization, initialize standard BYP entries */ /* 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) { if (ret < 0) {
dev_err(dev, "osi_macsec_init failed, %d\n", ret); dev_err(dev, "osi_macsec_init failed, %d\n", ret);
goto err_osi_init; goto err_osi_init;