f2b4cc7fb1cc66b2b0147838b9abe7d9c704616c
[openwrt-10.03/.git] / package / madwifi / patches / 301-tx_locking.patch
1 Index: madwifi-ng-r2420-20070602/ath/if_ath.c
2 ===================================================================
3 --- madwifi-ng-r2420-20070602.orig/ath/if_ath.c 2007-06-04 13:21:58.427094400 +0200
4 +++ madwifi-ng-r2420-20070602/ath/if_ath.c      2007-06-04 13:21:58.684055336 +0200
5 @@ -2554,7 +2554,7 @@
6         /* NB: use this lock to protect an->an_ff_txbuf in athff_can_aggregate()
7          *     call too.
8          */
9 -       ATH_TXQ_LOCK_IRQ(txq);
10 +       ATH_TXQ_LOCK_BH(txq);
11         if (athff_can_aggregate(sc, eh, an, skb, vap->iv_fragthreshold, &ff_flush)) {
12                 if (an->an_tx_ffbuf[skb->priority]) { /* i.e., frame on the staging queue */
13                         bf = an->an_tx_ffbuf[skb->priority];
14 @@ -2562,6 +2562,7 @@
15                         /* get (and remove) the frame from staging queue */
16                         TAILQ_REMOVE(&txq->axq_stageq, bf, bf_stagelist);
17                         an->an_tx_ffbuf[skb->priority] = NULL;
18 +                       ATH_TXQ_UNLOCK_BH(txq);
19  
20                         /*
21                          * chain skbs and add FF magic
22 @@ -2584,7 +2585,7 @@
23                          */
24                         ATH_HARDSTART_GET_TX_BUF_WITH_LOCK;
25                         if (bf == NULL) {
26 -                               ATH_TXQ_UNLOCK_IRQ_EARLY(txq);
27 +                               ATH_TXQ_UNLOCK_BH(txq);
28                                 goto hardstart_fail;
29                         }
30                         DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_FF,
31 @@ -2596,8 +2597,7 @@
32                         an->an_tx_ffbuf[skb->priority] = bf;
33  
34                         TAILQ_INSERT_HEAD(&txq->axq_stageq, bf, bf_stagelist);
35 -
36 -                       ATH_TXQ_UNLOCK_IRQ_EARLY(txq);
37 +                       ATH_TXQ_UNLOCK_BH(txq);
38  
39                         return 0;
40                 }
41 @@ -2649,12 +2649,12 @@
42  
43                 ATH_HARDSTART_GET_TX_BUF_WITH_LOCK;
44                 if (bf == NULL) {
45 -                       ATH_TXQ_UNLOCK_IRQ_EARLY(txq);
46 +                       ATH_TXQ_UNLOCK_BH(txq);
47                         goto hardstart_fail;
48                 }
49 +               ATH_TXQ_UNLOCK_BH(txq);
50         }
51  
52 -       ATH_TXQ_UNLOCK_IRQ(txq);
53  
54  ff_bypass:
55  
56 Index: madwifi-ng-r2420-20070602/ath/if_athvar.h
57 ===================================================================
58 --- madwifi-ng-r2420-20070602.orig/ath/if_athvar.h      2007-06-04 13:21:58.428094248 +0200
59 +++ madwifi-ng-r2420-20070602/ath/if_athvar.h   2007-06-04 13:21:58.684055336 +0200
60 @@ -484,6 +484,8 @@
61  #define ATH_TXQ_INTR_PERIOD            5  /* axq_intrcnt period for intr gen */
62  #define        ATH_TXQ_LOCK_INIT(_tq)          spin_lock_init(&(_tq)->axq_lock)
63  #define        ATH_TXQ_LOCK_DESTROY(_tq)
64 +#define ATH_TXQ_LOCK_BH(_tq)           spin_lock_bh(&(_tq)->axq_lock);
65 +#define ATH_TXQ_UNLOCK_BH(_tq)         spin_unlock_bh(&(_tq)->axq_lock);
66  #define ATH_TXQ_LOCK_IRQ(_tq)          do {                            \
67         unsigned long __axq_lockflags;                                  \
68         spin_lock_irqsave(&(_tq)->axq_lock, __axq_lockflags);