Commit 4e4db200541d49404ff39ac482efee072dd72144
Committed by
David S. Miller
1 parent
14d1232f49
Exists in
master
and in
39 other branches
net: Fix ETHTOOL_GFEATURES compatibility
Implement getting rx checksum state for not updated drivers. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 14 additions and 0 deletions Side-by-side Diff
net/core/ethtool.c
... | ... | @@ -168,6 +168,18 @@ |
168 | 168 | |
169 | 169 | #define ETHTOOL_DEV_FEATURE_WORDS 1 |
170 | 170 | |
171 | +static void ethtool_get_features_compat(struct net_device *dev, | |
172 | + struct ethtool_get_features_block *features) | |
173 | +{ | |
174 | + if (!dev->ethtool_ops) | |
175 | + return; | |
176 | + | |
177 | + /* getting RX checksum */ | |
178 | + if (dev->ethtool_ops->get_rx_csum) | |
179 | + if (dev->ethtool_ops->get_rx_csum(dev)) | |
180 | + features[0].active |= NETIF_F_RXCSUM; | |
181 | +} | |
182 | + | |
171 | 183 | static int ethtool_get_features(struct net_device *dev, void __user *useraddr) |
172 | 184 | { |
173 | 185 | struct ethtool_gfeatures cmd = { |
... | ... | @@ -184,6 +196,8 @@ |
184 | 196 | }; |
185 | 197 | u32 __user *sizeaddr; |
186 | 198 | u32 copy_size; |
199 | + | |
200 | + ethtool_get_features_compat(dev, features); | |
187 | 201 | |
188 | 202 | sizeaddr = useraddr + offsetof(struct ethtool_gfeatures, size); |
189 | 203 | if (get_user(copy_size, sizeaddr)) |