netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Veaceslav Falico <vfalico@redhat.com>
To: netdev@vger.kernel.org
Cc: Veaceslav Falico <vfalico@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>, Jiri Pirko <jiri@resnulli.us>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Cong Wang <amwang@redhat.com>
Subject: [PATCH net-next v2 05/13] net: add netdev_for_each_upper_dev_rcu()
Date: Wed, 28 Aug 2013 14:02:24 +0200	[thread overview]
Message-ID: <1377691352-4146-6-git-send-email-vfalico@redhat.com> (raw)
In-Reply-To: <1377691352-4146-1-git-send-email-vfalico@redhat.com>

The new macro netdev_for_each_upper_dev_rcu(dev, upper, iter) iterates
through the dev->upper_dev_list starting from the first element, using
the netdev_upper_get_next_dev_rcu(dev, &iter).

Must be called under RCU read lock.

v1: new patch
v2: rename netdev_for_each_upper_dev{,_rcu} and use/export the renamed
    netdev_upper_get_next_dev_rcu().

CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Jiri Pirko <jiri@resnulli.us>
CC: Alexander Duyck <alexander.h.duyck@intel.com>
CC: Cong Wang <amwang@redhat.com>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 include/linux/netdevice.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5ccf5b7..3ad49b8 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2768,6 +2768,16 @@ extern int		bpf_jit_enable;
 extern bool netdev_has_upper_dev(struct net_device *dev,
 				 struct net_device *upper_dev);
 extern bool netdev_has_any_upper_dev(struct net_device *dev);
+extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
+							struct list_head **iter);
+
+/* iterate through upper list, must be called under RCU read lock */
+#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \
+	for (iter = &(dev)->upper_dev_list, \
+	     upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \
+	     upper; \
+	     upper = netdev_upper_get_next_dev_rcu(dev, &(iter)))
+
 extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
 extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
 extern int netdev_upper_dev_link(struct net_device *dev,
-- 
1.7.1

  parent reply	other threads:[~2013-08-28 12:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28 12:02 [PATCH net-next v2 0/13] bonding: remove vlan special handling Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 01/13] net: rename netdev_upper to netdev_adjacent Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 02/13] net: add lower_dev_list to net_device and make a full mesh Veaceslav Falico
2013-08-28 13:59   ` Jiri Pirko
2013-08-28 14:15     ` Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 03/13] net: remove search_list from netdev_adjacent Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 04/13] net: add netdev_upper_get_next_dev_rcu(dev, iter) Veaceslav Falico
2013-08-28 12:02 ` Veaceslav Falico [this message]
2013-08-28 12:02 ` [PATCH net-next v2 06/13] bonding: use netdev_upper list in bond_vlan_used Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 07/13] bonding: make bond_arp_send_all use upper device list Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 08/13] bonding: convert bond_has_this_ip() to use upper devices Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 09/13] bonding: use vlan_uses_dev() in __bond_release_one() Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 10/13] bonding: split alb_send_learning_packets() Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 11/13] bonding: make alb_send_learning_packets() use upper dev list Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 12/13] bonding: remove vlan_list/current_alb_vlan Veaceslav Falico
2013-08-28 12:02 ` [PATCH net-next v2 13/13] bonding: pr_debug instead of pr_warn in bond_arp_send_all Veaceslav Falico
2013-08-28 16:04 ` [PATCH net-next v2 0/13] 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=1377691352-4146-6-git-send-email-vfalico@redhat.com \
    --to=vfalico@redhat.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    /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).