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 <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3146810
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
This commit is contained in:
Jon Hunter
2024-05-29 10:16:05 +01:00
committed by mobile promotions
parent 716ec492d8
commit cb70a7e245

View File

@@ -1161,7 +1161,11 @@ static inline void validate_eee_conf(struct net_device *ndev,
* on whether EEE has toggled or not. * on whether EEE has toggled or not.
*/ */
if (!eee_req->eee_enabled && !eee_req->tx_lpi_enabled && 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) { eee_req->advertised) {
#endif
if (eee_req->eee_enabled != cur_eee.eee_enabled) { if (eee_req->eee_enabled != cur_eee.eee_enabled) {
netdev_warn(ndev, "EEE off. Set Rx LPI off\n"); netdev_warn(ndev, "EEE off. Set Rx LPI off\n");
#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */ #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 (!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) { !eee_req->advertised) {
#endif
if (eee_req->eee_enabled != cur_eee.eee_enabled) { if (eee_req->eee_enabled != cur_eee.eee_enabled) {
netdev_warn(ndev, "EEE off. Set Tx LPI off\n"); netdev_warn(ndev, "EEE off. Set Tx LPI off\n");
eee_req->tx_lpi_enabled = OSI_DISABLE; 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 (!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) { eee_req->advertised) {
#endif
if (eee_req->eee_enabled != cur_eee.eee_enabled) { if (eee_req->eee_enabled != cur_eee.eee_enabled) {
netdev_warn(ndev, "EEE off. Set Tx & Rx LPI off\n"); netdev_warn(ndev, "EEE off. Set Tx & Rx LPI off\n");
eee_req->tx_lpi_enabled = OSI_DISABLE; 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 (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) { !eee_req->advertised) {
#endif
if (eee_req->eee_enabled != cur_eee.eee_enabled) { if (eee_req->eee_enabled != cur_eee.eee_enabled) {
netdev_warn(ndev, "EEE on. Set Tx & Rx LPI on\n"); netdev_warn(ndev, "EEE on. Set Tx & Rx LPI on\n");
eee_req->tx_lpi_enabled = OSI_ENABLE; eee_req->tx_lpi_enabled = OSI_ENABLE;