[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56E078EB.7040509@cogentembedded.com>
Date: Wed, 9 Mar 2016 22:26:35 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, kernel@...oirfairelinux.com,
"David S. Miller" <davem@...emloft.net>,
Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Scott Feldman <sfeldma@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
Ido Schimmel <idosch@...lanox.com>,
nikolay@...ulusnetworks.com, Elad Raz <eladr@...lanox.com>
Subject: Re: [RFC PATCH net-next 1/2] net: bridge: add switchdev attr for port
bridging
Hello.
On 03/09/2016 08:42 PM, Vivien Didelot wrote:
> Add a new SWITCHDEV_ATTR_ID_PORT_BRIDGE_IF switchdev attribute which is
> set before adding a port to a bridge and deleting a port from a bridge.
>
> The main purpose for this attribute is to provide switchdev users a
> simple and common way to retrieve bridging information, instead of
> implementing complex notifier blocks to listen to global netdev events.
>
> We can also imagine a switchdev user returning an error different from
> -EOPNOTSUPP in the prepare phase to prevent a port from being bridged.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
> ---
> include/net/switchdev.h | 2 ++
> net/bridge/br_if.c | 27 +++++++++++++++++++++++++++
> 2 files changed, 29 insertions(+)
>
[...]
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index a73df33..105b9fd 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -28,6 +28,24 @@
>
> #include "br_private.h"
>
> +static int switchdev_bridge_if(struct net_device *dev, struct net_bridge *br,
> + bool join)
> +{
> + struct switchdev_attr attr = {
> + .orig_dev = br->dev,
> + .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_IF,
> + .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP,
> + .u.join = join,
> + };
> + int err;
> +
> + err = switchdev_port_attr_set(dev, &attr);
> + if (err && err != -EOPNOTSUPP)
Enough to only do the latter comparison.
> + return err;
> +
> + return 0;
> +}
> +
> /*
> * Determine initial path cost based on speed.
> * using recommendations from 802.1d standard
[...]
MBR, Sergei
Powered by blists - more mailing lists