mirror of https://github.com/hak5/openwrt-owl.git
238 lines
6.7 KiB
Diff
238 lines
6.7 KiB
Diff
Index: madwifi-trunk-r3314/ath/if_ath.c
|
|
===================================================================
|
|
--- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-01-31 04:25:11.617671781 +0100
|
|
+++ madwifi-trunk-r3314/ath/if_ath.c 2008-01-31 05:06:04.606254148 +0100
|
|
@@ -184,7 +184,11 @@
|
|
struct sk_buff *, int, int, u_int64_t);
|
|
static void ath_setdefantenna(struct ath_softc *, u_int);
|
|
static struct ath_txq *ath_txq_setup(struct ath_softc *, int, int);
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+static int ath_rx_poll(struct napi_struct *napi, int budget);
|
|
+#else
|
|
static int ath_rx_poll(struct net_device *dev, int *budget);
|
|
+#endif
|
|
static int ath_hardstart(struct sk_buff *, struct net_device *);
|
|
static int ath_mgtstart(struct ieee80211com *, struct sk_buff *);
|
|
#ifdef ATH_SUPERG_COMP
|
|
@@ -374,6 +378,9 @@
|
|
u_int32_t new_clamped_maxtxpower);
|
|
static u_int32_t ath_get_real_maxtxpower(struct ath_softc *sc);
|
|
|
|
+static void ath_poll_disable(struct net_device *dev);
|
|
+static void ath_poll_enable(struct net_device *dev);
|
|
+
|
|
/* calibrate every 30 secs in steady state but check every second at first. */
|
|
static int ath_calinterval = ATH_SHORT_CALINTERVAL;
|
|
static int ath_countrycode = CTRY_DEFAULT; /* country code */
|
|
@@ -818,8 +825,12 @@
|
|
dev->set_mac_address = ath_set_mac_address;
|
|
dev->change_mtu = ath_change_mtu;
|
|
dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ netif_napi_add(dev, &sc->sc_napi, ath_rx_poll, 64);
|
|
+#else
|
|
dev->poll = ath_rx_poll;
|
|
dev->weight = 64;
|
|
+#endif
|
|
#ifdef USE_HEADERLEN_RESV
|
|
dev->hard_header_len += sizeof(struct ieee80211_qosframe) +
|
|
sizeof(struct llc) +
|
|
@@ -2268,12 +2279,21 @@
|
|
if (status & (HAL_INT_RX | HAL_INT_RXPHY)) {
|
|
ath_uapsd_processtriggers(sc, hw_tsf);
|
|
sc->sc_isr &= ~HAL_INT_RX;
|
|
- if (netif_rx_schedule_prep(dev)) {
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ if (netif_rx_schedule_prep(dev, &sc->sc_napi))
|
|
+#else
|
|
+ if (netif_rx_schedule_prep(dev))
|
|
+#endif
|
|
+ {
|
|
#ifndef ATH_PRECISE_TSF
|
|
sc->sc_imask &= ~HAL_INT_RX;
|
|
ath_hal_intrset(ah, sc->sc_imask);
|
|
#endif
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ __netif_rx_schedule(dev, &sc->sc_napi);
|
|
+#else
|
|
__netif_rx_schedule(dev);
|
|
+#endif
|
|
}
|
|
}
|
|
if (status & HAL_INT_TX) {
|
|
@@ -2557,6 +2577,9 @@
|
|
if (sc->sc_tx99 != NULL)
|
|
sc->sc_tx99->stop(sc->sc_tx99);
|
|
#endif
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ ath_poll_disable(dev);
|
|
+#endif
|
|
netif_stop_queue(dev); /* XXX re-enabled by ath_newstate */
|
|
dev->flags &= ~IFF_RUNNING; /* NB: avoid recursion */
|
|
ieee80211_stop_running(ic); /* stop all VAPs */
|
|
@@ -4015,6 +4038,39 @@
|
|
return ath_keyset(sc, k, mac, vap->iv_bss);
|
|
}
|
|
|
|
+static void ath_poll_disable(struct net_device *dev)
|
|
+{
|
|
+ struct ath_softc *sc = dev->priv;
|
|
+
|
|
+ /*
|
|
+ * XXX Using in_softirq is not right since we might
|
|
+ * be called from other soft irq contexts than
|
|
+ * ath_rx_poll
|
|
+ */
|
|
+ if (!in_softirq()) {
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ napi_disable(&sc->sc_napi);
|
|
+#else
|
|
+ netif_poll_disable(dev);
|
|
+#endif
|
|
+ }
|
|
+}
|
|
+
|
|
+static void ath_poll_enable(struct net_device *dev)
|
|
+{
|
|
+ struct ath_softc *sc = dev->priv;
|
|
+
|
|
+ /* NB: see above */
|
|
+ if (!in_softirq()) {
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ napi_enable(&sc->sc_napi);
|
|
+#else
|
|
+ netif_poll_enable(dev);
|
|
+#endif
|
|
+ }
|
|
+}
|
|
+
|
|
+
|
|
/*
|
|
* Block/unblock tx+rx processing while a key change is done.
|
|
* We assume the caller serializes key management operations
|
|
@@ -4032,13 +4088,8 @@
|
|
* When called from the rx tasklet we cannot use
|
|
* tasklet_disable because it will block waiting
|
|
* for us to complete execution.
|
|
- *
|
|
- * XXX Using in_softirq is not right since we might
|
|
- * be called from other soft irq contexts than
|
|
- * ath_rx_poll
|
|
*/
|
|
- if (!in_softirq())
|
|
- netif_poll_disable(dev);
|
|
+ ath_poll_disable(dev);
|
|
netif_stop_queue(dev);
|
|
}
|
|
|
|
@@ -4050,8 +4101,7 @@
|
|
|
|
DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
|
|
netif_wake_queue(dev);
|
|
- if (!in_softirq()) /* NB: see above */
|
|
- netif_poll_enable(dev);
|
|
+ ath_poll_enable(dev);
|
|
}
|
|
|
|
/*
|
|
@@ -6359,24 +6409,34 @@
|
|
}
|
|
|
|
static int
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ath_rx_poll(struct napi_struct *napi, int budget)
|
|
+#else
|
|
ath_rx_poll(struct net_device *dev, int *budget)
|
|
+#endif
|
|
{
|
|
#define PA2DESC(_sc, _pa) \
|
|
((struct ath_desc *)((caddr_t)(_sc)->sc_rxdma.dd_desc + \
|
|
((_pa) - (_sc)->sc_rxdma.dd_desc_paddr)))
|
|
- struct ath_buf *bf;
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ struct ath_softc *sc = container_of(napi, struct ath_softc, sc_napi);
|
|
+ struct net_device *dev = sc->sc_dev;
|
|
+ u_int rx_limit = budget;
|
|
+#else
|
|
struct ath_softc *sc = dev->priv;
|
|
+ u_int rx_limit = dev->quota;
|
|
+#endif
|
|
struct ieee80211com *ic = &sc->sc_ic;
|
|
struct ath_hal *ah = sc ? sc->sc_ah : NULL;
|
|
struct ath_desc *ds;
|
|
struct ath_rx_status *rs;
|
|
struct sk_buff *skb = NULL;
|
|
struct ieee80211_node *ni;
|
|
+ struct ath_buf *bf;
|
|
unsigned int len;
|
|
int type;
|
|
u_int phyerr;
|
|
u_int processed = 0, early_stop = 0;
|
|
- u_int rx_limit = dev->quota;
|
|
u_int mic_fail = 0;
|
|
|
|
DPRINTF(sc, ATH_DEBUG_RX_PROC, "invoked\n");
|
|
@@ -6405,7 +6465,9 @@
|
|
break;
|
|
}
|
|
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
processed++;
|
|
+#endif
|
|
if (rx_limit-- < 0) {
|
|
early_stop = 1;
|
|
break;
|
|
@@ -6675,8 +6737,6 @@
|
|
goto process_rx_again;
|
|
}
|
|
#endif
|
|
- netif_rx_complete(dev);
|
|
-
|
|
#ifndef ATH_PRECISE_TSF
|
|
sc->sc_imask |= HAL_INT_RX;
|
|
ath_hal_intrset(ah, sc->sc_imask);
|
|
@@ -6684,11 +6744,17 @@
|
|
#endif
|
|
}
|
|
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ netif_rx_complete(dev, napi);
|
|
+#else
|
|
+ netif_rx_complete(dev);
|
|
*budget -= processed;
|
|
+#endif
|
|
|
|
/* rx signal state monitoring, only necessary/applicable for sta mode */
|
|
if (sc->sc_opmode == HAL_M_STA)
|
|
ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan);
|
|
+
|
|
return early_stop;
|
|
#undef PA2DESC
|
|
}
|
|
@@ -10395,9 +10461,9 @@
|
|
dev->mtu = mtu;
|
|
if ((dev->flags & IFF_RUNNING) && !sc->sc_invalid) {
|
|
/* NB: the rx buffers may need to be reallocated */
|
|
- netif_poll_disable(dev);
|
|
+ ath_poll_disable(dev);
|
|
error = ath_reset(dev);
|
|
- netif_poll_enable(dev);
|
|
+ ath_poll_enable(dev);
|
|
}
|
|
ATH_UNLOCK(sc);
|
|
|
|
Index: madwifi-trunk-r3314/ath/if_athvar.h
|
|
===================================================================
|
|
--- madwifi-trunk-r3314.orig/ath/if_athvar.h 2008-01-31 04:25:14.001807644 +0100
|
|
+++ madwifi-trunk-r3314/ath/if_athvar.h 2008-01-31 04:32:31.858759693 +0100
|
|
@@ -620,6 +620,9 @@
|
|
struct ath_softc {
|
|
struct ieee80211com sc_ic; /* NB: must be first */
|
|
struct net_device *sc_dev;
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
|
+ struct napi_struct sc_napi;
|
|
+#endif
|
|
void __iomem *sc_iobase; /* address of the device */
|
|
struct semaphore sc_lock; /* dev-level lock */
|
|
struct net_device_stats sc_devstats; /* device statistics */
|