staging: r8712u: Merging Realtek's latest (v2.6.6). tx: NULL _in_ spin lock.
authorAli Bahar <ali@internetdog.org>
Sat, 3 Sep 2011 19:14:18 +0000 (03:14 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 7 Sep 2011 00:00:34 +0000 (17:00 -0700)
In transmit path, r8712_free_xmitframe(), the pkt pointer is now
NULLed _within_ the spin lock.

Signed-off-by: Ali Bahar <ali@internetDog.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8712/drv_types.h
drivers/staging/rtl8712/rtl871x_xmit.c
drivers/staging/rtl8712/xmit_linux.c
drivers/staging/rtl8712/xmit_osdep.h

index 6e16d58332a5b08b88d93c33d4f3a313b9275329..9b5d771e650ca240d99bd625fcd3ec33b090914f 100644 (file)
@@ -181,6 +181,9 @@ struct _adapter {
        struct net_device_stats stats;
        struct iw_statistics iwstats;
        int pid; /*process id from UI*/
+       _workitem wkFilterRxFF0;
+       u8 blnEnableRxFF0Filter;
+       spinlock_t lockRxFF0Filter;
 };
 
 static inline u8 *myid(struct eeprom_priv *peepriv)
index 073493b30f4d64bbf88a053f3810626e3d61e282..8bbdee70f8670d2c4e2d98ab1515f223535dffcf 100644 (file)
@@ -152,11 +152,12 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
                pxmitbuf++;
        }
        pxmitpriv->free_xmitbuf_cnt = NR_XMITBUFF;
+       _init_workitem(&padapter->wkFilterRxFF0, r8712_SetFilter, padapter);
        alloc_hwxmits(padapter);
        init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
        tasklet_init(&pxmitpriv->xmit_tasklet,
-            (void(*)(addr_t))r8712_xmit_bh,
-            (addr_t)padapter);
+               (void(*)(unsigned long))r8712_xmit_bh,
+               (unsigned long)padapter);
        return _SUCCESS;
 }
 
@@ -612,7 +613,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
        if (make_wlanhdr(padapter, mem_start, pattrib) == _FAIL)
                return _FAIL;
        _r8712_open_pktfile(pkt, &pktfile);
-       _r8712_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen);
+       _r8712_pktfile_read(&pktfile, NULL, (uint) pattrib->pkt_hdrlen);
        if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
                /* truncate TXDESC_SIZE bytes txcmd if at mp mode for 871x */
                if (pattrib->ether_type == 0x8712) {
@@ -826,13 +827,16 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
        unsigned long irqL;
        struct  __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;
        struct _adapter *padapter = pxmitpriv->adapter;
+       struct sk_buff *pndis_pkt = NULL;
 
        if (pxmitframe == NULL)
                return;
-       if (pxmitframe->pkt)
-               r8712_xmit_complete(padapter, pxmitframe);
        spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
        list_delete(&pxmitframe->list);
+       if (pxmitframe->pkt) {
+               pndis_pkt = pxmitframe->pkt;
+               pxmitframe->pkt = NULL;
+       }
        list_insert_tail(&pxmitframe->list, get_list_head(pfree_xmit_queue));
        pxmitpriv->free_xmitframe_cnt++;
        spin_unlock_irqrestore(&pfree_xmit_queue->lock, irqL);
index d3535ba5dd43036712b3d954792eb34e056a9f80..c9703627c8f5b499515b6f3a8aa1d36fc9c9207c 100644 (file)
@@ -44,7 +44,6 @@
 
 static uint remainder_len(struct pkt_file *pfile)
 {
-       /* Kovich: Need to extend the buf_len to 64 bit ?(unsigned long long) */
        return (uint)(pfile->buf_len - ((addr_t)(pfile->cur_addr) -
               (addr_t)(pfile->buf_start)));
 }
@@ -109,6 +108,26 @@ void r8712_set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
        pattrib->subtype = WIFI_QOS_DATA_TYPE;
 }
 
+void r8712_SetFilter(struct work_struct *work)
+{
+       struct _adapter *padapter = container_of(work, struct _adapter,
+                                               wkFilterRxFF0);
+       u8  oldvalue = 0x00, newvalue = 0x00;
+       unsigned long irqL;
+
+       oldvalue = r8712_read8(padapter, 0x117);
+       newvalue = oldvalue & 0xfe;
+       r8712_write8(padapter, 0x117, newvalue);
+
+       spin_lock_irqsave(&padapter->lockRxFF0Filter, irqL);
+       padapter->blnEnableRxFF0Filter = 1;
+       spin_unlock_irqrestore(&padapter->lockRxFF0Filter, irqL);
+       do {
+               msleep(100);
+       } while (padapter->blnEnableRxFF0Filter == 1);
+       r8712_write8(padapter, 0x117, oldvalue);
+}
+
 int r8712_xmit_resource_alloc(struct _adapter *padapter,
                              struct xmit_buf *pxmitbuf)
 {
index 19f6f3c2777888d3d0b097fa45c57d045d7e7f20..8eba7ca0ddef2b36f135d7bdaac2ccd8de51d948 100644 (file)
@@ -47,6 +47,7 @@ struct xmit_frame;
 struct xmit_buf;
 
 int r8712_xmit_entry(_pkt *pkt, struct  net_device *pnetdev);
+void r8712_SetFilter(struct work_struct *work);
 int r8712_xmit_resource_alloc(struct _adapter *padapter,
                           struct xmit_buf *pxmitbuf);
 void r8712_xmit_resource_free(struct _adapter *padapter,