summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8712/rtl8712_recv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/rtl8712/rtl8712_recv.c')
-rw-r--r--drivers/staging/rtl8712/rtl8712_recv.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 1f700171af13..df1e498e98b6 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -66,14 +66,14 @@ int r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter *padapter)
((addr_t) (precvpriv->pallocated_recv_buf) & 3);
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
- _init_listhead(&precvbuf->list);
+ INIT_LIST_HEAD(&precvbuf->list);
spin_lock_init(&precvbuf->recvbuf_lock);
res = r8712_os_recvbuf_resource_alloc(padapter, precvbuf);
if (res == _FAIL)
break;
precvbuf->ref_cnt = 0;
precvbuf->adapter = padapter;
- list_insert_tail(&precvbuf->list,
+ list_add_tail(&precvbuf->list,
&(precvpriv->free_recv_buf_queue.queue));
precvbuf++;
}
@@ -145,9 +145,8 @@ int r8712_free_recvframe(union recv_frame *precvframe,
precvframe->u.hdr.pkt = NULL;
}
spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
- list_delete(&(precvframe->u.hdr.list));
- list_insert_tail(&(precvframe->u.hdr.list),
- get_list_head(pfree_recv_queue));
+ list_del_init(&(precvframe->u.hdr.list));
+ list_add_tail(&(precvframe->u.hdr.list), &pfree_recv_queue->queue);
if (padapter != NULL) {
if (pfree_recv_queue == &precvpriv->free_recv_queue)
precvpriv->free_recvframe_cnt++;
@@ -208,10 +207,10 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
struct __queue *pfree_recv_queue;
pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
- phead = get_list_head(defrag_q);
- plist = get_next(phead);
+ phead = &defrag_q->queue;
+ plist = phead->next;
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
- list_delete(&prframe->u.list);
+ list_del_init(&prframe->u.list);
pfhdr = &prframe->u.hdr;
curfragnum = 0;
if (curfragnum != pfhdr->attrib.frag_num) {
@@ -222,8 +221,8 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
return NULL;
}
curfragnum++;
- plist = get_list_head(defrag_q);
- plist = get_next(plist);
+ plist = &defrag_q->queue;
+ plist = plist->next;
data = get_recvframe_data(prframe);
while (end_of_queue_search(phead, plist) == false) {
pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
@@ -247,7 +246,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
memcpy(pfhdr->rx_tail, pnfhdr->rx_data, pnfhdr->len);
recvframe_put(prframe, pnfhdr->len);
pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
- plist = get_next(plist);
+ plist = plist->next;
}
/* free the defrag_q queue and return the prframe */
r8712_free_recvframe_queue(defrag_q, pfree_recv_queue);
@@ -289,15 +288,15 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
if (pdefrag_q != NULL) {
if (fragnum == 0) {
/*the first fragment*/
- if (_queue_empty(pdefrag_q) == false) {
+ if (!list_empty(&pdefrag_q->queue)) {
/*free current defrag_q */
r8712_free_recvframe_queue(pdefrag_q,
pfree_recv_queue);
}
}
/* Then enqueue the 0~(n-1) fragment to the defrag_q */
- phead = get_list_head(pdefrag_q);
- list_insert_tail(&pfhdr->list, phead);
+ phead = &pdefrag_q->queue;
+ list_add_tail(&pfhdr->list, phead);
prtnframe = NULL;
} else {
/* can't find this ta's defrag_queue, so free this
@@ -311,8 +310,8 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
/* the last fragment frame
* enqueue the last fragment */
if (pdefrag_q != NULL) {
- phead = get_list_head(pdefrag_q);
- list_insert_tail(&pfhdr->list, phead);
+ phead = &pdefrag_q->queue;
+ list_add_tail(&pfhdr->list, phead);
/*call recvframe_defrag to defrag*/
precv_frame = recvframe_defrag(padapter, pdefrag_q);
prtnframe = precv_frame;
@@ -499,20 +498,20 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
&preorder_ctrl->pending_recvframe_queue;
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
- phead = get_list_head(ppending_recvframe_queue);
- plist = get_next(phead);
+ phead = &ppending_recvframe_queue->queue;
+ plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
pnextattrib = &pnextrframe->u.hdr.attrib;
if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num))
- plist = get_next(plist);
+ plist = plist->next;
else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num))
return false;
else
break;
}
- list_delete(&(prframe->u.hdr.list));
- list_insert_tail(&(prframe->u.hdr.list), plist);
+ list_del_init(&(prframe->u.hdr.list));
+ list_add_tail(&(prframe->u.hdr.list), plist);
return true;
}
@@ -528,11 +527,11 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
struct __queue *ppending_recvframe_queue =
&preorder_ctrl->pending_recvframe_queue;
- phead = get_list_head(ppending_recvframe_queue);
- plist = get_next(phead);
+ phead = &ppending_recvframe_queue->queue;
+ plist = phead->next;
/* Handling some condition for forced indicate case.*/
if (bforced == true) {
- if (is_list_empty(phead))
+ if (list_empty(phead))
return true;
else {
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
@@ -542,12 +541,12 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
}
/* Prepare indication list and indication.
* Check if there is any packet need indicate. */
- while (!is_list_empty(phead)) {
+ while (!list_empty(phead)) {
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
pattrib = &prframe->u.hdr.attrib;
if (!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) {
- plist = get_next(plist);
- list_delete(&(prframe->u.hdr.list));
+ plist = plist->next;
+ list_del_init(&(prframe->u.hdr.list));
if (SN_EQUAL(preorder_ctrl->indicate_seq,
pattrib->seq_num))
preorder_ctrl->indicate_seq =
@@ -1061,11 +1060,11 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
precvframe = r8712_alloc_recvframe(pfree_recv_queue);
if (precvframe == NULL)
goto _exit_recvbuf2recvframe;
- _init_listhead(&precvframe->u.hdr.list);
+ INIT_LIST_HEAD(&precvframe->u.hdr.list);
precvframe->u.hdr.precvbuf = NULL; /*can't access the precvbuf*/
precvframe->u.hdr.len = 0;
tmp_len = pkt_len + drvinfo_sz + RXDESC_SIZE;
- pkt_offset = (u16)_RND128(tmp_len);
+ pkt_offset = (u16)round_up(tmp_len, 128);
/* for first fragment packet, driver need allocate 1536 +
* drvinfo_sz + RXDESC_SIZE to defrag packet. */
if ((mf == 1) && (frag == 0))