linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: bridge: multicast: notify switchdev driver whenever MC processing gets disabled
@ 2022-02-15 16:53 Oleksandr Mazur
  2022-02-15 16:56 ` Nikolay Aleksandrov
  2022-02-17  4:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Oleksandr Mazur @ 2022-02-15 16:53 UTC (permalink / raw)
  To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller,
	Jakub Kicinski, Ivan Vecera, Yotam Gigi, Nogah Frankel,
	Jiri Pirko
  Cc: Oleksandr Mazur, taras.chornyi, volodymyr.mytnyk, mickeyr,
	nikolay, bridge, vladimir.oltean, netdev, linux-kernel

Whenever bridge driver hits the max capacity of MDBs, it disables
the MC processing (by setting corresponding bridge option), but never
notifies switchdev about such change (the notifiers are called only upon
explicit setting of this option, through the registered netlink interface).

This could lead to situation when Software MDB processing gets disabled,
but this event never gets offloaded to the underlying Hardware.

Fix this by adding a notify message in such case.

Fixes: 147c1e9b902c ("switchdev: bridge: Offload multicast disabled")

Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
---
V2:
  - target 'net' tree;
  - add missed 'Fixes' tag;
  - remove mc_disabled retcode check, as well as WARN_ON in case of err;
---
 net/bridge/br_multicast.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index de2409889489..db4f2641d1cd 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -82,6 +82,9 @@ static void br_multicast_find_del_pg(struct net_bridge *br,
 				     struct net_bridge_port_group *pg);
 static void __br_multicast_stop(struct net_bridge_mcast *brmctx);
 
+static int br_mc_disabled_update(struct net_device *dev, bool value,
+				 struct netlink_ext_ack *extack);
+
 static struct net_bridge_port_group *
 br_sg_port_find(struct net_bridge *br,
 		struct net_bridge_port_group_sg_key *sg_p)
@@ -1156,6 +1159,7 @@ struct net_bridge_mdb_entry *br_multicast_new_group(struct net_bridge *br,
 		return mp;
 
 	if (atomic_read(&br->mdb_hash_tbl.nelems) >= br->hash_max) {
+		br_mc_disabled_update(br->dev, false, NULL);
 		br_opt_toggle(br, BROPT_MULTICAST_ENABLED, false);
 		return ERR_PTR(-E2BIG);
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] net: bridge: multicast: notify switchdev driver whenever MC processing gets disabled
  2022-02-15 16:53 [PATCH net v2] net: bridge: multicast: notify switchdev driver whenever MC processing gets disabled Oleksandr Mazur
@ 2022-02-15 16:56 ` Nikolay Aleksandrov
  2022-02-17  4:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2022-02-15 16:56 UTC (permalink / raw)
  To: Oleksandr Mazur, Roopa Prabhu, Nikolay Aleksandrov,
	David S. Miller, Jakub Kicinski, Ivan Vecera, Yotam Gigi,
	Nogah Frankel, Jiri Pirko
  Cc: taras.chornyi, volodymyr.mytnyk, mickeyr, bridge,
	vladimir.oltean, netdev, linux-kernel

On 15/02/2022 18:53, Oleksandr Mazur wrote:
> Whenever bridge driver hits the max capacity of MDBs, it disables
> the MC processing (by setting corresponding bridge option), but never
> notifies switchdev about such change (the notifiers are called only upon
> explicit setting of this option, through the registered netlink interface).
> 
> This could lead to situation when Software MDB processing gets disabled,
> but this event never gets offloaded to the underlying Hardware.
> 
> Fix this by adding a notify message in such case.
> 
> Fixes: 147c1e9b902c ("switchdev: bridge: Offload multicast disabled")
> 
> Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
> ---
> V2:
>   - target 'net' tree;
>   - add missed 'Fixes' tag;
>   - remove mc_disabled retcode check, as well as WARN_ON in case of err;
> ---
>  net/bridge/br_multicast.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
> index de2409889489..db4f2641d1cd 100644
> --- a/net/bridge/br_multicast.c
> +++ b/net/bridge/br_multicast.c
> @@ -82,6 +82,9 @@ static void br_multicast_find_del_pg(struct net_bridge *br,
>  				     struct net_bridge_port_group *pg);
>  static void __br_multicast_stop(struct net_bridge_mcast *brmctx);
>  
> +static int br_mc_disabled_update(struct net_device *dev, bool value,
> +				 struct netlink_ext_ack *extack);
> +
>  static struct net_bridge_port_group *
>  br_sg_port_find(struct net_bridge *br,
>  		struct net_bridge_port_group_sg_key *sg_p)
> @@ -1156,6 +1159,7 @@ struct net_bridge_mdb_entry *br_multicast_new_group(struct net_bridge *br,
>  		return mp;
>  
>  	if (atomic_read(&br->mdb_hash_tbl.nelems) >= br->hash_max) {
> +		br_mc_disabled_update(br->dev, false, NULL);
>  		br_opt_toggle(br, BROPT_MULTICAST_ENABLED, false);
>  		return ERR_PTR(-E2BIG);
>  	}

nit: you don't have to leave empty new line between Fixes and Signed-off-by.
Patch looks good to me.

Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] net: bridge: multicast: notify switchdev driver whenever MC processing gets disabled
  2022-02-15 16:53 [PATCH net v2] net: bridge: multicast: notify switchdev driver whenever MC processing gets disabled Oleksandr Mazur
  2022-02-15 16:56 ` Nikolay Aleksandrov
@ 2022-02-17  4:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-17  4:40 UTC (permalink / raw)
  To: Oleksandr Mazur
  Cc: roopa, razor, davem, kuba, ivecera, yotamg, nogahf, jiri,
	taras.chornyi, volodymyr.mytnyk, mickeyr, nikolay, bridge,
	vladimir.oltean, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 15 Feb 2022 18:53:03 +0200 you wrote:
> Whenever bridge driver hits the max capacity of MDBs, it disables
> the MC processing (by setting corresponding bridge option), but never
> notifies switchdev about such change (the notifiers are called only upon
> explicit setting of this option, through the registered netlink interface).
> 
> This could lead to situation when Software MDB processing gets disabled,
> but this event never gets offloaded to the underlying Hardware.
> 
> [...]

Here is the summary with links:
  - [net,v2] net: bridge: multicast: notify switchdev driver whenever MC processing gets disabled
    https://git.kernel.org/netdev/net/c/c832962ac972

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-17  4:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 16:53 [PATCH net v2] net: bridge: multicast: notify switchdev driver whenever MC processing gets disabled Oleksandr Mazur
2022-02-15 16:56 ` Nikolay Aleksandrov
2022-02-17  4:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).