Maxim Mikityanskiy 840110a4ea ethtool: Fix preserving of wanted feature bits in netlink interface
Currently, ethtool-netlink calculates new wanted bits as:
(req_wanted & req_mask) | (old_active & ~req_mask)

It completely discards the old wanted bits, so they are forgotten with
the next ethtool command. Sample steps to reproduce:

1. ethtool -k eth0
   tx-tcp-segmentation: on # TSO is on from the beginning
2. ethtool -K eth0 tx off
   tx-tcp-segmentation: off [not requested]
3. ethtool -k eth0
   tx-tcp-segmentation: off [requested on]
4. ethtool -K eth0 rx off # Some change unrelated to TSO
5. ethtool -k eth0
   tx-tcp-segmentation: off # "Wanted on" is forgotten

This commit fixes it by changing the formula to:
(req_wanted & req_mask) | (old_wanted & ~req_mask),
where old_active was replaced by old_wanted to account for the wanted
bits.

The shortcut condition for the case where nothing was changed now
compares wanted bitmasks, instead of wanted to active.

Fixes: 0980bfcd6954 ("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>
2020-08-18 16:00:24 -07:00
..
2020-08-15 08:34:36 -07:00
2020-06-23 20:27:09 -07:00
2019-09-26 08:56:17 +02:00
2020-08-18 15:58:53 -07:00
2020-07-13 17:20:40 -07:00
2020-08-15 08:26:55 -07:00
2020-07-13 17:20:40 -07:00
2020-08-18 15:58:53 -07:00
2020-08-11 10:20:34 -07:00
2020-08-10 19:07:44 -07:00