From: Veaceslav Falico <vfalico@redhat.com>
To: netdev@vger.kernel.org
Cc: Veaceslav Falico <vfalico@redhat.com>,
Jay Vosburgh <fubar@us.ibm.com>,
Andy Gospodarek <andy@greyhouse.net>
Subject: [PATCH net-next 2/8] bonding: use netdev_upper list in bond_vlan_used
Date: Mon, 26 Aug 2013 18:28:47 +0200 [thread overview]
Message-ID: <1377534533-6944-3-git-send-email-vfalico@redhat.com> (raw)
In-Reply-To: <1377534533-6944-1-git-send-email-vfalico@redhat.com>
Convert bond_vlan_used() to traverse the upper device list to see if we
have any vlans above us. It's protected by rcu, and in case we are holding
rtnl_lock we should call vlan_uses_dev() instead - it's faster.
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
drivers/net/bonding/bonding.h | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 4bf52d5..5ebb3d8 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -267,9 +267,21 @@ struct bonding {
#endif /* CONFIG_DEBUG_FS */
};
+/* if we hold rtnl_lock() - call vlan_uses_dev() */
static inline bool bond_vlan_used(struct bonding *bond)
{
- return !list_empty(&bond->vlan_list);
+ struct netdev_upper *upper;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(upper, &bond->dev->upper_dev_list, list) {
+ if (upper->dev->priv_flags & IFF_802_1Q_VLAN) {
+ rcu_read_unlock();
+ return true;
+ }
+ }
+ rcu_read_unlock();
+
+ return false;
}
#define bond_slave_get_rcu(dev) \
--
1.7.1
next prev parent reply other threads:[~2013-08-26 16:28 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
2013-08-26 18:10 ` Veaceslav Falico
2013-08-26 16:28 ` Veaceslav Falico [this message]
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=1377534533-6944-3-git-send-email-vfalico@redhat.com \
--to=vfalico@redhat.com \
--cc=andy@greyhouse.net \
--cc=fubar@us.ibm.com \
--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).