From: Sven Eckelmann <sven.eckelmann@openmesh.com>
To: netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>,
Jiri Pirko <jiri@mellanox.com>,
Eric Dumazet <edumazet@google.com>,
linux-kernel@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Sven Eckelmann <sven.eckelmann@openmesh.com>
Subject: [B.A.T.M.A.N.] [RFC v2 6/6] flow_dissector: Parse batman-adv unicast headers
Date: Tue, 5 Dec 2017 15:35:14 +0100 [thread overview]
Message-ID: <20171205143514.4441-7-sven.eckelmann@openmesh.com> (raw)
In-Reply-To: <20171205143514.4441-1-sven.eckelmann@openmesh.com>
The batman-adv unicast packets contain a full layer 2 frame in encapsulated
form. The flow dissector must therefore be able to parse the batman-adv
unicast header to reach the layer 2+3 information.
+--------------------+
| ip(v6)hdr |
+--------------------+
| inner ethhdr |
+--------------------+
| batadv unicast hdr |
+--------------------+
| outer ethhdr |
+--------------------+
The obtained information from the upper layer can then be used by RPS to
schedule the processing on separate cores. This allows better distribution
of multiple flows from the same neighbor to different cores.
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
---
net/core/flow_dissector.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 15ce30063765..784cc07fc58e 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -24,6 +24,7 @@
#include <linux/tcp.h>
#include <net/flow_dissector.h>
#include <scsi/fc/fc_fcoe.h>
+#include <uapi/linux/batadv.h>
static void dissector_set_key(struct flow_dissector *flow_dissector,
enum flow_dissector_key_id key_id)
@@ -696,6 +697,35 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
break;
}
+ case htons(ETH_P_BATMAN): {
+ struct {
+ struct batadv_unicast_packet batadv_unicast;
+ struct ethhdr eth;
+ } *hdr, _hdr;
+
+ hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen,
+ &_hdr);
+ if (!hdr) {
+ fdret = FLOW_DISSECT_RET_OUT_BAD;
+ break;
+ }
+
+ if (hdr->batadv_unicast.version != BATADV_COMPAT_VERSION) {
+ fdret = FLOW_DISSECT_RET_OUT_BAD;
+ break;
+ }
+
+ if (hdr->batadv_unicast.packet_type != BATADV_UNICAST) {
+ fdret = FLOW_DISSECT_RET_OUT_BAD;
+ break;
+ }
+
+ proto = hdr->eth.h_proto;
+ nhoff += sizeof(*hdr);
+
+ fdret = FLOW_DISSECT_RET_PROTO_AGAIN;
+ break;
+ }
case htons(ETH_P_8021AD):
case htons(ETH_P_8021Q): {
const struct vlan_hdr *vlan;
--
2.11.0
next prev parent reply other threads:[~2017-12-05 14:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 14:35 [B.A.T.M.A.N.] [RFC v2 0/6] flow_dissector: Provide basic batman-adv unicast handling Sven Eckelmann
2017-12-05 14:35 ` [B.A.T.M.A.N.] [RFC v2 1/6] batman-adv: Change nl references to genl Sven Eckelmann
2017-12-05 14:35 ` [B.A.T.M.A.N.] [RFC v2 2/6] batman-adv: Rename batman-adv.h to batadv_genl.h Sven Eckelmann
2017-12-06 16:42 ` Willem de Bruijn
2017-12-06 16:55 ` Sven Eckelmann
2017-12-06 16:58 ` Willem de Bruijn
2017-12-15 10:32 ` Sven Eckelmann
2017-12-15 11:48 ` Sven Eckelmann
2017-12-15 16:57 ` Willem de Bruijn
2017-12-15 17:18 ` Sven Eckelmann
2017-12-15 17:23 ` Willem de Bruijn
2017-12-05 14:35 ` [B.A.T.M.A.N.] [RFC v2 3/6] batman-adv: Let packet.h include its headers directly Sven Eckelmann
2017-12-05 14:35 ` [B.A.T.M.A.N.] [RFC v2 4/6] batman-adv: Remove usage of BIT(x) in packet.h Sven Eckelmann
2017-12-05 14:35 ` [B.A.T.M.A.N.] [RFC v2 5/6] batman-adv: Convert packet.h to uapi header Sven Eckelmann
2017-12-05 14:35 ` Sven Eckelmann [this message]
2017-12-05 17:19 ` [B.A.T.M.A.N.] [RFC v2 6/6] flow_dissector: Parse batman-adv unicast headers Tom Herbert
2017-12-06 10:26 ` Sven Eckelmann
2017-12-06 16:54 ` Willem de Bruijn
2017-12-06 17:10 ` Tom Herbert
2017-12-06 17:27 ` Sven Eckelmann
2017-12-06 18:24 ` Willem de Bruijn
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=20171205143514.4441-7-sven.eckelmann@openmesh.com \
--to=sven.eckelmann@openmesh.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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