Search Linux Wireless

Re: [RFC v3 1/4] mac80211: enable IEEE80211_CONF_PS only when associated

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

 



On Fri, 2008-11-28 at 21:49 +0200, Kalle Valo wrote:

> @@ -953,25 +953,44 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev,
>  				    struct iw_param *wrq,
>  				    char *extra)
>  {
> +	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>  	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
> +	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
>  	struct ieee80211_conf *conf = &local->hw.conf;
> +	int ret = 0;
> +	bool ps;
>  
>  	if (wrq->disabled) {
> -		conf->flags &= ~IEEE80211_CONF_PS;
> -		return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
> +		ps = false;
> +		goto set;
>  	}
>  
>  	switch (wrq->flags & IW_POWER_MODE) {
>  	case IW_POWER_ON:       /* If not specified */
>  	case IW_POWER_MODE:     /* If set all mask */
>  	case IW_POWER_ALL_R:    /* If explicitely state all */
> -		conf->flags |= IEEE80211_CONF_PS;
> +		ps = true;
>  		break;
>  	default:                /* Otherwise we don't support it */
>  		return -EINVAL;
>  	}
>  
> -	return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
> +	if (ps == local->powersave)
> +		return ret;
> +
> +set:
> +	local->powersave = ps;
> +
> +	if (ifsta->flags && IEEE80211_STA_ASSOCIATED) {

This really needs to check you're actually in STA mode.

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