提交 8c00228e 编写于 作者: Y Yogesh Ashok Powar 提交者: John W. Linville

mwifiex: rename fuctions and variables for better readability

Renaming the long fuctions and variable names from 11n_rxreoder.c
file to shorter ones for better readability.
Signed-off-by: NYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: NBing Zhao <bzhao@marvell.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 bb7de2ba
...@@ -27,31 +27,31 @@ ...@@ -27,31 +27,31 @@
#include "11n_rxreorder.h" #include "11n_rxreorder.h"
/* /*
* This function dispatches all packets in the Rx reorder table. * This function dispatches all packets in the Rx reorder table until the
* start window.
* *
* There could be holes in the buffer, which are skipped by the function. * There could be holes in the buffer, which are skipped by the function.
* Since the buffer is linear, the function uses rotation to simulate * Since the buffer is linear, the function uses rotation to simulate
* circular buffer. * circular buffer.
*/ */
static void static void
mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv, mwifiex_11n_dispatch_pkt(struct mwifiex_private *priv,
struct mwifiex_rx_reorder_tbl struct mwifiex_rx_reorder_tbl *tbl, int start_win)
*rx_reor_tbl_ptr, int start_win)
{ {
int no_pkt_to_send, i; int pkt_to_send, i;
void *rx_tmp_ptr; void *rx_tmp_ptr;
unsigned long flags; unsigned long flags;
no_pkt_to_send = (start_win > rx_reor_tbl_ptr->start_win) ? pkt_to_send = (start_win > tbl->start_win) ?
min((start_win - rx_reor_tbl_ptr->start_win), min((start_win - tbl->start_win), tbl->win_size) :
rx_reor_tbl_ptr->win_size) : rx_reor_tbl_ptr->win_size; tbl->win_size;
for (i = 0; i < no_pkt_to_send; ++i) { for (i = 0; i < pkt_to_send; ++i) {
spin_lock_irqsave(&priv->rx_pkt_lock, flags); spin_lock_irqsave(&priv->rx_pkt_lock, flags);
rx_tmp_ptr = NULL; rx_tmp_ptr = NULL;
if (rx_reor_tbl_ptr->rx_reorder_ptr[i]) { if (tbl->rx_reorder_ptr[i]) {
rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i]; rx_tmp_ptr = tbl->rx_reorder_ptr[i];
rx_reor_tbl_ptr->rx_reorder_ptr[i] = NULL; tbl->rx_reorder_ptr[i] = NULL;
} }
spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
if (rx_tmp_ptr) if (rx_tmp_ptr)
...@@ -63,13 +63,12 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv, ...@@ -63,13 +63,12 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
* We don't have a circular buffer, hence use rotation to simulate * We don't have a circular buffer, hence use rotation to simulate
* circular buffer * circular buffer
*/ */
for (i = 0; i < rx_reor_tbl_ptr->win_size - no_pkt_to_send; ++i) { for (i = 0; i < tbl->win_size - pkt_to_send; ++i) {
rx_reor_tbl_ptr->rx_reorder_ptr[i] = tbl->rx_reorder_ptr[i] = tbl->rx_reorder_ptr[pkt_to_send + i];
rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i]; tbl->rx_reorder_ptr[pkt_to_send + i] = NULL;
rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i] = NULL;
} }
rx_reor_tbl_ptr->start_win = start_win; tbl->start_win = start_win;
spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
} }
...@@ -83,20 +82,20 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv, ...@@ -83,20 +82,20 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
*/ */
static void static void
mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv, mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr) struct mwifiex_rx_reorder_tbl *tbl)
{ {
int i, j, xchg; int i, j, xchg;
void *rx_tmp_ptr; void *rx_tmp_ptr;
unsigned long flags; unsigned long flags;
for (i = 0; i < rx_reor_tbl_ptr->win_size; ++i) { for (i = 0; i < tbl->win_size; ++i) {
spin_lock_irqsave(&priv->rx_pkt_lock, flags); spin_lock_irqsave(&priv->rx_pkt_lock, flags);
if (!rx_reor_tbl_ptr->rx_reorder_ptr[i]) { if (!tbl->rx_reorder_ptr[i]) {
spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
break; break;
} }
rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i]; rx_tmp_ptr = tbl->rx_reorder_ptr[i];
rx_reor_tbl_ptr->rx_reorder_ptr[i] = NULL; tbl->rx_reorder_ptr[i] = NULL;
spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
mwifiex_process_rx_packet(priv->adapter, rx_tmp_ptr); mwifiex_process_rx_packet(priv->adapter, rx_tmp_ptr);
} }
...@@ -107,15 +106,13 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv, ...@@ -107,15 +106,13 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
* circular buffer * circular buffer
*/ */
if (i > 0) { if (i > 0) {
xchg = rx_reor_tbl_ptr->win_size - i; xchg = tbl->win_size - i;
for (j = 0; j < xchg; ++j) { for (j = 0; j < xchg; ++j) {
rx_reor_tbl_ptr->rx_reorder_ptr[j] = tbl->rx_reorder_ptr[j] = tbl->rx_reorder_ptr[i + j];
rx_reor_tbl_ptr->rx_reorder_ptr[i + j]; tbl->rx_reorder_ptr[i + j] = NULL;
rx_reor_tbl_ptr->rx_reorder_ptr[i + j] = NULL;
} }
} }
rx_reor_tbl_ptr->start_win = (rx_reor_tbl_ptr->start_win + i) tbl->start_win = (tbl->start_win + i) & (MAX_TID_VALUE - 1);
&(MAX_TID_VALUE - 1);
spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
} }
...@@ -126,28 +123,25 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv, ...@@ -126,28 +123,25 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
* pending packets in the Rx reorder table before deletion. * pending packets in the Rx reorder table before deletion.
*/ */
static void static void
mwifiex_11n_delete_rx_reorder_tbl_entry(struct mwifiex_private *priv, mwifiex_del_rx_reorder_entry(struct mwifiex_private *priv,
struct mwifiex_rx_reorder_tbl struct mwifiex_rx_reorder_tbl *tbl)
*rx_reor_tbl_ptr)
{ {
unsigned long flags; unsigned long flags;
if (!rx_reor_tbl_ptr) if (!tbl)
return; return;
mwifiex_11n_dispatch_pkt_until_start_win(priv, rx_reor_tbl_ptr, mwifiex_11n_dispatch_pkt(priv, tbl, (tbl->start_win + tbl->win_size) &
(rx_reor_tbl_ptr->start_win + (MAX_TID_VALUE - 1));
rx_reor_tbl_ptr->win_size)
&(MAX_TID_VALUE - 1));
del_timer(&rx_reor_tbl_ptr->timer_context.timer); del_timer(&tbl->timer_context.timer);
spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
list_del(&rx_reor_tbl_ptr->list); list_del(&tbl->list);
spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
kfree(rx_reor_tbl_ptr->rx_reorder_ptr); kfree(tbl->rx_reorder_ptr);
kfree(rx_reor_tbl_ptr); kfree(tbl);
} }
/* /*
...@@ -157,16 +151,15 @@ mwifiex_11n_delete_rx_reorder_tbl_entry(struct mwifiex_private *priv, ...@@ -157,16 +151,15 @@ mwifiex_11n_delete_rx_reorder_tbl_entry(struct mwifiex_private *priv,
static struct mwifiex_rx_reorder_tbl * static struct mwifiex_rx_reorder_tbl *
mwifiex_11n_get_rx_reorder_tbl(struct mwifiex_private *priv, int tid, u8 *ta) mwifiex_11n_get_rx_reorder_tbl(struct mwifiex_private *priv, int tid, u8 *ta)
{ {
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; struct mwifiex_rx_reorder_tbl *tbl;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
list_for_each_entry(rx_reor_tbl_ptr, &priv->rx_reorder_tbl_ptr, list) { list_for_each_entry(tbl, &priv->rx_reorder_tbl_ptr, list) {
if ((!memcmp(rx_reor_tbl_ptr->ta, ta, ETH_ALEN)) if (!memcmp(tbl->ta, ta, ETH_ALEN) && tbl->tid == tid) {
&& (rx_reor_tbl_ptr->tid == tid)) {
spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock,
flags); flags);
return rx_reor_tbl_ptr; return tbl;
} }
} }
spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
...@@ -200,22 +193,19 @@ mwifiex_11n_find_last_seq_num(struct mwifiex_rx_reorder_tbl *rx_reorder_tbl_ptr) ...@@ -200,22 +193,19 @@ mwifiex_11n_find_last_seq_num(struct mwifiex_rx_reorder_tbl *rx_reorder_tbl_ptr)
static void static void
mwifiex_flush_data(unsigned long context) mwifiex_flush_data(unsigned long context)
{ {
struct reorder_tmr_cnxt *reorder_cnxt = struct reorder_tmr_cnxt *ctx =
(struct reorder_tmr_cnxt *) context; (struct reorder_tmr_cnxt *) context;
int start_win; int start_win;
start_win = mwifiex_11n_find_last_seq_num(reorder_cnxt->ptr); start_win = mwifiex_11n_find_last_seq_num(ctx->ptr);
if (start_win < 0) if (start_win < 0)
return; return;
dev_dbg(reorder_cnxt->priv->adapter->dev, "info: flush data %d\n", dev_dbg(ctx->priv->adapter->dev, "info: flush data %d\n", start_win);
start_win); mwifiex_11n_dispatch_pkt(ctx->priv, ctx->ptr,
mwifiex_11n_dispatch_pkt_until_start_win(reorder_cnxt->priv, (ctx->ptr->start_win + start_win + 1) &
reorder_cnxt->ptr, (MAX_TID_VALUE - 1));
((reorder_cnxt->ptr->start_win
+ start_win + 1) &
(MAX_TID_VALUE - 1)));
} }
/* /*
...@@ -233,7 +223,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, ...@@ -233,7 +223,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
int tid, int win_size, int seq_num) int tid, int win_size, int seq_num)
{ {
int i; int i;
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr, *new_node; struct mwifiex_rx_reorder_tbl *tbl, *new_node;
u16 last_seq = 0; u16 last_seq = 0;
unsigned long flags; unsigned long flags;
...@@ -241,13 +231,12 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, ...@@ -241,13 +231,12 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
* If we get a TID, ta pair which is already present dispatch all the * If we get a TID, ta pair which is already present dispatch all the
* the packets and move the window size until the ssn * the packets and move the window size until the ssn
*/ */
rx_reor_tbl_ptr = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta); tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta);
if (rx_reor_tbl_ptr) { if (tbl) {
mwifiex_11n_dispatch_pkt_until_start_win(priv, rx_reor_tbl_ptr, mwifiex_11n_dispatch_pkt(priv, tbl, seq_num);
seq_num);
return; return;
} }
/* if !rx_reor_tbl_ptr then create one */ /* if !tbl then create one */
new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL); new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL);
if (!new_node) { if (!new_node) {
dev_err(priv->adapter->dev, "%s: failed to alloc new_node\n", dev_err(priv->adapter->dev, "%s: failed to alloc new_node\n",
...@@ -404,24 +393,23 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, ...@@ -404,24 +393,23 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
u16 seq_num, u16 tid, u16 seq_num, u16 tid,
u8 *ta, u8 pkt_type, void *payload) u8 *ta, u8 pkt_type, void *payload)
{ {
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; struct mwifiex_rx_reorder_tbl *tbl;
int start_win, end_win, win_size; int start_win, end_win, win_size;
u16 pkt_index; u16 pkt_index;
rx_reor_tbl_ptr = tbl = mwifiex_11n_get_rx_reorder_tbl((struct mwifiex_private *) priv,
mwifiex_11n_get_rx_reorder_tbl((struct mwifiex_private *) priv, tid, ta);
tid, ta); if (!tbl) {
if (!rx_reor_tbl_ptr) {
if (pkt_type != PKT_TYPE_BAR) if (pkt_type != PKT_TYPE_BAR)
mwifiex_process_rx_packet(priv->adapter, payload); mwifiex_process_rx_packet(priv->adapter, payload);
return 0; return 0;
} }
start_win = rx_reor_tbl_ptr->start_win; start_win = tbl->start_win;
win_size = rx_reor_tbl_ptr->win_size; win_size = tbl->win_size;
end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1); end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1);
del_timer(&rx_reor_tbl_ptr->timer_context.timer); del_timer(&tbl->timer_context.timer);
mod_timer(&rx_reor_tbl_ptr->timer_context.timer, jiffies mod_timer(&tbl->timer_context.timer,
+ (MIN_FLUSH_TIMER_MS * win_size * HZ) / 1000); jiffies + (MIN_FLUSH_TIMER_MS * win_size * HZ) / 1000);
/* /*
* If seq_num is less then starting win then ignore and drop the * If seq_num is less then starting win then ignore and drop the
...@@ -452,8 +440,7 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, ...@@ -452,8 +440,7 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
start_win = (end_win - win_size) + 1; start_win = (end_win - win_size) + 1;
else else
start_win = (MAX_TID_VALUE - (win_size - seq_num)) + 1; start_win = (MAX_TID_VALUE - (win_size - seq_num)) + 1;
mwifiex_11n_dispatch_pkt_until_start_win(priv, mwifiex_11n_dispatch_pkt(priv, tbl, start_win);
rx_reor_tbl_ptr, start_win);
} }
if (pkt_type != PKT_TYPE_BAR) { if (pkt_type != PKT_TYPE_BAR) {
...@@ -462,17 +449,17 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, ...@@ -462,17 +449,17 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
else else
pkt_index = (seq_num+MAX_TID_VALUE) - start_win; pkt_index = (seq_num+MAX_TID_VALUE) - start_win;
if (rx_reor_tbl_ptr->rx_reorder_ptr[pkt_index]) if (tbl->rx_reorder_ptr[pkt_index])
return -1; return -1;
rx_reor_tbl_ptr->rx_reorder_ptr[pkt_index] = payload; tbl->rx_reorder_ptr[pkt_index] = payload;
} }
/* /*
* Dispatch all packets sequentially from start_win until a * Dispatch all packets sequentially from start_win until a
* hole is found and adjust the start_win appropriately * hole is found and adjust the start_win appropriately
*/ */
mwifiex_11n_scan_and_dispatch(priv, rx_reor_tbl_ptr); mwifiex_11n_scan_and_dispatch(priv, tbl);
return 0; return 0;
} }
...@@ -486,7 +473,7 @@ void ...@@ -486,7 +473,7 @@ void
mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac, mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac,
u8 type, int initiator) u8 type, int initiator)
{ {
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; struct mwifiex_rx_reorder_tbl *tbl;
struct mwifiex_tx_ba_stream_tbl *ptx_tbl; struct mwifiex_tx_ba_stream_tbl *ptx_tbl;
u8 cleanup_rx_reorder_tbl; u8 cleanup_rx_reorder_tbl;
unsigned long flags; unsigned long flags;
...@@ -500,14 +487,14 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac, ...@@ -500,14 +487,14 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac,
"initiator=%d\n", peer_mac, tid, initiator); "initiator=%d\n", peer_mac, tid, initiator);
if (cleanup_rx_reorder_tbl) { if (cleanup_rx_reorder_tbl) {
rx_reor_tbl_ptr = mwifiex_11n_get_rx_reorder_tbl(priv, tid, tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid,
peer_mac); peer_mac);
if (!rx_reor_tbl_ptr) { if (!tbl) {
dev_dbg(priv->adapter->dev, dev_dbg(priv->adapter->dev,
"event: TID, TA not found in table\n"); "event: TID, TA not found in table\n");
return; return;
} }
mwifiex_11n_delete_rx_reorder_tbl_entry(priv, rx_reor_tbl_ptr); mwifiex_del_rx_reorder_entry(priv, tbl);
} else { } else {
ptx_tbl = mwifiex_get_ba_tbl(priv, tid, peer_mac); ptx_tbl = mwifiex_get_ba_tbl(priv, tid, peer_mac);
if (!ptx_tbl) { if (!ptx_tbl) {
...@@ -535,7 +522,7 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv, ...@@ -535,7 +522,7 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
(struct host_cmd_ds_11n_addba_rsp *) (struct host_cmd_ds_11n_addba_rsp *)
&resp->params.add_ba_rsp; &resp->params.add_ba_rsp;
int tid, win_size; int tid, win_size;
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; struct mwifiex_rx_reorder_tbl *tbl;
uint16_t block_ack_param_set; uint16_t block_ack_param_set;
block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set); block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set);
...@@ -557,13 +544,12 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv, ...@@ -557,13 +544,12 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
tid, add_ba_rsp->ssn, win_size); tid, add_ba_rsp->ssn, win_size);
} else { } else {
dev_err(priv->adapter->dev, "ADDBA RSP: failed %pM tid=%d)\n", dev_err(priv->adapter->dev, "ADDBA RSP: failed %pM tid=%d)\n",
add_ba_rsp->peer_mac_addr, tid); add_ba_rsp->peer_mac_addr, tid);
rx_reor_tbl_ptr = mwifiex_11n_get_rx_reorder_tbl(priv, tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid,
tid, add_ba_rsp->peer_mac_addr); add_ba_rsp->peer_mac_addr);
if (rx_reor_tbl_ptr) if (tbl)
mwifiex_11n_delete_rx_reorder_tbl_entry(priv, mwifiex_del_rx_reorder_entry(priv, tbl);
rx_reor_tbl_ptr);
} }
return 0; return 0;
...@@ -602,7 +588,7 @@ void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv) ...@@ -602,7 +588,7 @@ void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv)
list_for_each_entry_safe(del_tbl_ptr, tmp_node, list_for_each_entry_safe(del_tbl_ptr, tmp_node,
&priv->rx_reorder_tbl_ptr, list) { &priv->rx_reorder_tbl_ptr, list) {
spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
mwifiex_11n_delete_rx_reorder_tbl_entry(priv, del_tbl_ptr); mwifiex_del_rx_reorder_entry(priv, del_tbl_ptr);
spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
} }
spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册