Search Linux Wireless

Re: [PATCH 5/6] mac80211: rx.c/tx.c remove more users of tx/rx_data->fc

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

 



>  
> -	switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
> -	case IEEE80211_FCTL_TODS:

> +	if (ieee80211_has_a4(hdr->frame_control)) {
> +		if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS &&
> +			     sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT))
> +			return -1;
> +	} else if (ieee80211_has_tods(hdr->frame_control)) {

I don't particularly like converting a switch statement to chained ifs
in this path, you even put the most unlikely one first. With the switch,
the compiler should be able to generate just two compares for each path
(binary tree), while with this the common STA path already needs three.

We could instead open-code the binary tree that the compiler should
create for the switch, I guess, i.e.

if (has_tods()) {
	if (has_fromds()) {
		// a4 code
	} else {
		// tods code
	}
} else {
	if (has_fromds()) {
		// fromds code
	} else {
		// none
	}
}

but I think the switch is more readable.

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