Commit 40aefedc8b494d6a7006ceb9d051fbc58268c86e
Committed by
Johannes Berg
1 parent
65821635d2
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
mac80211: refactor ieee80211_set_qos_hdr
Return early if not a QoS Data frame. Give proper documentation. Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Showing 1 changed file with 23 additions and 17 deletions Side-by-side Diff
net/mac80211/wme.c
... | ... | @@ -160,32 +160,38 @@ |
160 | 160 | return ieee80211_downgrade_queue(sdata, skb); |
161 | 161 | } |
162 | 162 | |
163 | +/** | |
164 | + * ieee80211_set_qos_hdr - Fill in the QoS header if there is one. | |
165 | + * | |
166 | + * @sdata: local subif | |
167 | + * @skb: packet to be updated | |
168 | + */ | |
163 | 169 | void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, |
164 | 170 | struct sk_buff *skb) |
165 | 171 | { |
166 | 172 | struct ieee80211_hdr *hdr = (void *)skb->data; |
167 | 173 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
174 | + u8 *p; | |
175 | + u8 ack_policy, tid; | |
168 | 176 | |
169 | - /* Fill in the QoS header if there is one. */ | |
170 | - if (ieee80211_is_data_qos(hdr->frame_control)) { | |
171 | - u8 *p = ieee80211_get_qos_ctl(hdr); | |
172 | - u8 ack_policy, tid; | |
177 | + if (!ieee80211_is_data_qos(hdr->frame_control)) | |
178 | + return; | |
173 | 179 | |
174 | - tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; | |
180 | + p = ieee80211_get_qos_ctl(hdr); | |
181 | + tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; | |
175 | 182 | |
176 | - /* preserve EOSP bit */ | |
177 | - ack_policy = *p & IEEE80211_QOS_CTL_EOSP; | |
183 | + /* preserve EOSP bit */ | |
184 | + ack_policy = *p & IEEE80211_QOS_CTL_EOSP; | |
178 | 185 | |
179 | - if (is_multicast_ether_addr(hdr->addr1) || | |
180 | - sdata->noack_map & BIT(tid)) { | |
181 | - ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK; | |
182 | - info->flags |= IEEE80211_TX_CTL_NO_ACK; | |
183 | - } | |
184 | - | |
185 | - /* qos header is 2 bytes */ | |
186 | - *p++ = ack_policy | tid; | |
187 | - *p = ieee80211_vif_is_mesh(&sdata->vif) ? | |
188 | - (IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8) : 0; | |
186 | + if (is_multicast_ether_addr(hdr->addr1) || | |
187 | + sdata->noack_map & BIT(tid)) { | |
188 | + ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK; | |
189 | + info->flags |= IEEE80211_TX_CTL_NO_ACK; | |
189 | 190 | } |
191 | + | |
192 | + /* qos header is 2 bytes */ | |
193 | + *p++ = ack_policy | tid; | |
194 | + *p = ieee80211_vif_is_mesh(&sdata->vif) ? | |
195 | + (IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8) : 0; | |
190 | 196 | } |