mac80211: backport 2011-01-24 from trunk
[openwrt-10.03/.git] / package / mac80211 / patches / 540-ath9k_fix_queue_debug.patch
1 --- a/drivers/net/wireless/ath/ath9k/debug.c
2 +++ b/drivers/net/wireless/ath/ath9k/debug.c
3 @@ -450,14 +450,15 @@ static const struct file_operations fops
4         .llseek = default_llseek,
5  };
6  
7 +#define PR_QNUM(_n) sc->tx.txq_map[_n]->axq_qnum
8  #define PR(str, elem)                                                  \
9         do {                                                            \
10                 len += snprintf(buf + len, size - len,                  \
11                                 "%s%13u%11u%10u%10u\n", str,            \
12 -               sc->debug.stats.txstats[WME_AC_BE].elem, \
13 -               sc->debug.stats.txstats[WME_AC_BK].elem, \
14 -               sc->debug.stats.txstats[WME_AC_VI].elem, \
15 -               sc->debug.stats.txstats[WME_AC_VO].elem); \
16 +               sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem, \
17 +               sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem, \
18 +               sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem, \
19 +               sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem); \
20                 if (len >= size)                          \
21                         goto done;                        \
22  } while(0)
23 @@ -466,10 +467,10 @@ static const struct file_operations fops
24  do {                                                                   \
25         len += snprintf(buf + len, size - len,                          \
26                         "%s%13u%11u%10u%10u\n", str,                    \
27 -                       (unsigned int)(sc->tx.txq[ATH_TXQ_AC_BE].elem), \
28 -                       (unsigned int)(sc->tx.txq[ATH_TXQ_AC_BK].elem), \
29 -                       (unsigned int)(sc->tx.txq[ATH_TXQ_AC_VI].elem), \
30 -                       (unsigned int)(sc->tx.txq[ATH_TXQ_AC_VO].elem));        \
31 +                       (unsigned int)(sc->tx.txq_map[WME_AC_BE]->elem),        \
32 +                       (unsigned int)(sc->tx.txq_map[WME_AC_BK]->elem),        \
33 +                       (unsigned int)(sc->tx.txq_map[WME_AC_VI]->elem),        \
34 +                       (unsigned int)(sc->tx.txq_map[WME_AC_VO]->elem));       \
35         if (len >= size)                                                \
36                 goto done;                                              \
37  } while(0)
38 @@ -478,10 +479,10 @@ do {                                                                      \
39  do {                                                                   \
40         len += snprintf(buf + len, size - len,                          \
41                         "%s%13i%11i%10i%10i\n", str,                    \
42 -                       list_empty(&sc->tx.txq[ATH_TXQ_AC_BE].elem),    \
43 -                       list_empty(&sc->tx.txq[ATH_TXQ_AC_BK].elem),    \
44 -                       list_empty(&sc->tx.txq[ATH_TXQ_AC_VI].elem),    \
45 -                       list_empty(&sc->tx.txq[ATH_TXQ_AC_VO].elem));   \
46 +                       list_empty(&sc->tx.txq_map[WME_AC_BE]->elem),   \
47 +                       list_empty(&sc->tx.txq_map[WME_AC_BK]->elem),   \
48 +                       list_empty(&sc->tx.txq_map[WME_AC_VI]->elem),   \
49 +                       list_empty(&sc->tx.txq_map[WME_AC_VO]->elem));  \
50         if (len >= size)                                                \
51                 goto done;                                              \
52  } while (0)
53 @@ -528,10 +529,10 @@ static ssize_t read_file_xmit(struct fil
54         PR("hw-tx-proc-desc: ", txprocdesc);
55         len += snprintf(buf + len, size - len,
56                         "%s%11p%11p%10p%10p\n", "txq-memory-address:",
57 -                       &(sc->tx.txq[ATH_TXQ_AC_BE]),
58 -                       &(sc->tx.txq[ATH_TXQ_AC_BK]),
59 -                       &(sc->tx.txq[ATH_TXQ_AC_VI]),
60 -                       &(sc->tx.txq[ATH_TXQ_AC_VO]));
61 +                       &(sc->tx.txq_map[WME_AC_BE]),
62 +                       &(sc->tx.txq_map[WME_AC_BK]),
63 +                       &(sc->tx.txq_map[WME_AC_VI]),
64 +                       &(sc->tx.txq_map[WME_AC_VO]));
65         if (len >= size)
66                 goto done;
67  
68 @@ -751,9 +752,9 @@ static ssize_t read_file_misc(struct fil
69  }
70  
71  void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
72 -                      struct ath_tx_status *ts)
73 +                      struct ath_tx_status *ts, struct ath_txq *txq)
74  {
75 -       int qnum = skb_get_queue_mapping(bf->bf_mpdu);
76 +       int qnum = txq->axq_qnum;
77  
78         TX_STAT_INC(qnum, tx_pkts_all);
79         sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;
80 --- a/drivers/net/wireless/ath/ath9k/debug.h
81 +++ b/drivers/net/wireless/ath/ath9k/debug.h
82 @@ -175,7 +175,7 @@ int ath9k_init_debug(struct ath_hw *ah);
83  
84  void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
85  void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
86 -                      struct ath_tx_status *ts);
87 +                      struct ath_tx_status *ts, struct ath_txq *txq);
88  void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs);
89  
90  #else
91 --- a/drivers/net/wireless/ath/ath9k/xmit.c
92 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
93 @@ -1913,7 +1913,7 @@ static void ath_tx_complete_buf(struct a
94                 else
95                         complete(&sc->paprd_complete);
96         } else {
97 -               ath_debug_stat_tx(sc, bf, ts);
98 +               ath_debug_stat_tx(sc, bf, ts, txq);
99                 ath_tx_complete(sc, skb, tx_flags,
100                                 bf->bf_state.bfs_ftype, txq);
101         }