diff options
author | Johannes Berg <johannes.berg@intel.com> | 2018-04-20 06:49:18 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2018-05-07 14:49:44 -0400 |
commit | c096b92aa79e603995982c4d324a52ee02775b85 (patch) | |
tree | f4e59b3e0cb719909598d7b85fd78fb64a9b0ba7 /net/mac80211 | |
parent | 8db0c433692eda3a0358d72643bd0268b736767c (diff) |
mac80211: rename rtap_vendor_space to rtap_space
Since all the HE data won't fit into struct ieee80211_rx_status,
we'll (have to) move that into the SKB proper. This means we'll
need to skip over more things in the future, so rename this to
remove the vendor-only notion from it.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/rx.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 03102aff0953..0a38cc1cbebc 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> | 5 | * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> |
6 | * Copyright 2013-2014 Intel Mobile Communications GmbH | 6 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
7 | * Copyright(c) 2015 - 2017 Intel Deutschland GmbH | 7 | * Copyright(c) 2015 - 2017 Intel Deutschland GmbH |
8 | * Copyright (C) 2018 Intel Corporation | ||
8 | * | 9 | * |
9 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
@@ -97,27 +98,27 @@ static u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, | |||
97 | */ | 98 | */ |
98 | static void remove_monitor_info(struct sk_buff *skb, | 99 | static void remove_monitor_info(struct sk_buff *skb, |
99 | unsigned int present_fcs_len, | 100 | unsigned int present_fcs_len, |
100 | unsigned int rtap_vendor_space) | 101 | unsigned int rtap_space) |
101 | { | 102 | { |
102 | if (present_fcs_len) | 103 | if (present_fcs_len) |
103 | __pskb_trim(skb, skb->len - present_fcs_len); | 104 | __pskb_trim(skb, skb->len - present_fcs_len); |
104 | __pskb_pull(skb, rtap_vendor_space); | 105 | __pskb_pull(skb, rtap_space); |
105 | } | 106 | } |
106 | 107 | ||
107 | static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len, | 108 | static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len, |
108 | unsigned int rtap_vendor_space) | 109 | unsigned int rtap_space) |
109 | { | 110 | { |
110 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 111 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
111 | struct ieee80211_hdr *hdr; | 112 | struct ieee80211_hdr *hdr; |
112 | 113 | ||
113 | hdr = (void *)(skb->data + rtap_vendor_space); | 114 | hdr = (void *)(skb->data + rtap_space); |
114 | 115 | ||
115 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | | 116 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | |
116 | RX_FLAG_FAILED_PLCP_CRC | | 117 | RX_FLAG_FAILED_PLCP_CRC | |
117 | RX_FLAG_ONLY_MONITOR)) | 118 | RX_FLAG_ONLY_MONITOR)) |
118 | return true; | 119 | return true; |
119 | 120 | ||
120 | if (unlikely(skb->len < 16 + present_fcs_len + rtap_vendor_space)) | 121 | if (unlikely(skb->len < 16 + present_fcs_len + rtap_space)) |
121 | return true; | 122 | return true; |
122 | 123 | ||
123 | if (ieee80211_is_ctl(hdr->frame_control) && | 124 | if (ieee80211_is_ctl(hdr->frame_control) && |
@@ -199,7 +200,7 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local, | |||
199 | 200 | ||
200 | static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata, | 201 | static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata, |
201 | struct sk_buff *skb, | 202 | struct sk_buff *skb, |
202 | int rtap_vendor_space) | 203 | int rtap_space) |
203 | { | 204 | { |
204 | struct { | 205 | struct { |
205 | struct ieee80211_hdr_3addr hdr; | 206 | struct ieee80211_hdr_3addr hdr; |
@@ -212,14 +213,14 @@ static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata, | |||
212 | 213 | ||
213 | BUILD_BUG_ON(sizeof(action) != IEEE80211_MIN_ACTION_SIZE + 1); | 214 | BUILD_BUG_ON(sizeof(action) != IEEE80211_MIN_ACTION_SIZE + 1); |
214 | 215 | ||
215 | if (skb->len < rtap_vendor_space + sizeof(action) + | 216 | if (skb->len < rtap_space + sizeof(action) + |
216 | VHT_MUMIMO_GROUPS_DATA_LEN) | 217 | VHT_MUMIMO_GROUPS_DATA_LEN) |
217 | return; | 218 | return; |
218 | 219 | ||
219 | if (!is_valid_ether_addr(sdata->u.mntr.mu_follow_addr)) | 220 | if (!is_valid_ether_addr(sdata->u.mntr.mu_follow_addr)) |
220 | return; | 221 | return; |
221 | 222 | ||
222 | skb_copy_bits(skb, rtap_vendor_space, &action, sizeof(action)); | 223 | skb_copy_bits(skb, rtap_space, &action, sizeof(action)); |
223 | 224 | ||
224 | if (!ieee80211_is_action(action.hdr.frame_control)) | 225 | if (!ieee80211_is_action(action.hdr.frame_control)) |
225 | return; | 226 | return; |
@@ -545,7 +546,7 @@ static struct sk_buff * | |||
545 | ieee80211_make_monitor_skb(struct ieee80211_local *local, | 546 | ieee80211_make_monitor_skb(struct ieee80211_local *local, |
546 | struct sk_buff **origskb, | 547 | struct sk_buff **origskb, |
547 | struct ieee80211_rate *rate, | 548 | struct ieee80211_rate *rate, |
548 | int rtap_vendor_space, bool use_origskb) | 549 | int rtap_space, bool use_origskb) |
549 | { | 550 | { |
550 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(*origskb); | 551 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(*origskb); |
551 | int rt_hdrlen, needed_headroom; | 552 | int rt_hdrlen, needed_headroom; |
@@ -553,7 +554,7 @@ ieee80211_make_monitor_skb(struct ieee80211_local *local, | |||
553 | 554 | ||
554 | /* room for the radiotap header based on driver features */ | 555 | /* room for the radiotap header based on driver features */ |
555 | rt_hdrlen = ieee80211_rx_radiotap_hdrlen(local, status, *origskb); | 556 | rt_hdrlen = ieee80211_rx_radiotap_hdrlen(local, status, *origskb); |
556 | needed_headroom = rt_hdrlen - rtap_vendor_space; | 557 | needed_headroom = rt_hdrlen - rtap_space; |
557 | 558 | ||
558 | if (use_origskb) { | 559 | if (use_origskb) { |
559 | /* only need to expand headroom if necessary */ | 560 | /* only need to expand headroom if necessary */ |
@@ -607,7 +608,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
607 | struct ieee80211_sub_if_data *sdata; | 608 | struct ieee80211_sub_if_data *sdata; |
608 | struct sk_buff *monskb = NULL; | 609 | struct sk_buff *monskb = NULL; |
609 | int present_fcs_len = 0; | 610 | int present_fcs_len = 0; |
610 | unsigned int rtap_vendor_space = 0; | 611 | unsigned int rtap_space = 0; |
611 | struct ieee80211_sub_if_data *monitor_sdata = | 612 | struct ieee80211_sub_if_data *monitor_sdata = |
612 | rcu_dereference(local->monitor_sdata); | 613 | rcu_dereference(local->monitor_sdata); |
613 | bool only_monitor = false; | 614 | bool only_monitor = false; |
@@ -615,7 +616,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
615 | if (unlikely(status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA)) { | 616 | if (unlikely(status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA)) { |
616 | struct ieee80211_vendor_radiotap *rtap = (void *)origskb->data; | 617 | struct ieee80211_vendor_radiotap *rtap = (void *)origskb->data; |
617 | 618 | ||
618 | rtap_vendor_space = sizeof(*rtap) + rtap->len + rtap->pad; | 619 | rtap_space += sizeof(*rtap) + rtap->len + rtap->pad; |
619 | } | 620 | } |
620 | 621 | ||
621 | /* | 622 | /* |
@@ -638,13 +639,12 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
638 | } | 639 | } |
639 | 640 | ||
640 | /* ensure hdr->frame_control and vendor radiotap data are in skb head */ | 641 | /* ensure hdr->frame_control and vendor radiotap data are in skb head */ |
641 | if (!pskb_may_pull(origskb, 2 + rtap_vendor_space)) { | 642 | if (!pskb_may_pull(origskb, 2 + rtap_space)) { |
642 | dev_kfree_skb(origskb); | 643 | dev_kfree_skb(origskb); |
643 | return NULL; | 644 | return NULL; |
644 | } | 645 | } |
645 | 646 | ||
646 | only_monitor = should_drop_frame(origskb, present_fcs_len, | 647 | only_monitor = should_drop_frame(origskb, present_fcs_len, rtap_space); |
647 | rtap_vendor_space); | ||
648 | 648 | ||
649 | if (!local->monitors || (status->flag & RX_FLAG_SKIP_MONITOR)) { | 649 | if (!local->monitors || (status->flag & RX_FLAG_SKIP_MONITOR)) { |
650 | if (only_monitor) { | 650 | if (only_monitor) { |
@@ -652,12 +652,11 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
652 | return NULL; | 652 | return NULL; |
653 | } | 653 | } |
654 | 654 | ||
655 | remove_monitor_info(origskb, present_fcs_len, | 655 | remove_monitor_info(origskb, present_fcs_len, rtap_space); |
656 | rtap_vendor_space); | ||
657 | return origskb; | 656 | return origskb; |
658 | } | 657 | } |
659 | 658 | ||
660 | ieee80211_handle_mu_mimo_mon(monitor_sdata, origskb, rtap_vendor_space); | 659 | ieee80211_handle_mu_mimo_mon(monitor_sdata, origskb, rtap_space); |
661 | 660 | ||
662 | list_for_each_entry_rcu(sdata, &local->mon_list, u.mntr.list) { | 661 | list_for_each_entry_rcu(sdata, &local->mon_list, u.mntr.list) { |
663 | bool last_monitor = list_is_last(&sdata->u.mntr.list, | 662 | bool last_monitor = list_is_last(&sdata->u.mntr.list, |
@@ -665,8 +664,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
665 | 664 | ||
666 | if (!monskb) | 665 | if (!monskb) |
667 | monskb = ieee80211_make_monitor_skb(local, &origskb, | 666 | monskb = ieee80211_make_monitor_skb(local, &origskb, |
668 | rate, | 667 | rate, rtap_space, |
669 | rtap_vendor_space, | ||
670 | only_monitor && | 668 | only_monitor && |
671 | last_monitor); | 669 | last_monitor); |
672 | 670 | ||
@@ -698,7 +696,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
698 | if (!origskb) | 696 | if (!origskb) |
699 | return NULL; | 697 | return NULL; |
700 | 698 | ||
701 | remove_monitor_info(origskb, present_fcs_len, rtap_vendor_space); | 699 | remove_monitor_info(origskb, present_fcs_len, rtap_space); |
702 | return origskb; | 700 | return origskb; |
703 | } | 701 | } |
704 | 702 | ||