b082dbda8bd59c7b221bdb09a861c6238d819a24
[openwrt/openwrt.git] / package / madwifi / patches / 301-tx_locking.patch
1 Index: madwifi-ng-r2799-20071030/ath/if_ath.c
2 ===================================================================
3 --- madwifi-ng-r2799-20071030.orig/ath/if_ath.c 2007-10-31 14:04:51.313545672 +0100
4 +++ madwifi-ng-r2799-20071030/ath/if_ath.c 2007-10-31 14:04:51.569560260 +0100
5 @@ -2693,7 +2693,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 @@ -2701,6 +2701,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 @@ -2723,7 +2724,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 @@ -2735,8 +2736,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 NETDEV_TX_OK;
40 }
41 @@ -2749,7 +2749,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 @@ -2798,12 +2798,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-r2799-20071030/ath/if_athvar.h
66 ===================================================================
67 --- madwifi-ng-r2799-20071030.orig/ath/if_athvar.h 2007-10-31 14:04:51.317545898 +0100
68 +++ madwifi-ng-r2799-20071030/ath/if_athvar.h 2007-10-31 14:04:51.569560260 +0100
69 @@ -504,6 +504,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);