linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Flavio Leitner <fbl@redhat.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,
	bhutchings@solarflare.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
Subject: Re: [patch net-next 01/16] net: introduce upper device lists
Date: Tue, 14 Aug 2012 15:35:35 +0200	[thread overview]
Message-ID: <20120814133535.GC1661@minipsycho.brq.redhat.com> (raw)
In-Reply-To: <20120814101400.0ef7aaa9@obelix.rh>

Tue, Aug 14, 2012 at 03:14:00PM CEST, fbl@redhat.com wrote:
>On Tue, 14 Aug 2012 14:24:33 +0200
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> Mon, Aug 13, 2012 at 07:52:17PM CEST, fbl@redhat.com wrote:
>> >On Mon, 13 Aug 2012 17:27:00 +0200
>> >Jiri Pirko <jiri@resnulli.us> wrote:
>> >> +	/*
>> >> +	 * To prevent loops, check if dev is not upper device to upper_dev.
>> >> +	 */
>> >> +	if (__netdev_has_upper_dev(upper_dev, dev, true))
>> >> +		return -EBUSY;
>> >> +
>> >> +	if (__netdev_find_upper(dev, upper_dev))
>> >> +		return -EEXIST;
>> >
>> >__netdev_has_upper_dev() can go all the way up finding the device and
>> >the __netdev_find_upper() just check the first level.
>> 
>> 
>> I do not think this ordering is somewhat inportant.
>
>it's not the order, see below:
>
>> >I think it would be better to use:
>> >__netdev_find_upper_dev(,,deep=true/false)
>> >__netdev_has_upper(,)
>
>It's their names.  Currently, the function ..._find_... look at
>one level only, while the function ..._has_... does one or more
>levels.  I think it's better to swap 'has' and 'find' in their names:
>
>__netdev_find_upper_dev(,,deep=true/false) <-- find in all levels
>__netdev_has_upper(,)  <-- check only the one level.

Oh, now I think I see your point. But realise this:

The main reason for __netdev_find_upper() is to find "struct upper" for
netdev_upper_dev_unlink(). Therefore the name is not
"__netdev_find_upper_dev" and there's no need to go deep here.

On the orher hand, __netdev_has_upper_dev() only says whether device is lower
to specified upper device. In this case I think the name is quite
convenient as well.


>
>fbl

  reply	other threads:[~2012-08-14 13:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 15:26 [patch net-next 00/16] net: introduce upper device lists and remove dev->master Jiri Pirko
2012-08-13 15:27 ` [patch net-next 01/16] net: introduce upper device lists Jiri Pirko
2012-08-13 17:04   ` Ben Hutchings
2012-08-13 17:31     ` Jiri Pirko
2012-08-15 20:33       ` Nicolas de Pesloüan
2012-08-13 17:52   ` Flavio Leitner
2012-08-14 12:24     ` Jiri Pirko
2012-08-14 13:14       ` Flavio Leitner
2012-08-14 13:35         ` Jiri Pirko [this message]
2012-08-14  9:02   ` Cong Wang
2012-08-14 10:18     ` Jiri Pirko
2012-08-13 15:27 ` [patch net-next 02/16] macvlan: add link to upper device Jiri Pirko
2012-08-13 15:27 ` [patch net-next 03/16] vlan: " Jiri Pirko
2012-08-13 19:04   ` Flavio Leitner
2012-08-14  7:24     ` Jiri Pirko
2012-08-13 15:27 ` [patch net-next 04/16] rtnetlink: remove usage of dev->master Jiri Pirko
2012-08-13 15:27 ` [patch net-next 05/16] team: remove usage of netdev_set_master() Jiri Pirko
2012-08-13 15:27 ` [patch net-next 06/16] bridge: " Jiri Pirko
2012-08-13 15:27 ` [patch net-next 07/16] netpoll: remove usage of dev->master Jiri Pirko
2012-08-13 15:27 ` [patch net-next 08/16] cxgb3: " Jiri Pirko
2012-08-13 15:27 ` [patch net-next 09/16] qlcnic: guard __vlan_find_dev_deep() by rcu_read_lock Jiri Pirko
2012-08-13 15:27 ` [patch net-next 10/16] qeth: ensure that __vlan_find_dev_deep() is called with rcu_read_lock Jiri Pirko
2012-08-13 15:27 ` [patch net-next 11/16] vlan: remove usage of dev->master in __vlan_find_dev_deep() Jiri Pirko
2012-08-13 15:27 ` [patch net-next 12/16] nes: remove usage of dev->master Jiri Pirko
2012-08-13 15:27 ` [patch net-next 13/16] bonding: " Jiri Pirko
2012-08-13 15:27 ` [patch net-next 14/16] net: remove no longer used netdev_set_bond_master() and netdev_set_master() Jiri Pirko
2012-08-13 15:27 ` [patch net-next 15/16] net: remove usage of dev->master Jiri Pirko
2012-08-13 17:15   ` Ben Hutchings
2012-08-13 17:31     ` Jiri Pirko
2012-08-13 15:27 ` [patch net-next 16/16] 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=20120814133535.GC1661@minipsycho.brq.redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).