Thread (181 messages) 181 messages, 6 authors, 2022-01-27

[RFCv2 net-next 059/167] net: vrf: use netdev feature helpers

From: Jian Shen <shenjian15@huawei.com>
Date: 2021-09-29 15:59:59
Subsystem: networking drivers, the rest, vrf · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, David Ahern

Use netdev_feature_xxx helpers to replace the logical operation
for netdev features.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 drivers/net/vrf.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index bf2fac913942..aee9e0fa0842 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1653,21 +1653,23 @@ static void vrf_setup(struct net_device *dev)
 	eth_hw_addr_random(dev);
 
 	/* don't acquire vrf device's netif_tx_lock when transmitting */
-	dev->features |= NETIF_F_LLTX;
+	netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features);
 
 	/* don't allow vrf devices to change network namespaces. */
-	dev->features |= NETIF_F_NETNS_LOCAL;
+	netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features);
 
 	/* does not make sense for a VLAN to be added to a vrf device */
-	dev->features   |= NETIF_F_VLAN_CHALLENGED;
+	netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &dev->features);
 
 	/* enable offload features */
-	dev->features   |= NETIF_F_GSO_SOFTWARE;
-	dev->features   |= NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_SCTP_CRC;
-	dev->features   |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA;
-
-	dev->hw_features = dev->features;
-	dev->hw_enc_features = dev->features;
+	netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features);
+	netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_SCTP_CRC,
+				&dev->features);
+	netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA,
+				&dev->features);
+
+	netdev_feature_copy(&dev->hw_features, dev->features);
+	netdev_feature_copy(&dev->hw_enc_features, dev->features);
 
 	/* default to no qdisc; user can add if desired */
 	dev->priv_flags |= IFF_NO_QUEUE;
-- 
2.33.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help