Search Linux Wireless

Re: [RFC v2] mac80211: Add 802.11h CSA support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux