[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210929155334.12454-139-shenjian15@huawei.com>
Date: Wed, 29 Sep 2021 23:53:05 +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 138/167] net: apm: 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/apm/xgene-v2/main.c | 5 ++---
.../net/ethernet/apm/xgene/xgene_enet_main.c | 21 +++++++++++--------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c
index 80399c8980bd..2903a0fea0c3 100644
--- a/drivers/net/ethernet/apm/xgene-v2/main.c
+++ b/drivers/net/ethernet/apm/xgene-v2/main.c
@@ -648,14 +648,13 @@ static int xge_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pdata);
ndev->netdev_ops = &xgene_ndev_ops;
- ndev->features |= NETIF_F_GSO |
- NETIF_F_GRO;
+ netdev_feature_set_bits(NETIF_F_GSO | NETIF_F_GRO, &ndev->features);
ret = xge_get_resources(pdata);
if (ret)
goto err;
- ndev->hw_features = ndev->features;
+ netdev_feature_copy(&ndev->hw_features, ndev->features);
xge_set_ethtool_ops(ndev);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 5f1fc6582d74..ed67becb8654 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -320,7 +320,8 @@ static int xgene_enet_work_msg(struct sk_buff *skb, u64 *hopinfo)
unlikely(skb->protocol != htons(ETH_P_8021Q)))
goto out;
- if (unlikely(!(skb->dev->features & NETIF_F_IP_CSUM)))
+ if (unlikely(!netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT,
+ skb->dev->features)))
goto out;
iph = ip_hdr(skb);
@@ -331,7 +332,7 @@ static int xgene_enet_work_msg(struct sk_buff *skb, u64 *hopinfo)
l4hlen = tcp_hdrlen(skb) >> 2;
csum_enable = 1;
proto = TSO_IPPROTO_TCP;
- if (ndev->features & NETIF_F_TSO) {
+ if (netdev_feature_test_bit(NETIF_F_TSO_BIT, ndev->features)) {
hdr_len = ethhdr + ip_hdrlen(skb) + tcp_hdrlen(skb);
mss = skb_shinfo(skb)->gso_size;
@@ -590,7 +591,7 @@ static void xgene_enet_rx_csum(struct sk_buff *skb)
struct net_device *ndev = skb->dev;
struct iphdr *iph = ip_hdr(skb);
- if (!(ndev->features & NETIF_F_RXCSUM))
+ if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, ndev->features))
return;
if (skb->protocol != htons(ETH_P_IP))
@@ -2032,10 +2033,11 @@ static int xgene_enet_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pdata);
ndev->netdev_ops = &xgene_ndev_ops;
xgene_enet_set_ethtool_ops(ndev);
- ndev->features |= NETIF_F_IP_CSUM |
- NETIF_F_GSO |
- NETIF_F_GRO |
- NETIF_F_SG;
+ netdev_feature_set_bits(NETIF_F_IP_CSUM |
+ NETIF_F_GSO |
+ NETIF_F_GRO |
+ NETIF_F_SG,
+ &ndev->features);
of_id = of_match_device(xgene_enet_of_match, &pdev->dev);
if (of_id) {
@@ -2063,10 +2065,11 @@ static int xgene_enet_probe(struct platform_device *pdev)
spin_lock_init(&pdata->mac_lock);
if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) {
- ndev->features |= NETIF_F_TSO | NETIF_F_RXCSUM;
+ netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM,
+ &ndev->features);
spin_lock_init(&pdata->mss_lock);
}
- ndev->hw_features = ndev->features;
+ netdev_feature_copy(&ndev->hw_features, ndev->features);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
if (ret) {
--
2.33.0
Powered by blists - more mailing lists