madwifi: enable txstop workaround for ap and ibss mode only
[openwrt.git] / package / madwifi / patches / 118-txstop_workaround.patch
1 diff -urN madwifi-ng-refcount-r2313-20070505.old/ath/if_ath.c madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath.c
2 --- madwifi-ng-refcount-r2313-20070505.old/ath/if_ath.c 2007-05-13 18:17:56.196025944 +0200
3 +++ madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath.c 2007-05-13 18:17:56.284012568 +0200
4 @@ -1711,6 +1711,7 @@
5                         } 
6  #endif
7                         ATH_SCHEDULE_TQUEUE(&sc->sc_txtq, &needmark);
8 +                       sc->sc_tx_start = 0;
9                 }
10                 if (status & HAL_INT_BMISS) {
11                         sc->sc_stats.ast_bmiss++;
12 @@ -2264,6 +2265,17 @@
13                 txq->axq_link = &lastds->ds_link;
14                 ath_hal_txstart(ah, txq->axq_qnum);
15                 sc->sc_dev->trans_start = jiffies;
16 +               if ((sc->sc_opmode == HAL_M_IBSS) || (sc->sc_opmode == HAL_M_HOSTAP)) {
17 +                       if (sc->sc_tx_start) {
18 +                               if (jiffies > sc->sc_tx_start + 2 * HZ) {
19 +                                       printk("%s: Tx queue stuck. Resetting hardware...\n", sc->sc_dev->name);
20 +                                       ath_reset(sc->sc_dev);
21 +                                       sc->sc_tx_start = 0;
22 +                               }
23 +                       } else {
24 +                               sc->sc_tx_start = jiffies;
25 +                       }
26 +               }
27         }
28         ATH_TXQ_UNLOCK(txq);
29  
30 diff -urN madwifi-ng-refcount-r2313-20070505.old/ath/if_athvar.h madwifi-ng-refcount-r2313-20070505.dev/ath/if_athvar.h
31 --- madwifi-ng-refcount-r2313-20070505.old/ath/if_athvar.h      2007-05-04 23:09:29.000000000 +0200
32 +++ madwifi-ng-refcount-r2313-20070505.dev/ath/if_athvar.h      2007-05-13 18:17:56.285012416 +0200
33 @@ -689,6 +689,14 @@
34  #endif
35         u_int sc_slottimeconf;                  /* manual override for slottime */
36         int16_t sc_channoise;                   /* Measured noise of current channel (dBm) */
37 +
38 +       /* 
39 +        * Several MiniPCI cards and most SoC revs frequently cease all transmission
40 +        * when operating in IBSS mode. The reason for this is unknown and could potentially
41 +        * be a hardware bug. This variable contains the timestamp of the last successful
42 +        * transmission and is checked when enqueueing new frames
43 +        */
44 +       unsigned long sc_tx_start;
45  };
46  
47  typedef void (*ath_callback) (struct ath_softc *);