update to the latest madwifi snapshot
[openwrt-10.03/.git] / package / madwifi / patches / 301-tx_locking.patch
1 Index: madwifi-ng-r2525-20070630/ath/if_ath.c
2 ===================================================================
3 --- madwifi-ng-r2525-20070630.orig/ath/if_ath.c 2007-07-03 23:02:32.998106000 +0200
4 +++ madwifi-ng-r2525-20070630/ath/if_ath.c      2007-07-03 23:02:33.302125000 +0200
5 @@ -2567,7 +2567,7 @@
6         /* NB: use this lock to protect an->an_tx_ffbuf (and txq->axq_stageq)
7          *      in athff_can_aggregate() 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 @@ -2575,6 +2575,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 @@ -2597,7 +2598,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 @@ -2609,8 +2610,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 @@ -2623,7 +2623,7 @@
42                         an->an_tx_ffbuf[skb->priority] = NULL;
43  
44                         /* NB: ath_tx_start -> ath_tx_txqaddbuf uses ATH_TXQ_LOCK too */
45 -                       ATH_TXQ_UNLOCK_IRQ_EARLY(txq);
46 +                       ATH_TXQ_UNLOCK_BH(txq);
47  
48                         /* encap and xmit */
49                         bf_ff->bf_skb = ieee80211_encap(ni, bf_ff->bf_skb, &framecnt);
50 @@ -2674,12 +2674,12 @@
51  
52                 ATH_HARDSTART_GET_TX_BUF_WITH_LOCK;
53                 if (bf == NULL) {
54 -                       ATH_TXQ_UNLOCK_IRQ_EARLY(txq);
55 +                       ATH_TXQ_UNLOCK_BH(txq);
56                         goto hardstart_fail;
57                 }
58 +               ATH_TXQ_UNLOCK_BH(txq);
59         }
60  
61 -       ATH_TXQ_UNLOCK_IRQ(txq);
62  
63  ff_flush_done:
64  ff_bypass:
65 Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
66 ===================================================================
67 --- madwifi-ng-r2525-20070630.orig/ath/if_athvar.h      2007-07-03 23:02:33.002106250 +0200
68 +++ madwifi-ng-r2525-20070630/ath/if_athvar.h   2007-07-03 23:02:33.302125000 +0200
69 @@ -487,6 +487,8 @@
70  #define ATH_TXQ_INTR_PERIOD            5  /* axq_intrcnt period for intr gen */
71  #define        ATH_TXQ_LOCK_INIT(_tq)          spin_lock_init(&(_tq)->axq_lock)
72  #define        ATH_TXQ_LOCK_DESTROY(_tq)
73 +#define ATH_TXQ_LOCK_BH(_tq)           spin_lock_bh(&(_tq)->axq_lock);
74 +#define ATH_TXQ_UNLOCK_BH(_tq)         spin_unlock_bh(&(_tq)->axq_lock);
75  #define ATH_TXQ_LOCK_IRQ(_tq)          do {                            \
76         unsigned long __axq_lockflags;                                  \
77         spin_lock_irqsave(&(_tq)->axq_lock, __axq_lockflags);