netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Veaceslav Falico <vfalico@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Cong Wang <amwang@redhat.com>
Subject: Re: [PATCH net-next 1/8] net: move netdev_upper to netdevice.h
Date: Mon, 26 Aug 2013 19:38:44 +0200	[thread overview]
Message-ID: <20130826173844.GA1437@minipsycho.orion> (raw)
In-Reply-To: <20130826165535.GG1992@redhat.com>

Mon, Aug 26, 2013 at 06:55:35PM CEST, vfalico@redhat.com wrote:
>On Mon, Aug 26, 2013 at 06:41:15PM +0200, Jiri Pirko wrote:
>>Mon, Aug 26, 2013 at 06:28:46PM CEST, vfalico@redhat.com wrote:
>...snip...
>>>+struct netdev_upper {
>>>+	struct net_device *dev;
>>>+	bool master;
>>>+	struct list_head list;
>>>+	struct rcu_head rcu;
>>>+	struct list_head search_list;
>>>+};
>>>+
>>
>>
>>I like your patchset.  However I'm not entirely comfortable with exposing
>>this struct. I would love to have it "under control" in net/core/dev.c
>
>I've taken this approach first, however the change to non-bonding stuff
>became a bit too big to justify the (only) bonding use.
>
>bonding only reads from it, and there are already primitives in dev.c to
>modify it, so if they will be used for it it's still the dev.c who controls
>it (if someone writes directly to it - it's a bug, and can be NAKed).
>
>>
>>I'm thinking of some getter/iterator for this use. It can work by
>>type as well so you would be able to remove the checks from bonding
>>code.
>
>There are 3 checks in bonding - looking for vlan devs, for a specific dev
>and for a specific ip address. list_for_each_entry() fits here perfectly
>for each case, otherwise the best way to do this would be to
>
>while ((next_dev = netdev_upper_get_next_dev(dev, next_dev)))

I was imagine something like:

struct list_head *iter;
struct net_device *dev, *upper;

netdev_for_each_upper_dev(dev, upper, iter) {

}

This macro can be easily implented using netdev_upper_get_next_dev()
from dev.c

Not much of added overhead other than netdev_upper_get_next_dev calls
(without any search when using list_head iter).
	
>
>or something like that, which adds quite a bit of overhead (looking for the
>previous dev and then returning the next one on each iteration), and looks
>ugly.
>
>So, given that it's a plain list actually, and any modification to this
>list can (and should be) done via functions from dev.c, while reading can
>be done with standard list_for_each_entry(_rcu)(), I think it's better to
>expose it this way.

  reply	other threads:[~2013-08-26 17:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26 16:28 [PATCH net-next 0/8] bonding: remove vlan special handling Veaceslav Falico
2013-08-26 16:28 ` [PATCH net-next 1/8] net: move netdev_upper to netdevice.h Veaceslav Falico
2013-08-26 16:41   ` Jiri Pirko
2013-08-26 16:55     ` Veaceslav Falico
2013-08-26 17:38       ` Jiri Pirko [this message]
2013-08-26 18:10         ` Veaceslav Falico
2013-08-26 16:28 ` [PATCH net-next 2/8] bonding: use netdev_upper list in bond_vlan_used Veaceslav Falico
2013-08-26 16:28 ` [PATCH net-next 3/8] bonding: make bond_arp_send_all use upper device list Veaceslav Falico
2013-08-26 16:28 ` [PATCH net-next 4/8] bonding: convert bond_has_this_ip() to use upper devices Veaceslav Falico
2013-08-26 16:28 ` [PATCH net-next 5/8] bonding: use vlan_uses_dev() in __bond_release_one() Veaceslav Falico
2013-08-26 16:28 ` [PATCH net-next 6/8] bonding: split alb_send_learning_packets() Veaceslav Falico
2013-08-26 16:28 ` [PATCH net-next 7/8] bonding: make alb_send_learning_packets() use upper dev list Veaceslav Falico
2013-08-26 16:28 ` [PATCH net-next 8/8] bonding: remove vlan_list/current_alb_vlan Veaceslav Falico
2013-08-26 20:33 ` [PATCH net-next 0/8] bonding: remove vlan special handling Veaceslav Falico

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=20130826173844.GA1437@minipsycho.orion \
    --to=jiri@resnulli.us \
    --cc=alexander.h.duyck@intel.com \
    --cc=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=vfalico@redhat.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).