From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 1/2] ipvlan: ipvlan_handle_mode_l2() refactoring
Date: Thu, 9 Apr 2026 08:52:37 +0000 [thread overview]
Message-ID: <20260409085238.1122947-2-edumazet@google.com> (raw)
In-Reply-To: <20260409085238.1122947-1-edumazet@google.com>
Reduce indentation level, and add a likely() clause
as we expect to process more unicast packets than multicast ones.
No functional change, this eases the following patch review.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
drivers/net/ipvlan/ipvlan_core.c | 38 +++++++++++++++-----------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index 0b493a8aa33857d531329e8eaef6b25a5c6f572d..214fd299a5aa6e40579aa2dbcb178b5474b561a4 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -744,34 +744,32 @@ static rx_handler_result_t ipvlan_handle_mode_l3(struct sk_buff **pskb,
static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb,
struct ipvl_port *port)
{
- struct sk_buff *skb = *pskb;
+ struct sk_buff *nskb, *skb = *pskb;
struct ethhdr *eth = eth_hdr(skb);
- rx_handler_result_t ret = RX_HANDLER_PASS;
if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
return RX_HANDLER_PASS;
- if (is_multicast_ether_addr(eth->h_dest)) {
- if (ipvlan_external_frame(skb, port)) {
- struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
+ /* Perform like l3 mode for non-multicast packet */
+ if (likely(!is_multicast_ether_addr(eth->h_dest)))
+ return ipvlan_handle_mode_l3(pskb, port);
- /* External frames are queued for device local
- * distribution, but a copy is given to master
- * straight away to avoid sending duplicates later
- * when work-queue processes this frame. This is
- * achieved by returning RX_HANDLER_PASS.
- */
- if (nskb) {
- ipvlan_skb_crossing_ns(nskb, NULL);
- ipvlan_multicast_enqueue(port, nskb, false);
- }
- }
- } else {
- /* Perform like l3 mode for non-multicast packet */
- ret = ipvlan_handle_mode_l3(pskb, port);
+ /* External frames are queued for device local
+ * distribution, but a copy is given to master
+ * straight away to avoid sending duplicates later
+ * when work-queue processes this frame.
+ * This is achieved by returning RX_HANDLER_PASS.
+ */
+ if (!ipvlan_external_frame(skb, port))
+ return RX_HANDLER_PASS;
+
+ nskb = skb_clone(skb, GFP_ATOMIC);
+ if (nskb) {
+ ipvlan_skb_crossing_ns(nskb, NULL);
+ ipvlan_multicast_enqueue(port, nskb, false);
}
- return ret;
+ return RX_HANDLER_PASS;
}
rx_handler_result_t ipvlan_handle_frame(struct sk_buff **pskb)
--
2.53.0.1213.gd9a14994de-goog
next prev parent reply other threads:[~2026-04-09 8:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 8:52 [PATCH net-next 0/2] ipvlan: multicast delivery changes Eric Dumazet
2026-04-09 8:52 ` Eric Dumazet [this message]
2026-04-09 8:52 ` [PATCH net-next 2/2] ipvlan: avoid spinlock contention in ipvlan_multicast_enqueue() Eric Dumazet
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=20260409085238.1122947-2-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--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