aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c56
1 files changed, 46 insertions, 10 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 73cf126cef49..b729c005a2b3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -149,7 +149,17 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
149 pos++; 149 pos++;
150 150
151 /* IEEE80211_RADIOTAP_RATE */ 151 /* IEEE80211_RADIOTAP_RATE */
152 *pos = rate->bitrate / 5; 152 if (status->flag & RX_FLAG_HT) {
153 /*
154 * TODO: add following information into radiotap header once
155 * suitable fields are defined for it:
156 * - MCS index (status->rate_idx)
157 * - HT40 (status->flag & RX_FLAG_40MHZ)
158 * - short-GI (status->flag & RX_FLAG_SHORT_GI)
159 */
160 *pos = 0;
161 } else
162 *pos = rate->bitrate / 5;
153 pos++; 163 pos++;
154 164
155 /* IEEE80211_RADIOTAP_CHANNEL */ 165 /* IEEE80211_RADIOTAP_CHANNEL */
@@ -1849,9 +1859,15 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1849 if (!(sdata->dev->flags & IFF_PROMISC)) 1859 if (!(sdata->dev->flags & IFF_PROMISC))
1850 return 0; 1860 return 0;
1851 rx->flags &= ~IEEE80211_RX_RA_MATCH; 1861 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1852 } else if (!rx->sta) 1862 } else if (!rx->sta) {
1863 int rate_idx;
1864 if (rx->status->flag & RX_FLAG_HT)
1865 rate_idx = 0; /* TODO: HT rates */
1866 else
1867 rate_idx = rx->status->rate_idx;
1853 rx->sta = ieee80211_ibss_add_sta(sdata, bssid, hdr->addr2, 1868 rx->sta = ieee80211_ibss_add_sta(sdata, bssid, hdr->addr2,
1854 BIT(rx->status->rate_idx)); 1869 BIT(rate_idx));
1870 }
1855 break; 1871 break;
1856 case NL80211_IFTYPE_MESH_POINT: 1872 case NL80211_IFTYPE_MESH_POINT:
1857 if (!multicast && 1873 if (!multicast &&
@@ -2057,7 +2073,13 @@ static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2057 tid_agg_rx->reorder_buf[index]->cb, 2073 tid_agg_rx->reorder_buf[index]->cb,
2058 sizeof(status)); 2074 sizeof(status));
2059 sband = local->hw.wiphy->bands[status.band]; 2075 sband = local->hw.wiphy->bands[status.band];
2060 rate = &sband->bitrates[status.rate_idx]; 2076 if (status.flag & RX_FLAG_HT) {
2077 /* TODO: HT rates */
2078 rate = sband->bitrates;
2079 } else {
2080 rate = &sband->bitrates
2081 [status.rate_idx];
2082 }
2061 __ieee80211_rx_handle_packet(hw, 2083 __ieee80211_rx_handle_packet(hw,
2062 tid_agg_rx->reorder_buf[index], 2084 tid_agg_rx->reorder_buf[index],
2063 &status, rate); 2085 &status, rate);
@@ -2101,7 +2123,10 @@ static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2101 memcpy(&status, tid_agg_rx->reorder_buf[index]->cb, 2123 memcpy(&status, tid_agg_rx->reorder_buf[index]->cb,
2102 sizeof(status)); 2124 sizeof(status));
2103 sband = local->hw.wiphy->bands[status.band]; 2125 sband = local->hw.wiphy->bands[status.band];
2104 rate = &sband->bitrates[status.rate_idx]; 2126 if (status.flag & RX_FLAG_HT)
2127 rate = sband->bitrates; /* TODO: HT rates */
2128 else
2129 rate = &sband->bitrates[status.rate_idx];
2105 __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index], 2130 __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index],
2106 &status, rate); 2131 &status, rate);
2107 tid_agg_rx->stored_mpdu_num--; 2132 tid_agg_rx->stored_mpdu_num--;
@@ -2189,15 +2214,26 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
2189 } 2214 }
2190 2215
2191 sband = local->hw.wiphy->bands[status->band]; 2216 sband = local->hw.wiphy->bands[status->band];
2192 2217 if (!sband) {
2193 if (!sband ||
2194 status->rate_idx < 0 ||
2195 status->rate_idx >= sband->n_bitrates) {
2196 WARN_ON(1); 2218 WARN_ON(1);
2197 return; 2219 return;
2198 } 2220 }
2199 2221
2200 rate = &sband->bitrates[status->rate_idx]; 2222 if (status->flag & RX_FLAG_HT) {
2223 /* rate_idx is MCS index */
2224 if (WARN_ON(status->rate_idx < 0 ||
2225 status->rate_idx >= 76))
2226 return;
2227 /* HT rates are not in the table - use the highest legacy rate
2228 * for now since other parts of mac80211 may not yet be fully
2229 * MCS aware. */
2230 rate = &sband->bitrates[sband->n_bitrates - 1];
2231 } else {
2232 if (WARN_ON(status->rate_idx < 0 ||
2233 status->rate_idx >= sband->n_bitrates))
2234 return;
2235 rate = &sband->bitrates[status->rate_idx];
2236 }
2201 2237
2202 /* 2238 /*
2203 * key references and virtual interfaces are protected using RCU 2239 * key references and virtual interfaces are protected using RCU