Skip to contentSkip to conversation

mld: convert ipv6_mc_socklist to list macros

PATCH Superseded Taehee Yoo 1 participant 1 message Feb 8, 2021

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Taehee Yoo

author
#0 lore raw

PATCH 6/8 mld: convert ipv6_mc_socklist to list macros

Currently, struct ipv6_mc_socklist doesn't use list API so that code shape is a little bit different from others.
So it converts ipv6_mc_socklist to use list API so it would improve readability.

---
 .../chelsio/inline_crypto/chtls/chtls_cm.c    |   1 +
 include/linux/ipv6.h                          |   2 +-
 include/net/if_inet6.h                        |   2 +-
 net/dccp/ipv6.c                               |   4 +-
 net/ipv6/af_inet6.c                           |   1 +
 net/ipv6/mcast.c                              | 190 +++++++++---------
 net/ipv6/tcp_ipv6.c                           |   4 +-
 net/sctp/ipv6.c                               |   2 +-
 8 files changed, 105 insertions(+), 101 deletions(-)
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c +1 -0
index 19dc7dc054a2..729d9de9db62 100644
@@ -1204,6 +1204,7 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
 		newsk->sk_v6_rcv_saddr = treq->ir_v6_loc_addr;
 		inet6_sk(newsk)->saddr = treq->ir_v6_loc_addr;
 		newnp->ipv6_fl_list = NULL;
+		INIT_LIST_HEAD(&newnp->ipv6_mc_list);
 		newnp->pktoptions = NULL;
 		newsk->sk_bound_dev_if = treq->ir_iif;
 		newinet->inet_opt = NULL;
include/linux/ipv6.h +1 -1
index 9d1f29f0c512..66533e42a758 100644
@@ -282,7 +282,7 @@ struct ipv6_pinfo {
 	__u32			dst_cookie;
 	__u32			rx_dst_cookie;
 
-	struct ipv6_mc_socklist	__rcu *ipv6_mc_list;
+	struct list_head	ipv6_mc_list;
 	struct ipv6_ac_socklist	*ipv6_ac_list;
 	struct ipv6_fl_socklist __rcu *ipv6_fl_list;
 
include/net/if_inet6.h +1 -1
index 096c0554d199..babf19c27b29 100644
@@ -90,7 +90,7 @@ struct ipv6_mc_socklist {
 	struct in6_addr		addr;
 	int			ifindex;
 	unsigned int		sfmode;		/* MCAST_{INCLUDE,EXCLUDE} */
-	struct ipv6_mc_socklist __rcu *next;
+	struct list_head	list;
 	rwlock_t		sflock;
 	struct ip6_sf_socklist	*sflist;
 	struct rcu_head		rcu;
net/dccp/ipv6.c +2 -2
index 1f73603913f5..3a6332b9b845 100644
@@ -430,7 +430,7 @@ static struct sock *dccp_v6_request_recv_sock(const struct sock *sk,
 		newsk->sk_backlog_rcv = dccp_v4_do_rcv;
 		newnp->pktoptions  = NULL;
 		newnp->opt	   = NULL;
-		newnp->ipv6_mc_list = NULL;
+		INIT_LIST_HEAD(&newnp->ipv6_mc_list);
 		newnp->ipv6_ac_list = NULL;
 		newnp->ipv6_fl_list = NULL;
 		newnp->mcast_oif   = inet_iif(skb);
@@ -497,7 +497,7 @@ static struct sock *dccp_v6_request_recv_sock(const struct sock *sk,
 	/* Clone RX bits */
 	newnp->rxopt.all = np->rxopt.all;
 
-	newnp->ipv6_mc_list = NULL;
+	INIT_LIST_HEAD(&newnp->ipv6_mc_list);
 	newnp->ipv6_ac_list = NULL;
 	newnp->ipv6_fl_list = NULL;
 	newnp->pktoptions = NULL;
net/ipv6/af_inet6.c +1 -0
index ace6527171bd..ae3a1865189f 100644
@@ -207,6 +207,7 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
 
 	inet_sk(sk)->pinet6 = np = inet6_sk_generic(sk);
 	np->hop_limit	= -1;
+	INIT_LIST_HEAD(&np->ipv6_mc_list);
 	np->mcast_hops	= IPV6_DEFAULT_MCASTHOPS;
 	np->mc_loop	= 1;
 	np->mc_all	= 1;
net/ipv6/mcast.c +96 -94

417 lines not on this page · raw message

net/ipv6/tcp_ipv6.c +2 -2
index d093ef3ef060..b6cb600fd02a 100644
@@ -1242,7 +1242,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
 		newtp->af_specific = &tcp_sock_ipv6_mapped_specific;
 #endif
 
-		newnp->ipv6_mc_list = NULL;
+		INIT_LIST_HEAD(&newnp->ipv6_mc_list);
 		newnp->ipv6_ac_list = NULL;
 		newnp->ipv6_fl_list = NULL;
 		newnp->pktoptions  = NULL;
@@ -1311,7 +1311,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
 	   First: no IPv4 options.
 	 */
 	newinet->inet_opt = NULL;
-	newnp->ipv6_mc_list = NULL;
+	INIT_LIST_HEAD(&newnp->ipv6_mc_list);
 	newnp->ipv6_ac_list = NULL;
 	newnp->ipv6_fl_list = NULL;
 
net/sctp/ipv6.c +1 -1
index c3e89c776e66..4842e538a988 100644
@@ -754,7 +754,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
 	newnp = inet6_sk(newsk);
 
 	memcpy(newnp, np, sizeof(struct ipv6_pinfo));
-	newnp->ipv6_mc_list = NULL;
+	INIT_LIST_HEAD(&newnp->ipv6_mc_list);
 	newnp->ipv6_ac_list = NULL;
 	newnp->ipv6_fl_list = NULL;
 
Signature · 1 line
2.17.1