From patchwork Wed Apr 25 14:06:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10363277 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 A4791601D3 for ; Wed, 25 Apr 2018 14:07:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9402D26785 for ; Wed, 25 Apr 2018 14:07:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 883012857F; Wed, 25 Apr 2018 14:07:12 +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 B33FC26785 for ; Wed, 25 Apr 2018 14:07:11 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40WMTB0Lt0zF24N for ; Thu, 26 Apr 2018 00:07:10 +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="nQGSkGUg"; 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=40.107.2.49; helo=eur02-ve1-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="nQGSkGUg"; dkim-atps=neutral Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20049.outbound.protection.outlook.com [40.107.2.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40WMT50yJ5zDrDT for ; Thu, 26 Apr 2018 00:07:04 +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=MQ3l9xK2RKLwEuLn5nLYLTmnCrVHFqmBnFYKWfSfnXQ=; b=nQGSkGUg6II0THjNbtI8jRTOYOB4E4dfOh+Ry8uYZNvT/OmThiKznQ9rTDb+WRv+V100+elXh83oSWqY2lmDPknZ5JrSHFc15zYcIMoqUCYFGL7yhYliTQ2yQXZaPFLHX8XPkEW1YEJU5TCHpvO0yBKjDQDZaXpdWHyDsLCWnCY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (89.177.127.115) by AM0PR05MB4179.eurprd05.prod.outlook.com (2603:10a6:208:57::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Wed, 25 Apr 2018 14:06:52 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 1/6] net: bridge: Publish bridge accessor functions In-Reply-To: References: Message-Id: <9375b5fc7c6edb3e3bad4869cf06efc8371009be.1524654206.git.petrm@mellanox.com> Date: Wed, 25 Apr 2018 16:06:46 +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: HE1PR02CA0102.eurprd02.prod.outlook.com (2603:10a6:7:29::31) To AM0PR05MB4179.eurprd05.prod.outlook.com (2603:10a6:208:57::28) 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:AM0PR05MB4179; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4179; 3:7v3j0uBbja2t+wcYGhDc4mnBYekqgFaPRClseq9E3OF1xGlPAfsNQf4Z5JDfOS6cdG5oKgOgA+tDpog3pOA3oGlfeVp5TQPuJNiBsqEYIXkdRziwkeQfTZxjFXUKB3Gwq0lWChv8E4QEnaFDKJtWV8JWr1Uv90D78BceOpk1dBuDaYe6dT7snfAfHrQaMKEhwOFs9QaaMLNYmFtK+guakneRYRWbwwTp0lTMtbzreQjBCtxYSlEcT/gjnMwTQgN0; 25:LXmF/B7nL8nU6JtSPtpv0fy8iLVb06pf2jBHu/YijKDoGsafJm3rDufC55JNO1psYHc+R9o75mh6xoGrzrMlM/VjfMnli7XhQuQ8E692g3j39VTOg6qRnuWvMYQRN9tgJ9pr00otxjVDxc/ca9EBveXVxMjo3BGVZ4etTitNhUgrLwxZlqSCFvb7+NzMhc9xFMzg98/lOF8CY0csQjN+8/bjylsz7w6/m2yrsVeGvurAJ0XnWEN5M6Y/e3sJQesXvJhRpoXSavWoSPVq+smB36iPANB7MC54EjdmL+iE5vgfOCPhl6k76yct0ssbiBfSAtMn/DpkQL/l8smUQI7Myw==; 31:ZPPla/n7EjjwKwAjw/13SHtOwblRJJ/DCoK61iaoAbW3wx7EU7NUN1auP4aTte0GjxrWgQsnu2y4sJfiEnkfVsdtISnZC8WzniZHPcXuKk5TrHU3n2JW6agqWsH76/pumz3NQDC3TmnE2iIKUx/gAQD2q0cByCpJtqPQlViCFDR/Eeng8rjG6naj0fr6w0EnGye1O8vGOBciFi6r8xD9FZ3gnlmUQJDHcdR9GRjgiyw= X-MS-TrafficTypeDiagnostic: AM0PR05MB4179: X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4179; 20:za66ksLhg9qCzLNjHHDC5na7EWBJzoK0lW+omuaVELKAa+3tAJUZp6Bqap7gNqlhRu6Jybr5TFHbnwughoPv5B67rxuWY3QeywL8shjPBSwkNH/bdtwjIKT0OadjmZ4s7ak5j7RHpBVxHgGuSGrYUpuqXsvQcnOO5gkH21+i62oDlhxE9orzTdYaUOpwN4g+p00MrCl0JhRE5vkzsQ3d5DtqFVJJ9LbcjeYAFsMvNiPdKx6XP2frAUlVCQm+PuoLRkLHMaUzyvmilPZXDz57fX4Hae1gKY81OprUZJxF65x5gOUHH40Ql765ZE147XNrlSYDAyGP7ROgQybcr3kqLygNXJmbAA8WWNxEMiTbvnR/rfUosLfeke7QP2NnhZfSrDer2y/kuK7+jw0mAPHc2K8yPS06qAKvi8LTdPoNu3gdpmB1LNOUiPFW7/puVak7VSle7nZun2ib5nWiMcSLmBrI8tK+oFQvNRdRxaqqYlCKMtLM4RGZ8LXx4cTLI9cN; 4:wQQfeXst0jAvPXldLGLqWbgNdnJRmDtem0xh4VCw1cUakDWnXaMe07SPg0eS00U1UIwKpLpBwmJ8mB9pPo+1GONi8gIRVzJX75djvS4hSiqBlPPD1Nx/UMZhUkl4Gd0w00gWiIYIBIHzHr/CLezQGcuN3zTNPErH1DT5sEhzWYok8CHgkYMF4N6DwtnaFQld7OisjczdG+62s4W6wdGeIVo6XBE97fYGrvNIf+XBU8N/KVuVhYkj5AtYDZZuOAOM2oklguwBePySEVLBQmCYmg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231232)(944501410)(52105095)(3002001)(6055026)(6041310)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM0PR05MB4179; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4179; X-Forefront-PRVS: 06530126A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(376002)(39380400002)(39860400002)(189003)(199004)(25786009)(4326008)(575784001)(106356001)(478600001)(58126008)(6916009)(16586007)(6666003)(48376002)(2906002)(81156014)(8676002)(81166006)(107886003)(8936002)(105586002)(47776003)(50466002)(86362001)(316002)(66066001)(6116002)(3846002)(7736002)(59450400001)(68736007)(386003)(51416003)(5660300001)(6486002)(76176011)(6496006)(26005)(486006)(446003)(956004)(476003)(53936002)(97736004)(2351001)(36756003)(2616005)(305945005)(118296001)(16526019)(52116002)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4179; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR05MB4179; 23:1X4ksTfYfPyKr+mY1W5XdM6Uagy8goDMQu7EMShi5?= =?us-ascii?Q?Y1HOgsxniMUOQabV7qeYMFTAnqJ4zGpvlPBBhCcX48UzvFQX6CkvFIAKP/Is?= =?us-ascii?Q?1ZpOIfb4/ffASCepg7ZmJYgBT500ehaPQT9YPp5G79YQ9wgNcNUFHrEnVoga?= =?us-ascii?Q?vIp5CLFCAXNeeT846fA7EpeZGShP9u+4vDBq2u4mmvqAMNnDi/WE/eNC8YwY?= =?us-ascii?Q?iEvhk+lO4mLfYZz4r53Jux63wiPjcpm6eRI3WKWmg5ZR/r7z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2N+Uoa0rMifcGczyNqPY20jHvUsKdKZ2Rv+ey1s5H9yMrl5+V37nsULYUBps/QvznT99UCxvWOicj40= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4179; 7:8R0uZna7VyXqQJCk4wpzPR3OSKo2uRi8fz51TJFz7Ft/tDFSHRf22j7Er+i/NgYLHPYVIF0qd83fgkvpkbzm7HAm2iZgH+z/X/k5mNxSjoE4/gB+I19afFwNloHysIcc9VH2x/BCfjkVZwMhEXayvH4jxebEtT53O0BHzCh/7/X5Rl0WdEtYx0/FxY/LQSR14P7QjqoXS5zewxjTMmWdcrR3HkC88NWG2yj3i79h0mY0LdsHPD9tVR1dldxH8IGy X-MS-Office365-Filtering-Correlation-Id: 19663323-d9cc-4bae-7f18-08d5aab5cbaf X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2018 14:06:52.0715 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19663323-d9cc-4bae-7f18-08d5aab5cbaf X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4179 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 v2 to v3: - In br_fdb_find_port(), guard against NULL f->dst. Also hold the returned device, and correspondingly rename to br_fdb_find_port_hold(). 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 | 25 +++++++++++++++++++++ net/bridge/br_private.h | 17 +++++++++------ net/bridge/br_vlan.c | 32 +++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 6 deletions(-) diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 02639eb..2020f61 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_hold(const struct net_device *br_dev, + const unsigned char *addr, + __u16 vid); +#else +static inline struct net_device * +br_fdb_find_port_hold(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..cbdcf0e 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -121,6 +121,31 @@ static struct net_bridge_fdb_entry *br_fdb_find(struct net_bridge *br, return fdb; } +struct net_device *br_fdb_find_port_hold(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 && f->dst) { + dev = f->dst->dev; + dev_hold(dev); + } + spin_unlock_bh(&br->hash_lock); + + return dev; +} +EXPORT_SYMBOL_GPL(br_fdb_find_port_hold); + 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);