1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-01-31 04:25:11.617671781 +0100
4 +++ madwifi-trunk-r3314/ath/if_ath.c 2008-01-31 05:06:04.606254148 +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->stop(sc->sc_tx99);
67 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
68 + ath_poll_disable(dev);
70 netif_stop_queue(dev); /* XXX re-enabled by ath_newstate */
71 dev->flags &= ~IFF_RUNNING; /* NB: avoid recursion */
72 ieee80211_stop_running(ic); /* stop all VAPs */
73 @@ -4015,6 +4038,39 @@
74 return ath_keyset(sc, k, mac, vap->iv_bss);
77 +static void ath_poll_disable(struct net_device *dev)
79 + struct ath_softc *sc = dev->priv;
82 + * XXX Using in_softirq is not right since we might
83 + * be called from other soft irq contexts than
86 + if (!in_softirq()) {
87 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
88 + napi_disable(&sc->sc_napi);
90 + netif_poll_disable(dev);
95 +static void ath_poll_enable(struct net_device *dev)
97 + struct ath_softc *sc = dev->priv;
100 + if (!in_softirq()) {
101 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
102 + napi_enable(&sc->sc_napi);
104 + netif_poll_enable(dev);
111 * Block/unblock tx+rx processing while a key change is done.
112 * We assume the caller serializes key management operations
113 @@ -4032,13 +4088,8 @@
114 * When called from the rx tasklet we cannot use
115 * tasklet_disable because it will block waiting
116 * for us to complete execution.
118 - * XXX Using in_softirq is not right since we might
119 - * be called from other soft irq contexts than
123 - netif_poll_disable(dev);
124 + ath_poll_disable(dev);
125 netif_stop_queue(dev);
128 @@ -4050,8 +4101,7 @@
130 DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
131 netif_wake_queue(dev);
132 - if (!in_softirq()) /* NB: see above */
133 - netif_poll_enable(dev);
134 + ath_poll_enable(dev);
138 @@ -6359,24 +6409,34 @@
142 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
143 +ath_rx_poll(struct napi_struct *napi, int budget)
145 ath_rx_poll(struct net_device *dev, int *budget)
148 #define PA2DESC(_sc, _pa) \
149 ((struct ath_desc *)((caddr_t)(_sc)->sc_rxdma.dd_desc + \
150 ((_pa) - (_sc)->sc_rxdma.dd_desc_paddr)))
151 - struct ath_buf *bf;
152 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
153 + struct ath_softc *sc = container_of(napi, struct ath_softc, sc_napi);
154 + struct net_device *dev = sc->sc_dev;
155 + u_int rx_limit = budget;
157 struct ath_softc *sc = dev->priv;
158 + u_int rx_limit = dev->quota;
160 struct ieee80211com *ic = &sc->sc_ic;
161 struct ath_hal *ah = sc ? sc->sc_ah : NULL;
163 struct ath_rx_status *rs;
164 struct sk_buff *skb = NULL;
165 struct ieee80211_node *ni;
166 + struct ath_buf *bf;
170 u_int processed = 0, early_stop = 0;
171 - u_int rx_limit = dev->quota;
174 DPRINTF(sc, ATH_DEBUG_RX_PROC, "invoked\n");
175 @@ -6405,7 +6465,9 @@
179 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
182 if (rx_limit-- < 0) {
185 @@ -6675,8 +6737,6 @@
186 goto process_rx_again;
189 - netif_rx_complete(dev);
191 #ifndef ATH_PRECISE_TSF
192 sc->sc_imask |= HAL_INT_RX;
193 ath_hal_intrset(ah, sc->sc_imask);
194 @@ -6684,11 +6744,17 @@
198 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
199 + netif_rx_complete(dev, napi);
201 + netif_rx_complete(dev);
202 *budget -= processed;
205 /* rx signal state monitoring, only necessary/applicable for sta mode */
206 if (sc->sc_opmode == HAL_M_STA)
207 ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan);
212 @@ -10395,9 +10461,9 @@
214 if ((dev->flags & IFF_RUNNING) && !sc->sc_invalid) {
215 /* NB: the rx buffers may need to be reallocated */
216 - netif_poll_disable(dev);
217 + ath_poll_disable(dev);
218 error = ath_reset(dev);
219 - netif_poll_enable(dev);
220 + ath_poll_enable(dev);
224 Index: madwifi-trunk-r3314/ath/if_athvar.h
225 ===================================================================
226 --- madwifi-trunk-r3314.orig/ath/if_athvar.h 2008-01-31 04:25:14.001807644 +0100
227 +++ madwifi-trunk-r3314/ath/if_athvar.h 2008-01-31 04:32:31.858759693 +0100
230 struct ieee80211com sc_ic; /* NB: must be first */
231 struct net_device *sc_dev;
232 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
233 + struct napi_struct sc_napi;
235 void __iomem *sc_iobase; /* address of the device */
236 struct semaphore sc_lock; /* dev-level lock */
237 struct net_device_stats sc_devstats; /* device statistics */