[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210929155334.12454-126-shenjian15@huawei.com>
Date: Wed, 29 Sep 2021 23:52:52 +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 125/167] net: 3com: use netdev feature helpers
Use netdev_feature_xxx helpers to replace the logical operation
for netdev features.
Signed-off-by: Jian Shen <shenjian15@...wei.com>
---
drivers/net/ethernet/3com/3c59x.c | 9 ++++++---
drivers/net/ethernet/3com/typhoon.c | 10 ++++++----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 7b0ae9efc004..d5bdd8a97a61 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -1446,7 +1446,8 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,
if (card_idx < MAX_UNITS &&
((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) ||
hw_checksums[card_idx] == 1)) {
- dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
+ netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG,
+ &dev->features);
}
} else
dev->netdev_ops = &vortex_netdev_ops;
@@ -1454,8 +1455,10 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,
if (print_info) {
pr_info("%s: scatter/gather %sabled. h/w checksums %sabled\n",
print_name,
- (dev->features & NETIF_F_SG) ? "en":"dis",
- (dev->features & NETIF_F_IP_CSUM) ? "en":"dis");
+ netdev_feature_test_bit(NETIF_F_SG_BIT,
+ dev->features) ? "en" : "dis",
+ netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT,
+ dev->features) ? "en" : "dis");
}
dev->ethtool_ops = &vortex_ethtool_ops;
diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c
index 05e15b6e5e2c..5ec10b9217f1 100644
--- a/drivers/net/ethernet/3com/typhoon.c
+++ b/drivers/net/ethernet/3com/typhoon.c
@@ -2458,10 +2458,12 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
* on the current 3XP firmware -- it does not respect the offload
* settings -- so we only allow the user to toggle the TX processing.
*/
- dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
- NETIF_F_HW_VLAN_CTAG_TX;
- dev->features = dev->hw_features |
- NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM;
+ netdev_feature_zero(&dev->hw_features);
+ netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
+ NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features);
+ netdev_feature_copy(&dev->features, dev->hw_features);
+ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM,
+ &dev->features);
err = register_netdev(dev);
if (err < 0) {
--
2.33.0
Powered by blists - more mailing lists