nvethernet: macsec suspend-resume with wol enabled

Issue: If WOL is enabled after running "./ethtool -s eth0 wol g"
command there will not be any eapol frames transaction, hence macsec
will be disabled. As macsec is disabled before suspend we are not
enabling it back once resumed. Because of this eapol frames are also
sent with sec-tag as byp_lut is not programmed.

Fix: Instead of depending on the macsec state, check if there is any
supplicant running, if there is any supplicant then enable the macsec
post resume.

Bug 3577131

Change-Id: I6018b94411034eebba34f5f0a9520907305c573e
Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2694446
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sanath Kumar Gampa
2022-04-08 13:56:27 +05:30
committed by Revanth Kumar Uppala
parent 76abafe3a3
commit c7376b2390
3 changed files with 9 additions and 11 deletions

View File

@@ -6821,7 +6821,7 @@ static int ether_resume(struct ether_priv_data *pdata)
#ifdef MACSEC_SUPPORT
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)) {
if (pdata->macsec_pdata->enabled_before_suspend != OSI_DISABLE) {
if (pdata->macsec_pdata->next_supp_idx != OSI_DISABLE) {
ret = macsec_resume(pdata->macsec_pdata);
if (ret < 0)
dev_err(pdata->dev, "Failed to resume MACSEC ");
@@ -6869,9 +6869,7 @@ static int ether_suspend_noirq(struct device *dev)
#ifdef MACSEC_SUPPORT
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)) {
pdata->macsec_pdata->enabled_before_suspend =
pdata->macsec_pdata->enabled;
if (pdata->macsec_pdata->enabled != OSI_DISABLE) {
if (pdata->macsec_pdata->next_supp_idx != OSI_DISABLE) {
ret = macsec_suspend(pdata->macsec_pdata);
if (ret < 0)
dev_err(pdata->dev, "Failed to suspend macsec");

View File

@@ -330,7 +330,6 @@ int macsec_suspend(struct macsec_priv_data *macsec_pdata)
dev_err(dev, "Failed to close macsec\n");
return ret;
}
macsec_disable_car(macsec_pdata);
return ret;
}
@@ -345,11 +344,14 @@ int macsec_resume(struct macsec_priv_data *macsec_pdata)
struct device *dev = pdata->dev;
int ret = 0;
ret = macsec_enable_car(macsec_pdata);
if (macsec_pdata->ns_rst) {
ret = reset_control_reset(macsec_pdata->ns_rst);
if (ret < 0) {
dev_err(dev, "Unable to enable macsec clks & reset\n");
dev_err(dev, "failed to reset macsec\n");
return ret;
}
}
return macsec_open(macsec_pdata, OSI_NULL);
}

View File

@@ -205,8 +205,6 @@ struct macsec_priv_data {
unsigned int protect_frames;
/** MACsec enabled flags for Tx/Rx controller status */
unsigned int enabled;
/** MACsec enabled flags for Tx/Rx controller status before Suspend */
unsigned int enabled_before_suspend;
/** MACsec Rx PN Window */
unsigned int pn_window;
/** MACsec controller init reference count */