Commit 85db6352 authored by Tariq Toukan's avatar Tariq Toukan Committed by Jakub Kicinski

net: Fix features skip in for_each_netdev_feature()

The find_next_netdev_feature() macro gets the "remaining length",
not bit index.
Passing "bit - 1" for the following iteration is wrong as it skips
the adjacent bit. Pass "bit" instead.

Fixes: 3b89ea9c ("net: Fix for_each_netdev_feature on Big endian")
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarGal Pressman <gal@nvidia.com>
Link: https://lore.kernel.org/r/20220504080914.1918-1-tariqt@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 690447a2
...@@ -169,7 +169,7 @@ enum { ...@@ -169,7 +169,7 @@ enum {
#define NETIF_F_HW_HSR_FWD __NETIF_F(HW_HSR_FWD) #define NETIF_F_HW_HSR_FWD __NETIF_F(HW_HSR_FWD)
#define NETIF_F_HW_HSR_DUP __NETIF_F(HW_HSR_DUP) #define NETIF_F_HW_HSR_DUP __NETIF_F(HW_HSR_DUP)
/* Finds the next feature with the highest number of the range of start till 0. /* Finds the next feature with the highest number of the range of start-1 till 0.
*/ */
static inline int find_next_netdev_feature(u64 feature, unsigned long start) static inline int find_next_netdev_feature(u64 feature, unsigned long start)
{ {
...@@ -188,7 +188,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) ...@@ -188,7 +188,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
for ((bit) = find_next_netdev_feature((mask_addr), \ for ((bit) = find_next_netdev_feature((mask_addr), \
NETDEV_FEATURE_COUNT); \ NETDEV_FEATURE_COUNT); \
(bit) >= 0; \ (bit) >= 0; \
(bit) = find_next_netdev_feature((mask_addr), (bit) - 1)) (bit) = find_next_netdev_feature((mask_addr), (bit)))
/* Features valid for ethtool to change */ /* Features valid for ethtool to change */
/* = all defined minus driver/device-class-related */ /* = all defined minus driver/device-class-related */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment