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: [PATCH v2] wireless: Allow registering more than one beacon listener.
Date: Mon, 29 Oct 2012 09:17:52 -0700	[thread overview]
Message-ID: <508EAC30.8020600@candelatech.com> (raw)
In-Reply-To: <1351501451.10925.6.camel@jlt4.sipsolutions.net>

On 10/29/2012 02:04 AM, Johannes Berg wrote:
> Thanks Ben,
>
> I was going to apply this but it looks like I missed something on the
> previous review:
>
>>   void cfg80211_report_obss_beacon(struct wiphy *wiphy,
>>   				 const u8 *frame, size_t len,
>> -				 int freq, int sig_dbm, gfp_t gfp)
>> +				 int freq, int sig_dbm)
>>   {
>
> ...
>
>> +	spin_lock_bh(&rdev->beacon_registrations_lock);
> ...
>> +	spin_unlock_bh(&rdev->beacon_registrations_lock);
>
> I have a feeling this is incorrect, this is called with BHs disabled, so
> if we disable/enable BHs here we end up with BHs enabled even if the
> caller wanted them disabled, no?
>
> So I suppose unless we need to be able to call this from hard interrupt
> in some driver (unlikely) we should add a change like this:

I get confused with the various types of spin-locks,
and I just copied this code from the mgt frames logic.

I did run some tests and my code seems stable, but I could
just be getting lucky.

Do you want me to roll in your changes below and re-submit, or
do you want to just make the updates?

Thanks,
Ben

>
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 10a7f45..3b6a11a 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -3544,6 +3544,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
>    * Use this function to report to userspace when a beacon was
>    * received. It is not useful to call this when there is no
>    * netdev that is in AP/GO mode.
> + * The function must be called with BHs disabled.
>    */
>   void cfg80211_report_obss_beacon(struct wiphy *wiphy,
>   				 const u8 *frame, size_t len,
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index 15ddbb8..5ff24ef 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -8942,11 +8942,11 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
>
>   	trace_cfg80211_report_obss_beacon(wiphy, frame, len, freq, sig_dbm);
>
> -	spin_lock_bh(&rdev->beacon_registrations_lock);
> +	spin_lock(&rdev->beacon_registrations_lock);
>   	list_for_each_entry(reg, &rdev->beacon_registrations, list) {
>   		msg = nlmsg_new(len + 100, GFP_ATOMIC);
>   		if (!msg) {
> -			spin_unlock_bh(&rdev->beacon_registrations_lock);
> +			spin_unlock(&rdev->beacon_registrations_lock);
>   			return;
>   		}
>
> @@ -8966,11 +8966,11 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
>
>   		genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, reg->nlportid);
>   	}
> -	spin_unlock_bh(&rdev->beacon_registrations_lock);
> +	spin_unlock(&rdev->beacon_registrations_lock);
>   	return;
>
>    nla_put_failure:
> -	spin_unlock_bh(&rdev->beacon_registrations_lock);
> +	spin_unlock(&rdev->beacon_registrations_lock);
>   	if (hdr)
>   		genlmsg_cancel(msg, hdr);
>   	nlmsg_free(msg);
>
>
> johannes
>


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


  reply	other threads:[~2012-10-29 16:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26 21:49 [PATCH v2] wireless: Allow registering more than one beacon listener greearb
2012-10-29  9:04 ` Johannes Berg
2012-10-29 16:17   ` Ben Greear [this message]
2012-10-29 16:26     ` Johannes Berg
2012-10-29 16:54       ` Felix Fietkau
2012-11-05 15:32         ` 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=508EAC30.8020600@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).