netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] ipv4: remove useless arg
@ 2024-11-26 13:19 tianyu2
  2024-11-26 14:20 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: tianyu2 @ 2024-11-26 13:19 UTC (permalink / raw)
  To: davem; +Cc: netdev

When I wanted to kprobe the ip_rcv_finish_core, I found that using x1 to
pass "struct sk_buff *skb"."struct sock *sk" was not used in the
function, causing the compiler to optimize away. This resulted in a
hard to use kprobe. Why not delete him?

Signed-off-by: tianyu2 <tianyu2@kernelsoft.com>
---
 net/ipv4/ip_input.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index e7196ecffafc..2ff88c598988 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -314,7 +314,7 @@ static bool ip_can_use_hint(const struct sk_buff *skb, const struct iphdr *iph,
 
 int tcp_v4_early_demux(struct sk_buff *skb);
 int udp_v4_early_demux(struct sk_buff *skb);
-static int ip_rcv_finish_core(struct net *net, struct sock *sk,
+static int ip_rcv_finish_core(struct net *net,
 			      struct sk_buff *skb, struct net_device *dev,
 			      const struct sk_buff *hint)
 {
@@ -444,7 +444,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
 	if (!skb)
 		return NET_RX_SUCCESS;
 
-	ret = ip_rcv_finish_core(net, sk, skb, dev, NULL);
+	ret = ip_rcv_finish_core(net, skb, dev, NULL);
 	if (ret != NET_RX_DROP)
 		ret = dst_input(skb);
 	return ret;
@@ -610,7 +610,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
 		skb = l3mdev_ip_rcv(skb);
 		if (!skb)
 			continue;
-		if (ip_rcv_finish_core(net, sk, skb, dev, hint) == NET_RX_DROP)
+		if (ip_rcv_finish_core(net, skb, dev, hint) == NET_RX_DROP)
 			continue;
 
 		dst = skb_dst(skb);
-- 
2.27.0


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

* Re: [RFC] ipv4: remove useless arg
  2024-11-26 13:19 [RFC] ipv4: remove useless arg tianyu2
@ 2024-11-26 14:20 ` Eric Dumazet
  2024-11-27  6:07   ` 田宇2
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2024-11-26 14:20 UTC (permalink / raw)
  To: tianyu2, davem; +Cc: netdev


On 11/26/24 2:19 PM, tianyu2 wrote:
> When I wanted to kprobe the ip_rcv_finish_core, I found that using x1 to
> pass "struct sk_buff *skb"."struct sock *sk" was not used in the
> function, causing the compiler to optimize away. This resulted in a
> hard to use kprobe. Why not delete him?
>
> Signed-off-by: tianyu2 <tianyu2@kernelsoft.com>
> ---

This is great seeing compilers being smart.

SGTM, please send this next week when net-next is open again.

Also do the same for ip_list_rcv_finish()



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

* Re: Re: [RFC] ipv4: remove useless arg
  2024-11-26 14:20 ` Eric Dumazet
@ 2024-11-27  6:07   ` 田宇2
  0 siblings, 0 replies; 3+ messages in thread
From: 田宇2 @ 2024-11-27  6:07 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, netdev


> On 11/26/24 2:19 PM, tianyu2 wrote:
> > When I wanted to kprobe the ip_rcv_finish_core, I found that using x1 to
> > pass "struct sk_buff *skb"."struct sock *sk" was not used in the
> > function, causing the compiler to optimize away. This resulted in a
> > hard to use kprobe. Why not delete him?
> >
> > Signed-off-by: tianyu2 <tianyu2@kernelsoft.com>
> > ---
> 
> This is great seeing compilers being smart.
> 
> SGTM, please send this next week when net-next is open again.
> 
> Also do the same for ip_list_rcv_finish()
> 
Okay, thanks for the reply.

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

end of thread, other threads:[~2024-11-27  6:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-26 13:19 [RFC] ipv4: remove useless arg tianyu2
2024-11-26 14:20 ` Eric Dumazet
2024-11-27  6:07   ` 田宇2

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).