From patchwork Sun Nov 4 19:33:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17610 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 BDAE482192; Sun, 4 Nov 2018 20:33:48 +0100 (CET) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.b="lxuUOGks"; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver= Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id 377EC80934 for ; Sun, 4 Nov 2018 20:33:45 +0100 (CET) Received: from sven-desktop.home.narfation.org (p200300C593DB96FD0000000000008096.dip0.t-ipconnect.de [IPv6:2003:c5:93db:96fd::8096]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 017B0110109; Sun, 4 Nov 2018 20:33:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1541360024; bh=9P57GMFAvnQV8j1szplANEY39TomwmkHcYAIAZqoytk=; h=From:To:Cc:Subject:Date:From; b=lxuUOGks2uJrInLGT2xibDBrKOzqV5yAyP+XxvXcqwTs9xGMLCpa0dR+kqVMoHISN 5dIVNZIIOSjRjod7njoZrzZwsXqVAIHifYXzSnQG+QdszEEOPGFjOWE4Z6HQ499MNG I5HSFAdh3r8OagxDCGtQUTXSAAAA9V7RjBofUcQY= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 4 Nov 2018 20:33:12 +0100 Message-Id: <20181104193314.18104-1-sven@narfation.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [B.A.T.M.A.N.] [RFC 0/2] batman-adv: netlink restructuring, part 2 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: Jiri Pirko Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" Hi, Jiri Pirko called the batman-adv configuration interface a while back "a huge mistake" [1] and suggested genl as alternative. But it is not completely clear what he meant by that. I had a look at the implementation in team and devlink (he is maintainer of both). Unfortunately, both work in slightly different ways. But they seem to have in common that there are different classes of configuration options/params which then have their own set of commands. But each set of command works for multiple options/params. I have tried to replicate something similar with this implementation. It might be important to point out that it requires multiple messages when trying to change multiple options (e.g. modification of gw_bandwidth_down and gw_bandwidth_up require two messages). This should be more like devlink and not like team. But it directly sends the new options back via genlmsg_multicast to all subscribers of the "config" mcast group. There is also currently no nesting of attributes. The code is basically around the triplet name-type-value. All three are required for set operations, name is required for get operations and nothing of the triplet is required for dump operations (because it will create messages containing this triplet). The different classes of options also require as input: * mesh interface (the batadv device) - meshif_index * hard interface specific (the enslaved devices) - meshif_index - hardif_index * vlan specific (vlan on top of the mesh interface) - meshif_index - vlan id Luckily, Jiri Pirko told us that he will have a look at patches. Here are two patches with an initial implementation. I might have to split them futher - maybe three patches for the infrastructure part and a couple for the import of the sysfs options in the new infrastructure. I am happy to receive suggestions how I should split them. There is also some potential in reducing the shared code for the .doit commands by moving the BATADV_ATTR_MESH_IFINDEX -> bat_priv code to .pre and .post handlers. Kind regards, Sven [1] https://www.open-mesh.org/issues/300 Sven Eckelmann (2): batman-adv: Add infrastructure for netlink config manipulation batman-adv: Convert existing sysfs options to netlink include/uapi/linux/batman_adv.h | 55 + net/batman-adv/Makefile | 1 + net/batman-adv/netlink.c | 50 +- net/batman-adv/netlink.h | 6 + net/batman-adv/netlink_cfg.c | 2096 +++++++++++++++++++++++++++++++ net/batman-adv/netlink_cfg.h | 78 ++ 6 files changed, 2280 insertions(+), 6 deletions(-) create mode 100644 net/batman-adv/netlink_cfg.c create mode 100644 net/batman-adv/netlink_cfg.h