[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130917073408.GB18195@redhat.com>
Date: Tue, 17 Sep 2013 09:34:08 +0200
From: Veaceslav Falico <vfalico@...hat.com>
To: Ben Hutchings <bhutchings@...arflare.com>
Cc: netdev@...r.kernel.org, jiri@...nulli.us,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Alexander Duyck <alexander.h.duyck@...el.com>,
Cong Wang <amwang@...hat.com>
Subject: Re: [PATCH v3 net-next 02/27] net: add RCU variant to search for
netdev_adjacent link
On Tue, Sep 17, 2013 at 02:23:18AM +0100, Ben Hutchings wrote:
>On Tue, 2013-09-17 at 02:46 +0200, Veaceslav Falico wrote:
>> Currently we have only the RTNL flavour, however we can traverse it while
>> holding only RCU, so add the RCU search. Add only one function that will be
>> used further, other functions can be added easily afterwards, if anyone
>> would need them.
>[...]
>> +static struct netdev_adjacent *__netdev_find_adj_rcu(struct net_device *dev,
>> + struct net_device *adj_dev,
>> + bool upper, bool neighbour)
>> +{
>> + struct netdev_adjacent *adj;
>> + struct list_head *adj_list;
>> +
>> + if (neighbour)
>> + adj_list = upper ? &dev->adj_list.upper :
>> + &dev->adj_list.lower;
>> + else
>> + adj_list = upper ? &dev->all_adj_list.upper :
>> + &dev->all_adj_list.lower;
>
>I think it would be clearer to make adj_list a parameter, rather than
>taking the dev and a pair of booleans.
Hm, true, indeed, will try to change in the next version.
Thank you!
>
>Ben.
>
>> + list_for_each_entry_rcu(adj, adj_list, list) {
>> + if (adj->dev == adj_dev)
>> + return adj;
>> + }
>> + return NULL;
>> +}
>> +
>> +static struct netdev_adjacent *__netdev_lower_find_rcu(struct net_device *dev,
>> + struct net_device *ldev)
>> +{
>> + return __netdev_find_adj_rcu(dev, ldev, false, true);
>> +}
>> +
>> static struct netdev_adjacent *__netdev_find_adj(struct net_device *dev,
>> struct net_device *adj_dev,
>> bool upper, bool neighbour)
>
>--
>Ben Hutchings, Staff Engineer, Solarflare
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists