1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-02-11 19:10:30.010051203 +0100
4 +++ madwifi-trunk-r3314/ath/if_ath.c 2008-02-11 19:18:00.615729758 +0100
6 struct sk_buff *, int, int, u_int64_t);
7 static void ath_setdefantenna(struct ath_softc *, u_int);
8 static struct ath_txq *ath_txq_setup(struct ath_softc *, int, int);
9 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
10 +static int ath_rx_poll(struct napi_struct *napi, int budget);
12 static int ath_rx_poll(struct net_device *dev, int *budget);
14 static int ath_hardstart(struct sk_buff *, struct net_device *);
15 static int ath_mgtstart(struct ieee80211com *, struct sk_buff *);
16 #ifdef ATH_SUPERG_COMP
18 u_int32_t new_clamped_maxtxpower);
19 static u_int32_t ath_get_real_maxtxpower(struct ath_softc *sc);
21 +static void ath_poll_disable(struct net_device *dev);
22 +static void ath_poll_enable(struct net_device *dev);
24 /* calibrate every 30 secs in steady state but check every second at first. */
25 static int ath_calinterval = ATH_SHORT_CALINTERVAL;
26 static int ath_countrycode = CTRY_DEFAULT; /* country code */
28 dev->set_mac_address = ath_set_mac_address;
29 dev->change_mtu = ath_change_mtu;
30 dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
31 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
32 + netif_napi_add(dev, &sc->sc_napi, ath_rx_poll, 64);
34 dev->poll = ath_rx_poll;
37 #ifdef USE_HEADERLEN_RESV
38 dev->hard_header_len += sizeof(struct ieee80211_qosframe) +
40 @@ -2268,12 +2279,21 @@
41 if (status & (HAL_INT_RX | HAL_INT_RXPHY)) {
42 ath_uapsd_processtriggers(sc, hw_tsf);
43 sc->sc_isr &= ~HAL_INT_RX;
44 - if (netif_rx_schedule_prep(dev)) {
45 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
46 + if (netif_rx_schedule_prep(dev, &sc->sc_napi))
48 + if (netif_rx_schedule_prep(dev))
51 #ifndef ATH_PRECISE_TSF
52 sc->sc_imask &= ~HAL_INT_RX;
53 ath_hal_intrset(ah, sc->sc_imask);
55 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
56 + __netif_rx_schedule(dev, &sc->sc_napi);
58 __netif_rx_schedule(dev);
62 if (status & HAL_INT_TX) {
64 if (sc->sc_tx99 != NULL)
65 sc->sc_tx99->start(sc->sc_tx99);
67 + ath_poll_enable(dev);
72 if (sc->sc_tx99 != NULL)
73 sc->sc_tx99->stop(sc->sc_tx99);
75 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
76 + ath_poll_disable(dev);
78 netif_stop_queue(dev); /* XXX re-enabled by ath_newstate */
79 dev->flags &= ~IFF_RUNNING; /* NB: avoid recursion */
80 ieee80211_stop_running(ic); /* stop all VAPs */
81 @@ -4015,6 +4039,39 @@
82 return ath_keyset(sc, k, mac, vap->iv_bss);
85 +static void ath_poll_disable(struct net_device *dev)
87 + struct ath_softc *sc = dev->priv;
90 + * XXX Using in_softirq is not right since we might
91 + * be called from other soft irq contexts than
94 + if (!in_softirq()) {
95 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
96 + napi_disable(&sc->sc_napi);
98 + netif_poll_disable(dev);
103 +static void ath_poll_enable(struct net_device *dev)
105 + struct ath_softc *sc = dev->priv;
107 + /* NB: see above */
108 + if (!in_softirq()) {
109 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
110 + napi_enable(&sc->sc_napi);
112 + netif_poll_enable(dev);
119 * Block/unblock tx+rx processing while a key change is done.
120 * We assume the caller serializes key management operations
121 @@ -4032,13 +4089,8 @@
122 * When called from the rx tasklet we cannot use
123 * tasklet_disable because it will block waiting
124 * for us to complete execution.
126 - * XXX Using in_softirq is not right since we might
127 - * be called from other soft irq contexts than
131 - netif_poll_disable(dev);
132 + ath_poll_disable(dev);
133 netif_stop_queue(dev);
136 @@ -4050,8 +4102,7 @@
138 DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
139 netif_wake_queue(dev);
140 - if (!in_softirq()) /* NB: see above */
141 - netif_poll_enable(dev);
142 + ath_poll_enable(dev);
146 @@ -6359,24 +6410,34 @@
150 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
151 +ath_rx_poll(struct napi_struct *napi, int budget)
153 ath_rx_poll(struct net_device *dev, int *budget)
156 #define PA2DESC(_sc, _pa) \
157 ((struct ath_desc *)((caddr_t)(_sc)->sc_rxdma.dd_desc + \
158 ((_pa) - (_sc)->sc_rxdma.dd_desc_paddr)))
159 - struct ath_buf *bf;
160 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
161 + struct ath_softc *sc = container_of(napi, struct ath_softc, sc_napi);
162 + struct net_device *dev = sc->sc_dev;
163 + u_int rx_limit = budget;
165 struct ath_softc *sc = dev->priv;
166 + u_int rx_limit = dev->quota;
168 struct ieee80211com *ic = &sc->sc_ic;
169 struct ath_hal *ah = sc ? sc->sc_ah : NULL;
171 struct ath_rx_status *rs;
172 struct sk_buff *skb = NULL;
173 struct ieee80211_node *ni;
174 + struct ath_buf *bf;
178 u_int processed = 0, early_stop = 0;
179 - u_int rx_limit = dev->quota;
182 DPRINTF(sc, ATH_DEBUG_RX_PROC, "invoked\n");
183 @@ -6405,7 +6466,9 @@
187 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
190 if (rx_limit-- < 0) {
193 @@ -6675,8 +6738,6 @@
194 goto process_rx_again;
197 - netif_rx_complete(dev);
199 #ifndef ATH_PRECISE_TSF
200 sc->sc_imask |= HAL_INT_RX;
201 ath_hal_intrset(ah, sc->sc_imask);
202 @@ -6684,11 +6745,17 @@
206 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
207 + netif_rx_complete(dev, napi);
209 + netif_rx_complete(dev);
210 *budget -= processed;
213 /* rx signal state monitoring, only necessary/applicable for sta mode */
214 if (sc->sc_opmode == HAL_M_STA)
215 ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan);
220 @@ -10378,9 +10445,9 @@
222 if ((dev->flags & IFF_RUNNING) && !sc->sc_invalid) {
223 /* NB: the rx buffers may need to be reallocated */
224 - netif_poll_disable(dev);
225 + ath_poll_disable(dev);
226 error = ath_reset(dev);
227 - netif_poll_enable(dev);
228 + ath_poll_enable(dev);
232 Index: madwifi-trunk-r3314/ath/if_athvar.h
233 ===================================================================
234 --- madwifi-trunk-r3314.orig/ath/if_athvar.h 2008-02-11 19:10:29.758036841 +0100
235 +++ madwifi-trunk-r3314/ath/if_athvar.h 2008-02-11 19:17:35.042272406 +0100
238 struct ieee80211com sc_ic; /* NB: must be first */
239 struct net_device *sc_dev;
240 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
241 + struct napi_struct sc_napi;
243 void __iomem *sc_iobase; /* address of the device */
244 struct semaphore sc_lock; /* dev-level lock */
245 struct net_device_stats sc_devstats; /* device statistics */