aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-11-11 10:49:25 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-11-11 11:05:43 -0500
commit0395442ad25853f50d515f4dc00e3475b0df920d (patch)
tree45f488e34a854c79826cc453d96eeaccf892a14e /net/mac80211/rx.c
parenta6d4a534e15f0e1b13b518c31219f9fb7166412a (diff)
mac80211: refactor duplicate detection
Put duplicate detection into its own RX handler, and separate out the conditions a bit to make the code more readable. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f57af5c7c12a..0f4297e2aae2 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1047,7 +1047,7 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx,
1047} 1047}
1048 1048
1049static ieee80211_rx_result debug_noinline 1049static ieee80211_rx_result debug_noinline
1050ieee80211_rx_h_check(struct ieee80211_rx_data *rx) 1050ieee80211_rx_h_check_dup(struct ieee80211_rx_data *rx)
1051{ 1051{
1052 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; 1052 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
1053 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); 1053 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
@@ -1056,10 +1056,16 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
1056 * Drop duplicate 802.11 retransmissions 1056 * Drop duplicate 802.11 retransmissions
1057 * (IEEE 802.11-2012: 9.3.2.10 "Duplicate detection and recovery") 1057 * (IEEE 802.11-2012: 9.3.2.10 "Duplicate detection and recovery")
1058 */ 1058 */
1059 if (rx->skb->len >= 24 && rx->sta && 1059
1060 !ieee80211_is_ctl(hdr->frame_control) && 1060 if (rx->skb->len < 24)
1061 !ieee80211_is_qos_nullfunc(hdr->frame_control) && 1061 return RX_CONTINUE;
1062 !is_multicast_ether_addr(hdr->addr1)) { 1062
1063 if (ieee80211_is_ctl(hdr->frame_control) ||
1064 ieee80211_is_qos_nullfunc(hdr->frame_control) ||
1065 is_multicast_ether_addr(hdr->addr1))
1066 return RX_CONTINUE;
1067
1068 if (rx->sta) {
1063 if (unlikely(ieee80211_has_retry(hdr->frame_control) && 1069 if (unlikely(ieee80211_has_retry(hdr->frame_control) &&
1064 rx->sta->last_seq_ctrl[rx->seqno_idx] == 1070 rx->sta->last_seq_ctrl[rx->seqno_idx] ==
1065 hdr->seq_ctrl)) { 1071 hdr->seq_ctrl)) {
@@ -1073,6 +1079,14 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
1073 } 1079 }
1074 } 1080 }
1075 1081
1082 return RX_CONTINUE;
1083}
1084
1085static ieee80211_rx_result debug_noinline
1086ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
1087{
1088 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
1089
1076 if (unlikely(rx->skb->len < 16)) { 1090 if (unlikely(rx->skb->len < 16)) {
1077 I802_DEBUG_INC(rx->local->rx_handlers_drop_short); 1091 I802_DEBUG_INC(rx->local->rx_handlers_drop_short);
1078 return RX_DROP_MONITOR; 1092 return RX_DROP_MONITOR;
@@ -3110,6 +3124,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
3110 goto rxh_next; \ 3124 goto rxh_next; \
3111 } while (0); 3125 } while (0);
3112 3126
3127 CALL_RXH(ieee80211_rx_h_check_dup)
3113 CALL_RXH(ieee80211_rx_h_check) 3128 CALL_RXH(ieee80211_rx_h_check)
3114 3129
3115 ieee80211_rx_reorder_ampdu(rx, &reorder_release); 3130 ieee80211_rx_reorder_ampdu(rx, &reorder_release);