mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Jiri Pirko <jiri@resnulli.us>
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 V5 01/15] net: introduce upper device lists
Date: Wed, 2 Jan 2013 18:57:26 +0000	[thread overview]
Message-ID: <1357153046.3652.11.camel@bwh-desktop.uk.solarflarecom.com> (raw)
In-Reply-To: <1357129716-2450-2-git-send-email-jiri@resnulli.us>

On Wed, 2013-01-02 at 13:28 +0100, 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.
> 
> New upper device list resolves this limitation. Also, the information
> stored in lists is used for preventing looping setups like
> "bond->somethingelse->samebond"

Thanks for continuing with this, Jiri.  I just see some
cosmetic/documentation issues:

[...]
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[...]
> +static bool __netdev_has_upper_dev(struct net_device *dev,
> +				   struct net_device *upper_dev)
> +{
> +	LIST_HEAD(search_list);
> +	struct netdev_upper *upper;
> +	struct netdev_upper *tmp;
> +	bool ret = false;
> +
> +	__append_search_uppers(&search_list, dev);
> +	list_for_each_entry(upper, &search_list, search_list) {
> +		if (upper->dev == upper_dev) {
> +			ret = true;
> +			break;
> +		}
> +		__append_search_uppers(&search_list, upper->dev);
> +	}
> +	list_for_each_entry_safe(upper, tmp, &search_list, search_list)
> +		INIT_LIST_HEAD(&upper->search_list);
> +	return ret;
> +}
> +
> +static struct netdev_upper *__netdev_find_upper(struct net_device *dev,
> +						struct net_device *upper_dev)
> +{
> +	struct netdev_upper *upper;
> +
> +	list_for_each_entry(upper, &dev->upper_dev_list, list) {
> +		if (upper->dev == upper_dev)
> +			return upper;
> +	}
> +	return NULL;
> +}
> +
> +/**
> + * netdev_has_upper_dev - Check if device is linked to an upper device

Please clarify that this (and other functions) only checks for an
immediate upper device and not through a complete stack of devices.

> + * @dev: device
> + * @upper_dev: upper device to check
> + *
> + * Find out if a device is linked to specified upper device and return true
> + * in case it is. The caller must hold the RTNL semaphore.

It is no longer a semaphore, even if some kernel-doc in this file calls
it that.  'RTNL lock' would be better as it matches the function naming:
rtnl_lock() etc.

> + */
> +bool netdev_has_upper_dev(struct net_device *dev,
> +			  struct net_device *upper_dev)

The '__' prefix normally implies doing less work than the un-prefixed
function but __netdev_has_upper_dev() checks all devices stacked above
dev whereas this only checks a single level.  Therefore I think one or
both should be renamed.

> +{
> +	ASSERT_RTNL();
> +
> +	return __netdev_find_upper(dev, upper_dev);
> +}
> +EXPORT_SYMBOL(netdev_has_upper_dev);
[...]
> +static int __netdev_upper_dev_link(struct net_device *dev,
> +				   struct net_device *upper_dev, bool master)
> +{
[...]
> +}
> +/**
> + * netdev_upper_dev_link - Add a link to the upper device
[...] 

There should be a blank line between the closing brace and the comment
for the next function.

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.


  reply	other threads:[~2013-01-02 18:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-02 12:28 [patch net-next V5 00/15] net: introduce upper device lists and remove dev->master Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 01/15] net: introduce upper device lists Jiri Pirko
2013-01-02 18:57   ` Ben Hutchings [this message]
2013-01-02 12:28 ` [patch net-next V5 02/15] macvlan: add link to upper device Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 03/15] vlan: " Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 04/15] rtnetlink: remove usage of dev->master Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 05/15] team: remove usage of netdev_set_master() Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 06/15] bridge: " Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 07/15] netpoll: remove usage of dev->master Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 08/15] cxgb3: " Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 09/15] qlcnic: guard __vlan_find_dev_deep() by rcu_read_lock Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 10/15] qeth: ensure that __vlan_find_dev_deep() is called with rcu_read_lock Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 11/15] vlan: remove usage of dev->master in __vlan_find_dev_deep() Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 12/15] nes: remove usage of dev->master Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 13/15] bonding: " Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 14/15] net: remove no longer used netdev_set_bond_master() and netdev_set_master() Jiri Pirko
2013-01-02 12:28 ` [patch net-next V5 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=1357153046.3652.11.camel@bwh-desktop.uk.solarflarecom.com \
    --to=bhutchings@solarflare.com \
    --cc=andy@greyhouse.net \
    --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=jiri@resnulli.us \
    --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

all inboxes | Powered by JetHome®