netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series.
@ 2022-06-19 23:29 Kuniyuki Iwashima
  2022-06-19 23:29 ` [PATCH v1 net-next 1/2] raw: Fix mixed declarations error in raw_icmp_error() Kuniyuki Iwashima
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-19 23:29 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

The first patch fixes a build error by commit ba44f8182ec2 ("raw: use
more conventional iterators"), but it does not land in the net tree,
so this series is targeted to net-next.  The second patch replaces some
hlist functions with sk's helper macros.


Kuniyuki Iwashima (2):
  raw: Fix mixed declarations error in raw_icmp_error().
  raw: Use helpers for the hlist_nulls variant.

 net/ipv4/raw.c      | 10 +++++-----
 net/ipv4/raw_diag.c |  4 ++--
 net/ipv6/raw.c      |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 net-next 1/2] raw: Fix mixed declarations error in raw_icmp_error().
  2022-06-19 23:29 [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series Kuniyuki Iwashima
@ 2022-06-19 23:29 ` Kuniyuki Iwashima
  2022-06-19 23:29 ` [PATCH v1 net-next 2/2] raw: Use helpers for the hlist_nulls variant Kuniyuki Iwashima
  2022-06-20  8:20 ` [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-19 23:29 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

The trailing semicolon causes a compiler error, so let's remove it.

net/ipv4/raw.c: In function ‘raw_icmp_error’:
net/ipv4/raw.c:266:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  266 |  struct hlist_nulls_head *hlist;
      |  ^~~~~~

Fixes: ba44f8182ec2 ("raw: use more conventional iterators")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
 net/ipv4/raw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index d28bf0b901a2..b3b255db9021 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -262,7 +262,7 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info)
 
 void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
 {
-	struct net *net = dev_net(skb->dev);;
+	struct net *net = dev_net(skb->dev);
 	struct hlist_nulls_head *hlist;
 	struct hlist_nulls_node *hnode;
 	int dif = skb->dev->ifindex;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v1 net-next 2/2] raw: Use helpers for the hlist_nulls variant.
  2022-06-19 23:29 [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series Kuniyuki Iwashima
  2022-06-19 23:29 ` [PATCH v1 net-next 1/2] raw: Fix mixed declarations error in raw_icmp_error() Kuniyuki Iwashima
@ 2022-06-19 23:29 ` Kuniyuki Iwashima
  2022-06-20  8:20 ` [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-19 23:29 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

hlist_nulls_add_head_rcu() and hlist_nulls_for_each_entry() have dedicated
macros for sk.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
 net/ipv4/raw.c      | 8 ++++----
 net/ipv4/raw_diag.c | 4 ++--
 net/ipv6/raw.c      | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index b3b255db9021..959bea12dc48 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -96,7 +96,7 @@ int raw_hash_sk(struct sock *sk)
 	hlist = &h->ht[inet_sk(sk)->inet_num & (RAW_HTABLE_SIZE - 1)];
 
 	write_lock_bh(&h->lock);
-	hlist_nulls_add_head_rcu(&sk->sk_nulls_node, hlist);
+	__sk_nulls_add_node_rcu(sk, hlist);
 	sock_set_flag(sk, SOCK_RCU_FREE);
 	write_unlock_bh(&h->lock);
 	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
@@ -172,7 +172,7 @@ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash)
 
 	hlist = &raw_v4_hashinfo.ht[hash];
 	rcu_read_lock();
-	hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
+	sk_nulls_for_each(sk, hnode, hlist) {
 		if (!raw_v4_match(net, sk, iph->protocol,
 				  iph->saddr, iph->daddr, dif, sdif))
 			continue;
@@ -275,7 +275,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
 	hlist = &raw_v4_hashinfo.ht[hash];
 
 	rcu_read_lock();
-	hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
+	sk_nulls_for_each(sk, hnode, hlist) {
 		iph = (const struct iphdr *)skb->data;
 		if (!raw_v4_match(net, sk, iph->protocol,
 				  iph->saddr, iph->daddr, dif, sdif))
@@ -954,7 +954,7 @@ static struct sock *raw_get_first(struct seq_file *seq, int bucket)
 	for (state->bucket = bucket; state->bucket < RAW_HTABLE_SIZE;
 			++state->bucket) {
 		hlist = &h->ht[state->bucket];
-		hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
+		sk_nulls_for_each(sk, hnode, hlist) {
 			if (sock_net(sk) == seq_file_net(seq))
 				return sk;
 		}
diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c
index 5f208e840d85..ac4b6525d3c6 100644
--- a/net/ipv4/raw_diag.c
+++ b/net/ipv4/raw_diag.c
@@ -68,7 +68,7 @@ static struct sock *raw_sock_get(struct net *net, const struct inet_diag_req_v2
 	rcu_read_lock();
 	for (slot = 0; slot < RAW_HTABLE_SIZE; slot++) {
 		hlist = &hashinfo->ht[slot];
-		hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
+		sk_nulls_for_each(sk, hnode, hlist) {
 			if (raw_lookup(net, sk, r)) {
 				/*
 				 * Grab it and keep until we fill
@@ -161,7 +161,7 @@ static void raw_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
 		num = 0;
 
 		hlist = &hashinfo->ht[slot];
-		hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
+		sk_nulls_for_each(sk, hnode, hlist) {
 			struct inet_sock *inet = inet_sk(sk);
 
 			if (!net_eq(sock_net(sk), net))
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index f6119998700e..46b560aacc11 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -155,7 +155,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
 	hash = nexthdr & (RAW_HTABLE_SIZE - 1);
 	hlist = &raw_v6_hashinfo.ht[hash];
 	rcu_read_lock();
-	hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
+	sk_nulls_for_each(sk, hnode, hlist) {
 		int filtered;
 
 		if (!raw_v6_match(net, sk, nexthdr, daddr, saddr,
@@ -342,7 +342,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
 	hash = nexthdr & (RAW_HTABLE_SIZE - 1);
 	hlist = &raw_v6_hashinfo.ht[hash];
 	rcu_read_lock();
-	hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) {
+	sk_nulls_for_each(sk, hnode, hlist) {
 		/* Note: ipv6_hdr(skb) != skb->data */
 		const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
 		saddr = &ip6h->saddr;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series.
  2022-06-19 23:29 [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series Kuniyuki Iwashima
  2022-06-19 23:29 ` [PATCH v1 net-next 1/2] raw: Fix mixed declarations error in raw_icmp_error() Kuniyuki Iwashima
  2022-06-19 23:29 ` [PATCH v1 net-next 2/2] raw: Use helpers for the hlist_nulls variant Kuniyuki Iwashima
@ 2022-06-20  8:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-06-20  8:20 UTC (permalink / raw)
  To: Kuniyuki Iwashima; +Cc: davem, edumazet, kuba, pabeni, kuni1840, netdev

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Sun, 19 Jun 2022 16:29:25 -0700 you wrote:
> The first patch fixes a build error by commit ba44f8182ec2 ("raw: use
> more conventional iterators"), but it does not land in the net tree,
> so this series is targeted to net-next.  The second patch replaces some
> hlist functions with sk's helper macros.
> 
> 
> Kuniyuki Iwashima (2):
>   raw: Fix mixed declarations error in raw_icmp_error().
>   raw: Use helpers for the hlist_nulls variant.
> 
> [...]

Here is the summary with links:
  - [v1,net-next,1/2] raw: Fix mixed declarations error in raw_icmp_error().
    https://git.kernel.org/netdev/net-next/c/5da39e31b1b0
  - [v1,net-next,2/2] raw: Use helpers for the hlist_nulls variant.
    https://git.kernel.org/netdev/net-next/c/f289c02bf41b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-20  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-19 23:29 [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series Kuniyuki Iwashima
2022-06-19 23:29 ` [PATCH v1 net-next 1/2] raw: Fix mixed declarations error in raw_icmp_error() Kuniyuki Iwashima
2022-06-19 23:29 ` [PATCH v1 net-next 2/2] raw: Use helpers for the hlist_nulls variant Kuniyuki Iwashima
2022-06-20  8:20 ` [PATCH v1 net-next 0/2] raw: Fix nits of RCU conversion series patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).