Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-btrfs-devel.git] / drivers / net / wireless / mwifiex / 11n_rxreorder.c
blob7aa9aa0ac958eba09e8661d05b16a512ccec49d2
1 /*
2 * Marvell Wireless LAN device driver: 802.11n RX Re-ordering
4 * Copyright (C) 2011, Marvell International Ltd.
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
20 #include "decl.h"
21 #include "ioctl.h"
22 #include "util.h"
23 #include "fw.h"
24 #include "main.h"
25 #include "wmm.h"
26 #include "11n.h"
27 #include "11n_rxreorder.h"
30 * This function dispatches all packets in the Rx reorder table.
32 * There could be holes in the buffer, which are skipped by the function.
33 * Since the buffer is linear, the function uses rotation to simulate
34 * circular buffer.
36 static int
37 mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
38 struct mwifiex_rx_reorder_tbl
39 *rx_reor_tbl_ptr, int start_win)
41 int no_pkt_to_send, i;
42 void *rx_tmp_ptr;
43 unsigned long flags;
45 no_pkt_to_send = (start_win > rx_reor_tbl_ptr->start_win) ?
46 min((start_win - rx_reor_tbl_ptr->start_win),
47 rx_reor_tbl_ptr->win_size) : rx_reor_tbl_ptr->win_size;
49 for (i = 0; i < no_pkt_to_send; ++i) {
50 spin_lock_irqsave(&priv->rx_pkt_lock, flags);
51 rx_tmp_ptr = NULL;
52 if (rx_reor_tbl_ptr->rx_reorder_ptr[i]) {
53 rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i];
54 rx_reor_tbl_ptr->rx_reorder_ptr[i] = NULL;
56 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
57 if (rx_tmp_ptr)
58 mwifiex_process_rx_packet(priv->adapter, rx_tmp_ptr);
61 spin_lock_irqsave(&priv->rx_pkt_lock, flags);
63 * We don't have a circular buffer, hence use rotation to simulate
64 * circular buffer
66 for (i = 0; i < rx_reor_tbl_ptr->win_size - no_pkt_to_send; ++i) {
67 rx_reor_tbl_ptr->rx_reorder_ptr[i] =
68 rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i];
69 rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i] = NULL;
72 rx_reor_tbl_ptr->start_win = start_win;
73 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
75 return 0;
79 * This function dispatches all packets in the Rx reorder table until
80 * a hole is found.
82 * The start window is adjusted automatically when a hole is located.
83 * Since the buffer is linear, the function uses rotation to simulate
84 * circular buffer.
86 static int
87 mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
88 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr)
90 int i, j, xchg;
91 void *rx_tmp_ptr;
92 unsigned long flags;
94 for (i = 0; i < rx_reor_tbl_ptr->win_size; ++i) {
95 spin_lock_irqsave(&priv->rx_pkt_lock, flags);
96 if (!rx_reor_tbl_ptr->rx_reorder_ptr[i]) {
97 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
98 break;
100 rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i];
101 rx_reor_tbl_ptr->rx_reorder_ptr[i] = NULL;
102 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
103 mwifiex_process_rx_packet(priv->adapter, rx_tmp_ptr);
106 spin_lock_irqsave(&priv->rx_pkt_lock, flags);
108 * We don't have a circular buffer, hence use rotation to simulate
109 * circular buffer
111 if (i > 0) {
112 xchg = rx_reor_tbl_ptr->win_size - i;
113 for (j = 0; j < xchg; ++j) {
114 rx_reor_tbl_ptr->rx_reorder_ptr[j] =
115 rx_reor_tbl_ptr->rx_reorder_ptr[i + j];
116 rx_reor_tbl_ptr->rx_reorder_ptr[i + j] = NULL;
119 rx_reor_tbl_ptr->start_win = (rx_reor_tbl_ptr->start_win + i)
120 &(MAX_TID_VALUE - 1);
121 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
122 return 0;
126 * This function deletes the Rx reorder table and frees the memory.
128 * The function stops the associated timer and dispatches all the
129 * pending packets in the Rx reorder table before deletion.
131 static void
132 mwifiex_11n_delete_rx_reorder_tbl_entry(struct mwifiex_private *priv,
133 struct mwifiex_rx_reorder_tbl
134 *rx_reor_tbl_ptr)
136 unsigned long flags;
138 if (!rx_reor_tbl_ptr)
139 return;
141 mwifiex_11n_dispatch_pkt_until_start_win(priv, rx_reor_tbl_ptr,
142 (rx_reor_tbl_ptr->start_win +
143 rx_reor_tbl_ptr->win_size)
144 &(MAX_TID_VALUE - 1));
146 del_timer(&rx_reor_tbl_ptr->timer_context.timer);
148 spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
149 list_del(&rx_reor_tbl_ptr->list);
150 spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
152 kfree(rx_reor_tbl_ptr->rx_reorder_ptr);
153 kfree(rx_reor_tbl_ptr);
157 * This function returns the pointer to an entry in Rx reordering
158 * table which matches the given TA/TID pair.
160 static struct mwifiex_rx_reorder_tbl *
161 mwifiex_11n_get_rx_reorder_tbl(struct mwifiex_private *priv, int tid, u8 *ta)
163 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
164 unsigned long flags;
166 spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
167 list_for_each_entry(rx_reor_tbl_ptr, &priv->rx_reorder_tbl_ptr, list) {
168 if ((!memcmp(rx_reor_tbl_ptr->ta, ta, ETH_ALEN))
169 && (rx_reor_tbl_ptr->tid == tid)) {
170 spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock,
171 flags);
172 return rx_reor_tbl_ptr;
175 spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
177 return NULL;
181 * This function finds the last sequence number used in the packets
182 * buffered in Rx reordering table.
184 static int
185 mwifiex_11n_find_last_seq_num(struct mwifiex_rx_reorder_tbl *rx_reorder_tbl_ptr)
187 int i;
189 for (i = (rx_reorder_tbl_ptr->win_size - 1); i >= 0; --i)
190 if (rx_reorder_tbl_ptr->rx_reorder_ptr[i])
191 return i;
193 return -1;
197 * This function flushes all the packets in Rx reordering table.
199 * The function checks if any packets are currently buffered in the
200 * table or not. In case there are packets available, it dispatches
201 * them and then dumps the Rx reordering table.
203 static void
204 mwifiex_flush_data(unsigned long context)
206 struct reorder_tmr_cnxt *reorder_cnxt =
207 (struct reorder_tmr_cnxt *) context;
208 int start_win;
210 start_win = mwifiex_11n_find_last_seq_num(reorder_cnxt->ptr);
211 if (start_win >= 0) {
212 dev_dbg(reorder_cnxt->priv->adapter->dev,
213 "info: flush data %d\n", start_win);
214 mwifiex_11n_dispatch_pkt_until_start_win(reorder_cnxt->priv,
215 reorder_cnxt->ptr,
216 ((reorder_cnxt->ptr->start_win +
217 start_win + 1) & (MAX_TID_VALUE - 1)));
222 * This function creates an entry in Rx reordering table for the
223 * given TA/TID.
225 * The function also initializes the entry with sequence number, window
226 * size as well as initializes the timer.
228 * If the received TA/TID pair is already present, all the packets are
229 * dispatched and the window size is moved until the SSN.
231 static void
232 mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
233 int tid, int win_size, int seq_num)
235 int i;
236 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr, *new_node;
237 u16 last_seq = 0;
238 unsigned long flags;
241 * If we get a TID, ta pair which is already present dispatch all the
242 * the packets and move the window size until the ssn
244 rx_reor_tbl_ptr = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta);
245 if (rx_reor_tbl_ptr) {
246 mwifiex_11n_dispatch_pkt_until_start_win(priv, rx_reor_tbl_ptr,
247 seq_num);
248 return;
250 /* if !rx_reor_tbl_ptr then create one */
251 new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL);
252 if (!new_node) {
253 dev_err(priv->adapter->dev, "%s: failed to alloc new_node\n",
254 __func__);
255 return;
258 INIT_LIST_HEAD(&new_node->list);
259 new_node->tid = tid;
260 memcpy(new_node->ta, ta, ETH_ALEN);
261 new_node->start_win = seq_num;
262 if (mwifiex_queuing_ra_based(priv))
263 /* TODO for adhoc */
264 dev_dbg(priv->adapter->dev,
265 "info: ADHOC:last_seq=%d start_win=%d\n",
266 last_seq, new_node->start_win);
267 else
268 last_seq = priv->rx_seq[tid];
270 if (last_seq >= new_node->start_win)
271 new_node->start_win = last_seq + 1;
273 new_node->win_size = win_size;
275 new_node->rx_reorder_ptr = kzalloc(sizeof(void *) * win_size,
276 GFP_KERNEL);
277 if (!new_node->rx_reorder_ptr) {
278 kfree((u8 *) new_node);
279 dev_err(priv->adapter->dev,
280 "%s: failed to alloc reorder_ptr\n", __func__);
281 return;
284 new_node->timer_context.ptr = new_node;
285 new_node->timer_context.priv = priv;
287 init_timer(&new_node->timer_context.timer);
288 new_node->timer_context.timer.function = mwifiex_flush_data;
289 new_node->timer_context.timer.data =
290 (unsigned long) &new_node->timer_context;
292 for (i = 0; i < win_size; ++i)
293 new_node->rx_reorder_ptr[i] = NULL;
295 spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
296 list_add_tail(&new_node->list, &priv->rx_reorder_tbl_ptr);
297 spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
301 * This function prepares command for adding a BA request.
303 * Preparation includes -
304 * - Setting command ID and proper size
305 * - Setting add BA request buffer
306 * - Ensuring correct endian-ness
308 int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd, void *data_buf)
310 struct host_cmd_ds_11n_addba_req *add_ba_req =
311 (struct host_cmd_ds_11n_addba_req *)
312 &cmd->params.add_ba_req;
314 cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_REQ);
315 cmd->size = cpu_to_le16(sizeof(*add_ba_req) + S_DS_GEN);
316 memcpy(add_ba_req, data_buf, sizeof(*add_ba_req));
318 return 0;
322 * This function prepares command for adding a BA response.
324 * Preparation includes -
325 * - Setting command ID and proper size
326 * - Setting add BA response buffer
327 * - Ensuring correct endian-ness
329 int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
330 struct host_cmd_ds_command *cmd,
331 struct host_cmd_ds_11n_addba_req
332 *cmd_addba_req)
334 struct host_cmd_ds_11n_addba_rsp *add_ba_rsp =
335 (struct host_cmd_ds_11n_addba_rsp *)
336 &cmd->params.add_ba_rsp;
337 u8 tid;
338 int win_size;
339 uint16_t block_ack_param_set;
341 cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_RSP);
342 cmd->size = cpu_to_le16(sizeof(*add_ba_rsp) + S_DS_GEN);
344 memcpy(add_ba_rsp->peer_mac_addr, cmd_addba_req->peer_mac_addr,
345 ETH_ALEN);
346 add_ba_rsp->dialog_token = cmd_addba_req->dialog_token;
347 add_ba_rsp->block_ack_tmo = cmd_addba_req->block_ack_tmo;
348 add_ba_rsp->ssn = cmd_addba_req->ssn;
350 block_ack_param_set = le16_to_cpu(cmd_addba_req->block_ack_param_set);
351 tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK)
352 >> BLOCKACKPARAM_TID_POS;
353 add_ba_rsp->status_code = cpu_to_le16(ADDBA_RSP_STATUS_ACCEPT);
354 block_ack_param_set &= ~IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK;
355 /* We donot support AMSDU inside AMPDU, hence reset the bit */
356 block_ack_param_set &= ~BLOCKACKPARAM_AMSDU_SUPP_MASK;
357 block_ack_param_set |= (priv->add_ba_param.rx_win_size <<
358 BLOCKACKPARAM_WINSIZE_POS);
359 add_ba_rsp->block_ack_param_set = cpu_to_le16(block_ack_param_set);
360 win_size = (le16_to_cpu(add_ba_rsp->block_ack_param_set)
361 & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK)
362 >> BLOCKACKPARAM_WINSIZE_POS;
363 cmd_addba_req->block_ack_param_set = cpu_to_le16(block_ack_param_set);
365 mwifiex_11n_create_rx_reorder_tbl(priv, cmd_addba_req->peer_mac_addr,
366 tid, win_size, le16_to_cpu(cmd_addba_req->ssn));
367 return 0;
371 * This function prepares command for deleting a BA request.
373 * Preparation includes -
374 * - Setting command ID and proper size
375 * - Setting del BA request buffer
376 * - Ensuring correct endian-ness
378 int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd, void *data_buf)
380 struct host_cmd_ds_11n_delba *del_ba = (struct host_cmd_ds_11n_delba *)
381 &cmd->params.del_ba;
383 cmd->command = cpu_to_le16(HostCmd_CMD_11N_DELBA);
384 cmd->size = cpu_to_le16(sizeof(*del_ba) + S_DS_GEN);
385 memcpy(del_ba, data_buf, sizeof(*del_ba));
387 return 0;
391 * This function identifies if Rx reordering is needed for a received packet.
393 * In case reordering is required, the function will do the reordering
394 * before sending it to kernel.
396 * The Rx reorder table is checked first with the received TID/TA pair. If
397 * not found, the received packet is dispatched immediately. But if found,
398 * the packet is reordered and all the packets in the updated Rx reordering
399 * table is dispatched until a hole is found.
401 * For sequence number less than the starting window, the packet is dropped.
403 int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
404 u16 seq_num, u16 tid,
405 u8 *ta, u8 pkt_type, void *payload)
407 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
408 int start_win, end_win, win_size, ret;
409 u16 pkt_index;
411 rx_reor_tbl_ptr =
412 mwifiex_11n_get_rx_reorder_tbl((struct mwifiex_private *) priv,
413 tid, ta);
414 if (!rx_reor_tbl_ptr) {
415 if (pkt_type != PKT_TYPE_BAR)
416 mwifiex_process_rx_packet(priv->adapter, payload);
417 return 0;
419 start_win = rx_reor_tbl_ptr->start_win;
420 win_size = rx_reor_tbl_ptr->win_size;
421 end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1);
422 del_timer(&rx_reor_tbl_ptr->timer_context.timer);
423 mod_timer(&rx_reor_tbl_ptr->timer_context.timer, jiffies
424 + (MIN_FLUSH_TIMER_MS * win_size * HZ) / 1000);
427 * If seq_num is less then starting win then ignore and drop the
428 * packet
430 if ((start_win + TWOPOW11) > (MAX_TID_VALUE - 1)) {/* Wrap */
431 if (seq_num >= ((start_win + (TWOPOW11)) & (MAX_TID_VALUE - 1))
432 && (seq_num < start_win))
433 return -1;
434 } else if ((seq_num < start_win)
435 || (seq_num > (start_win + (TWOPOW11)))) {
436 return -1;
440 * If this packet is a BAR we adjust seq_num as
441 * WinStart = seq_num
443 if (pkt_type == PKT_TYPE_BAR)
444 seq_num = ((seq_num + win_size) - 1) & (MAX_TID_VALUE - 1);
446 if (((end_win < start_win)
447 && (seq_num < (TWOPOW11 - (MAX_TID_VALUE - start_win)))
448 && (seq_num > end_win)) || ((end_win > start_win)
449 && ((seq_num > end_win) || (seq_num < start_win)))) {
450 end_win = seq_num;
451 if (((seq_num - win_size) + 1) >= 0)
452 start_win = (end_win - win_size) + 1;
453 else
454 start_win = (MAX_TID_VALUE - (win_size - seq_num)) + 1;
455 ret = mwifiex_11n_dispatch_pkt_until_start_win(priv,
456 rx_reor_tbl_ptr, start_win);
458 if (ret)
459 return ret;
462 if (pkt_type != PKT_TYPE_BAR) {
463 if (seq_num >= start_win)
464 pkt_index = seq_num - start_win;
465 else
466 pkt_index = (seq_num+MAX_TID_VALUE) - start_win;
468 if (rx_reor_tbl_ptr->rx_reorder_ptr[pkt_index])
469 return -1;
471 rx_reor_tbl_ptr->rx_reorder_ptr[pkt_index] = payload;
475 * Dispatch all packets sequentially from start_win until a
476 * hole is found and adjust the start_win appropriately
478 ret = mwifiex_11n_scan_and_dispatch(priv, rx_reor_tbl_ptr);
480 return ret;
484 * This function deletes an entry for a given TID/TA pair.
486 * The TID/TA are taken from del BA event body.
488 void
489 mwifiex_11n_delete_ba_stream_tbl(struct mwifiex_private *priv, int tid,
490 u8 *peer_mac, u8 type, int initiator)
492 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
493 struct mwifiex_tx_ba_stream_tbl *ptx_tbl;
494 u8 cleanup_rx_reorder_tbl;
495 unsigned long flags;
497 if (type == TYPE_DELBA_RECEIVE)
498 cleanup_rx_reorder_tbl = (initiator) ? true : false;
499 else
500 cleanup_rx_reorder_tbl = (initiator) ? false : true;
502 dev_dbg(priv->adapter->dev, "event: DELBA: %pM tid=%d, "
503 "initiator=%d\n", peer_mac, tid, initiator);
505 if (cleanup_rx_reorder_tbl) {
506 rx_reor_tbl_ptr = mwifiex_11n_get_rx_reorder_tbl(priv, tid,
507 peer_mac);
508 if (!rx_reor_tbl_ptr) {
509 dev_dbg(priv->adapter->dev,
510 "event: TID, TA not found in table\n");
511 return;
513 mwifiex_11n_delete_rx_reorder_tbl_entry(priv, rx_reor_tbl_ptr);
514 } else {
515 ptx_tbl = mwifiex_11n_get_tx_ba_stream_tbl(priv, tid, peer_mac);
516 if (!ptx_tbl) {
517 dev_dbg(priv->adapter->dev,
518 "event: TID, RA not found in table\n");
519 return;
522 spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
523 mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, ptx_tbl);
524 spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
529 * This function handles the command response of an add BA response.
531 * Handling includes changing the header fields into CPU format and
532 * creating the stream, provided the add BA is accepted.
534 int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
535 struct host_cmd_ds_command *resp)
537 struct host_cmd_ds_11n_addba_rsp *add_ba_rsp =
538 (struct host_cmd_ds_11n_addba_rsp *)
539 &resp->params.add_ba_rsp;
540 int tid, win_size;
541 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
542 uint16_t block_ack_param_set;
544 block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set);
546 tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK)
547 >> BLOCKACKPARAM_TID_POS;
549 * Check if we had rejected the ADDBA, if yes then do not create
550 * the stream
552 if (le16_to_cpu(add_ba_rsp->status_code) == BA_RESULT_SUCCESS) {
553 win_size = (block_ack_param_set &
554 IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK)
555 >> BLOCKACKPARAM_WINSIZE_POS;
557 dev_dbg(priv->adapter->dev, "cmd: ADDBA RSP: %pM"
558 " tid=%d ssn=%d win_size=%d\n",
559 add_ba_rsp->peer_mac_addr,
560 tid, add_ba_rsp->ssn, win_size);
561 } else {
562 dev_err(priv->adapter->dev, "ADDBA RSP: failed %pM tid=%d)\n",
563 add_ba_rsp->peer_mac_addr, tid);
565 rx_reor_tbl_ptr = mwifiex_11n_get_rx_reorder_tbl(priv,
566 tid, add_ba_rsp->peer_mac_addr);
567 if (rx_reor_tbl_ptr)
568 mwifiex_11n_delete_rx_reorder_tbl_entry(priv,
569 rx_reor_tbl_ptr);
572 return 0;
576 * This function handles BA stream timeout event by preparing and sending
577 * a command to the firmware.
579 void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv,
580 struct host_cmd_ds_11n_batimeout *event)
582 struct host_cmd_ds_11n_delba delba;
584 memset(&delba, 0, sizeof(struct host_cmd_ds_11n_delba));
585 memcpy(delba.peer_mac_addr, event->peer_mac_addr, ETH_ALEN);
587 delba.del_ba_param_set |=
588 cpu_to_le16((u16) event->tid << DELBA_TID_POS);
589 delba.del_ba_param_set |= cpu_to_le16(
590 (u16) event->origninator << DELBA_INITIATOR_POS);
591 delba.reason_code = cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT);
592 mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA, 0, 0, &delba);
596 * This function cleans up the Rx reorder table by deleting all the entries
597 * and re-initializing.
599 void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv)
601 struct mwifiex_rx_reorder_tbl *del_tbl_ptr, *tmp_node;
602 unsigned long flags;
604 spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
605 list_for_each_entry_safe(del_tbl_ptr, tmp_node,
606 &priv->rx_reorder_tbl_ptr, list) {
607 spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
608 mwifiex_11n_delete_rx_reorder_tbl_entry(priv, del_tbl_ptr);
609 spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
611 spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
613 INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr);
614 memset(priv->rx_seq, 0, sizeof(priv->rx_seq));