From: Stephen Hemminger <shemminger@vyatta•com>
To: "David S. Miller" <davem@davemloft•net>
Cc: netdev@vger•kernel.org
Subject: [PATCH 3/7] bridge: split rcu and no-rcu cases of fdb lookup
Date: Mon, 04 Apr 2011 17:03:29 -0700 [thread overview]
Message-ID: <20110405000537.187138133@vyatta.com> (raw)
In-Reply-To: 20110405000326.714524584@vyatta.com
[-- Attachment #1: br-fdb-norcu.patch --]
[-- Type: text/plain, Size: 1349 bytes --]
In some cases, look up of forward database entry is done with RCU;
and for others no RCU is needed because of locking. Split the two
cases into two differnt loops (and take off inline).
Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
--- a/net/bridge/br_fdb.c 2011-03-21 10:36:51.109460181 -0700
+++ b/net/bridge/br_fdb.c 2011-03-21 10:37:11.872443564 -0700
@@ -305,8 +305,21 @@ int br_fdb_fillbuf(struct net_bridge *br
return num;
}
-static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
- const unsigned char *addr)
+static struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
+ const unsigned char *addr)
+{
+ struct hlist_node *h;
+ struct net_bridge_fdb_entry *fdb;
+
+ hlist_for_each_entry(fdb, h, head, hlist) {
+ if (!compare_ether_addr(fdb->addr.addr, addr))
+ return fdb;
+ }
+ return NULL;
+}
+
+static struct net_bridge_fdb_entry *fdb_find_rcu(struct hlist_head *head,
+ const unsigned char *addr)
{
struct hlist_node *h;
struct net_bridge_fdb_entry *fdb;
@@ -393,7 +406,7 @@ void br_fdb_update(struct net_bridge *br
source->state == BR_STATE_FORWARDING))
return;
- fdb = fdb_find(head, addr);
+ fdb = fdb_find_rcu(head, addr);
if (likely(fdb)) {
/* attempt to update an entry for a local interface */
if (unlikely(fdb->is_local)) {
next prev parent reply other threads:[~2011-04-05 0:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 0:03 [PATCH 0/7] bridge enhancements for net-next Stephen Hemminger
2011-04-05 0:03 ` [PATCH 1/7] bridge: change arguments to fdb_create Stephen Hemminger
2011-04-05 0:03 ` [PATCH 2/7] bridge: track last used time in forwarding table Stephen Hemminger
2011-04-05 0:03 ` Stephen Hemminger [this message]
2011-04-05 0:03 ` [PATCH 4/7] bridge: add netlink notification on forward entry changes Stephen Hemminger
2011-04-05 0:03 ` [PATCH 5/7] bridge: allow creating/deleting fdb entries via netlink Stephen Hemminger
2011-10-05 19:06 ` Kevin Wilson
2011-10-05 19:13 ` Stephen Hemminger
2011-10-05 19:36 ` Ben Hutchings
2011-04-05 0:03 ` [PATCH 6/7] bridge: allow creating bridge devices with netlink Stephen Hemminger
2011-04-05 0:03 ` [PATCH 7/7] bridge: range check STP parameters Stephen Hemminger
2011-04-05 0:23 ` [PATCH 0/7] bridge enhancements for net-next David Miller
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=20110405000537.187138133@vyatta.com \
--to=shemminger@vyatta$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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