[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210929155334.12454-120-shenjian15@huawei.com>
Date: Wed, 29 Sep 2021 23:52:46 +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 119/167] net: altera: 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/altera/altera_tse_main.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index 1c00d719e5d7..b488140414e0 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -354,7 +354,9 @@ static inline void tse_rx_vlan(struct net_device *dev, struct sk_buff *skb)
{
struct ethhdr *eth_hdr;
u16 vid;
- if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
+
+ if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
+ dev->features) &&
!__vlan_get_tag(skb, &vid)) {
eth_hdr = (struct ethhdr *)skb->data;
memmove(skb->data + VLAN_HLEN, eth_hdr, ETH_ALEN * 2);
@@ -1549,14 +1551,15 @@ static int altera_tse_probe(struct platform_device *pdev)
/* Scatter/gather IO is not supported,
* so it is turned off
*/
- ndev->hw_features &= ~NETIF_F_SG;
- ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA;
+ netdev_feature_clear_bit(NETIF_F_SG_BIT, &ndev->hw_features);
+ netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features);
+ netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features);
/* VLAN offloading of tagging, stripping and filtering is not
* supported by hardware, but driver will accommodate the
* extra 4-byte VLAN tag for processing by upper layers
*/
- ndev->features |= NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, &ndev->features);
/* setup NAPI interface */
netif_napi_add(ndev, &priv->napi, tse_poll, NAPI_POLL_WEIGHT);
--
2.33.0
Powered by blists - more mailing lists