@@ -291,17 +291,18 @@ static int ethtool_set_one_feature(struct net_device *dev,
static u32 __ethtool_get_flags(struct net_device *dev)
{
+ netdev_features_t features = READ_ONCE(dev->features);
u32 flags = 0;
- if (dev->features & NETIF_F_LRO)
+ if (features & NETIF_F_LRO)
flags |= ETH_FLAG_LRO;
- if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
+ if (features & NETIF_F_HW_VLAN_CTAG_RX)
flags |= ETH_FLAG_RXVLAN;
- if (dev->features & NETIF_F_HW_VLAN_CTAG_TX)
+ if (features & NETIF_F_HW_VLAN_CTAG_TX)
flags |= ETH_FLAG_TXVLAN;
- if (dev->features & NETIF_F_NTUPLE)
+ if (features & NETIF_F_NTUPLE)
flags |= ETH_FLAG_NTUPLE;
- if (dev->features & NETIF_F_RXHASH)
+ if (features & NETIF_F_RXHASH)
flags |= ETH_FLAG_RXHASH;
return flags;
@@ -2993,10 +2994,6 @@ __dev_ethtool(struct net_device *dev, struct ifreq *ifr,
case ETHTOOL_GPERMADDR:
rc = ethtool_get_perm_addr(dev, useraddr);
break;
- case ETHTOOL_GFLAGS:
- rc = ethtool_get_value(dev, useraddr, ethcmd,
- __ethtool_get_flags);
- break;
case ETHTOOL_SFLAGS:
rc = ethtool_set_value(dev, useraddr, __ethtool_set_flags);
break;
@@ -3179,6 +3176,10 @@ int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr)
case ETHTOOL_GGRO:
rc = ethtool_get_one_feature(dev, useraddr, ethcmd);
break;
+ case ETHTOOL_GFLAGS:
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ __ethtool_get_flags);
+ break;
default:
rtnl_lock();
rc = __dev_ethtool(dev, ifr, useraddr, ethcmd, sub_cmd, state);
ETHTOOL_GFLAGS only reads dev->features, there is no need for RTNL protection. Signed-off-by: Eric Dumazet <edumazet@google.com> --- net/ethtool/ioctl.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)