From: Vladimir Oltean <vladimir.oltean@nxp.com> To: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>, "David S. Miller" <davem@davemloft.net> Cc: Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vivien Didelot <vivien.didelot@gmail.com>, Jiri Pirko <jiri@resnulli.us>, Ido Schimmel <idosch@idosch.org>, Tobias Waldekranz <tobias@waldekranz.com>, Roopa Prabhu <roopa@nvidia.com>, Nikolay Aleksandrov <nikolay@nvidia.com>, Stephen Hemminger <stephen@networkplumber.org>, bridge@lists.linux-foundation.org, Grygorii Strashko <grygorii.strashko@ti.com>, Marek Behun <kabel@blackhole.sk>, DENG Qingfang <dqfext@gmail.com> Subject: [PATCH v6 net-next 6/7] net: bridge: guard the switchdev replay helpers against a NULL notifier block Date: Wed, 21 Jul 2021 19:24:02 +0300 [thread overview] Message-ID: <20210721162403.1988814-7-vladimir.oltean@nxp.com> (raw) In-Reply-To: <20210721162403.1988814-1-vladimir.oltean@nxp.com> There is a desire to make the object and FDB replay helpers optional when moving them inside the bridge driver. For example a certain driver might not offload host MDBs and there is no case where the replay helpers would be of immediate use to it. So it would be nice if we could allow drivers to pass NULL pointers for the atomic and blocking notifier blocks, and the replay helpers to do nothing in that case. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> --- net/bridge/br_fdb.c | 3 +++ net/bridge/br_mdb.c | 3 +++ net/bridge/br_vlan.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 2b862cffc03a..47f190b6bfa3 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -760,6 +760,9 @@ int br_fdb_replay(const struct net_device *br_dev, const struct net_device *dev, unsigned long action; int err = 0; + if (!nb) + return 0; + if (!netif_is_bridge_master(br_dev)) return -EINVAL; diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index d3383a47a2f2..09358c475787 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -617,6 +617,9 @@ int br_mdb_replay(struct net_device *br_dev, struct net_device *dev, ASSERT_RTNL(); + if (!nb) + return 0; + if (!netif_is_bridge_master(br_dev) || !netif_is_bridge_port(dev)) return -EINVAL; diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index e66b004df763..45ef07f682f1 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -1856,6 +1856,9 @@ int br_vlan_replay(struct net_device *br_dev, struct net_device *dev, ASSERT_RTNL(); + if (!nb) + return 0; + if (!netif_is_bridge_master(br_dev)) return -EINVAL; -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Oltean <vladimir.oltean@nxp.com> To: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>, "David S. Miller" <davem@davemloft.net> Cc: Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Jiri Pirko <jiri@resnulli.us>, DENG Qingfang <dqfext@gmail.com>, bridge@lists.linux-foundation.org, Ido Schimmel <idosch@idosch.org>, Grygorii Strashko <grygorii.strashko@ti.com>, Nikolay Aleksandrov <nikolay@nvidia.com>, Roopa Prabhu <roopa@nvidia.com>, Marek Behun <kabel@blackhole.sk>, Vivien Didelot <vivien.didelot@gmail.com>, Tobias Waldekranz <tobias@waldekranz.com> Subject: [Bridge] [PATCH v6 net-next 6/7] net: bridge: guard the switchdev replay helpers against a NULL notifier block Date: Wed, 21 Jul 2021 19:24:02 +0300 [thread overview] Message-ID: <20210721162403.1988814-7-vladimir.oltean@nxp.com> (raw) In-Reply-To: <20210721162403.1988814-1-vladimir.oltean@nxp.com> There is a desire to make the object and FDB replay helpers optional when moving them inside the bridge driver. For example a certain driver might not offload host MDBs and there is no case where the replay helpers would be of immediate use to it. So it would be nice if we could allow drivers to pass NULL pointers for the atomic and blocking notifier blocks, and the replay helpers to do nothing in that case. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> --- net/bridge/br_fdb.c | 3 +++ net/bridge/br_mdb.c | 3 +++ net/bridge/br_vlan.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 2b862cffc03a..47f190b6bfa3 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -760,6 +760,9 @@ int br_fdb_replay(const struct net_device *br_dev, const struct net_device *dev, unsigned long action; int err = 0; + if (!nb) + return 0; + if (!netif_is_bridge_master(br_dev)) return -EINVAL; diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index d3383a47a2f2..09358c475787 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -617,6 +617,9 @@ int br_mdb_replay(struct net_device *br_dev, struct net_device *dev, ASSERT_RTNL(); + if (!nb) + return 0; + if (!netif_is_bridge_master(br_dev) || !netif_is_bridge_port(dev)) return -EINVAL; diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index e66b004df763..45ef07f682f1 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -1856,6 +1856,9 @@ int br_vlan_replay(struct net_device *br_dev, struct net_device *dev, ASSERT_RTNL(); + if (!nb) + return 0; + if (!netif_is_bridge_master(br_dev)) return -EINVAL; -- 2.25.1
next prev parent reply other threads:[~2021-07-21 16:26 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-21 16:23 [PATCH v6 net-next 0/7] Let switchdev drivers offload and unoffload bridge ports at their own convenience Vladimir Oltean 2021-07-21 16:23 ` [Bridge] " Vladimir Oltean 2021-07-21 16:23 ` [PATCH v6 net-next 1/7] net: dpaa2-switch: use extack in dpaa2_switch_port_bridge_join Vladimir Oltean 2021-07-21 16:23 ` [Bridge] " Vladimir Oltean 2021-07-21 16:23 ` [PATCH v6 net-next 2/7] net: dpaa2-switch: refactor prechangeupper sanity checks Vladimir Oltean 2021-07-21 16:23 ` [Bridge] " Vladimir Oltean 2021-07-21 16:23 ` [PATCH v6 net-next 3/7] net: bridge: disambiguate offload_fwd_mark Vladimir Oltean 2021-07-21 16:23 ` [Bridge] " Vladimir Oltean 2021-07-21 16:24 ` [PATCH v6 net-next 4/7] net: bridge: switchdev: recycle unused hwdoms Vladimir Oltean 2021-07-21 16:24 ` [Bridge] " Vladimir Oltean 2021-07-21 16:24 ` [PATCH v6 net-next 5/7] net: bridge: switchdev: let drivers inform which bridge ports are offloaded Vladimir Oltean 2021-07-21 16:24 ` [Bridge] " Vladimir Oltean 2021-07-26 13:51 ` Naresh Kamboju 2021-07-26 13:51 ` [Bridge] " Naresh Kamboju 2021-07-26 14:08 ` Andrew Lunn 2021-07-26 14:08 ` [Bridge] " Andrew Lunn 2021-07-26 14:37 ` Vladimir Oltean 2021-07-26 14:37 ` [Bridge] " Vladimir Oltean 2021-07-27 4:03 ` Naresh Kamboju 2021-07-27 4:03 ` [Bridge] " Naresh Kamboju 2021-07-21 16:24 ` Vladimir Oltean [this message] 2021-07-21 16:24 ` [Bridge] [PATCH v6 net-next 6/7] net: bridge: guard the switchdev replay helpers against a NULL notifier block Vladimir Oltean 2021-07-21 16:27 ` Florian Fainelli 2021-07-21 16:27 ` [Bridge] " Florian Fainelli 2021-07-21 16:24 ` [PATCH v6 net-next 7/7] net: bridge: move the switchdev object replay helpers to "push" mode Vladimir Oltean 2021-07-21 16:24 ` [Bridge] " Vladimir Oltean 2021-07-22 7:40 ` [PATCH v6 net-next 0/7] Let switchdev drivers offload and unoffload bridge ports at their own convenience patchwork-bot+netdevbpf 2021-07-22 7:40 ` [Bridge] " patchwork-bot+netdevbpf
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210721162403.1988814-7-vladimir.oltean@nxp.com \ --to=vladimir.oltean@nxp.com \ --cc=andrew@lunn.ch \ --cc=bridge@lists.linux-foundation.org \ --cc=davem@davemloft.net \ --cc=dqfext@gmail.com \ --cc=f.fainelli@gmail.com \ --cc=grygorii.strashko@ti.com \ --cc=idosch@idosch.org \ --cc=jiri@resnulli.us \ --cc=kabel@blackhole.sk \ --cc=kuba@kernel.org \ --cc=netdev@vger.kernel.org \ --cc=nikolay@nvidia.com \ --cc=roopa@nvidia.com \ --cc=stephen@networkplumber.org \ --cc=tobias@waldekranz.com \ --cc=vivien.didelot@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.