stating: rtl8723au: Use kmalloc instead of vmalloc to allocate pool of xmit_frame_ext
authorJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 9 May 2014 13:03:53 +0000 (15:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 May 2014 20:12:00 +0000 (13:12 -0700)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_xmit.c
drivers/staging/rtl8723au/include/rtw_xmit.h

index f824b9ff2cd667eb23498f7ba7ada045482998d1..1ab7ded5679d2f3482390f1338cdcb9d444c9b6b 100644 (file)
@@ -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; i<num_xmit_extbuf; i++) {
-                       rtw_os_xmit_complete23a(padapter, pxframe);
-                       pxframe++;
-               }
+       list_for_each_safe(plist, ptmp,
+                          &pxmitpriv->free_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) {
index e6d417c5e09aab91946400781c9d89683e87f7f6..19c08d54c845ffe17b2e181bb252decc9b635ac5 100644 (file)
@@ -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;