Search Linux Wireless

Re: [RFC v2 2/8] mac80211: mesh power mode indication in QoS frames

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

 



On Mon, 2011-11-21 at 18:40 +0400, Ivan Bezyazychnyy wrote:

> +static enum nl80211_mesh_power_mode
> +ieee80211s_get_ps_mode(struct ieee80211_sub_if_data *sdata,
> +			struct ieee80211_hdr *hdr)
> +{
> +	enum nl80211_mesh_power_mode pm = NL80211_MESH_POWER_ACTIVE;
> +	struct mesh_path *mpath;
> +
> +	if (is_multicast_ether_addr(hdr->addr1)) {
> +		pm = (enum nl80211_mesh_power_mode)
> +				sdata->u.mesh.mshcfg.power_mode;

I mean here.

> +	} else {
> +		rcu_read_lock();
> +		mpath = mesh_path_lookup(hdr->addr3, sdata);
> +		if (mpath) {
> +			pm = mpath->next_hop->local_ps_mode;
> +		}

No need for braces.

> +static void ieee80211_set_mesh_ps_fields(struct ieee80211_sub_if_data *sdata,
> +					struct ieee80211_hdr *hdr)
> +{
> +	if (ieee80211_vif_is_mesh(&sdata->vif) &&
> +	    (ieee80211_is_data_qos(hdr->frame_control)
> +	     || ieee80211_is_qos_nullfunc(hdr->frame_control))) {
> +		enum nl80211_mesh_power_mode
> +				pm = ieee80211s_get_ps_mode(sdata, hdr);
> +		if (pm != NL80211_MESH_POWER_ACTIVE) {
> +			__le16 *qc = (__le16 *) ieee80211_get_qos_ctl(hdr);
> +			hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
> +			if (pm == NL80211_MESH_POWER_DEEP_SLEEP) {
> +				*qc |= cpu_to_le16(
> +					IEEE80211_QOS_CTL_MESH_PS_LEVEL);
> +			}
> +		}
> +	}
> +}

I'm sure you can write this in a more readable way, e.g. by returning
from the function if the conditions aren't met etc.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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