Review-by: Jie Wang wangjie125@huawei.com
On 2021/9/22 22:58, Jian Shen wrote:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.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,
} } else dev->netdev_ops = &vortex_netdev_ops;&dev->features);
@@ -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) {