From patchwork Tue Dec 5 14:35:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17182 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 355BC814FB; Tue, 5 Dec 2017 15:35:53 +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="DAy7PQMV"; dkim-atps=neutral Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:400d:c0d::230; helo=mail-qt0-x230.google.com; envelope-from=sven.eckelmann@openmesh.com; receiver= Received: from mail-qt0-x230.google.com (mail-qt0-x230.google.com [IPv6:2607:f8b0:400d:c0d::230]) by open-mesh.org (Postfix) with ESMTPS id 3B416803F7 for ; Tue, 5 Dec 2017 15:35:50 +0100 (CET) Received: by mail-qt0-x230.google.com with SMTP id k19so1138306qtj.6 for ; Tue, 05 Dec 2017 06:35:50 -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=+RS2SU2UlenjDLf5QOtRvrWOboVxW+2fPidVXPkQJXA=; b=DAy7PQMVRKK7Qh7yyQw8o55wgexp+NR8voBHnSUDY2zm54IX87EJj+VekVa0qMxniL PGsG+lixlXn79V3UTGYrHGe7nzlJv1UuvhNcPmhPBUvB3herz00tPskIvDc6/QFj08Vm oDGZp8BoUl1cgKQyrK4ZGqZ0o4VpEzmGvnCUn4y81vxh+EWcsPC6RCscXQb0Q+TJv+kO wy6jgJB1pOmYV2EF9RePzWhSR2yIiTHol5RhfGaGaqfXjcVx2a2o1ArdNAaOY9hLyzXy G/c+nGTzteYfCEEEZMmGpVVbZjIE6KsyvOjnYp5kClxOrHWwkSaaRTupzUQ8kAZF2AuJ ev4g== 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=+RS2SU2UlenjDLf5QOtRvrWOboVxW+2fPidVXPkQJXA=; b=giE6OQVjCwFwWfFt+rj05cD92TG4foxL/7ZYQtyFy0TFd5TJT8epJVuRyp+aW9InmI bRlTjPPpyhKmmjFysaAg3KEjBWInDqafC/HOS6qrQTlJLmWbj2dIs3kl3/jxe06FNb+7 1YSPCZkiq+grgCV2pkUPYGbmgvXoYmVG/1uqAph3Wa/5XY9UVhprnxAzxnrf2cg0N8Hd 57NmGEIEvw7MKpmPW/yKI55oV3CVujORHGQCatQ4rMrGOLlgTLmO4P6Q2vFcQ+RTr8Ro Npx5whxLGekiLvoakSfvsJ4pq1qffkCzbfo+iI+BAgpzXeZZn5K+iMnkQpp1aCHmqT6t 26Vw== X-Gm-Message-State: AKGB3mJ8zS3uDE9XpFZKSh37alsBmZZHQ24c/bSZbZPnLpyAC94zbB0x RXDpbG3gTPNxwp9ViM7ESvSEYQ== X-Google-Smtp-Source: AGs4zMZINW/3DBHH2jX5cj6wzZuTjnGOAnoENO7UpJcqmGx9t1xq/1qAfVgTAaJPMsfJ+voI1JrW3Q== X-Received: by 10.55.124.67 with SMTP id x64mr23104681qkc.113.1512484549707; Tue, 05 Dec 2017 06:35:49 -0800 (PST) Received: from sven-desktop.home.narfation.org (p2003007C6F4F41EE52D08C1B61D759F9.dip0.t-ipconnect.de. [2003:7c:6f4f:41ee:52d0:8c1b:61d7:59f9]) by smtp.gmail.com with ESMTPSA id j1sm188042qkc.5.2017.12.05.06.35.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Dec 2017 06:35:49 -0800 (PST) From: Sven Eckelmann To: netdev@vger.kernel.org Date: Tue, 5 Dec 2017 15:35:08 +0100 Message-Id: <20171205143514.4441-1-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 Subject: [B.A.T.M.A.N.] [RFC v2 0/6] flow_dissector: Provide basic batman-adv unicast handling 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: b.a.t.m.a.n@lists.open-mesh.org, Eric Dumazet , linux-kernel@vger.kernel.org, Jiri Pirko , Sven Eckelmann , "David S . Miller" Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" Hi, we are currently starting to use batman-adv as mesh protocol on multicore embedded devices. These usually don't have a lot of CPU power per core but are reasonable fast when using multiple cores. It was noticed that sending was working very well but receiving was basically only using on CPU core per neighbor. The reason for that is format of the (normal) incoming packet: +--------------------+ | ip(v6)hdr | +--------------------+ | inner ethhdr | +--------------------+ | batadv unicast hdr | +--------------------+ | outer ethhdr | +--------------------+ The flow dissector will therefore stop after parsing the outer ethernet header and will not parse the actual ipv(4|6)/... header of the packet. Our assumption was now that it would help us to add minimal support to the flow dissector to jump over the batman-adv unicast and inner ethernet header (like in gre ETH_P_TEB). The patch was implemented in a slightly hacky way [1] and the results looked quite promising. Now we comes the actual "problematic" part. The packet format is currently only available in net/batman-adv/packet.h. I've guessed that it should be moved somewhere under include/ to make it accessible to the flow dissector in a "standard way". First we have to find the correct place for it. I am not aware of any standard for that - so I've grepped for some packet headers which are used by the dissector and found following files (most likely not a complete list): * linux/if_vlan.h * net/gre.h * net/tipc.h * uapi/linux/if_arp.h * uapi/linux/if_ether.h * uapi/linux/if_pppox.h * uapi/linux/ip.h * uapi/linux/ipv6.h * uapi/linux/mpls.h * uapi/linux/tcp.h So I would say that uapi/linux is the "winner" here. This would actually also helpful for userspace tools which either inject packets or monitor interfaces + dissect packets (for example batctl). Now to the actual filename. batman_adv.h is already used in the moment for the netlink definition and I would like to avoid that these two things are placed in the same file. A quick grep for "NL_NAME" showed me following names: * linux/nl802154.h * net/nl802154.h * uapi/linux/batman_adv.h * uapi/linux/devlink.h * uapi/linux/dlm_netlink.h * uapi/linux/fou.h * uapi/linux/if_macsec.h * uapi/linux/if_team.h * uapi/linux/ila.h * uapi/linux/ip_vs.h * uapi/linux/irda.h * uapi/linux/l2tp.h * uapi/linux/nfc.h * uapi/linux/nl80211.h * uapi/linux/psample.h * uapi/linux/seg6_genl.h * uapi/linux/taskstats.h * uapi/linux/tcp_metrics.h * uapi/linux/tipc_config.h * uapi/linux/tipc_netlink.h There doesn't seem to be any common way to do it - so I have to guess what the best names could be. I've decided (but please provide better alternatives) to use batadv_genl.h (for generic netlink stuff) and batadv.h (for the packet format). I would really appreciate it when you would provide feedback to the naming/placement of the files. Btw. the patches are currently based on the top of batadv/net-next [2] and this repository contains changes which still have to be submitted to net-next. Changes in v2: ============= * removed the batman-adv unicast packet header definition from flow_dissector.c * moved the batman-adv packet.h/uapi headers around to provide the correct definitions to flow_dissector.c Kind regards, Sven [1] https://patchwork.open-mesh.org/patch/17162/ [2] https://git.open-mesh.org/linux-merge.git/shortlog/refs/heads/batadv/net-next Sven Eckelmann (6): batman-adv: Change nl references to genl batman-adv: Rename batman-adv.h to batadv_genl.h batman-adv: Let packet.h include its headers directly batman-adv: Remove usage of BIT(x) in packet.h batman-adv: Convert packet.h to uapi header flow_dissector: Parse batman-adv unicast headers MAINTAINERS | 3 +- .../packet.h => include/uapi/linux/batadv.h | 32 ++++++++++++---------- include/uapi/linux/{batman_adv.h => batadv_genl.h} | 20 +++++++------- net/batman-adv/bat_algo.c | 2 +- net/batman-adv/bat_iv_ogm.c | 4 +-- net/batman-adv/bat_v.c | 4 +-- net/batman-adv/bat_v_elp.c | 2 +- net/batman-adv/bat_v_ogm.c | 2 +- net/batman-adv/bridge_loop_avoidance.c | 4 +-- net/batman-adv/distributed-arp-table.h | 2 +- net/batman-adv/fragmentation.c | 2 +- net/batman-adv/gateway_client.c | 4 +-- net/batman-adv/gateway_common.c | 2 +- net/batman-adv/hard-interface.c | 2 +- net/batman-adv/icmp_socket.c | 2 +- net/batman-adv/main.c | 6 ++-- net/batman-adv/main.h | 4 +-- net/batman-adv/multicast.c | 2 +- net/batman-adv/netlink.c | 14 ++++++---- net/batman-adv/network-coding.c | 2 +- net/batman-adv/originator.c | 2 +- net/batman-adv/routing.c | 2 +- net/batman-adv/send.h | 3 +- net/batman-adv/soft-interface.c | 2 +- net/batman-adv/sysfs.c | 2 +- net/batman-adv/tp_meter.c | 4 +-- net/batman-adv/translation-table.c | 4 +-- net/batman-adv/tvlv.c | 2 +- net/batman-adv/types.h | 5 ++-- net/core/flow_dissector.c | 30 ++++++++++++++++++++ 30 files changed, 101 insertions(+), 70 deletions(-) rename net/batman-adv/packet.h => include/uapi/linux/batadv.h (96%) rename include/uapi/linux/{batman_adv.h => batadv_genl.h} (95%)