diff mbox series

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

Message ID 20210929155334.12454-60-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/vrf.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
diff mbox series

Patch

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;