Thread (181 messages) read the whole thread 181 messages, 6 authors, 2022-01-27

[RFCv2 net-next 054/167] net: dccp: use netdev feature helpers

From: Jian Shen <shenjian15@huawei.com>
Date: 2021-09-29 15:59:20
Subsystem: networking [general], the rest · Maintainers: "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>
---
 net/dccp/ipv4.c | 2 +-
 net/dccp/ipv6.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 0ea29270d7e5..f6161a100dbe 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -138,7 +138,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	 */
 	dccp_set_state(sk, DCCP_CLOSED);
 	ip_rt_put(rt);
-	sk->sk_route_caps = 0;
+	netdev_feature_zero(&sk->sk_route_caps);
 	inet->inet_dport = 0;
 	goto out;
 }
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index fa663518fa0e..0f966e02ddc4 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -489,8 +489,9 @@ static struct sock *dccp_v6_request_recv_sock(const struct sock *sk,
 	 */
 
 	ip6_dst_store(newsk, dst, NULL, NULL);
-	newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM |
-						      NETIF_F_TSO);
+	netdev_feature_copy(&newsk->sk_route_caps, dst->dev->features);
+	netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_TSO,
+				  &newsk->sk_route_caps);
 	newdp6 = (struct dccp6_sock *)newsk;
 	newinet = inet_sk(newsk);
 	newinet->pinet6 = &newdp6->inet6;
@@ -970,7 +971,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 	__sk_dst_reset(sk);
 failure:
 	inet->inet_dport = 0;
-	sk->sk_route_caps = 0;
+	netdev_feature_zero(&sk->sk_route_caps);
 	return err;
 }
 
-- 
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