diff mbox series

[RFCv2,net-next,037/167] net: tls: use netdev feature helpers

Message ID 20210929155334.12454-38-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>
---
 net/tls/tls_device.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index b932469ee69c..94189107995f 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1125,7 +1125,7 @@  int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
 		goto disable_cad;
 	}
 
-	if (!(netdev->features & NETIF_F_HW_TLS_TX)) {
+	if (!netdev_feature_test_bit(NETIF_F_HW_TLS_TX_BIT, netdev->features)) {
 		rc = -EOPNOTSUPP;
 		goto release_netdev;
 	}
@@ -1200,7 +1200,7 @@  int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx)
 		return -EINVAL;
 	}
 
-	if (!(netdev->features & NETIF_F_HW_TLS_RX)) {
+	if (!netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, netdev->features)) {
 		rc = -EOPNOTSUPP;
 		goto release_netdev;
 	}
@@ -1361,7 +1361,8 @@  static int tls_dev_event(struct notifier_block *this, unsigned long event,
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 
 	if (!dev->tlsdev_ops &&
-	    !(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX)))
+	    !netdev_feature_test_bits(NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX,
+				      dev->features))
 		return NOTIFY_DONE;
 
 	switch (event) {
@@ -1369,7 +1370,8 @@  static int tls_dev_event(struct notifier_block *this, unsigned long event,
 	case NETDEV_FEAT_CHANGE:
 		if (netif_is_bond_master(dev))
 			return NOTIFY_DONE;
-		if ((dev->features & NETIF_F_HW_TLS_RX) &&
+		if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT,
+					    dev->features) &&
 		    !dev->tlsdev_ops->tls_dev_resync)
 			return NOTIFY_BAD;