public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: Drop unused @sk of __skb_try_recv_from_queue()
@ 2025-04-07 19:01 Michal Luczaj
  2025-04-08  2:10 ` Joe Damato
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michal Luczaj @ 2025-04-07 19:01 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Willem de Bruijn, David Ahern
  Cc: netdev, linux-kernel, Michal Luczaj

__skb_try_recv_from_queue() deals with a queue, @sk is never used.
Remove sk from function parameters, adapt callers.

No functional change intended.

Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
 include/linux/skbuff.h | 3 +--
 net/core/datagram.c    | 5 ++---
 net/ipv4/udp.c         | 8 ++++----
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b974a277975a8a7b6f40c362542e9e8522539009..f1381aff0f896220b2b6bc706aaca17b8f28fd8b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -4105,8 +4105,7 @@ static inline void skb_frag_list_init(struct sk_buff *skb)
 int __skb_wait_for_more_packets(struct sock *sk, struct sk_buff_head *queue,
 				int *err, long *timeo_p,
 				const struct sk_buff *skb);
-struct sk_buff *__skb_try_recv_from_queue(struct sock *sk,
-					  struct sk_buff_head *queue,
+struct sk_buff *__skb_try_recv_from_queue(struct sk_buff_head *queue,
 					  unsigned int flags,
 					  int *off, int *err,
 					  struct sk_buff **last);
diff --git a/net/core/datagram.c b/net/core/datagram.c
index f0693707aece46bb5ffd2143a0773d54c234999c..f0634f0cb8346d69923f65183dbdf000b6993cf9 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -163,8 +163,7 @@ static struct sk_buff *skb_set_peeked(struct sk_buff *skb)
 	return skb;
 }
 
-struct sk_buff *__skb_try_recv_from_queue(struct sock *sk,
-					  struct sk_buff_head *queue,
+struct sk_buff *__skb_try_recv_from_queue(struct sk_buff_head *queue,
 					  unsigned int flags,
 					  int *off, int *err,
 					  struct sk_buff **last)
@@ -261,7 +260,7 @@ struct sk_buff *__skb_try_recv_datagram(struct sock *sk,
 		 * However, this function was correct in any case. 8)
 		 */
 		spin_lock_irqsave(&queue->lock, cpu_flags);
-		skb = __skb_try_recv_from_queue(sk, queue, flags, off, &error,
+		skb = __skb_try_recv_from_queue(queue, flags, off, &error,
 						last);
 		spin_unlock_irqrestore(&queue->lock, cpu_flags);
 		if (error)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2742cc7602bb58535e8ef217d9ffc3fea7ff9297..1696cc5a2dcdc4f9c40c65b4d61c722a1cd9ca9a 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1942,8 +1942,8 @@ struct sk_buff *__skb_recv_udp(struct sock *sk, unsigned int flags,
 		error = -EAGAIN;
 		do {
 			spin_lock_bh(&queue->lock);
-			skb = __skb_try_recv_from_queue(sk, queue, flags, off,
-							err, &last);
+			skb = __skb_try_recv_from_queue(queue, flags, off, err,
+							&last);
 			if (skb) {
 				if (!(flags & MSG_PEEK))
 					udp_skb_destructor(sk, skb);
@@ -1964,8 +1964,8 @@ struct sk_buff *__skb_recv_udp(struct sock *sk, unsigned int flags,
 			spin_lock(&sk_queue->lock);
 			skb_queue_splice_tail_init(sk_queue, queue);
 
-			skb = __skb_try_recv_from_queue(sk, queue, flags, off,
-							err, &last);
+			skb = __skb_try_recv_from_queue(queue, flags, off, err,
+							&last);
 			if (skb && !(flags & MSG_PEEK))
 				udp_skb_dtor_locked(sk, skb);
 			spin_unlock(&sk_queue->lock);

---
base-commit: 61f96e684edd28ca40555ec49ea1555df31ba619
change-id: 20250406-cleanup-drop-param-sk-9c25464d59c5

Best regards,
-- 
Michal Luczaj <mhal@rbox.co>


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

* Re: [PATCH net-next] net: Drop unused @sk of __skb_try_recv_from_queue()
  2025-04-07 19:01 [PATCH net-next] net: Drop unused @sk of __skb_try_recv_from_queue() Michal Luczaj
@ 2025-04-08  2:10 ` Joe Damato
  2025-04-09  2:40 ` patchwork-bot+netdevbpf
  2025-06-15 21:19 ` Michal Luczaj
  2 siblings, 0 replies; 4+ messages in thread
From: Joe Damato @ 2025-04-08  2:10 UTC (permalink / raw)
  To: Michal Luczaj
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Willem de Bruijn, David Ahern, netdev, linux-kernel

On Mon, Apr 07, 2025 at 09:01:02PM +0200, Michal Luczaj wrote:
> __skb_try_recv_from_queue() deals with a queue, @sk is never used.
> Remove sk from function parameters, adapt callers.
> 
> No functional change intended.
> 
> Signed-off-by: Michal Luczaj <mhal@rbox.co>
> ---
>  include/linux/skbuff.h | 3 +--
>  net/core/datagram.c    | 5 ++---
>  net/ipv4/udp.c         | 8 ++++----
>  3 files changed, 7 insertions(+), 9 deletions(-)

Reviewed-by: Joe Damato <jdamato@fastly.com>

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

* Re: [PATCH net-next] net: Drop unused @sk of __skb_try_recv_from_queue()
  2025-04-07 19:01 [PATCH net-next] net: Drop unused @sk of __skb_try_recv_from_queue() Michal Luczaj
  2025-04-08  2:10 ` Joe Damato
@ 2025-04-09  2:40 ` patchwork-bot+netdevbpf
  2025-06-15 21:19 ` Michal Luczaj
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-09  2:40 UTC (permalink / raw)
  To: Michal Luczaj
  Cc: davem, edumazet, kuba, pabeni, horms, willemdebruijn.kernel,
	dsahern, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 07 Apr 2025 21:01:02 +0200 you wrote:
> __skb_try_recv_from_queue() deals with a queue, @sk is never used.
> Remove sk from function parameters, adapt callers.
> 
> No functional change intended.
> 
> Signed-off-by: Michal Luczaj <mhal@rbox.co>
> 
> [...]

Here is the summary with links:
  - [net-next] net: Drop unused @sk of __skb_try_recv_from_queue()
    https://git.kernel.org/netdev/net-next/c/420aabef3ab5

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

* Re: [PATCH net-next] net: Drop unused @sk of __skb_try_recv_from_queue()
  2025-04-07 19:01 [PATCH net-next] net: Drop unused @sk of __skb_try_recv_from_queue() Michal Luczaj
  2025-04-08  2:10 ` Joe Damato
  2025-04-09  2:40 ` patchwork-bot+netdevbpf
@ 2025-06-15 21:19 ` Michal Luczaj
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Luczaj @ 2025-06-15 21:19 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Willem de Bruijn, David Ahern
  Cc: netdev, linux-kernel

On 4/7/25 21:01, Michal Luczaj wrote:
> __skb_try_recv_from_queue() deals with a queue, @sk is never used.
> Remove sk from function parameters, adapt callers.
> 
> No functional change intended.

Looking at datagram.c, it's a similar story with skb_free_datagram(): its
@sk is unused since commit 4890b686f408 ("net: keep sk->sk_forward_alloc as
small as possible").

All this function does is `consume_skb(skb)`. Would it be worth dropping
the `sk` parameter? Or making callers directly invoke consume_skb()?

$ git grep skb_free_datagram | wc -l
52

Thanks,
Michal


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

end of thread, other threads:[~2025-06-15 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 19:01 [PATCH net-next] net: Drop unused @sk of __skb_try_recv_from_queue() Michal Luczaj
2025-04-08  2:10 ` Joe Damato
2025-04-09  2:40 ` patchwork-bot+netdevbpf
2025-06-15 21:19 ` Michal Luczaj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox