[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210929155334.12454-23-shenjian15@huawei.com>
Date: Wed, 29 Sep 2021 23:51:09 +0800
From: Jian Shen <shenjian15@...wei.com>
To: <davem@...emloft.net>, <kuba@...nel.org>, <andrew@...n.ch>,
<hkallweit1@...il.com>
CC: <netdev@...r.kernel.org>, <linuxarm@...neuler.org>
Subject: [RFCv2 net-next 022/167] ethtool: convert the prototype of ethtool_get_feature_mask
For the origin type for netdev_features_t would be changed to
be unsigned long * from u64, so changes the prototype of
ethtool_get_feature_mask for adaption.
Signed-off-by: Jian Shen <shenjian15@...wei.com>
---
net/ethtool/ioctl.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index bf6e8c2f9bf7..661b75dee9fd 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -195,30 +195,35 @@ static void __ethtool_get_strings(struct net_device *dev,
ops->get_strings(dev, stringset, data);
}
-static netdev_features_t ethtool_get_feature_mask(u32 eth_cmd)
+static void ethtool_get_feature_mask(u32 eth_cmd, netdev_features_t *mask)
{
/* feature masks of legacy discrete ethtool ops */
switch (eth_cmd) {
case ETHTOOL_GTXCSUM:
case ETHTOOL_STXCSUM:
- return NETIF_F_CSUM_MASK | NETIF_F_FCOE_CRC |
- NETIF_F_SCTP_CRC;
+ *mask = NETIF_F_CSUM_MASK | NETIF_F_FCOE_CRC | NETIF_F_SCTP_CRC;
+ break;
case ETHTOOL_GRXCSUM:
case ETHTOOL_SRXCSUM:
- return NETIF_F_RXCSUM;
+ *mask = NETIF_F_RXCSUM;
+ break;
case ETHTOOL_GSG:
case ETHTOOL_SSG:
- return NETIF_F_SG | NETIF_F_FRAGLIST;
+ *mask = NETIF_F_SG | NETIF_F_FRAGLIST;
+ break;
case ETHTOOL_GTSO:
case ETHTOOL_STSO:
- return NETIF_F_ALL_TSO;
+ *mask = NETIF_F_ALL_TSO;
+ break;
case ETHTOOL_GGSO:
case ETHTOOL_SGSO:
- return NETIF_F_GSO;
+ *mask = NETIF_F_GSO;
+ break;
case ETHTOOL_GGRO:
case ETHTOOL_SGRO:
- return NETIF_F_GRO;
+ *mask = NETIF_F_GRO;
+ break;
default:
BUG();
}
@@ -227,11 +232,12 @@ static netdev_features_t ethtool_get_feature_mask(u32 eth_cmd)
static int ethtool_get_one_feature(struct net_device *dev,
char __user *useraddr, u32 ethcmd)
{
- netdev_features_t mask = ethtool_get_feature_mask(ethcmd);
- struct ethtool_value edata = {
- .cmd = ethcmd,
- .data = !!(dev->features & mask),
- };
+ struct ethtool_value edata;
+ netdev_features_t mask;
+
+ ethtool_get_feature_mask(ethcmd, &mask);
+ edata.cmd = ethcmd;
+ edata.data = !!(dev->features & mask);
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
@@ -247,7 +253,7 @@ static int ethtool_set_one_feature(struct net_device *dev,
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
- mask = ethtool_get_feature_mask(ethcmd);
+ ethtool_get_feature_mask(ethcmd, &mask);
mask &= dev->hw_features;
if (!mask)
return -EOPNOTSUPP;
--
2.33.0
Powered by blists - more mailing lists