Skip to content

Commit 2847bfe

Browse files
Maxim Mikityanskiydavem330
authored andcommitted
ethtool: Account for hw_features in netlink interface
ethtool-netlink ignores dev->hw_features and may confuse the drivers by asking them to enable features not in the hw_features bitmask. For example: 1. ethtool -k eth0 tls-hw-tx-offload: off [fixed] 2. ethtool -K eth0 tls-hw-tx-offload on tls-hw-tx-offload: on 3. ethtool -k eth0 tls-hw-tx-offload: on [fixed] Fitler out dev->hw_features from req_wanted to fix it and to resemble the legacy ethtool behavior. Fixes: 0980bfc ("ethtool: set netdev features with FEATURES_SET request") Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com> Reviewed-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 840110a commit 2847bfe

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎net/ethtool/features.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
273273
goto out_rtnl;
274274
}
275275

276-
dev->wanted_features = ethnl_bitmap_to_features(req_wanted);
276+
dev->wanted_features &= ~dev->hw_features;
277+
dev->wanted_features |= ethnl_bitmap_to_features(req_wanted) & dev->hw_features;
277278
__netdev_update_features(dev);
278279
ethnl_features_to_bitmap(new_active, dev->features);
279280
mod = !bitmap_equal(old_active, new_active, NETDEV_FEATURE_COUNT);

0 commit comments

Comments
 (0)