From: Jiri Pirko <jiri@resnulli.us>
To: Scott Feldman <sfeldma@gmail.com>
Cc: Netdev <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Ido Schimmel <idosch@mellanox.com>, Elad Raz <eladr@mellanox.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Guenter Roeck <linux@roeck-us.net>,
Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
"andrew@lunn.ch" <andrew@lunn.ch>,
john fastabend <john.fastabend@gmail.com>,
David Laight <David.Laight@aculab.com>,
"stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: Re: [patch net-next v5 3/8] switchdev: allow caller to explicitly request attr_set as deferred
Date: Thu, 15 Oct 2015 07:57:53 +0200 [thread overview]
Message-ID: <20151015055753.GA2242@nanopsycho.orion> (raw)
In-Reply-To: <CAE4R7bAZbRYbc=2nWJjCjQ0dkz5HA+y4a7-H38cE6CYDtJ2PBA@mail.gmail.com>
Thu, Oct 15, 2015 at 06:34:01AM CEST, sfeldma@gmail.com wrote:
>On Wed, Oct 14, 2015 at 10:40 AM, Jiri Pirko <jiri@resnulli.us> wrote:
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> Caller should know if he can call attr_set directly (when holding RTNL)
>> or if he has to defer the att_set processing for later.
>>
>> This also allows drivers to sleep inside attr_set and report operation
>> status back to switchdev core. Switchdev core then warns if status is
>> not ok, instead of silent errors happening in drivers.
>>
>> Benefit from newly introduced switchdev deferred ops infrastructure.
>>
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>> include/net/switchdev.h | 1 +
>> net/bridge/br_stp.c | 3 +-
>> net/switchdev/switchdev.c | 108 ++++++++++++++++++----------------------------
>> 3 files changed, 46 insertions(+), 66 deletions(-)
>>
>> diff --git a/include/net/switchdev.h b/include/net/switchdev.h
>> index d1c7f90..f7de6f8 100644
>> --- a/include/net/switchdev.h
>> +++ b/include/net/switchdev.h
>> @@ -17,6 +17,7 @@
>>
>> #define SWITCHDEV_F_NO_RECURSE BIT(0)
>> #define SWITCHDEV_F_SKIP_EOPNOTSUPP BIT(1)
>> +#define SWITCHDEV_F_DEFER BIT(2)
>>
>> struct switchdev_trans_item {
>> struct list_head list;
>> diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
>> index db6d243de..80c34d7 100644
>> --- a/net/bridge/br_stp.c
>> +++ b/net/bridge/br_stp.c
>> @@ -41,13 +41,14 @@ void br_set_state(struct net_bridge_port *p, unsigned int state)
>> {
>> struct switchdev_attr attr = {
>> .id = SWITCHDEV_ATTR_ID_PORT_STP_STATE,
>> + .flags = SWITCHDEV_F_DEFER,
>> .u.stp_state = state,
>> };
>> int err;
>>
>> p->state = state;
>> err = switchdev_port_attr_set(p->dev, &attr);
>> - if (err && err != -EOPNOTSUPP)
>> + if (err)
>> br_warn(p->br, "error setting offload STP state on port %u(%s)\n",
>> (unsigned int) p->port_no, p->dev->name);
>> }
>
>Should this part of the patch be moved to patch 6/8 where
>switchdev_deferred_process() is called from del_nbp()?
No, this part relates to the fact that attr_set now does not defer
automagically. So caller must say when to defer. So having this here is
correct.
next prev parent reply other threads:[~2015-10-15 5:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 17:40 [patch net-next v5 0/8] switchdev: change locking Jiri Pirko
2015-10-14 17:40 ` [patch net-next v5 1/8] switchdev: introduce switchdev deferred ops infrastructure Jiri Pirko
2015-10-14 17:40 ` [patch net-next v5 2/8] switchdev: make struct switchdev_attr parameter const for attr_set calls Jiri Pirko
2015-10-14 19:01 ` Vivien Didelot
2015-10-14 17:40 ` [patch net-next v5 3/8] switchdev: allow caller to explicitly request attr_set as deferred Jiri Pirko
2015-10-15 4:34 ` Scott Feldman
2015-10-15 5:57 ` Jiri Pirko [this message]
2015-10-15 15:21 ` John Fastabend
2015-10-16 8:23 ` Jiri Pirko
2015-10-16 16:20 ` Scott Feldman
2015-10-16 17:16 ` John Fastabend
2015-10-17 2:11 ` John Fastabend
2015-10-14 17:40 ` [patch net-next v5 4/8] switchdev: remove pointers from switchdev objects Jiri Pirko
2015-10-14 17:40 ` [patch net-next v5 5/8] switchdev: introduce possibility to defer obj_add/del Jiri Pirko
2015-10-19 7:55 ` Scott Feldman
2015-10-19 8:24 ` Jiri Pirko
2015-10-14 17:40 ` [patch net-next v5 6/8] bridge: defer switchdev fdb del call in fdb_del_external_learn Jiri Pirko
2015-10-14 17:40 ` [patch net-next v5 7/8] rocker: remove nowait from switchdev callbacks Jiri Pirko
2015-10-14 17:40 ` [patch net-next v5 8/8] switchdev: assert rtnl mutex when going over lower netdevs Jiri Pirko
2015-10-15 13:10 ` [patch net-next v5 0/8] switchdev: change locking David Miller
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=20151015055753.GA2242@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=David.Laight@aculab.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=f.fainelli@gmail.com \
--cc=idosch@mellanox.com \
--cc=john.fastabend@gmail.com \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@gmail.com \
--cc=stephen@networkplumber.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).