> > - 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