[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180310163050.GF29174@lunn.ch>
Date: Sat, 10 Mar 2018 17:30:50 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Igor Mitsyanko <igor.mitsyanko.os@...ntenna.com>
Cc: bridge@...ts.linux-foundation.org, netdev@...r.kernel.org,
sergey.matyukevich.os@...ntenna.com, smaksimenko@...ntenna.com,
ashevchenko@...ntenna.com, dlebed@...ntenna.com, jiri@...nulli.us,
ivecera@...hat.com
Subject: Re: [PATCH net-next 1/5] bridge: initialize port flags with
switchdev defaults
On Fri, Mar 09, 2018 at 07:03:04PM -0800, Igor Mitsyanko wrote:
> Default bridge port flags for switchdev devices can be different from
> what is used in bridging core. Get default value from switchdev itself
> on port initialization.
>
> Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@...ntenna.com>
> ---
> net/bridge/br_if.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index 9ba4ed6..d658b55 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -342,6 +342,21 @@ static int find_portno(struct net_bridge *br)
> return (index >= BR_MAX_PORTS) ? -EXFULL : index;
> }
>
> +static unsigned long nbp_flags_get_default(struct net_device *dev)
> +{
> + struct switchdev_attr attr = {
> + .orig_dev = dev,
> + .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
> + };
> + int ret;
> +
> + ret = switchdev_port_attr_get(dev, &attr);
> + if (ret)
> + return BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD;
Hi Igor
Please check if ret == -EOPNOTSUPP and only then use the defaults. A
real error should be propagated, causing new_nbp to fail. You might
also consider what to do when ENODATA is returned.
Andrew
Powered by blists - more mailing lists