From: Jiri Pirko <jiri@resnulli.us>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
faisal.latif@intel.com, roland@kernel.org, sean.hefty@intel.com,
hal.rosenstock@gmail.com, fubar@us.ibm.com, andy@greyhouse.net,
divy@chelsio.com, jitendra.kalsaria@qlogic.com,
sony.chacko@qlogic.com, linux-driver@qlogic.com, kaber@trash.net,
ursula.braun@de.ibm.com, blaschka@linux.vnet.ibm.com,
linux390@de.ibm.com, shemminger@vyatta.com, therbert@google.com,
xiyou.wangcong@gmail.com, joe@perches.com,
gregory.v.rose@intel.com, john.r.fastabend@intel.com,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org, bridge@lists.linux-foundation.org,
fbl@redhat.com
Subject: Re: [patch net-next v2 01/15] net: introduce upper device lists
Date: Wed, 15 Aug 2012 09:46:12 +0200 [thread overview]
Message-ID: <20120815074612.GB1726@minipsycho.orion> (raw)
In-Reply-To: <1344983624.2690.77.camel@bwh-desktop.uk.solarflarecom.com>
Wed, Aug 15, 2012 at 12:33:44AM CEST, bhutchings@solarflare.com wrote:
>On Tue, 2012-08-14 at 17:05 +0200, Jiri Pirko wrote:
>> This lists are supposed to serve for storing pointers to all upper devices.
>> Eventually it will replace dev->master pointer which is used for
>> bonding, bridge, team but it cannot be used for vlan, macvlan where
>> there might be multiple upper present. In case the upper link is
>> replacement for dev->master, it is marked with "master" flag.
>
>Something I found interesting is that the dev->master pointer and now
>netdev_master_upper_dev_get{,_rcu}() are hardly used by the stackled
>drivers that set the master. They also have to set an rx_handler on the
>lower device (which is itself mutually exclusive) which gets its own
>context pointer (rx_handler_data).
>
>Instead, the master pointer is mostly used by device drivers to find out
>about a bridge or bonding device above *their* devices. And that seems
>to work only for those specific device drivers, not e.g. openvswitch or
>team. I wonder if we could find a better way to encapsulate the things
>they want do do, in a later step (not holding up this change!).
Yes. I was thinking about this as well. I believe that we should follow up
with this.
>
>[...]
>> +static int __netdev_upper_dev_link(struct net_device *dev,
>> + struct net_device *upper_dev, bool master)
>> +{
>> + struct netdev_upper *upper;
>> +
>> + ASSERT_RTNL();
>> +
>> + if (dev == upper_dev)
>> + return -EBUSY;
>> + /*
>> + * To prevent loops, check if dev is not upper device to upper_dev.
>> + */
>> + if (__netdev_has_upper_dev(upper_dev, dev, true))
>> + return -EBUSY;
>[...]
>
>I think we will also need to limit the depth of the device stack so we
>don't run out of stack space here. __netif_receive() implements a kind
>of tail recursion whenever a packet is passed up, but
>__netdev_has_upper_dev() can't avoid doing real recursion (without the
>addition of a flag to net_device so it can mark its progress).
>
You are probably right. I'm not sure how to handle this correctly
though. Adding some hard limit number might not be correct.
The problem could be also resolved by adding another struct list_head
into struct upper and use this inside __netdev_has_upper_dev(). But that
does not seem right to me as well (Considering the fact that walking
through the tree could be in future done under _rcu).
>Ben.
>
>--
>Ben Hutchings, Staff Engineer, Solarflare
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
next prev parent reply other threads:[~2012-08-15 7:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 15:05 [patch net-next v2 00/15] net: introduce upper device lists and remove dev->master Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 01/15] net: introduce upper device lists Jiri Pirko
2012-08-14 22:33 ` Ben Hutchings
2012-08-14 23:00 ` Stephen Hemminger
2012-08-15 7:46 ` Jiri Pirko [this message]
2012-08-15 22:15 ` David Miller
[not found] ` <20120815.151549.1835466517645273818.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-08-16 5:48 ` Jiri Pirko
2012-08-15 22:12 ` David Miller
2012-08-14 15:05 ` [patch net-next v2 02/15] macvlan: add link to upper device Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 03/15] vlan: " Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 04/15] rtnetlink: remove usage of dev->master Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 05/15] team: remove usage of netdev_set_master() Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 06/15] bridge: " Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 07/15] netpoll: remove usage of dev->master Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 08/15] cxgb3: " Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 09/15] qlcnic: guard __vlan_find_dev_deep() by rcu_read_lock Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 10/15] qeth: ensure that __vlan_find_dev_deep() is called with rcu_read_lock Jiri Pirko
[not found] ` <1344956748-2099-1-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2012-08-14 15:05 ` [patch net-next v2 11/15] vlan: remove usage of dev->master in __vlan_find_dev_deep() Jiri Pirko
2012-08-14 20:19 ` [patch net-next v2 00/15] net: introduce upper device lists and remove dev->master Andy Gospodarek
2012-08-14 20:32 ` Ben Hutchings
2012-08-15 7:30 ` Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 12/15] nes: remove usage of dev->master Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 13/15] bonding: " Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 14/15] net: remove no longer used netdev_set_bond_master() and netdev_set_master() Jiri Pirko
2012-08-14 15:05 ` [patch net-next v2 15/15] net: kill dev->master Jiri Pirko
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=20120815074612.GB1726@minipsycho.orion \
--to=jiri@resnulli.us \
--cc=andy@greyhouse.net \
--cc=bhutchings@solarflare.com \
--cc=blaschka@linux.vnet.ibm.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=divy@chelsio.com \
--cc=edumazet@google.com \
--cc=faisal.latif@intel.com \
--cc=fbl@redhat.com \
--cc=fubar@us.ibm.com \
--cc=gregory.v.rose@intel.com \
--cc=hal.rosenstock@gmail.com \
--cc=jitendra.kalsaria@qlogic.com \
--cc=joe@perches.com \
--cc=john.r.fastabend@intel.com \
--cc=kaber@trash.net \
--cc=linux-driver@qlogic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux390@de.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=roland@kernel.org \
--cc=sean.hefty@intel.com \
--cc=shemminger@vyatta.com \
--cc=sony.chacko@qlogic.com \
--cc=therbert@google.com \
--cc=ursula.braun@de.ibm.com \
--cc=xiyou.wangcong@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