Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Sujith <m.sujith@gmail.com>
Cc: linux-wireless@vger.kernel.org, jouni.malinen@atheros.com
Subject: Re: [RFC v2] mac80211: Add 802.11h CSA support
Date: Tue, 30 Dec 2008 11:35:05 +0100	[thread overview]
Message-ID: <1230633305.3850.2.camel@johannes> (raw)
In-Reply-To: <18777.63336.140527.717269@localhost.localdomain> (sfid-20081230_112914_631451_C0C144BB)

[-- Attachment #1: Type: text/plain, Size: 2223 bytes --]

On Tue, 2008-12-30 at 15:56 +0530, Sujith wrote:
> Move to the advertised channel on reception of
> a CSA element. This is needed for 802.11h compliance.

Looks good, two small things:

> @@ -1645,6 +1645,12 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
>  	if (!bss)
>  		return;
>  
> +	if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3)) {
> +		struct ieee80211_channel_sw_ie *sw_elem =
> +			(struct ieee80211_channel_sw_ie *)elems->ch_switch_elem;
> +		ieee80211_process_chanswitch(sdata, sw_elem);
> +	}
> +
>  	/* was just updated in ieee80211_bss_info_update */
>  	beacon_timestamp = bss->timestamp;

We already have a bss pointer here, would it be better to pass that in,
avoid the bss lookup, and do the bss lookup manually in the action frame
case, to avoid a double lookup here?

> +void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
> +				  struct ieee80211_channel_sw_ie *sw_elem)
> +{
> +	struct ieee80211_bss *bss;
> +	struct ieee80211_channel *new_ch;
> +	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
> +	int ret, exp;
> +	int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num);
> +
> +	/* FIXME: Handle ADHOC later */
> +	if (sdata->vif.type != NL80211_IFTYPE_STATION)
> +		return;
> +
> +	if (ifsta->state != IEEE80211_STA_MLME_ASSOCIATED)
> +		return;
> +
> +	if (sdata->local->sw_scanning || sdata->local->hw_scanning)
> +		return;
> +
> +	/* Disregard subsequent beacons if we are already running a timer
> +	   processing a CSA */
> +
> +	if (ifsta->flags & IEEE80211_STA_CSA_RECEIVED)
> +		return;
> +
> +	new_ch = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
> +	if (!new_ch || new_ch->flags & IEEE80211_CHAN_DISABLED)
> +		return;
> +
> +	bss = ieee80211_rx_bss_get(sdata->local, ifsta->bssid,
> +				   sdata->local->hw.conf.channel->center_freq,
> +				   ifsta->ssid, ifsta->ssid_len);
> +	if (!bss)
> +		return;
> +
> +	sdata->local->oper_channel = new_ch;
> +
> +	if (sw_elem->count <= 1) {
> +		ret = ieee80211_hw_config(sdata->local,
> +					  IEEE80211_CONF_CHANGE_CHANNEL);

Didn't you want to put this into the workqueue?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2008-12-30 10:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 10:26 [RFC v2] mac80211: Add 802.11h CSA support Sujith
2008-12-30 10:35 ` Johannes Berg [this message]
2008-12-30 10:39   ` Sujith
2008-12-30 10:45     ` Johannes Berg
2008-12-30 10:51       ` Sujith

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=1230633305.3850.2.camel@johannes \
    --to=johannes@sipsolutions.net \
    --cc=jouni.malinen@atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=m.sujith@gmail.com \
    /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