提交 251ccc2d 编写于 作者: J Jes Sorensen 提交者: Greg Kroah-Hartman

staging: rtl8723au: Use kmalloc() rather than vmalloc() to allocate xmit_frames

Signed-off-by: NJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 6042cbfd
...@@ -81,42 +81,21 @@ s32 _rtw_init_xmit_priv23a(struct xmit_priv *pxmitpriv, struct rtw_adapter *pada ...@@ -81,42 +81,21 @@ s32 _rtw_init_xmit_priv23a(struct xmit_priv *pxmitpriv, struct rtw_adapter *pada
_rtw_init_queue23a(&pxmitpriv->free_xmit_queue); _rtw_init_queue23a(&pxmitpriv->free_xmit_queue);
/*
Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,
and initialize free_xmit_frame below.
Please also apply free_txobj to link_up all the xmit_frames...
*/
pxmitpriv->pallocated_frame_buf = rtw_zvmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4);
if (pxmitpriv->pallocated_frame_buf == NULL) {
pxmitpriv->pxmit_frame_buf = NULL;
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xmit_frame fail!\n"));
res = _FAIL;
goto exit;
}
pxmitpriv->pxmit_frame_buf = PTR_ALIGN(pxmitpriv->pallocated_frame_buf, 4);
pxframe = (struct xmit_frame*) pxmitpriv->pxmit_frame_buf;
for (i = 0; i < NR_XMITFRAME; i++) { for (i = 0; i < NR_XMITFRAME; i++) {
pxframe = (struct xmit_frame *)
kzalloc(sizeof(struct xmit_frame), GFP_KERNEL);
if (!pxframe)
break;
INIT_LIST_HEAD(&pxframe->list); INIT_LIST_HEAD(&pxframe->list);
pxframe->padapter = padapter; pxframe->padapter = padapter;
pxframe->frame_tag = NULL_FRAMETAG; pxframe->frame_tag = NULL_FRAMETAG;
pxframe->pkt = NULL;
pxframe->buf_addr = NULL;
pxframe->pxmitbuf = NULL;
list_add_tail(&pxframe->list, list_add_tail(&pxframe->list,
&pxmitpriv->free_xmit_queue.queue); &pxmitpriv->free_xmit_queue.queue);
pxframe++;
} }
pxmitpriv->free_xmitframe_cnt = NR_XMITFRAME; pxmitpriv->free_xmitframe_cnt = i;
pxmitpriv->frag_len = MAX_FRAG_THRESHOLD; pxmitpriv->frag_len = MAX_FRAG_THRESHOLD;
...@@ -242,7 +221,7 @@ s32 _rtw_init_xmit_priv23a(struct xmit_priv *pxmitpriv, struct rtw_adapter *pada ...@@ -242,7 +221,7 @@ s32 _rtw_init_xmit_priv23a(struct xmit_priv *pxmitpriv, struct rtw_adapter *pada
void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv) void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
{ {
struct rtw_adapter *padapter = pxmitpriv->adapter; struct rtw_adapter *padapter = pxmitpriv->adapter;
struct xmit_frame *pxmitframe = (struct xmit_frame*) pxmitpriv->pxmit_frame_buf; struct xmit_frame *pxframe;
struct xmit_buf *pxmitbuf; struct xmit_buf *pxmitbuf;
struct list_head *plist, *ptmp; struct list_head *plist, *ptmp;
u32 num_xmit_extbuf = NR_XMIT_EXTBUFF; u32 num_xmit_extbuf = NR_XMIT_EXTBUFF;
...@@ -250,11 +229,11 @@ void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv) ...@@ -250,11 +229,11 @@ void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
rtw_hal_free_xmit_priv23a(padapter); rtw_hal_free_xmit_priv23a(padapter);
if (pxmitpriv->pxmit_frame_buf == NULL) list_for_each_safe(plist, ptmp, &pxmitpriv->free_xmit_queue.queue) {
return; pxframe = container_of(plist, struct xmit_frame, list);
for (i = 0; i < NR_XMITFRAME; i++) { list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxmitframe); rtw_os_xmit_complete23a(padapter, pxframe);
pxmitframe++; kfree(pxframe);
} }
list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) { list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) {
...@@ -264,15 +243,11 @@ void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv) ...@@ -264,15 +243,11 @@ void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
kfree(pxmitbuf); kfree(pxmitbuf);
} }
if (pxmitpriv->pallocated_frame_buf) {
rtw_vmfree(pxmitpriv->pallocated_frame_buf, NR_XMITFRAME * sizeof(struct xmit_frame) + 4);
}
/* free xframe_ext queue, the same count as extbuf */ /* free xframe_ext queue, the same count as extbuf */
if ((pxmitframe = (struct xmit_frame*)pxmitpriv->xframe_ext)) { if ((pxframe = (struct xmit_frame*)pxmitpriv->xframe_ext)) {
for (i = 0; i<num_xmit_extbuf; i++) { for (i = 0; i<num_xmit_extbuf; i++) {
rtw_os_xmit_complete23a(padapter, pxmitframe); rtw_os_xmit_complete23a(padapter, pxframe);
pxmitframe++; pxframe++;
} }
} }
if (pxmitpriv->xframe_ext_alloc_addr) if (pxmitpriv->xframe_ext_alloc_addr)
......
...@@ -286,9 +286,7 @@ struct xmit_priv { ...@@ -286,9 +286,7 @@ struct xmit_priv {
struct rtw_queue vo_pending; struct rtw_queue vo_pending;
struct rtw_queue bm_pending; struct rtw_queue bm_pending;
u8 *pallocated_frame_buf; int free_xmitframe_cnt;
u8 *pxmit_frame_buf;
uint free_xmitframe_cnt;
struct rtw_queue free_xmit_queue; struct rtw_queue free_xmit_queue;
u8 *xframe_ext_alloc_addr; u8 *xframe_ext_alloc_addr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册