* [PATCH net-next-2.6] pppoe: RCU locking in get_item_by_addr()
@ 2009-11-02 5:51 Eric Dumazet
2009-11-02 7:57 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2009-11-02 5:51 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Netdev List
Note : this patch depends on dev_get_by_name_rcu(), not yet comitted.
Thanks
[PATCH net-next-2.6] pppoe: RCU locking in get_item_by_addr()
Use dev_get_by_name_rcu() instead of dev_get_by_name(),
to avoid touching device refcount in hotpath.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
drivers/net/pppoe.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 2559991..60c8d23 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -250,20 +250,19 @@ static inline struct pppox_sock *get_item_by_addr(struct net *net,
{
struct net_device *dev;
struct pppoe_net *pn;
- struct pppox_sock *pppox_sock;
+ struct pppox_sock *pppox_sock = NULL;
int ifindex;
- dev = dev_get_by_name(net, sp->sa_addr.pppoe.dev);
- if (!dev)
- return NULL;
-
- ifindex = dev->ifindex;
- pn = net_generic(net, pppoe_net_id);
- pppox_sock = get_item(pn, sp->sa_addr.pppoe.sid,
+ rcu_read_lock();
+ dev = dev_get_by_name_rcu(net, sp->sa_addr.pppoe.dev);
+ if (dev) {
+ ifindex = dev->ifindex;
+ pn = net_generic(net, pppoe_net_id);
+ pppox_sock = get_item(pn, sp->sa_addr.pppoe.sid,
sp->sa_addr.pppoe.remote, ifindex);
- dev_put(dev);
-
+ }
+ rcu_read_unlock();
return pppox_sock;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next-2.6] pppoe: RCU locking in get_item_by_addr()
2009-11-02 5:51 [PATCH net-next-2.6] pppoe: RCU locking in get_item_by_addr() Eric Dumazet
@ 2009-11-02 7:57 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-11-02 7:57 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 02 Nov 2009 06:51:22 +0100
>
> Note : this patch depends on dev_get_by_name_rcu(), not yet comitted.
Yep, I just tossed that one ine.
> [PATCH net-next-2.6] pppoe: RCU locking in get_item_by_addr()
>
> Use dev_get_by_name_rcu() instead of dev_get_by_name(),
> to avoid touching device refcount in hotpath.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
And now this one too, applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-02 7:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-02 5:51 [PATCH net-next-2.6] pppoe: RCU locking in get_item_by_addr() Eric Dumazet
2009-11-02 7:57 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.