cleanup
[openwrt-10.03/.git] / package / madwifi / patches / 118-txstop_workaround.patch
1 diff -ur madwifi.old/ath/if_ath.c madwifi.dev/ath/if_ath.c
2 --- madwifi.old/ath/if_ath.c    2007-05-15 16:26:02.721036296 +0200
3 +++ madwifi.dev/ath/if_ath.c    2007-05-20 21:33:53.269103736 +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 @@ -2261,11 +2262,25 @@
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 +                       unsigned long last;
18 +                       last = sc->sc_tx_start;
19 +                       if (last) {
20 +                               if (jiffies > last + 2 * HZ) {
21 +                                       printk("%s: Tx queue stuck. Resetting hardware...\n", sc->sc_dev->name);
22 +                                       ath_reset(sc->sc_dev);
23 +                                       sc->sc_tx_start = 0;
24 +                               }
25 +                       } else {
26 +                               sc->sc_tx_start = jiffies;
27 +                       }
28 +               }
29         }
30         ATH_TXQ_UNLOCK(txq);
31  
32         sc->sc_devstats.tx_packets++;
33         sc->sc_devstats.tx_bytes += framelen;
34 +       sc->sc_tx_start = 0;
35  }
36  
37  static int 
38 @@ -7272,7 +7287,7 @@
39                 DPRINTF(sc, ATH_DEBUG_UAPSD, "%s: reaping U-APSD txq\n", __func__);
40                 uapsdq = 1;
41         }
42 -
43 +       
44         for (;;) {
45                 if (uapsdq)
46                         ATH_TXQ_UAPSDQ_LOCK_IRQ(txq);
47 diff -ur madwifi.old/ath/if_athvar.h madwifi.dev/ath/if_athvar.h
48 --- madwifi.old/ath/if_athvar.h 2007-05-04 23:09:29.000000000 +0200
49 +++ madwifi.dev/ath/if_athvar.h 2007-05-15 16:26:28.911054808 +0200
50 @@ -689,6 +689,14 @@
51  #endif
52         u_int sc_slottimeconf;                  /* manual override for slottime */
53         int16_t sc_channoise;                   /* Measured noise of current channel (dBm) */
54 +
55 +       /* 
56 +        * Several MiniPCI cards and most SoC revs frequently cease all transmission
57 +        * when operating in IBSS mode. The reason for this is unknown and could potentially
58 +        * be a hardware bug. This variable contains the timestamp of the last successful
59 +        * transmission and is checked when enqueueing new frames
60 +        */
61 +       unsigned long sc_tx_start;
62  };
63  
64  typedef void (*ath_callback) (struct ath_softc *);