diff mbox series

[RFCv2,net-next,067/167] net: loopback: use netdev feature helpers

Message ID 20210929155334.12454-68-shenjian15@huawei.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series net: extend the netdev_features_t | expand

Commit Message

shenjian (K) Sept. 29, 2021, 3:51 p.m. UTC
Use netdev_feature_xxx helpers to replace the logical operation
for netdev features.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 drivers/net/loopback.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index a1c77cc00416..23cad6442959 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -174,17 +174,15 @@  static void gen_lo_setup(struct net_device *dev,
 	dev->flags		= IFF_LOOPBACK;
 	dev->priv_flags		|= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
 	netif_keep_dst(dev);
-	dev->hw_features	= NETIF_F_GSO_SOFTWARE;
-	dev->features		= NETIF_F_SG | NETIF_F_FRAGLIST
-		| NETIF_F_GSO_SOFTWARE
-		| NETIF_F_HW_CSUM
-		| NETIF_F_RXCSUM
-		| NETIF_F_SCTP_CRC
-		| NETIF_F_HIGHDMA
-		| NETIF_F_LLTX
-		| NETIF_F_NETNS_LOCAL
-		| NETIF_F_VLAN_CHALLENGED
-		| NETIF_F_LOOPBACK;
+	netdev_feature_zero(&dev->hw_features);
+	netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features);
+	netdev_feature_zero(&dev->features);
+	netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST |
+				NETIF_F_GSO_SOFTWARE | NETIF_F_HW_CSUM |
+				NETIF_F_RXCSUM | NETIF_F_SCTP_CRC |
+				NETIF_F_HIGHDMA | NETIF_F_LLTX |
+				NETIF_F_NETNS_LOCAL | NETIF_F_VLAN_CHALLENGED |
+				NETIF_F_LOOPBACK, &dev->hw_features);
 	dev->ethtool_ops	= eth_ops;
 	dev->header_ops		= hdr_ops;
 	dev->netdev_ops		= dev_ops;