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

[RFCv2 net-next 068/167] net: dummy: use netdev_feature helpers

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

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

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 drivers/net/dummy.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index f82ad7419508..54ebb638a57b 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -123,12 +123,14 @@ static void dummy_setup(struct net_device *dev)
 	dev->flags |= IFF_NOARP;
 	dev->flags &= ~IFF_MULTICAST;
 	dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
-	dev->features	|= NETIF_F_SG | NETIF_F_FRAGLIST;
-	dev->features	|= NETIF_F_GSO_SOFTWARE;
-	dev->features	|= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
-	dev->features	|= NETIF_F_GSO_ENCAP_ALL;
-	dev->hw_features |= dev->features;
-	dev->hw_enc_features |= dev->features;
+	netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, &dev->features);
+	netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features);
+	netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_HIGHDMA |
+				NETIF_F_LLTX, &dev->features);
+	netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->features);
+	netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features);
+	netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features,
+			  dev->features);
 	eth_hw_addr_random(dev);
 
 	dev->min_mtu = 0;
-- 
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