diff mbox series

[RFCv2,net-next,151/167] um: use netdev feature helpers

Message ID 20210929155334.12454-152-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:53 p.m. UTC
Use netdev_feature_xxx helpers to replace the logical operation
for netdev features.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 arch/um/drivers/vector_kern.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index 88cc24a58742..2c32794a87b1 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -1345,7 +1345,8 @@  static void vector_net_tx_timeout(struct net_device *dev, unsigned int txqueue)
 static void vector_fix_features(struct net_device *dev,
 				netdev_features_t *features)
 {
-	*features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
+	netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM,
+				  &features);
 }
 
 static int vector_set_features(struct net_device *dev,
@@ -1356,7 +1357,7 @@  static int vector_set_features(struct net_device *dev,
 	 * no way to negotiate it on raw sockets, so we can change
 	 * only our side.
 	 */
-	if (features & NETIF_F_GRO)
+	if (netdev_feature_test_bit(NETIF_F_GRO_BIT, features))
 		/* All new frame buffers will be GRO-sized */
 		vp->req_size = 65536;
 	else
@@ -1630,7 +1631,10 @@  static void vector_eth_configure(
 		.bpf			= NULL
 	});
 
-	dev->features = dev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST);
+	netdev_feature_zero(&dev->hw_features);
+	netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST,
+				&dev->hw_features);
+	netdev_feature_copy(&dev->features, dev->hw_features);
 	tasklet_setup(&vp->tx_poll, vector_tx_poll);
 	INIT_WORK(&vp->reset_tx, vector_reset_tx);