diff mbox series

[RFC] ipv4: remove useless arg

Message ID 20241126131912.601391-1-tianyu2@kernelsoft.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series [RFC] ipv4: remove useless arg | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 5 maintainers not CCed: kuba@kernel.org horms@kernel.org pabeni@redhat.com dsahern@kernel.org edumazet@google.com
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

tianyu2 Nov. 26, 2024, 1:19 p.m. UTC
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(-)

Comments

Eric Dumazet Nov. 26, 2024, 2:20 p.m. UTC | #1
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()
diff mbox series

Patch

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