net: wireless: bcmdhd: Fix frame sequence lag issue
Andrey Smolnikov [Mon, 2 Apr 2012 17:19:30 +0000 (10:19 -0700)]
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

drivers/net/wireless/bcmdhd/dhd_sdio.c

index a5f3051..49deee1 100644 (file)
@@ -21,7 +21,7 @@
  * software in any way with any other Broadcom software provided under a license
  * other than the GPL, without Broadcom's express prior written consent.
  *
- * $Id: dhd_sdio.c 315747 2012-02-18 00:16:06Z $
+ * $Id: dhd_sdio.c 324417 2012-03-29 03:15:15Z $
  */
 
 #include <typedefs.h>
@@ -754,7 +754,8 @@ dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok)
        uint oldstate = bus->clkstate;
 #endif /* DHD_DEBUG */
 
-       DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+       DHD_TRACE(("%s: Enter bus->clkstate %u target %u\n", __FUNCTION__,
+               bus->clkstate, target));
 
        /* Early exit if we're already there */
        if (bus->clkstate == target) {
@@ -4597,6 +4598,15 @@ clkwait:
 
        if (TXCTLOK(bus) && bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL))  {
                int ret, i;
+               uint8* frame_seq = bus->ctrl_frame_buf + SDPCM_FRAMETAG_LEN;
+
+               if (((bus->sih->chip == BCM4329_CHIP_ID) ||   /* limit to 4329 & 4330 for now  */
+                        (bus->sih->chip == BCM4330_CHIP_ID)) && (*frame_seq != bus->tx_seq)) {
+                       DHD_ERROR(("%s IOCTL frame seq lag detected!"
+                               " frm_seq:%d != bus->tx_seq:%d, corrected\n",
+                               __FUNCTION__, *frame_seq, bus->tx_seq));
+                       *frame_seq = bus->tx_seq;
+               }
 
                ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC,
                                      (uint8 *)bus->ctrl_frame_buf, (uint32)bus->ctrl_frame_len,
@@ -6303,11 +6313,12 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
        return bcmerror;
 }
 
+/* Get Chip ID version */
 uint dhd_bus_chip_id(dhd_pub_t *dhdp)
 {
        dhd_bus_t *bus = dhdp->bus;
 
-       return  bus->sih->chip;
+       return  bus->sih->chip;
 }
 
 int