From patchwork Mon Nov 27 12:33:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17162 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 5D7E080A02; Mon, 27 Nov 2017 13:34:01 +0100 (CET) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=openmesh-com.20150623.gappssmtp.com header.i=@openmesh-com.20150623.gappssmtp.com header.b="0XVj5qhD"; dkim-atps=neutral Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:400d:c09::241; helo=mail-qk0-x241.google.com; envelope-from=sven.eckelmann@openmesh.com; receiver= Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) by open-mesh.org (Postfix) with ESMTPS id BA7CE80405 for ; Mon, 27 Nov 2017 13:33:57 +0100 (CET) Received: by mail-qk0-x241.google.com with SMTP id v137so32117107qkb.1 for ; Mon, 27 Nov 2017 04:33:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openmesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=m51lYm7+4ATfhF2ssuRm0Kq9UtxTIB0P7Y+dU6oXvtY=; b=0XVj5qhDTr/pMYNFAXhuuMhBKySlRzJlMax+BzkVCoNE0AnBRwFBnW43W82RlkaP7v gDT3lSL32uNDvf4/FY3CTrcr9PQguiehhddMj9puFb+Blx9Of8YmYRF7d1IlPoFknLMf 6cyQF41wi6z9DOnqxQm5+8uF5prKgwTr1v8HeFzu34zfr/SRcG3ywk9+hATmr4pZcTL2 UcZ24tVGfsIxSd3UQOHcumsgvhFYCj5GusbLQtdeQjqqgyps1cfU70meC0a0qXnGeEwR BYgPNtk8henFDep80BxtXwPlYIP6nccZg39gs7JALU6Bf4ZzoqK32+JNamwzKEOf9RjI wKDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=m51lYm7+4ATfhF2ssuRm0Kq9UtxTIB0P7Y+dU6oXvtY=; b=gAzf6P6RosKDwK30ku4mD2ZhBk60054WL7m57sfPWXltj65S22ag0TycnFRz7kpav4 R4HeWW0q5pnawDTIvrwyp3iSManPvIavUg+2Sh901A7zEjIo7DKpJxgOMSEn1yjc5H3o Os7SrsDYLKKRnmu5hydK5U+zRjB8E7fXNedAhZo1jGMEgAqKz2dmWmfrGMUkqVs0vAN/ arYQexCNVDCjU6YST41W8gcZO3BOzy76xU9uklH9GnVd4AVStOa4bPLTMLnus8jqo5QU vUcmvpVPWsnpa03ARSLgtTCUsfV0eXfagMG0efgsItmSzjPKM7uAc7wWZ027AGW/Uiik pagw== X-Gm-Message-State: AJaThX6U+DgdTA7dbVikuW/8HiSnX6P4Udke/VfHQW8RB4X7il6zKASf Qj1gxc/vdsD22T25weTokgwanSdX X-Google-Smtp-Source: AGs4zMbD9JqJn/a/2pcFy8YXPQ+h8fEc7+pDZHw1t3smo8pK+HZuTV/go4to4A8pkrebDxq+LjQidQ== X-Received: by 10.55.174.134 with SMTP id x128mr9490448qke.167.1511786036240; Mon, 27 Nov 2017 04:33:56 -0800 (PST) Received: from sven-desktop.home.narfation.org ([84.155.216.143]) by smtp.gmail.com with ESMTPSA id e70sm19876400qka.83.2017.11.27.04.33.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Nov 2017 04:33:55 -0800 (PST) From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 27 Nov 2017 13:33:41 +0100 Message-Id: <20171127123341.11365-1-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 Subject: [B.A.T.M.A.N.] [PATCH] flow_dissector: Parse batman-adv unicast headers X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Cc: Sven Eckelmann Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" 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 to allow RPS to schedule the flow to different cores. Signed-off-by: Sven Eckelmann --- I've played around with the RPS+XPS to better distribute traffic to different cores on modern SoCs. It was observed that the batman-adv unicast traffic stayed at one core and this limited the overall throughput. The test was done between a modern PC which was running iperf over batman-adv. Another PC was also running iperf was just transmitting the traffic over ethernet. A QCA Dakota (IPQ4018) based device was in the middle and received the ethernet traffic on one port, encapsulated it as batman-adv unicast and transferred the resulting packet via ethernet to the modern PC. $ iperf -c 192.168.23.2 -t 30 -i 1 -P16 It was observed that only the receive processing was affected. Adding this relative simple patch allowed me to increase the ethernet throughput from 689 Mbits/sec (with one core doing the interrupt processing and 1 core completely busy with the other processing) to 910 Mbits/sec (one core doing the interrupt processing and the other 3 cores were sharing the load). In theory, the device with the patch could have handled a lot more traffic than 910 Mbit/sec - at least the RPS cores were not even near 100% load. This should bring a lot more when testing with good 802.11ac WiFi links because the wifi stack/driver are usually stressing the CPU a lot more than normal ethernet drivers. The change itself is not really invasive but could be a lot cleaner when the packet header information would be available under include/... . And I don't know yet whether it would make sense to add a new flow dissector key with the batman-adv destination address. This is also the reason why I only post this to the b.a.t.m.a.n@lists.open-mesh.org mailing list. Anyway, maybe some other people ran into the same problem and want to test it. --- net/core/flow_dissector.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 0a977373d003..bbf894fff3fc 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -595,6 +595,39 @@ bool __skb_flow_dissect(const struct sk_buff *skb, break; } + case htons(ETH_P_BATMAN): { + /* TODO provide struct in include/uapi/... header */ + struct batadv_unicast_packet { + u8 packet_type; + u8 version; + u8 ttl; + u8 ttvn; + u8 dest[ETH_ALEN]; + }; + + 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) + goto out_bad; + + if (hdr->batadv_unicast.version != 15) + break; + + if (hdr->batadv_unicast.packet_type != 0x40) + break; + + /* TODO set batman-adv dest address as flow key? */ + + proto = hdr->eth.h_proto; + nhoff += sizeof(*hdr); + + goto again; + } case htons(ETH_P_8021AD): case htons(ETH_P_8021Q): { const struct vlan_hdr *vlan;