rx.c (06d181a8fd58031db9c114d920b40d8820380a6e) rx.c (e3685e03b40f5ec7926d9a75bf63467fc4071df9)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 26 unchanged lines hidden (view full) ---

35 * monitor mode reception
36 *
37 * This function cleans up the SKB, i.e. it removes all the stuff
38 * only useful for monitoring.
39 */
40static struct sk_buff *remove_monitor_info(struct ieee80211_local *local,
41 struct sk_buff *skb)
42{
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 26 unchanged lines hidden (view full) ---

35 * monitor mode reception
36 *
37 * This function cleans up the SKB, i.e. it removes all the stuff
38 * only useful for monitoring.
39 */
40static struct sk_buff *remove_monitor_info(struct ieee80211_local *local,
41 struct sk_buff *skb)
42{
43 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
44
43 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) {
44 if (likely(skb->len > FCS_LEN))
45 __pskb_trim(skb, skb->len - FCS_LEN);
46 else {
47 /* driver bug */
48 WARN_ON(1);
49 dev_kfree_skb(skb);
50 return NULL;
51 }
52 }
53
45 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) {
46 if (likely(skb->len > FCS_LEN))
47 __pskb_trim(skb, skb->len - FCS_LEN);
48 else {
49 /* driver bug */
50 WARN_ON(1);
51 dev_kfree_skb(skb);
52 return NULL;
53 }
54 }
55
56 if (status->vendor_radiotap_len)
57 __pskb_pull(skb, status->vendor_radiotap_len);
58
54 return skb;
55}
56
57static inline int should_drop_frame(struct sk_buff *skb, int present_fcs_len)
58{
59 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
60 struct ieee80211_hdr *hdr;
61
59 return skb;
60}
61
62static inline int should_drop_frame(struct sk_buff *skb, int present_fcs_len)
63{
64 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
65 struct ieee80211_hdr *hdr;
66
62 hdr = (void *)(skb->data);
67 hdr = (void *)(skb->data + status->vendor_radiotap_len);
63
64 if (status->flag & (RX_FLAG_FAILED_FCS_CRC |
65 RX_FLAG_FAILED_PLCP_CRC |
66 RX_FLAG_AMPDU_IS_ZEROLEN))
67 return 1;
68
69 if (status->flag & (RX_FLAG_FAILED_FCS_CRC |
70 RX_FLAG_FAILED_PLCP_CRC |
71 RX_FLAG_AMPDU_IS_ZEROLEN))
72 return 1;
68 if (unlikely(skb->len < 16 + present_fcs_len))
73 if (unlikely(skb->len < 16 + present_fcs_len +
74 status->vendor_radiotap_len))
69 return 1;
70 if (ieee80211_is_ctl(hdr->frame_control) &&
71 !ieee80211_is_pspoll(hdr->frame_control) &&
72 !ieee80211_is_back_req(hdr->frame_control))
73 return 1;
74 return 0;
75}
76
77static int
78ieee80211_rx_radiotap_space(struct ieee80211_local *local,
79 struct ieee80211_rx_status *status)
80{
81 int len;
82
83 /* always present fields */
84 len = sizeof(struct ieee80211_radiotap_header) + 8;
85
86 /* allocate extra bitmaps */
75 return 1;
76 if (ieee80211_is_ctl(hdr->frame_control) &&
77 !ieee80211_is_pspoll(hdr->frame_control) &&
78 !ieee80211_is_back_req(hdr->frame_control))
79 return 1;
80 return 0;
81}
82
83static int
84ieee80211_rx_radiotap_space(struct ieee80211_local *local,
85 struct ieee80211_rx_status *status)
86{
87 int len;
88
89 /* always present fields */
90 len = sizeof(struct ieee80211_radiotap_header) + 8;
91
92 /* allocate extra bitmaps */
93 if (status->vendor_radiotap_len)
94 len += 4;
87 if (status->chains)
88 len += 4 * hweight8(status->chains);
89
90 if (ieee80211_have_rx_timestamp(status)) {
91 len = ALIGN(len, 8);
92 len += 8;
93 }
94 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)

--- 19 unchanged lines hidden (view full) ---

114 len += 12;
115 }
116
117 if (status->chains) {
118 /* antenna and antenna signal fields */
119 len += 2 * hweight8(status->chains);
120 }
121
95 if (status->chains)
96 len += 4 * hweight8(status->chains);
97
98 if (ieee80211_have_rx_timestamp(status)) {
99 len = ALIGN(len, 8);
100 len += 8;
101 }
102 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)

--- 19 unchanged lines hidden (view full) ---

122 len += 12;
123 }
124
125 if (status->chains) {
126 /* antenna and antenna signal fields */
127 len += 2 * hweight8(status->chains);
128 }
129
130 if (status->vendor_radiotap_len) {
131 if (WARN_ON_ONCE(status->vendor_radiotap_align == 0))
132 status->vendor_radiotap_align = 1;
133 /* align standard part of vendor namespace */
134 len = ALIGN(len, 2);
135 /* allocate standard part of vendor namespace */
136 len += 6;
137 /* align vendor-defined part */
138 len = ALIGN(len, status->vendor_radiotap_align);
139 /* vendor-defined part is already in skb */
140 }
141
122 return len;
123}
124
125/*
126 * ieee80211_add_rx_radiotap_header - add radiotap header
127 *
128 * add a radiotap header containing all the fields which the hardware provided.
129 */

--- 17 unchanged lines hidden (view full) ---

147 if (!(has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)))
148 mpdulen += FCS_LEN;
149
150 rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len);
151 memset(rthdr, 0, rtap_len);
152 it_present = &rthdr->it_present;
153
154 /* radiotap header, set always present flags */
142 return len;
143}
144
145/*
146 * ieee80211_add_rx_radiotap_header - add radiotap header
147 *
148 * add a radiotap header containing all the fields which the hardware provided.
149 */

--- 17 unchanged lines hidden (view full) ---

167 if (!(has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)))
168 mpdulen += FCS_LEN;
169
170 rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len);
171 memset(rthdr, 0, rtap_len);
172 it_present = &rthdr->it_present;
173
174 /* radiotap header, set always present flags */
155 rthdr->it_len = cpu_to_le16(rtap_len);
175 rthdr->it_len = cpu_to_le16(rtap_len + status->vendor_radiotap_len);
156 it_present_val = BIT(IEEE80211_RADIOTAP_FLAGS) |
157 BIT(IEEE80211_RADIOTAP_CHANNEL) |
158 BIT(IEEE80211_RADIOTAP_RX_FLAGS);
159
160 if (!status->chains)
161 it_present_val |= BIT(IEEE80211_RADIOTAP_ANTENNA);
162
163 for_each_set_bit(chain, &chains, IEEE80211_MAX_CHAINS) {
164 it_present_val |=
165 BIT(IEEE80211_RADIOTAP_EXT) |
166 BIT(IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE);
167 put_unaligned_le32(it_present_val, it_present);
168 it_present++;
169 it_present_val = BIT(IEEE80211_RADIOTAP_ANTENNA) |
170 BIT(IEEE80211_RADIOTAP_DBM_ANTSIGNAL);
171 }
172
176 it_present_val = BIT(IEEE80211_RADIOTAP_FLAGS) |
177 BIT(IEEE80211_RADIOTAP_CHANNEL) |
178 BIT(IEEE80211_RADIOTAP_RX_FLAGS);
179
180 if (!status->chains)
181 it_present_val |= BIT(IEEE80211_RADIOTAP_ANTENNA);
182
183 for_each_set_bit(chain, &chains, IEEE80211_MAX_CHAINS) {
184 it_present_val |=
185 BIT(IEEE80211_RADIOTAP_EXT) |
186 BIT(IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE);
187 put_unaligned_le32(it_present_val, it_present);
188 it_present++;
189 it_present_val = BIT(IEEE80211_RADIOTAP_ANTENNA) |
190 BIT(IEEE80211_RADIOTAP_DBM_ANTSIGNAL);
191 }
192
193 if (status->vendor_radiotap_len) {
194 it_present_val |= BIT(IEEE80211_RADIOTAP_VENDOR_NAMESPACE) |
195 BIT(IEEE80211_RADIOTAP_EXT);
196 put_unaligned_le32(it_present_val, it_present);
197 it_present++;
198 it_present_val = status->vendor_radiotap_bitmap;
199 }
200
173 put_unaligned_le32(it_present_val, it_present);
174
175 pos = (void *)(it_present + 1);
176
177 /* the order of the following fields is important */
178
179 /* IEEE80211_RADIOTAP_TSFT */
180 if (ieee80211_have_rx_timestamp(status)) {

--- 93 unchanged lines hidden (view full) ---

274 *pos++ = local->hw.radiotap_mcs_details;
275 *pos = 0;
276 if (status->flag & RX_FLAG_SHORT_GI)
277 *pos |= IEEE80211_RADIOTAP_MCS_SGI;
278 if (status->flag & RX_FLAG_40MHZ)
279 *pos |= IEEE80211_RADIOTAP_MCS_BW_40;
280 if (status->flag & RX_FLAG_HT_GF)
281 *pos |= IEEE80211_RADIOTAP_MCS_FMT_GF;
201 put_unaligned_le32(it_present_val, it_present);
202
203 pos = (void *)(it_present + 1);
204
205 /* the order of the following fields is important */
206
207 /* IEEE80211_RADIOTAP_TSFT */
208 if (ieee80211_have_rx_timestamp(status)) {

--- 93 unchanged lines hidden (view full) ---

302 *pos++ = local->hw.radiotap_mcs_details;
303 *pos = 0;
304 if (status->flag & RX_FLAG_SHORT_GI)
305 *pos |= IEEE80211_RADIOTAP_MCS_SGI;
306 if (status->flag & RX_FLAG_40MHZ)
307 *pos |= IEEE80211_RADIOTAP_MCS_BW_40;
308 if (status->flag & RX_FLAG_HT_GF)
309 *pos |= IEEE80211_RADIOTAP_MCS_FMT_GF;
282 if (status->flag & RX_FLAG_LDPC)
283 *pos |= IEEE80211_RADIOTAP_MCS_FEC_LDPC;
284 stbc = (status->flag & RX_FLAG_STBC_MASK) >> RX_FLAG_STBC_SHIFT;
285 *pos |= stbc << IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
286 pos++;
287 *pos++ = status->rate_idx;
288 }
289
290 if (status->flag & RX_FLAG_AMPDU_DETAILS) {
291 u16 flags = 0;

--- 26 unchanged lines hidden (view full) ---

318 *pos++ = 0;
319 }
320
321 if (status->flag & RX_FLAG_VHT) {
322 u16 known = local->hw.radiotap_vht_details;
323
324 rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_VHT);
325 /* known field - how to handle 80+80? */
310 stbc = (status->flag & RX_FLAG_STBC_MASK) >> RX_FLAG_STBC_SHIFT;
311 *pos |= stbc << IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
312 pos++;
313 *pos++ = status->rate_idx;
314 }
315
316 if (status->flag & RX_FLAG_AMPDU_DETAILS) {
317 u16 flags = 0;

--- 26 unchanged lines hidden (view full) ---

344 *pos++ = 0;
345 }
346
347 if (status->flag & RX_FLAG_VHT) {
348 u16 known = local->hw.radiotap_vht_details;
349
350 rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_VHT);
351 /* known field - how to handle 80+80? */
326 if (status->vht_flag & RX_VHT_FLAG_80P80MHZ)
352 if (status->flag & RX_FLAG_80P80MHZ)
327 known &= ~IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
328 put_unaligned_le16(known, pos);
329 pos += 2;
330 /* flags */
331 if (status->flag & RX_FLAG_SHORT_GI)
332 *pos |= IEEE80211_RADIOTAP_VHT_FLAG_SGI;
353 known &= ~IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
354 put_unaligned_le16(known, pos);
355 pos += 2;
356 /* flags */
357 if (status->flag & RX_FLAG_SHORT_GI)
358 *pos |= IEEE80211_RADIOTAP_VHT_FLAG_SGI;
333 /* in VHT, STBC is binary */
334 if (status->flag & RX_FLAG_STBC_MASK)
335 *pos |= IEEE80211_RADIOTAP_VHT_FLAG_STBC;
336 pos++;
337 /* bandwidth */
359 pos++;
360 /* bandwidth */
338 if (status->vht_flag & RX_VHT_FLAG_80MHZ)
361 if (status->flag & RX_FLAG_80MHZ)
339 *pos++ = 4;
362 *pos++ = 4;
340 else if (status->vht_flag & RX_VHT_FLAG_80P80MHZ)
363 else if (status->flag & RX_FLAG_80P80MHZ)
341 *pos++ = 0; /* marked not known above */
364 *pos++ = 0; /* marked not known above */
342 else if (status->vht_flag & RX_VHT_FLAG_160MHZ)
365 else if (status->flag & RX_FLAG_160MHZ)
343 *pos++ = 11;
344 else if (status->flag & RX_FLAG_40MHZ)
345 *pos++ = 1;
346 else /* 20 MHz */
347 *pos++ = 0;
348 /* MCS/NSS */
349 *pos = (status->rate_idx << 4) | status->vht_nss;
350 pos += 4;
351 /* coding field */
366 *pos++ = 11;
367 else if (status->flag & RX_FLAG_40MHZ)
368 *pos++ = 1;
369 else /* 20 MHz */
370 *pos++ = 0;
371 /* MCS/NSS */
372 *pos = (status->rate_idx << 4) | status->vht_nss;
373 pos += 4;
374 /* coding field */
352 if (status->flag & RX_FLAG_LDPC)
353 *pos |= IEEE80211_RADIOTAP_CODING_LDPC_USER0;
354 pos++;
355 /* group ID */
356 pos++;
357 /* partial_aid */
358 pos += 2;
359 }
360
361 for_each_set_bit(chain, &chains, IEEE80211_MAX_CHAINS) {
362 *pos++ = status->chain_signal[chain];
363 *pos++ = chain;
364 }
375 pos++;
376 /* group ID */
377 pos++;
378 /* partial_aid */
379 pos += 2;
380 }
381
382 for_each_set_bit(chain, &chains, IEEE80211_MAX_CHAINS) {
383 *pos++ = status->chain_signal[chain];
384 *pos++ = chain;
385 }
386
387 if (status->vendor_radiotap_len) {
388 /* ensure 2 byte alignment for the vendor field as required */
389 if ((pos - (u8 *)rthdr) & 1)
390 *pos++ = 0;
391 *pos++ = status->vendor_radiotap_oui[0];
392 *pos++ = status->vendor_radiotap_oui[1];
393 *pos++ = status->vendor_radiotap_oui[2];
394 *pos++ = status->vendor_radiotap_subns;
395 put_unaligned_le16(status->vendor_radiotap_len, pos);
396 pos += 2;
397 /* align the actual payload as requested */
398 while ((pos - (u8 *)rthdr) & (status->vendor_radiotap_align - 1))
399 *pos++ = 0;
400 }
365}
366
367/*
368 * This function copies a received frame to all monitor interfaces and
369 * returns a cleaned-up SKB that no longer includes the FCS nor the
370 * radiotap header the driver might have added.
371 */
372static struct sk_buff *

--- 14 unchanged lines hidden (view full) ---

387 *
388 * We don't need to, of course, if we aren't going to return
389 * the SKB because it has a bad FCS/PLCP checksum.
390 */
391
392 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
393 present_fcs_len = FCS_LEN;
394
401}
402
403/*
404 * This function copies a received frame to all monitor interfaces and
405 * returns a cleaned-up SKB that no longer includes the FCS nor the
406 * radiotap header the driver might have added.
407 */
408static struct sk_buff *

--- 14 unchanged lines hidden (view full) ---

423 *
424 * We don't need to, of course, if we aren't going to return
425 * the SKB because it has a bad FCS/PLCP checksum.
426 */
427
428 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
429 present_fcs_len = FCS_LEN;
430
395 /* ensure hdr->frame_control is in skb head */
396 if (!pskb_may_pull(origskb, 2)) {
431 /* ensure hdr->frame_control and vendor radiotap data are in skb head */
432 if (!pskb_may_pull(origskb, 2 + status->vendor_radiotap_len)) {
397 dev_kfree_skb(origskb);
398 return NULL;
399 }
400
401 if (!local->monitors) {
402 if (should_drop_frame(origskb, present_fcs_len)) {
403 dev_kfree_skb(origskb);
404 return NULL;

--- 153 unchanged lines hidden (view full) ---

558
559
560/* rx handlers */
561
562static int ieee80211_is_unicast_robust_mgmt_frame(struct sk_buff *skb)
563{
564 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
565
433 dev_kfree_skb(origskb);
434 return NULL;
435 }
436
437 if (!local->monitors) {
438 if (should_drop_frame(origskb, present_fcs_len)) {
439 dev_kfree_skb(origskb);
440 return NULL;

--- 153 unchanged lines hidden (view full) ---

594
595
596/* rx handlers */
597
598static int ieee80211_is_unicast_robust_mgmt_frame(struct sk_buff *skb)
599{
600 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
601
566 if (is_multicast_ether_addr(hdr->addr1))
602 if (skb->len < 24 || is_multicast_ether_addr(hdr->addr1))
567 return 0;
568
603 return 0;
604
569 return ieee80211_is_robust_mgmt_frame(skb);
605 return ieee80211_is_robust_mgmt_frame(hdr);
570}
571
572
573static int ieee80211_is_multicast_robust_mgmt_frame(struct sk_buff *skb)
574{
575 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
576
606}
607
608
609static int ieee80211_is_multicast_robust_mgmt_frame(struct sk_buff *skb)
610{
611 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
612
577 if (!is_multicast_ether_addr(hdr->addr1))
613 if (skb->len < 24 || !is_multicast_ether_addr(hdr->addr1))
578 return 0;
579
614 return 0;
615
580 return ieee80211_is_robust_mgmt_frame(skb);
616 return ieee80211_is_robust_mgmt_frame(hdr);
581}
582
583
584/* Get the BIP key index from MMIE; return -1 if this is not a BIP frame */
585static int ieee80211_get_mmie_keyidx(struct sk_buff *skb)
586{
587 struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
588 struct ieee80211_mmie *mmie;
589
590 if (skb->len < 24 + sizeof(*mmie) || !is_multicast_ether_addr(hdr->da))
591 return -1;
592
617}
618
619
620/* Get the BIP key index from MMIE; return -1 if this is not a BIP frame */
621static int ieee80211_get_mmie_keyidx(struct sk_buff *skb)
622{
623 struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
624 struct ieee80211_mmie *mmie;
625
626 if (skb->len < 24 + sizeof(*mmie) || !is_multicast_ether_addr(hdr->da))
627 return -1;
628
593 if (!ieee80211_is_robust_mgmt_frame(skb))
629 if (!ieee80211_is_robust_mgmt_frame((struct ieee80211_hdr *) hdr))
594 return -1; /* not a robust management frame */
595
596 mmie = (struct ieee80211_mmie *)
597 (skb->data + skb->len - sizeof(*mmie));
598 if (mmie->element_id != WLAN_EID_MMIE ||
599 mmie->length != sizeof(*mmie) - 2)
600 return -1;
601

--- 485 unchanged lines hidden (view full) ---

1087}
1088
1089static void sta_ps_end(struct sta_info *sta)
1090{
1091 ps_dbg(sta->sdata, "STA %pM aid %d exits power save mode\n",
1092 sta->sta.addr, sta->sta.aid);
1093
1094 if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
630 return -1; /* not a robust management frame */
631
632 mmie = (struct ieee80211_mmie *)
633 (skb->data + skb->len - sizeof(*mmie));
634 if (mmie->element_id != WLAN_EID_MMIE ||
635 mmie->length != sizeof(*mmie) - 2)
636 return -1;
637

--- 485 unchanged lines hidden (view full) ---

1123}
1124
1125static void sta_ps_end(struct sta_info *sta)
1126{
1127 ps_dbg(sta->sdata, "STA %pM aid %d exits power save mode\n",
1128 sta->sta.addr, sta->sta.aid);
1129
1130 if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
1131 /*
1132 * Clear the flag only if the other one is still set
1133 * so that the TX path won't start TX'ing new frames
1134 * directly ... In the case that the driver flag isn't
1135 * set ieee80211_sta_ps_deliver_wakeup() will clear it.
1136 */
1137 clear_sta_flag(sta, WLAN_STA_PS_STA);
1095 ps_dbg(sta->sdata, "STA %pM aid %d driver-ps-blocked\n",
1096 sta->sta.addr, sta->sta.aid);
1097 return;
1098 }
1099
1100 ieee80211_sta_ps_deliver_wakeup(sta);
1101}
1102

--- 117 unchanged lines hidden (view full) ---

1220 u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
1221 NL80211_IFTYPE_ADHOC);
1222 if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid) &&
1223 test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
1224 sta->last_rx = jiffies;
1225 if (ieee80211_is_data(hdr->frame_control)) {
1226 sta->last_rx_rate_idx = status->rate_idx;
1227 sta->last_rx_rate_flag = status->flag;
1138 ps_dbg(sta->sdata, "STA %pM aid %d driver-ps-blocked\n",
1139 sta->sta.addr, sta->sta.aid);
1140 return;
1141 }
1142
1143 ieee80211_sta_ps_deliver_wakeup(sta);
1144}
1145

--- 117 unchanged lines hidden (view full) ---

1263 u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
1264 NL80211_IFTYPE_ADHOC);
1265 if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid) &&
1266 test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
1267 sta->last_rx = jiffies;
1268 if (ieee80211_is_data(hdr->frame_control)) {
1269 sta->last_rx_rate_idx = status->rate_idx;
1270 sta->last_rx_rate_flag = status->flag;
1228 sta->last_rx_rate_vht_flag = status->vht_flag;
1229 sta->last_rx_rate_vht_nss = status->vht_nss;
1230 }
1231 }
1232 } else if (!is_multicast_ether_addr(hdr->addr1)) {
1233 /*
1234 * Mesh beacons will update last_rx when if they are found to
1235 * match the current local configuration when processed.
1236 */

--- 34 unchanged lines hidden (view full) ---

1271 /*
1272 * Change STA power saving mode only at the end of a frame
1273 * exchange sequence.
1274 */
1275 if (!(sta->local->hw.flags & IEEE80211_HW_AP_LINK_PS) &&
1276 !ieee80211_has_morefrags(hdr->frame_control) &&
1277 !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) &&
1278 (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
1271 sta->last_rx_rate_vht_nss = status->vht_nss;
1272 }
1273 }
1274 } else if (!is_multicast_ether_addr(hdr->addr1)) {
1275 /*
1276 * Mesh beacons will update last_rx when if they are found to
1277 * match the current local configuration when processed.
1278 */

--- 34 unchanged lines hidden (view full) ---

1313 /*
1314 * Change STA power saving mode only at the end of a frame
1315 * exchange sequence.
1316 */
1317 if (!(sta->local->hw.flags & IEEE80211_HW_AP_LINK_PS) &&
1318 !ieee80211_has_morefrags(hdr->frame_control) &&
1319 !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) &&
1320 (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
1279 rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
1280 /* PM bit is only checked in frames where it isn't reserved,
1281 * in AP mode it's reserved in non-bufferable management frames
1282 * (cf. IEEE 802.11-2012 8.2.4.1.7 Power Management field)
1283 */
1284 (!ieee80211_is_mgmt(hdr->frame_control) ||
1285 ieee80211_is_bufferable_mmpdu(hdr->frame_control))) {
1321 rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) {
1286 if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
1322 if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
1287 if (!ieee80211_has_pm(hdr->frame_control))
1323 /*
1324 * Ignore doze->wake transitions that are
1325 * indicated by non-data frames, the standard
1326 * is unclear here, but for example going to
1327 * PS mode and then scanning would cause a
1328 * doze->wake transition for the probe request,
1329 * and that is clearly undesirable.
1330 */
1331 if (ieee80211_is_data(hdr->frame_control) &&
1332 !ieee80211_has_pm(hdr->frame_control))
1288 sta_ps_end(sta);
1289 } else {
1290 if (ieee80211_has_pm(hdr->frame_control))
1291 sta_ps_start(sta);
1292 }
1293 }
1294
1295 /* mesh power save support */

--- 506 unchanged lines hidden (view full) ---

1802 rx->skb->len);
1803 return -EACCES;
1804 }
1805 /*
1806 * When using MFP, Action frames are not allowed prior to
1807 * having configured keys.
1808 */
1809 if (unlikely(ieee80211_is_action(fc) && !rx->key &&
1333 sta_ps_end(sta);
1334 } else {
1335 if (ieee80211_has_pm(hdr->frame_control))
1336 sta_ps_start(sta);
1337 }
1338 }
1339
1340 /* mesh power save support */

--- 506 unchanged lines hidden (view full) ---

1847 rx->skb->len);
1848 return -EACCES;
1849 }
1850 /*
1851 * When using MFP, Action frames are not allowed prior to
1852 * having configured keys.
1853 */
1854 if (unlikely(ieee80211_is_action(fc) && !rx->key &&
1810 ieee80211_is_robust_mgmt_frame(rx->skb)))
1855 ieee80211_is_robust_mgmt_frame(
1856 (struct ieee80211_hdr *) rx->skb->data)))
1811 return -EACCES;
1812 }
1813
1814 return 0;
1815}
1816
1817static int
1818__ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control)

--- 130 unchanged lines hidden (view full) ---

1949 }
1950 }
1951#endif
1952
1953 if (skb) {
1954 /* deliver to local stack */
1955 skb->protocol = eth_type_trans(skb, dev);
1956 memset(skb->cb, 0, sizeof(skb->cb));
1857 return -EACCES;
1858 }
1859
1860 return 0;
1861}
1862
1863static int
1864__ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control)

--- 130 unchanged lines hidden (view full) ---

1995 }
1996 }
1997#endif
1998
1999 if (skb) {
2000 /* deliver to local stack */
2001 skb->protocol = eth_type_trans(skb, dev);
2002 memset(skb->cb, 0, sizeof(skb->cb));
1957 if (rx->local->napi)
1958 napi_gro_receive(rx->local->napi, skb);
1959 else
1960 netif_receive_skb(skb);
2003 netif_receive_skb(skb);
1961 }
1962
1963 if (xmit_skb) {
1964 /*
1965 * Send to wireless media and increase priority by 256 to
1966 * keep the received priority instead of reclassifying
1967 * the frame (see cfg80211_classify8021d).
1968 */

--- 1452 unchanged lines hidden ---
2004 }
2005
2006 if (xmit_skb) {
2007 /*
2008 * Send to wireless media and increase priority by 256 to
2009 * keep the received priority instead of reclassifying
2010 * the frame (see cfg80211_classify8021d).
2011 */

--- 1452 unchanged lines hidden ---