diff mbox series

[net-next,5/8] bridge: Add SWITCHDEV_FDB_FLUSH_TO_BRIDGE notifier

Message ID 20200910172351.5622-6-jwi@linux.ibm.com
State New
Headers show
Series None | expand

Commit Message

Julian Wiedmann Sept. 10, 2020, 5:23 p.m. UTC
From: Alexandra Winter <wintera@linux.ibm.com>

so the switchdev can notifiy the bridge to flush non-permanent fdb entries
for this port. This is useful whenever the hardware fdb of the switchdev
is reset, but the netdev and the bridgeport are not deleted.

Note that this has the same effect as the IFLA_BRPORT_FLUSH attribute.

CC: Jiri Pirko <jiri@resnulli.us>
CC: Ivan Vecera <ivecera@redhat.com>
CC: Roopa Prabhu <roopa@nvidia.com>
CC: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 include/net/switchdev.h | 1 +
 net/bridge/br.c         | 5 +++++
 2 files changed, 6 insertions(+)

Comments

David Miller Sept. 14, 2020, 9:38 p.m. UTC | #1
From: Julian Wiedmann <jwi@linux.ibm.com>
Date: Thu, 10 Sep 2020 19:23:48 +0200

> From: Alexandra Winter <wintera@linux.ibm.com>
> 
> so the switchdev can notifiy the bridge to flush non-permanent fdb entries
> for this port. This is useful whenever the hardware fdb of the switchdev
> is reset, but the netdev and the bridgeport are not deleted.
> 
> Note that this has the same effect as the IFLA_BRPORT_FLUSH attribute.
> 
> CC: Jiri Pirko <jiri@resnulli.us>
> CC: Ivan Vecera <ivecera@redhat.com>
> CC: Roopa Prabhu <roopa@nvidia.com>
> CC: Nikolay Aleksandrov <nikolay@nvidia.com>
> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>

This still needs review by bridge experts.

Thank you.
Nikolay Aleksandrov Sept. 15, 2020, 7:20 a.m. UTC | #2
On Thu, 2020-09-10 at 19:23 +0200, Julian Wiedmann wrote:
> From: Alexandra Winter <wintera@linux.ibm.com>

> 

> so the switchdev can notifiy the bridge to flush non-permanent fdb entries

> for this port. This is useful whenever the hardware fdb of the switchdev

> is reset, but the netdev and the bridgeport are not deleted.

> 

> Note that this has the same effect as the IFLA_BRPORT_FLUSH attribute.

> 

> CC: Jiri Pirko <jiri@resnulli.us>

> CC: Ivan Vecera <ivecera@redhat.com>

> CC: Roopa Prabhu <roopa@nvidia.com>

> CC: Nikolay Aleksandrov <nikolay@nvidia.com>

> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>

> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>

> ---

>  include/net/switchdev.h | 1 +

>  net/bridge/br.c         | 5 +++++

>  2 files changed, 6 insertions(+)

> 

> diff --git a/include/net/switchdev.h b/include/net/switchdev.h

> index ff2246914301..53e8b4994296 100644

> --- a/include/net/switchdev.h

> +++ b/include/net/switchdev.h

> @@ -203,6 +203,7 @@ enum switchdev_notifier_type {

>  	SWITCHDEV_FDB_ADD_TO_DEVICE,

>  	SWITCHDEV_FDB_DEL_TO_DEVICE,

>  	SWITCHDEV_FDB_OFFLOADED,

> +	SWITCHDEV_FDB_FLUSH_TO_BRIDGE,

>  

>  	SWITCHDEV_PORT_OBJ_ADD, /* Blocking. */

>  	SWITCHDEV_PORT_OBJ_DEL, /* Blocking. */

> diff --git a/net/bridge/br.c b/net/bridge/br.c

> index b6fe30e3768f..401eeb9142eb 100644

> --- a/net/bridge/br.c

> +++ b/net/bridge/br.c

> @@ -183,6 +183,11 @@ static int br_switchdev_event(struct notifier_block *unused,

>  		br_fdb_offloaded_set(br, p, fdb_info->addr,

>  				     fdb_info->vid, fdb_info->offloaded);

>  		break;

> +	case SWITCHDEV_FDB_FLUSH_TO_BRIDGE:

> +		fdb_info = ptr;

> +		/* Don't delete static entries */

> +		br_fdb_delete_by_port(br, p, fdb_info->vid, 0);

> +		break;

>  	}

>  

>  out:


Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Ivan Vecera Sept. 15, 2020, 8:19 a.m. UTC | #3
On Thu, 10 Sep 2020 19:23:48 +0200
Julian Wiedmann <jwi@linux.ibm.com> wrote:

> From: Alexandra Winter <wintera@linux.ibm.com>
> 
> so the switchdev can notifiy the bridge to flush non-permanent fdb entries
> for this port. This is useful whenever the hardware fdb of the switchdev
> is reset, but the netdev and the bridgeport are not deleted.
> 
> Note that this has the same effect as the IFLA_BRPORT_FLUSH attribute.
> 
> CC: Jiri Pirko <jiri@resnulli.us>
> CC: Ivan Vecera <ivecera@redhat.com>
> CC: Roopa Prabhu <roopa@nvidia.com>
> CC: Nikolay Aleksandrov <nikolay@nvidia.com>
> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
> ---
>  include/net/switchdev.h | 1 +
>  net/bridge/br.c         | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/include/net/switchdev.h b/include/net/switchdev.h
> index ff2246914301..53e8b4994296 100644
> --- a/include/net/switchdev.h
> +++ b/include/net/switchdev.h
> @@ -203,6 +203,7 @@ enum switchdev_notifier_type {
>  	SWITCHDEV_FDB_ADD_TO_DEVICE,
>  	SWITCHDEV_FDB_DEL_TO_DEVICE,
>  	SWITCHDEV_FDB_OFFLOADED,
> +	SWITCHDEV_FDB_FLUSH_TO_BRIDGE,
>  
>  	SWITCHDEV_PORT_OBJ_ADD, /* Blocking. */
>  	SWITCHDEV_PORT_OBJ_DEL, /* Blocking. */
> diff --git a/net/bridge/br.c b/net/bridge/br.c
> index b6fe30e3768f..401eeb9142eb 100644
> --- a/net/bridge/br.c
> +++ b/net/bridge/br.c
> @@ -183,6 +183,11 @@ static int br_switchdev_event(struct notifier_block *unused,
>  		br_fdb_offloaded_set(br, p, fdb_info->addr,
>  				     fdb_info->vid, fdb_info->offloaded);
>  		break;
> +	case SWITCHDEV_FDB_FLUSH_TO_BRIDGE:
> +		fdb_info = ptr;
> +		/* Don't delete static entries */
> +		br_fdb_delete_by_port(br, p, fdb_info->vid, 0);
> +		break;
>  	}
>  
>  out:

Acked-by: Ivan Vecera <ivecera@redhat.com>
diff mbox series

Patch

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index ff2246914301..53e8b4994296 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -203,6 +203,7 @@  enum switchdev_notifier_type {
 	SWITCHDEV_FDB_ADD_TO_DEVICE,
 	SWITCHDEV_FDB_DEL_TO_DEVICE,
 	SWITCHDEV_FDB_OFFLOADED,
+	SWITCHDEV_FDB_FLUSH_TO_BRIDGE,
 
 	SWITCHDEV_PORT_OBJ_ADD, /* Blocking. */
 	SWITCHDEV_PORT_OBJ_DEL, /* Blocking. */
diff --git a/net/bridge/br.c b/net/bridge/br.c
index b6fe30e3768f..401eeb9142eb 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -183,6 +183,11 @@  static int br_switchdev_event(struct notifier_block *unused,
 		br_fdb_offloaded_set(br, p, fdb_info->addr,
 				     fdb_info->vid, fdb_info->offloaded);
 		break;
+	case SWITCHDEV_FDB_FLUSH_TO_BRIDGE:
+		fdb_info = ptr;
+		/* Don't delete static entries */
+		br_fdb_delete_by_port(br, p, fdb_info->vid, 0);
+		break;
 	}
 
 out: