netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: <netdev@vger.kernel.org>, <bridge@lists.linux-foundation.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <taras.chornyi@plvision.eu>,
	<saeedm@nvidia.com>, <leon@kernel.org>, <petrm@nvidia.com>,
	<vladimir.oltean@nxp.com>, <claudiu.manoil@nxp.com>,
	<alexandre.belloni@bootlin.com>, <UNGLinuxDriver@microchip.com>,
	<jhs@mojatatu.com>, <xiyou.wangcong@gmail.com>,
	<jiri@resnulli.us>, <roopa@nvidia.com>, <razor@blackwall.org>,
	<simon.horman@corigine.com>, Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next v2 2/8] flow_dissector: Dissect layer 2 miss from tc skb extension
Date: Mon, 29 May 2023 14:48:29 +0300	[thread overview]
Message-ID: <20230529114835.372140-3-idosch@nvidia.com> (raw)
In-Reply-To: <20230529114835.372140-1-idosch@nvidia.com>

Extend the 'FLOW_DISSECTOR_KEY_META' key with a new 'l2_miss' field and
populate it from a field with the same name in the tc skb extension.
This field is set by the bridge driver for packets that incur an FDB or
MDB miss.

The next patch will extend the flower classifier to be able to match on
layer 2 misses.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---

Notes:
    v2:
    * Split from flower patch.
    * Use tc skb extension instead of 'skb->l2_miss'.

 include/net/flow_dissector.h |  2 ++
 net/core/flow_dissector.c    | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index 85b2281576ed..8b41668c77fc 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -243,10 +243,12 @@ struct flow_dissector_key_ip {
  * struct flow_dissector_key_meta:
  * @ingress_ifindex: ingress ifindex
  * @ingress_iftype: ingress interface type
+ * @l2_miss: packet did not match an L2 entry during forwarding
  */
 struct flow_dissector_key_meta {
 	int ingress_ifindex;
 	u16 ingress_iftype;
+	u8 l2_miss;
 };
 
 /**
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 25fb0bbc310f..481ca4080cbd 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -27,6 +27,7 @@
 #include <linux/tcp.h>
 #include <linux/ptp_classify.h>
 #include <net/flow_dissector.h>
+#include <net/pkt_cls.h>
 #include <scsi/fc/fc_fcoe.h>
 #include <uapi/linux/batadv_packet.h>
 #include <linux/bpf.h>
@@ -241,6 +242,15 @@ void skb_flow_dissect_meta(const struct sk_buff *skb,
 					 FLOW_DISSECTOR_KEY_META,
 					 target_container);
 	meta->ingress_ifindex = skb->skb_iif;
+#if IS_ENABLED(CONFIG_NET_TC_SKB_EXT)
+	if (tc_skb_ext_tc_enabled()) {
+		struct tc_skb_ext *ext;
+
+		ext = skb_ext_find(skb, TC_SKB_EXT);
+		if (ext)
+			meta->l2_miss = ext->l2_miss;
+	}
+#endif
 }
 EXPORT_SYMBOL(skb_flow_dissect_meta);
 
-- 
2.40.1


  parent reply	other threads:[~2023-05-29 11:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29 11:48 [PATCH net-next v2 0/8] Add layer 2 miss indication and filtering Ido Schimmel
2023-05-29 11:48 ` [PATCH net-next v2 1/8] skbuff: bridge: Add layer 2 miss indication Ido Schimmel
2023-05-29 13:17   ` Nikolay Aleksandrov
2023-05-30  5:18   ` Jakub Kicinski
2023-05-29 11:48 ` Ido Schimmel [this message]
2023-05-29 13:18   ` [PATCH net-next v2 2/8] flow_dissector: Dissect layer 2 miss from tc skb extension Nikolay Aleksandrov
2023-05-29 11:48 ` [PATCH net-next v2 3/8] net/sched: flower: Allow matching on layer 2 miss Ido Schimmel
2023-05-29 13:18   ` Nikolay Aleksandrov
2023-05-29 11:48 ` [PATCH net-next v2 4/8] flow_offload: Reject " Ido Schimmel
2023-05-29 13:19   ` Nikolay Aleksandrov
2023-05-29 11:48 ` [PATCH net-next v2 5/8] mlxsw: spectrum_flower: Split iif parsing to a separate function Ido Schimmel
2023-05-29 14:49   ` Nikolay Aleksandrov
2023-05-29 11:48 ` [PATCH net-next v2 6/8] mlxsw: spectrum_flower: Do not force matching on iif Ido Schimmel
2023-05-29 14:49   ` Nikolay Aleksandrov
2023-05-29 11:48 ` [PATCH net-next v2 7/8] mlxsw: spectrum_flower: Add ability to match on layer 2 miss Ido Schimmel
2023-05-29 14:50   ` Nikolay Aleksandrov
2023-05-29 11:48 ` [PATCH net-next v2 8/8] selftests: forwarding: Add layer 2 miss test cases Ido Schimmel
2023-05-29 14:48   ` Nikolay Aleksandrov
2023-05-31  7:00 ` [PATCH net-next v2 0/8] Add layer 2 miss indication and filtering patchwork-bot+netdevbpf

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=20230529114835.372140-3-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    --cc=roopa@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=simon.horman@corigine.com \
    --cc=taras.chornyi@plvision.eu \
    --cc=vladimir.oltean@nxp.com \
    --cc=xiyou.wangcong@gmail.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).