From cb70a7e245b42a1fc8407df3f4bdde521ae4d328 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Wed, 29 May 2024 10:16:05 +0100 Subject: [PATCH] net: nvethernet: Fix support for Linux v6.9 When nvethernet was updated to support Linux v6.9 kernels, the code that checks if the variable 'eee_req->advertised' is zero or non-zero was not updated correctly. For Linux v6.9, the variable 'eee_req->advertised' is a bitmask and so cannot be checked directly to see if it is zero or non-zero. Building the nvethernet driver with the flag '-Werror=address' exposed this issue. Fix this by using the 'linkmode_empty()' function to determine if 'eee_req->advertised' is zero or non-zero for Linux v6.9 kernels. Bug 4471899 Bug 4662166 Change-Id: Id4080d62006226648cd398dc8652578c74dd8158 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3146810 GVS: buildbot_gerritrpt Reviewed-by: Revanth Kumar Uppala Reviewed-by: svcacv --- drivers/net/ethernet/nvidia/nvethernet/ethtool.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/nvidia/nvethernet/ethtool.c b/drivers/net/ethernet/nvidia/nvethernet/ethtool.c index 261f4ddf..e607e92b 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ethtool.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ethtool.c @@ -1161,7 +1161,11 @@ static inline void validate_eee_conf(struct net_device *ndev, * on whether EEE has toggled or not. */ if (!eee_req->eee_enabled && !eee_req->tx_lpi_enabled && +#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */ + !linkmode_empty(eee_req->advertised)) { +#else eee_req->advertised) { +#endif if (eee_req->eee_enabled != cur_eee.eee_enabled) { netdev_warn(ndev, "EEE off. Set Rx LPI off\n"); #if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */ @@ -1176,7 +1180,11 @@ static inline void validate_eee_conf(struct net_device *ndev, } if (!eee_req->eee_enabled && eee_req->tx_lpi_enabled && +#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */ + linkmode_empty(eee_req->advertised)) { +#else !eee_req->advertised) { +#endif if (eee_req->eee_enabled != cur_eee.eee_enabled) { netdev_warn(ndev, "EEE off. Set Tx LPI off\n"); eee_req->tx_lpi_enabled = OSI_DISABLE; @@ -1196,7 +1204,11 @@ static inline void validate_eee_conf(struct net_device *ndev, } if (!eee_req->eee_enabled && eee_req->tx_lpi_enabled && +#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */ + !linkmode_empty(eee_req->advertised)) { +#else eee_req->advertised) { +#endif if (eee_req->eee_enabled != cur_eee.eee_enabled) { netdev_warn(ndev, "EEE off. Set Tx & Rx LPI off\n"); eee_req->tx_lpi_enabled = OSI_DISABLE; @@ -1212,7 +1224,11 @@ static inline void validate_eee_conf(struct net_device *ndev, } if (eee_req->eee_enabled && !eee_req->tx_lpi_enabled && +#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */ + linkmode_empty(eee_req->advertised)) { +#else !eee_req->advertised) { +#endif if (eee_req->eee_enabled != cur_eee.eee_enabled) { netdev_warn(ndev, "EEE on. Set Tx & Rx LPI on\n"); eee_req->tx_lpi_enabled = OSI_ENABLE;