net: wireless: bcmdhd: Fix frame sequence lag issue
authorAndrey Smolnikov <asmolnik@broadcom.com>
Mon, 2 Apr 2012 17:19:30 +0000 (10:19 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Mon, 2 Apr 2012 23:01:29 +0000 (16:01 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcmdhd/dhd_sdio.c

index 8461d88bcfff1870e0d9080f474b18b4b3cd00ff..f751bc7ce0a6a7aea1f66aafbfdd43fe5e341fb4 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,
@@ -6289,11 +6299,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