提交 4e4db200 编写于 作者: M Michał Mirosław 提交者: David S. Miller

net: Fix ETHTOOL_GFEATURES compatibility

Implement getting rx checksum state for not updated drivers.
Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 14d1232f
...@@ -168,6 +168,18 @@ EXPORT_SYMBOL(ethtool_ntuple_flush); ...@@ -168,6 +168,18 @@ EXPORT_SYMBOL(ethtool_ntuple_flush);
#define ETHTOOL_DEV_FEATURE_WORDS 1 #define ETHTOOL_DEV_FEATURE_WORDS 1
static void ethtool_get_features_compat(struct net_device *dev,
struct ethtool_get_features_block *features)
{
if (!dev->ethtool_ops)
return;
/* getting RX checksum */
if (dev->ethtool_ops->get_rx_csum)
if (dev->ethtool_ops->get_rx_csum(dev))
features[0].active |= NETIF_F_RXCSUM;
}
static int ethtool_get_features(struct net_device *dev, void __user *useraddr) static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
{ {
struct ethtool_gfeatures cmd = { struct ethtool_gfeatures cmd = {
...@@ -185,6 +197,8 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr) ...@@ -185,6 +197,8 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
u32 __user *sizeaddr; u32 __user *sizeaddr;
u32 copy_size; u32 copy_size;
ethtool_get_features_compat(dev, features);
sizeaddr = useraddr + offsetof(struct ethtool_gfeatures, size); sizeaddr = useraddr + offsetof(struct ethtool_gfeatures, size);
if (get_user(copy_size, sizeaddr)) if (get_user(copy_size, sizeaddr))
return -EFAULT; return -EFAULT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册