From: Antoine Tenart <atenart@kernel.org>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, dsahern@kernel.org
Cc: Antoine Tenart <atenart@kernel.org>, netdev@vger.kernel.org
Subject: [PATCH net-next v2 3/4] net: ipv4: use the right type for drop reasons in ip_rcv_finish_core
Date: Thu, 18 Sep 2025 10:31:16 +0200 [thread overview]
Message-ID: <20250918083127.41147-4-atenart@kernel.org> (raw)
In-Reply-To: <20250918083127.41147-1-atenart@kernel.org>
Make drop reasons be `enum skb_drop_reason` instead of `int`. While at
it make the SKB_NOT_DROPPED_YET checks explicit.
Suggested-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Antoine Tenart <atenart@kernel.org>
---
net/ipv4/ip_input.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 93b8286e526a..229c7e6b7e4c 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -325,13 +325,13 @@ static int ip_rcv_finish_core(struct net *net,
const struct sk_buff *hint)
{
const struct iphdr *iph = ip_hdr(skb);
+ enum skb_drop_reason drop_reason;
struct rtable *rt;
- int drop_reason;
if (ip_can_use_hint(skb, iph, hint)) {
drop_reason = ip_route_use_hint(skb, iph->daddr, iph->saddr,
ip4h_dscp(iph), dev, hint);
- if (unlikely(drop_reason))
+ if (unlikely(drop_reason != SKB_NOT_DROPPED_YET))
goto drop_error;
}
@@ -351,7 +351,7 @@ static int ip_rcv_finish_core(struct net *net,
case IPPROTO_UDP:
if (READ_ONCE(net->ipv4.sysctl_udp_early_demux)) {
drop_reason = udp_v4_early_demux(skb);
- if (unlikely(drop_reason))
+ if (unlikely(drop_reason != SKB_NOT_DROPPED_YET))
goto drop_error;
/* must reload iph, skb->head might have changed */
@@ -368,7 +368,7 @@ static int ip_rcv_finish_core(struct net *net,
if (!skb_valid_dst(skb)) {
drop_reason = ip_route_input_noref(skb, iph->daddr, iph->saddr,
ip4h_dscp(iph), dev);
- if (unlikely(drop_reason))
+ if (unlikely(drop_reason != SKB_NOT_DROPPED_YET))
goto drop_error;
} else {
struct in_device *in_dev = __in_dev_get_rcu(dev);
--
2.51.0
next prev parent reply other threads:[~2025-09-18 8:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 8:31 [PATCH net-next v2 0/4] net: ipv4: some drop reason cleanup and improvements Antoine Tenart
2025-09-18 8:31 ` [PATCH net-next v2 1/4] net: ipv4: make udp_v4_early_demux explicitly return drop reason Antoine Tenart
2025-09-18 8:31 ` [PATCH net-next v2 2/4] net: ipv4: simplify drop reason handling in ip_rcv_finish_core Antoine Tenart
2025-09-18 15:24 ` David Ahern
2025-09-18 17:45 ` Antoine Tenart
2025-09-18 18:42 ` David Ahern
2025-09-18 8:31 ` Antoine Tenart [this message]
2025-09-18 18:43 ` [PATCH net-next v2 3/4] net: ipv4: use the right type for drop reasons " David Ahern
2025-09-20 0:37 ` Jakub Kicinski
2025-09-18 8:31 ` [PATCH net-next v2 4/4] net: ipv4: convert ip_rcv_options to drop reasons Antoine Tenart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250918083127.41147-4-atenart@kernel.org \
--to=atenart@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).