From: Alexander Duyck <alexander.duyck@gmail.com>
To: Jarod Wilson <jarod@redhat.com>
Cc: linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jay Vosburgh <j.vosburgh@gmail.com>,
Veaceslav Falico <vfalico@gmail.com>,
Andy Gospodarek <gospo@cumulusnetworks.com>,
Jiri Pirko <jiri@resnulli.us>,
Nikolay Aleksandrov <razor@blackwall.org>,
Michal Kubecek <mkubecek@suse.cz>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net/core: ensure features get disabled on new lower devs
Date: Tue, 3 Nov 2015 15:01:57 -0800 [thread overview]
Message-ID: <56393CE5.50704@gmail.com> (raw)
In-Reply-To: <56393127.4050406@redhat.com>
On 11/03/2015 02:11 PM, Jarod Wilson wrote:
> Alexander Duyck wrote:
>> On 11/03/2015 12:36 PM, Jarod Wilson wrote:
>>> With moving netdev_sync_lower_features() after the .ndo_set_features
>>> calls, I neglected to verify that devices added *after* a flag had been
>>> disabled on an upper device were properly added with that flag
>>> disabled as
>>> well. This currently happens, because we exit
>>> __netdev_update_features()
>>> when we see dev->features == features for the upper dev. We can retain
>>> the
>>> optimization of leaving without calling .ndo_set_features with a bit of
>>> tweaking and a goto here.
>>>
>>> Changing err to ret was somewhat arbitrary and makes the patch look
>>> more
>>> involved, but seems to better fit the altered use.
> ...
>>> + if (!ret) {
>>> + dev->features = features;
>>> + ret = 1;
>>> + }
>>> +
>>
>> I would take the "ret = 1;" out of the if statement and let it stay here
>> by itself. Technically anything that traversed this path was returning 1
>> previously so we probably want to retain that behavior.
>
> Ah, that. I took a look at all the callers of
> __netdev_update_features, and most don't even check return value, the
> one that does (netdev_update_features) only cares if its zero or not
> zero, so I figured it didn't really matter here, but it would indeed
> return 2 now instead of 1, if it got that from ndo_set_features. For
> consistency's sake, I can respin and just always set ret = 1 though.
One thought I just had would be to make it so that we assign -1 to ret
and then jump inside the earlier features==features check rather than
altering the ret value here. Then we could just use a ternary value at
the end and just do "return ret < 0 ? 0 : 1;". That would take care of
the return values and the features flag you called out below.
>>> +sync_lower:
>>> /* some features must be disabled on lower devices when disabled
>>> * on an upper device (think: bonding master or bridge)
>>> */
>>> netdev_for_each_lower_dev(dev, lower, iter)
>>> netdev_sync_lower_features(dev, lower, features);
>>>
>>> - if (!err)
>>> - dev->features = features;
>>
>> You could just alter the if statement here to check for a non-zero ret
>> value since you should have it as either 0 or 1. It shouldn't have any
>> other values.
>>
>> That way you will have disabled the feature on the lower devices before
>> advertising that it has been disabled on the upper device.
>
> If this check is down here, the goto will trigger, setting
> dev->features = features, but then, we got there because dev->features
> == features already, so meh. But it would also NOT trigger in the case
> of ndo_set_features returning 0 anymore, because we set ret = 1. Or am
> I missing something or misunderstanding what you're suggesting here?
>
next prev parent reply other threads:[~2015-11-03 23:01 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-24 3:40 [RFC PATCH net-next] net/core: initial support for stacked dev feature toggles Jarod Wilson
2015-10-24 4:41 ` Tom Herbert
2015-10-24 5:51 ` Alexander Duyck
2015-10-26 9:42 ` Michal Kubecek
2015-10-30 16:25 ` Jarod Wilson
2015-10-30 20:02 ` Alexander Duyck
2015-11-02 17:37 ` Jarod Wilson
2015-10-30 16:35 ` Jarod Wilson
2015-10-30 20:14 ` Alexander Duyck
2015-11-02 17:53 ` [PATCH net-next] net/core: generic support for disabling netdev features down stack Jarod Wilson
2015-11-02 18:04 ` Alexander Duyck
2015-11-02 21:57 ` Jarod Wilson
2015-11-03 2:55 ` [PATCH v2 " Jarod Wilson
2015-11-03 4:41 ` David Miller
2015-11-03 10:03 ` Nikolay Aleksandrov
2015-11-03 13:52 ` Geert Uytterhoeven
2015-11-03 13:57 ` Jarod Wilson
2015-11-03 14:05 ` Nikolay Aleksandrov
2015-11-03 15:18 ` Jarod Wilson
2015-11-03 15:15 ` [PATCH net-next] net/core: fix for_each_netdev_feature Jarod Wilson
2015-11-03 15:33 ` Nikolay Aleksandrov
2015-11-03 16:34 ` David Miller
2015-11-03 20:36 ` [PATCH net-next] net/core: ensure features get disabled on new lower devs Jarod Wilson
2015-11-03 21:17 ` Alexander Duyck
2015-11-03 22:11 ` Jarod Wilson
2015-11-03 23:01 ` Alexander Duyck [this message]
2015-11-03 21:21 ` Nikolay Aleksandrov
2015-11-03 21:53 ` Michal Kubecek
2015-11-03 21:58 ` Jarod Wilson
2015-11-04 4:09 ` [PATCH v2 " Jarod Wilson
2015-11-05 2:56 ` David Miller
2015-11-13 0:26 ` Florian Fainelli
2015-11-13 10:29 ` Jiri Pirko
2015-11-13 10:51 ` Nikolay Aleksandrov
2015-11-13 13:54 ` [PATCH net] net: fix feature changes on devices without ndo_set_features Nikolay Aleksandrov
2015-11-13 14:00 ` Jiri Pirko
2015-11-13 14:06 ` Andy Gospodarek
2015-11-13 14:34 ` Jarod Wilson
2015-11-13 18:30 ` Florian Fainelli
2015-11-15 7:25 ` [net] " Dave Young
2015-11-16 2:01 ` Dave Young
2015-11-16 19:56 ` [PATCH net] " David Miller
2015-11-17 23:03 ` Sergei Shtylyov
2015-11-17 23:10 ` Nikolay Aleksandrov
2015-11-18 10:51 ` Sergei Shtylyov
2015-11-13 22:31 ` [PATCH v2 net-next] net/core: ensure features get disabled on new lower devs Laura Abbott
2015-11-17 9:02 ` Geert Uytterhoeven
2015-11-17 10:04 ` Geert Uytterhoeven
2016-04-02 2:21 ` [PATCH v2 net-next] net/core: generic support for disabling netdev features down stack Michał Mirosław
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=56393CE5.50704@gmail.com \
--to=alexander.duyck@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gospo@cumulusnetworks.com \
--cc=j.vosburgh@gmail.com \
--cc=jarod@redhat.com \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=razor@blackwall.org \
--cc=vfalico@gmail.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).