aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-05-05 13:35:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-06 15:15:04 -0400
commit2d3babd11f91501f49c6af212e6795bd8954f4d4 (patch)
treed17066ce7cd347ce4feecf52019565a9431395e2 /net/mac80211
parent358623c22c9fd837b3b1b444377037f72553dc9f (diff)
mac80211: Use a shared function to release frames from RX reorder buf
No need to duplicate the same code in two places (and that would be three after the followup patch). Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/rx.c70
1 files changed, 31 insertions, 39 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 6a9d89b392e3..9f2a29d1890b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2284,6 +2284,34 @@ static inline u16 seq_sub(u16 sq1, u16 sq2)
2284} 2284}
2285 2285
2286 2286
2287static void ieee80211_release_reorder_frame(struct ieee80211_hw *hw,
2288 struct tid_ampdu_rx *tid_agg_rx,
2289 int index)
2290{
2291 struct ieee80211_supported_band *sband;
2292 struct ieee80211_rate *rate;
2293 struct ieee80211_rx_status status;
2294
2295 if (!tid_agg_rx->reorder_buf[index])
2296 goto no_frame;
2297
2298 /* release the reordered frames to stack */
2299 memcpy(&status, tid_agg_rx->reorder_buf[index]->cb, sizeof(status));
2300 sband = hw->wiphy->bands[status.band];
2301 if (status.flag & RX_FLAG_HT)
2302 rate = sband->bitrates; /* TODO: HT rates */
2303 else
2304 rate = &sband->bitrates[status.rate_idx];
2305 __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index],
2306 &status, rate);
2307 tid_agg_rx->stored_mpdu_num--;
2308 tid_agg_rx->reorder_buf[index] = NULL;
2309
2310no_frame:
2311 tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num);
2312}
2313
2314
2287/* 2315/*
2288 * As it function blongs to Rx path it must be called with 2316 * As it function blongs to Rx path it must be called with
2289 * the proper rcu_read_lock protection for its flow. 2317 * the proper rcu_read_lock protection for its flow.
@@ -2295,12 +2323,8 @@ static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2295 u16 mpdu_seq_num, 2323 u16 mpdu_seq_num,
2296 int bar_req) 2324 int bar_req)
2297{ 2325{
2298 struct ieee80211_local *local = hw_to_local(hw);
2299 struct ieee80211_rx_status status;
2300 u16 head_seq_num, buf_size; 2326 u16 head_seq_num, buf_size;
2301 int index; 2327 int index;
2302 struct ieee80211_supported_band *sband;
2303 struct ieee80211_rate *rate;
2304 2328
2305 buf_size = tid_agg_rx->buf_size; 2329 buf_size = tid_agg_rx->buf_size;
2306 head_seq_num = tid_agg_rx->head_seq_num; 2330 head_seq_num = tid_agg_rx->head_seq_num;
@@ -2325,28 +2349,8 @@ static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2325 index = seq_sub(tid_agg_rx->head_seq_num, 2349 index = seq_sub(tid_agg_rx->head_seq_num,
2326 tid_agg_rx->ssn) 2350 tid_agg_rx->ssn)
2327 % tid_agg_rx->buf_size; 2351 % tid_agg_rx->buf_size;
2328 2352 ieee80211_release_reorder_frame(hw, tid_agg_rx,
2329 if (tid_agg_rx->reorder_buf[index]) { 2353 index);
2330 /* release the reordered frames to stack */
2331 memcpy(&status,
2332 tid_agg_rx->reorder_buf[index]->cb,
2333 sizeof(status));
2334 sband = local->hw.wiphy->bands[status.band];
2335 if (status.flag & RX_FLAG_HT) {
2336 /* TODO: HT rates */
2337 rate = sband->bitrates;
2338 } else {
2339 rate = &sband->bitrates
2340 [status.rate_idx];
2341 }
2342 __ieee80211_rx_handle_packet(hw,
2343 tid_agg_rx->reorder_buf[index],
2344 &status, rate);
2345 tid_agg_rx->stored_mpdu_num--;
2346 tid_agg_rx->reorder_buf[index] = NULL;
2347 }
2348 tid_agg_rx->head_seq_num =
2349 seq_inc(tid_agg_rx->head_seq_num);
2350 } 2354 }
2351 if (bar_req) 2355 if (bar_req)
2352 return 1; 2356 return 1;
@@ -2380,19 +2384,7 @@ static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2380 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) 2384 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn)
2381 % tid_agg_rx->buf_size; 2385 % tid_agg_rx->buf_size;
2382 while (tid_agg_rx->reorder_buf[index]) { 2386 while (tid_agg_rx->reorder_buf[index]) {
2383 /* release the reordered frame back to stack */ 2387 ieee80211_release_reorder_frame(hw, tid_agg_rx, index);
2384 memcpy(&status, tid_agg_rx->reorder_buf[index]->cb,
2385 sizeof(status));
2386 sband = local->hw.wiphy->bands[status.band];
2387 if (status.flag & RX_FLAG_HT)
2388 rate = sband->bitrates; /* TODO: HT rates */
2389 else
2390 rate = &sband->bitrates[status.rate_idx];
2391 __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index],
2392 &status, rate);
2393 tid_agg_rx->stored_mpdu_num--;
2394 tid_agg_rx->reorder_buf[index] = NULL;
2395 tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num);
2396 index = seq_sub(tid_agg_rx->head_seq_num, 2388 index = seq_sub(tid_agg_rx->head_seq_num,
2397 tid_agg_rx->ssn) % tid_agg_rx->buf_size; 2389 tid_agg_rx->ssn) % tid_agg_rx->buf_size;
2398 } 2390 }