linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFC 1/2] mac80211:  Add vif hash for multi-station RX performance.
Date: Tue, 09 Apr 2013 10:54:18 -0700	[thread overview]
Message-ID: <516455CA.6070504@candelatech.com> (raw)
In-Reply-To: <1365501478.8465.17.camel@jlt4.sipsolutions.net>

On 04/09/2013 02:57 AM, Johannes Berg wrote:
> On Wed, 2013-04-03 at 09:48 -0700, greearb@candelatech.com wrote:

>> +++ b/net/mac80211/sta_info.c
>> @@ -77,19 +77,42 @@ static int sta_info_hash_del(struct ieee80211_local *local,
>>   	s = rcu_dereference_protected(local->sta_hash[STA_HASH(sta->sta.addr)],
>>   				      lockdep_is_held(&local->sta_mtx));
>>   	if (!s)
>> -		return -ENOENT;
>> +		goto try_lhash;
>
> Does this make sense? If the station doesn't exist in the regular hash,
> it really shouldn't be in the vif hash either, no?

It shouldn't be in the new vif hash, so I could add a short-cut
as you suggest.  I had left it in for reasons of paranoia.

>> +	s = rcu_dereference_protected(local->sta_vhash[STA_HASH(sta->sdata->vif.addr)],
>> +				      lockdep_is_held(&local->sta_mtx));
>> +	if (!s)
>> +		return -ENONET;
>
> You probably want -ENOENT, not -ENONET.

Yes, and in fact, I need to return just the rv from the old
hash logic since otherwise we get false failure results since
the new hash only has vifs.  This was the cause of that splat
I posted a week or two ago...

>> +struct sta_info *sta_info_get_by_vif(struct ieee80211_local *local,
>> +				     const u8 *vif_addr, const u8 * sta_addr) {
>> +	struct sta_info *sta;
>> +
>> +	sta = rcu_dereference_check(local->sta_vhash[STA_HASH(vif_addr)],
>> +				    lockdep_is_held(&local->sta_mtx));
>> +	while (sta) {
>> +		if (ether_addr_equal(sta->sdata->vif.addr, vif_addr) &&
>> +		    ether_addr_equal(sta->sta.addr, sta_addr))
>> +			break;
>> +		sta = rcu_dereference_check(sta->vnext,
>> +					    lockdep_is_held(&local->sta_mtx));
>
> Almost all of your rcu_dereference_check() invocations should be
> rcu_dereference_protected(). See include/linux/rcupdate.h :)

Now this, I'm not so sure of.  That rcu_dereference_protected seems to
be only used for the 'update-side' use.  I was under the impression
that when the mac80211 rx logic is called we are only protected by rcu,
not the update mutex.

I also struggle to understand RCU properly...so maybe I'm just
wrong about all that...

The other methods to get sta_info around that code use the _check() variant,
by the way...

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


  reply	other threads:[~2013-04-09 17:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 16:48 [RFC 1/2] mac80211: Add vif hash for multi-station RX performance greearb
2013-04-03 16:48 ` [RFC 2/2] mac80211: Add vhash to debugfs greearb
2013-04-09  9:57 ` [RFC 1/2] mac80211: Add vif hash for multi-station RX performance Johannes Berg
2013-04-09 17:54   ` Ben Greear [this message]
2013-04-11  9:19     ` Johannes Berg
2013-04-11 16:11       ` Ben Greear
2013-04-23 19:42       ` Ben Greear
2013-04-23 22:06         ` Ben Greear
2013-04-24 11:01           ` Johannes Berg

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=516455CA.6070504@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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).