Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752873AbdLEOgi (ORCPT ); Tue, 5 Dec 2017 09:36:38 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:46474 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752257AbdLEOgb (ORCPT ); Tue, 5 Dec 2017 09:36:31 -0500 X-Google-Smtp-Source: AGs4zMbr9HGT6UeODsVlRn3npJmPGKGoMQ0lG9iJdcQZExrS/XuRlCY5hRw1Lo0hVg2K21WFCJ6lnw== From: Sven Eckelmann To: netdev@vger.kernel.org Cc: "David S . Miller" , Jiri Pirko , Eric Dumazet , linux-kernel@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann Subject: [RFC v2 6/6] flow_dissector: Parse batman-adv unicast headers Date: Tue, 5 Dec 2017 15:35:14 +0100 Message-Id: <20171205143514.4441-7-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171205143514.4441-1-sven.eckelmann@openmesh.com> References: <20171205143514.4441-1-sven.eckelmann@openmesh.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2047 Lines: 73 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 --- 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 #include #include +#include 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