Subject: Re: [PATCH net-next 2/5] bridge: propagate BR_ flags updates through sysfs to switchdev

From: Andrew Lunn <[email-masked]>
Date: Sat, 10 Mar 2018 17:38:38 +0100

On Fri, Mar 09, 2018 at 07:03:05PM -0800, Igor Mitsyanko wrote:
> sysfs interface to configure bridge flags only updates SW copy but does
> not notify hardware through switchdev interface. Make sure it is.
> 
> Signed-off-by: Igor Mitsyanko <[email-masked]>
> ---
>  net/bridge/br_sysfs_if.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> index 126a8ea..9bdd177 100644
> --- a/net/bridge/br_sysfs_if.c
> +++ b/net/bridge/br_sysfs_if.c
> @@ -51,6 +51,7 @@ static int store_flag(struct net_bridge_port *p, unsigned long v,
>  		      unsigned long mask)
>  {
>  	unsigned long flags;
> +	int err;
>  
>  	flags = p->flags;
>  
> @@ -59,10 +60,16 @@ static int store_flag(struct net_bridge_port *p, unsigned long v,
>  	else
>  		flags &= ~mask;
>  
> -	if (flags != p->flags) {
> -		p->flags = flags;
> -		br_port_flags_change(p, mask);
> -	}
> +	if (flags == p->flags)
> +		return 0;
> +
> +	err = br_switchdev_set_port_flag(p, flags, mask);
> +	if (err)
> +		return err;

You might want to consider the br_warn() in
br_switchdev_set_port_flag(). Do we want to spam the kernel log?  Or
should store_flag() do some validation before calling
br_switchdev_set_port_flag()?

	Andrew