a8df8e3c05ba15e18094df0f43095bf9424f7d3b
[openwrt.git] / package / madwifi / patches / 319-no_queue_stop.patch
1 Index: madwifi-dfs-r3252/ath/if_ath.c
2 ===================================================================
3 --- madwifi-dfs-r3252.orig/ath/if_ath.c 2008-01-26 06:36:36.889082972 +0100
4 +++ madwifi-dfs-r3252/ath/if_ath.c      2008-01-26 06:41:35.670109540 +0100
5 @@ -3082,46 +3082,44 @@
6  {
7         struct ath_buf* bf = NULL;
8         ATH_TXBUF_LOCK_ASSERT(sc);
9 +
10         /* Reserve at least ATH_TXBUF_MGT_RESERVED buffers for management frames */
11 -       if (ath_get_buffers_available() <= ATH_TXBUF_MGT_RESERVED) {
12 +       if (!for_management && (ath_get_buffers_available() <= ATH_TXBUF_MGT_RESERVED)) {
13                 /* Stop the queue, we are full */
14                 DPRINTF(sc, ATH_DEBUG_XMIT, "%s: stopping queuing of additional "
15                                             "frames.  Insufficient free "
16                                             "buffers.\n", __func__);
17                 sc->sc_stats.ast_tx_qstop++;
18 -               netif_stop_queue(sc->sc_dev);
19 -               sc->sc_devstopped = 1;
20                 ATH_SCHEDULE_TQUEUE(&sc->sc_txtq, NULL);
21 +               return NULL;
22         }
23  
24         /* Only let us go further if management frame, or there are enough */
25 -       if (for_management || (ath_get_buffers_available() > ATH_TXBUF_MGT_RESERVED)) {
26 -               bf = STAILQ_FIRST(&sc->sc_txbuf);
27 -               if (bf) {
28 -                       STAILQ_REMOVE_HEAD(&sc->sc_txbuf, bf_list);
29 -                       /* This should be redundant, unless someone illegally 
30 -                        * accessed the buffer after returning it. */
31 +       bf = STAILQ_FIRST(&sc->sc_txbuf);
32 +       if (bf) {
33 +               STAILQ_REMOVE_HEAD(&sc->sc_txbuf, bf_list);
34 +               /* This should be redundant, unless someone illegally 
35 +                * accessed the buffer after returning it. */
36  #ifdef IEEE80211_DEBUG_REFCNT
37 -                       cleanup_ath_buf_debug(sc, bf, BUS_DMA_TODEVICE, func, line);
38 +               cleanup_ath_buf_debug(sc, bf, BUS_DMA_TODEVICE, func, line);
39  #else
40 -                       cleanup_ath_buf(sc, bf, BUS_DMA_TODEVICE);
41 +               cleanup_ath_buf(sc, bf, BUS_DMA_TODEVICE);
42  #endif
43 -                       atomic_inc(&ath_buf_counter);
44 +               atomic_inc(&ath_buf_counter);
45  #ifdef IEEE80211_DEBUG_REFCNT
46 -                       DPRINTF(sc, ATH_DEBUG_TXBUF, 
47 -                               "[TXBUF=%03d/%03d] %s:%d -> %s:%d took txbuf %p.\n", 
48 -                               ath_get_buffer_count(), ATH_TXBUF,
49 -                               func, line, __func__, __LINE__,
50 -                               bf);
51 +               DPRINTF(sc, ATH_DEBUG_TXBUF, 
52 +                       "[TXBUF=%03d/%03d] %s:%d -> %s:%d took txbuf %p.\n", 
53 +                       ath_get_buffer_count(), ATH_TXBUF,
54 +                       func, line, __func__, __LINE__,
55 +                       bf);
56  #endif
57 -               }
58 -               else {
59 -                       DPRINTF(sc, ATH_DEBUG_ANY, 
60 -                               "%s: discard %s, no xmit buffers available.\n", 
61 -                               __func__,
62 -                               for_management ? "management frame" : "frame");
63 -                       sc->sc_stats.ast_tx_nobuf++;
64 -               }
65 +       }
66 +       else {
67 +               DPRINTF(sc, ATH_DEBUG_ANY, 
68 +                       "%s: discard %s, no xmit buffers available.\n", 
69 +                       __func__,
70 +                       for_management ? "management frame" : "frame");
71 +               sc->sc_stats.ast_tx_nobuf++;
72         }
73  
74         return bf;
75 @@ -3503,9 +3501,6 @@
76         /* Pass control of the skb to the caller (i.e., resources are their 
77          * problem). */
78         if (requeue) {
79 -               /* queue is full, let the kernel backlog the skb */
80 -               netif_stop_queue(dev);
81 -               sc->sc_devstopped = 1;
82                 /* Stop tracking again we are giving it back*/
83                 ieee80211_skb_untrack(skb);
84                 return NETDEV_TX_BUSY;
85 @@ -12871,21 +12866,6 @@
86                 ath_get_buffer_count(), ATH_TXBUF,
87                 func, line, __func__, __LINE__, bfaddr);
88  #endif /* #ifdef IEEE80211_DEBUG_REFCNT */
89 -       if (sc->sc_devstopped) {
90 -               ++sc->sc_reapcount;
91 -               if (sc->sc_reapcount > ATH_TXBUF_FREE_THRESHOLD) {
92 -                       if (!ath_radio_silence_required_for_dfs(sc)) {
93 -                               netif_start_queue(sc->sc_dev);
94 -                               DPRINTF(sc, ATH_DEBUG_ANY,
95 -                                   "%s: restarting queue.\n",
96 -                                   __func__);
97 -                       }
98 -                       sc->sc_reapcount = 0;
99 -                       sc->sc_devstopped = 0;
100 -               }
101 -               else if (!ath_radio_silence_required_for_dfs(sc))
102 -                       ATH_SCHEDULE_TQUEUE(&sc->sc_txtq, NULL);
103 -       }
104  
105         *bf = NULL;
106  }
107 Index: madwifi-dfs-r3252/ath/if_athvar.h
108 ===================================================================
109 --- madwifi-dfs-r3252.orig/ath/if_athvar.h      2008-01-26 06:41:42.206482027 +0100
110 +++ madwifi-dfs-r3252/ath/if_athvar.h   2008-01-26 06:41:46.646735062 +0100
111 @@ -667,7 +667,6 @@
112         unsigned int    sc_xrgrppoll:1;         /* xr group polls are active */
113         unsigned int    sc_syncbeacon:1;        /* sync/resync beacon timers */
114         unsigned int    sc_hasclrkey:1;         /* CLR key supported */
115 -       unsigned int    sc_devstopped:1;        /* stopped due to of no tx bufs */
116         unsigned int    sc_stagbeacons:1;       /* use staggered beacons */
117         unsigned int    sc_dfswait:1;           /* waiting on channel for radar detect */
118         unsigned int    sc_ackrate:1;           /* send acks at high bitrate */