From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Scott Feldman <sfeldma@gmail.com>,
Jiri Pirko <jiri@resnulli.us>, Ido Schimmel <idosch@mellanox.com>,
nikolay@cumulusnetworks.com, Elad Raz <eladr@mellanox.com>
Subject: Re: [RFC PATCH net-next 1/2] net: bridge: add switchdev attr for port bridging
Date: Wed, 9 Mar 2016 22:26:35 +0300 [thread overview]
Message-ID: <56E078EB.7040509@cogentembedded.com> (raw)
In-Reply-To: <1457545368-20647-2-git-send-email-vivien.didelot@savoirfairelinux.com>
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@savoirfairelinux.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
next prev parent reply other threads:[~2016-03-09 19:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 17:42 [RFC PATCH net-next 0/2] net: switchdev: add attribute for port bridging Vivien Didelot
2016-03-09 17:42 ` [RFC PATCH net-next 1/2] net: bridge: add switchdev attr " Vivien Didelot
2016-03-09 19:26 ` Sergei Shtylyov [this message]
2016-03-09 21:42 ` Ido Schimmel
2016-03-09 22:58 ` Vivien Didelot
2016-03-09 17:42 ` [RFC PATCH net-next 2/2] net: dsa: support SWITCHDEV_ATTR_ID_PORT_BRIDGE_IF Vivien Didelot
2016-03-09 18:32 ` Andrew Lunn
2016-03-09 19:24 ` Jiri Pirko
2016-03-09 22:15 ` Vivien Didelot
2016-03-09 19:32 ` Vivien Didelot
2016-03-09 20:07 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56E078EB.7040509@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=f.fainelli@gmail.com \
--cc=idosch@mellanox.com \
--cc=jiri@resnulli.us \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=sfeldma@gmail.com \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.