From 3a35058f2e4c6e2a6a8bb079d16fd6c632281097 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 9 May 2014 15:03:53 +0200 Subject: [PATCH] stating: rtl8723au: Use kmalloc instead of vmalloc to allocate pool of xmit_frame_ext Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_xmit.c | 34 +++++++------------- drivers/staging/rtl8723au/include/rtw_xmit.h | 4 +-- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c index f824b9ff2cd6..1ab7ded5679d 100644 --- a/drivers/staging/rtl8723au/core/rtw_xmit.c +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c @@ -131,18 +131,11 @@ s32 _rtw_init_xmit_priv23a(struct xmit_priv *pxmitpriv, struct rtw_adapter *pada /* init xframe_ext queue, the same count as extbuf */ _rtw_init_queue23a(&pxmitpriv->free_xframe_ext_queue); - pxmitpriv->xframe_ext_alloc_addr = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_frame) + 4); - - if (pxmitpriv->xframe_ext_alloc_addr == NULL) { - pxmitpriv->xframe_ext = NULL; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xframe_ext fail!\n")); - res = _FAIL; - goto exit; - } - pxmitpriv->xframe_ext = PTR_ALIGN(pxmitpriv->xframe_ext_alloc_addr, 4); - pxframe = (struct xmit_frame*)pxmitpriv->xframe_ext; - for (i = 0; i < num_xmit_extbuf; i++) { + pxframe = (struct xmit_frame *) + kzalloc(sizeof(struct xmit_frame), GFP_KERNEL); + if (!pxframe) + break; INIT_LIST_HEAD(&pxframe->list); pxframe->padapter = padapter; @@ -157,10 +150,8 @@ s32 _rtw_init_xmit_priv23a(struct xmit_priv *pxmitpriv, struct rtw_adapter *pada list_add_tail(&pxframe->list, &pxmitpriv->free_xframe_ext_queue.queue); - - pxframe++; } - pxmitpriv->free_xframe_ext_cnt = num_xmit_extbuf; + pxmitpriv->free_xframe_ext_cnt = i; /* Init xmit extension buff */ _rtw_init_queue23a(&pxmitpriv->free_xmit_extbuf_queue); @@ -224,8 +215,6 @@ void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv) struct xmit_frame *pxframe; struct xmit_buf *pxmitbuf; struct list_head *plist, *ptmp; - u32 num_xmit_extbuf = NR_XMIT_EXTBUFF; - int i; rtw_hal_free_xmit_priv23a(padapter); @@ -244,14 +233,13 @@ void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv) } /* free xframe_ext queue, the same count as extbuf */ - if ((pxframe = (struct xmit_frame*)pxmitpriv->xframe_ext)) { - for (i = 0; ifree_xframe_ext_queue.queue) { + pxframe = container_of(plist, struct xmit_frame, list); + list_del_init(&pxframe->list); + rtw_os_xmit_complete23a(padapter, pxframe); + kfree(pxframe); } - if (pxmitpriv->xframe_ext_alloc_addr) - rtw_vmfree(pxmitpriv->xframe_ext_alloc_addr, num_xmit_extbuf * sizeof(struct xmit_frame) + 4); /* free xmit extension buff */ list_for_each_safe(plist, ptmp, &pxmitpriv->xmitextbuf_list) { diff --git a/drivers/staging/rtl8723au/include/rtw_xmit.h b/drivers/staging/rtl8723au/include/rtw_xmit.h index e6d417c5e09a..19c08d54c845 100644 --- a/drivers/staging/rtl8723au/include/rtw_xmit.h +++ b/drivers/staging/rtl8723au/include/rtw_xmit.h @@ -289,9 +289,7 @@ struct xmit_priv { int free_xmitframe_cnt; struct rtw_queue free_xmit_queue; - u8 *xframe_ext_alloc_addr; - u8 *xframe_ext; - uint free_xframe_ext_cnt; + int free_xframe_ext_cnt; struct rtw_queue free_xframe_ext_queue; uint frag_len; -- 2.20.1