From patchwork Tue Apr 24 23:08:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10361183 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B3B776038F for ; Tue, 24 Apr 2018 23:09:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A365528D53 for ; Tue, 24 Apr 2018 23:09:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97D6428E86; Tue, 24 Apr 2018 23:09:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2D6C528D53 for ; Tue, 24 Apr 2018 23:09:05 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40VzXv3LK1zF24K for ; Wed, 25 Apr 2018 09:09:03 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="nsyXWv/I"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=104.47.2.41; helo=eur01-db5-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="nsyXWv/I"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0041.outbound.protection.outlook.com [104.47.2.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40VzXn5z65zF24N for ; Wed, 25 Apr 2018 09:08:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XjVVfGFqp6CqZg4ppOVGrKX3Jib/r/bvKnsQY1H4Mzs=; b=nsyXWv/IQHt+FByRWHdT5/eutTH3nK36gQwitBXGPxf+8BKvGIUumGcoxD8ySAvV6VDIDSiT8UOP64PR/BDnNRv8NCdgozeitLUqBTnLsmxCWIlMypQa469aIugncDFXuaKKes2+CZwmZMAB6hH0iZj1HaT0xzFEsxt3KX8IfDg= Received: from t540p (89.177.127.115) by AM0PR05MB4180.eurprd05.prod.outlook.com (2603:10a6:208:57::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Tue, 24 Apr 2018 23:08:51 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 1/7] net: bridge: Publish bridge accessor functions In-Reply-To: References: Message-Id: Date: Wed, 25 Apr 2018 01:08:44 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [89.177.127.115] X-ClientProxiedBy: DB6PR1001CA0025.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::11) To AM0PR05MB4180.eurprd05.prod.outlook.com (2603:10a6:208:57::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4180; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 3:4P5rPe0vJG0zxl73b2+z4YKvcW7uVkwoMbLEF0wVDiGbFWrz6/VwKAlP00kbBxRYQvY9VRWHFeapu5J+RZUkzdRCMAn7NFxk/XnvM6DQJfUDG4hOH8KfZb2GQ5yrggrI7AtB6ULY/vaoCEjPGpk1LbAtxMSs9MSMnS4OkB9LmOx0Zq/+/P/K6wbj4XJnK5VBznCcDgzXiI1U3M6KZVr7QaieZ50+oi8xDmEr0LNHQTbNnvNxfi3+wU0dM0CIOhS9; 25:SBCtAlOcTOwA7ximECDlu8KYWX7lNk82S/c7ah5IOwM7LV5HA+JoMjaDyIhZGlzmvRp5nKTUmrFZAo2LNgALFzQqTCxA9yUQJ4GlT9ya0Mi1PjmJVFsKLurKhGYPUGq2oJG8sEjNPdJz668gyusB5ov09KEnT4H4Y8uctNstC/CvrhB3/t3YrL8ehoK9VykpPYt9oQjst1Kkth/aVOTVm/sgtlzvYlBrjoQi1UuIoGqCkUEebo60l+P2IIko/1owrsw4x5oh6SIyvwQ8gpoXeDEvQfiX7VWpKR36zcFpuyDoIi744RlCgF1QaIyPyYNQVnvvQBATjy8y/lfReY5Dpg==; 31:41l4ZANBVVO2UlR668k5zB09leqO/9lfFSFDK/gtSjysOQyavOdXzvVSrr/6D5Pyqc3Bs8o5X6PVVOK2u4bSUlgwhHfeLZLi6J3mP8SMbenOTuwPkf3qfCEudhGYVljvYRJdye9rR51kBMCBFAtzNi4OPvCkxRqJmEB7ZBNGcvysxAKcLRYuSB8tk/9J1SMHcrBlhi2IaRaC5SmfZfkld9FevWbxZFm3R1DQPdIxMis= X-MS-TrafficTypeDiagnostic: AM0PR05MB4180: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 20:c3FxNqbI29zmhXpquU975ECrJEp6YaXfgz9X7XFihEUBsC90a0Gv8AgEktmmVMn3FG4tClyymBIRjl+2TUV0hsN2M8/cHPPMMwPUdEfyaxrr4/6LLXJ/G4RyDWNf+a0dsh0Rubv2j8SGNyksc1Q4Xd1ceeAd/r8y0ulYzQLcOG/96HFIaQ3+WhNyUN9mS4TALlZBOHO/9qck9UQVuGdnQABv2p+YinYbikBzWR6G72spwACe4b7ihit5hMJxUwv4pp63QgPibbgDP3wZPTpkf238ZW/X3JhTZhteyCwgyPU6fbS/X8tVx0p11H7nEdu2+gX3iZjm8LeTAWdQvUMg86mdxDnBWIr100+GPs8V7y8paqEgqvftRhfH297q8dn3/n/IR5s5mXGtyTheCjVfjypXbOeBLVrf9umvYE9dqHKJaaZ4LMIeDFTosLT7iNLAMZFKHIZ3UjhHf0WZTEYitmYTof3f8Fc0d8cqowze5chC4489+ugQoplYrMsLr7Ly; 4:Iug8IuImAsRBhSyJrMXlhKp5iQaBGtpwBIpPavPV+clB1wfW+vlYXSOmracaveQohiEFSMXzZLUZMUX7ybqfl7co2OwlZqHDcRypn7DzjsXDHXXUpcuLd2ZesVv8MWmTfmT/eYTlCzJCIYXVL8sej6hQC64n4GjXXQKFhPjcWDhxZKBFh2ZjIcI4vEx+5qDDdT7UYo354UQMtUDh9bfsX8Ta1oyF2u0Y9VT1/PIcOsUIOWl2YUP5mZVId+Q0NywzhIWMAnwpmHblmLKqxiVuxg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231232)(944501410)(52105095)(10201501046)(3002001)(6055026)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:AM0PR05MB4180; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4180; X-Forefront-PRVS: 0652EA5565 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(366004)(396003)(39380400002)(199004)(189003)(6666003)(8676002)(68736007)(48376002)(6916009)(4326008)(8936002)(81156014)(2906002)(25786009)(81166006)(5660300001)(486006)(956004)(11346002)(446003)(476003)(52116002)(386003)(118296001)(16586007)(478600001)(50466002)(316002)(76176011)(2616005)(86362001)(6116002)(59450400001)(3846002)(58126008)(51416003)(36756003)(47776003)(66066001)(97736004)(6496006)(105586002)(106356001)(2351001)(53936002)(6486002)(7736002)(305945005)(26005)(16526019)(107886003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4180; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR05MB4180; 23:PgAWOxyjin8WWZfwJzZLid2tuxWhx2BDbbtZePxND?= =?us-ascii?Q?E29RgvL8pCO8c8Ts+uQaox6W0xz1IXgoERq44O2WmiT3fxXIpO9re+2Q9vuz?= =?us-ascii?Q?Mz1kJe1M2Js8DIg+cxTcvpdFTjeN0K8ncPRFOBzrJXS6QmpuEtoSwlKSfyEr?= =?us-ascii?Q?gkqm8gp+3D6SfcwDTKwwISVNUUAPvUAqvtr/4Hur7LwPj3zhbEwcvnNf0Dor?= =?us-ascii?Q?YC6SvHb/tLDzzC/izFIJey8aRDGrzu40c2o6e5Ttl3PrsNxTk9T4qn49379+?= =?us-ascii?Q?c84oAWtHjED0Hh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4L+kaj/+64t1o6VvmLSkuOHpvjPpC7/qQs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 7:rHMSz2K2veXkv1ElZmxag51dZmRqNHl8bsIH7LEYfbcP2Wc7Ef2+UC8q0IGl70FXiRnV+b55rL86NN0c1SWDxplWPJ108dmEJDWSM3bHfedJ2RdmR38WsDc8NmttUuX9D2Zn7NPZLaIO5914v1sto0z676fBky+f46tDo7XLsTkIggqvcuW49y6sENtQPtHG535HJ/ktVQ2cA2SSR9Gx5kmtl1n9NQa6qRtL5T2gr3H+rzODCuwdYlbKW7++gUGs X-MS-Office365-Filtering-Correlation-Id: 4aecbe4c-61f6-4845-091b-08d5aa385873 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2018 23:08:51.8805 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4aecbe4c-61f6-4845-091b-08d5aa385873 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4180 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-internal@mellanox.com Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org Sender: "Linux-mlxsw" X-Virus-Scanned: ClamAV using ClamSMTP To allow querying FDB and vlan settings of a bridge, publish several existing functions and add some new ones. Signed-off-by: Petr Machata --- Notes: Changes from v1 to v2: - Change from the two functions br_fdb_find_rtnl() and br_fdb_entry_dev() to a single br_fdb_find_port(). Take hash_lock before looking up the FDB entry. include/linux/if_bridge.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++ net/bridge/br_fdb.c | 23 ++++++++++++++++++++ net/bridge/br_private.h | 17 +++++++++------ net/bridge/br_vlan.c | 32 +++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 6 deletions(-) diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 02639eb..b6b5222 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h @@ -93,11 +93,66 @@ static inline bool br_multicast_router(const struct net_device *dev) #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) bool br_vlan_enabled(const struct net_device *dev); + +struct net_bridge_vlan_group * +br_vlan_group_rtnl(const struct net_device *br_dev); + +struct net_bridge_vlan_group * +br_port_vlan_group_rtnl(const struct net_device *dev); + +u16 br_vlan_group_pvid(const struct net_bridge_vlan_group *vg); + +struct net_bridge_vlan *br_vlan_find(struct net_bridge_vlan_group *vg, u16 vid); + +u16 br_vlan_flags(const struct net_bridge_vlan *v); + #else static inline bool br_vlan_enabled(const struct net_device *dev) { return false; } + +static inline struct net_bridge_vlan_group * +br_vlan_group_rtnl(const struct net_device *br_dev) +{ + return NULL; +} + +static inline struct net_bridge_vlan_group * +br_port_vlan_group_rtnl(const struct net_device *dev) +{ + return NULL; +} + +static inline u16 br_vlan_group_pvid(const struct net_bridge_vlan_group *vg) +{ + return 0; +} + +static inline struct net_bridge_vlan * +br_vlan_find(struct net_bridge_vlan_group *vg, u16 vid) +{ + return NULL; +} + +static inline u16 br_vlan_flags(const struct net_bridge_vlan *v) +{ + return 0; +} +#endif + +#if IS_ENABLED(CONFIG_BRIDGE) +struct net_device *br_fdb_find_port(const struct net_device *br_dev, + const unsigned char *addr, + __u16 vid); +#else +static inline struct net_device * +br_fdb_find_port(const struct net_device *br_dev, + const unsigned char *addr, + __u16 vid) +{ + return NULL; +} #endif #endif diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index d9e69e4..bc819d7 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -121,6 +121,29 @@ static struct net_bridge_fdb_entry *br_fdb_find(struct net_bridge *br, return fdb; } +struct net_device *br_fdb_find_port(const struct net_device *br_dev, + const unsigned char *addr, + __u16 vid) +{ + struct net_bridge_fdb_entry *f; + struct net_device *dev = NULL; + struct net_bridge *br; + + if (!netif_is_bridge_master(br_dev)) + return NULL; + + br = netdev_priv(br_dev); + + spin_lock_bh(&br->hash_lock); + f = br_fdb_find(br, addr, vid); + if (f) + dev = f->dst->dev; + spin_unlock_bh(&br->hash_lock); + + return dev; +} +EXPORT_SYMBOL_GPL(br_fdb_find_port); + struct net_bridge_fdb_entry *br_fdb_find_rcu(struct net_bridge *br, const unsigned char *addr, __u16 vid) diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index a7cb3ec..3c929d5 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -594,11 +594,22 @@ static inline bool br_rx_handler_check_rcu(const struct net_device *dev) return rcu_dereference(dev->rx_handler) == br_handle_frame; } +static inline bool br_rx_handler_check_rtnl(const struct net_device *dev) +{ + return rcu_dereference_rtnl(dev->rx_handler) == br_handle_frame; +} + static inline struct net_bridge_port *br_port_get_check_rcu(const struct net_device *dev) { return br_rx_handler_check_rcu(dev) ? br_port_get_rcu(dev) : NULL; } +static inline struct net_bridge_port * +br_port_get_check_rtnl(const struct net_device *dev) +{ + return br_rx_handler_check_rtnl(dev) ? br_port_get_rtnl_rcu(dev) : NULL; +} + /* br_ioctl.c */ int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, @@ -955,12 +966,6 @@ static inline void nbp_vlan_flush(struct net_bridge_port *port) { } -static inline struct net_bridge_vlan *br_vlan_find(struct net_bridge_vlan_group *vg, - u16 vid) -{ - return NULL; -} - static inline int nbp_vlan_init(struct net_bridge_port *port) { return 0; diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 9896f49..1c118c1 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -671,6 +671,7 @@ struct net_bridge_vlan *br_vlan_find(struct net_bridge_vlan_group *vg, u16 vid) return br_vlan_lookup(&vg->vlan_hash, vid); } +EXPORT_SYMBOL_GPL(br_vlan_find); /* Must be protected by RTNL. */ static void recalculate_group_addr(struct net_bridge *br) @@ -1149,3 +1150,34 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v, stats->tx_packets += txpackets; } } + +struct net_bridge_vlan_group * +br_vlan_group_rtnl(const struct net_device *br_dev) +{ + if (netif_is_bridge_master(br_dev)) + return br_vlan_group(netdev_priv(br_dev)); + else + return NULL; +} +EXPORT_SYMBOL_GPL(br_vlan_group_rtnl); + +struct net_bridge_vlan_group * +br_port_vlan_group_rtnl(const struct net_device *dev) +{ + struct net_bridge_port *p = br_port_get_check_rtnl(dev); + + return p ? nbp_vlan_group(p) : NULL; +} +EXPORT_SYMBOL_GPL(br_port_vlan_group_rtnl); + +u16 br_vlan_group_pvid(const struct net_bridge_vlan_group *vg) +{ + return br_get_pvid(vg); +} +EXPORT_SYMBOL_GPL(br_vlan_group_pvid); + +u16 br_vlan_flags(const struct net_bridge_vlan *v) +{ + return v->flags; +} +EXPORT_SYMBOL_GPL(br_vlan_flags);