1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-07-05 04:52:22 +03:00

pull madwifi forward to the latest upstream version - should fix some dual radio issues; add preliminary 2.6.24 support patch (compiles, not run-time tested, thx SeG)

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10334 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2008-01-31 04:09:54 +00:00
parent 10daf50d2e
commit 18a605bf0b
14 changed files with 284 additions and 323 deletions

View File

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=madwifi
PKG_REV:=3280
PKG_REV:=3314
PKG_VERSION:=r$(PKG_REV)
# PKG_BRANCH:=madwifi-dfs
PKG_RELEASE:=1

View File

@ -1,9 +1,9 @@
Index: madwifi-dfs-r3252/ath/if_athvar.h
Index: madwifi-trunk-r3314/ath/if_athvar.h
===================================================================
--- madwifi-dfs-r3252.orig/ath/if_athvar.h 2008-01-25 21:13:50.832747032 +0100
+++ madwifi-dfs-r3252/ath/if_athvar.h 2008-01-25 21:14:09.785827106 +0100
@@ -128,6 +128,11 @@
#define NETDEV_TX_BUSY 1
--- madwifi-trunk-r3314.orig/ath/if_athvar.h 2008-01-31 03:29:54.077194330 +0100
+++ madwifi-trunk-r3314/ath/if_athvar.h 2008-01-31 03:31:07.693389480 +0100
@@ -126,6 +126,11 @@
#define ATH_GET_NETDEV_DEV(ndev) ((ndev)->class_dev.dev)
#endif
+#ifndef NETDEV_TX_OK
@ -14,10 +14,10 @@ Index: madwifi-dfs-r3252/ath/if_athvar.h
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
static inline struct net_device *_alloc_netdev(int sizeof_priv, const char *mask,
void (*setup)(struct net_device *))
Index: madwifi-dfs-r3252/ath/if_ath_radar.c
Index: madwifi-trunk-r3314/ath/if_ath_radar.c
===================================================================
--- madwifi-dfs-r3252.orig/ath/if_ath_radar.c 2008-01-25 21:13:50.840747487 +0100
+++ madwifi-dfs-r3252/ath/if_ath_radar.c 2008-01-25 21:14:09.789827335 +0100
--- madwifi-trunk-r3314.orig/ath/if_ath_radar.c 2008-01-31 03:29:54.081194559 +0100
+++ madwifi-trunk-r3314/ath/if_ath_radar.c 2008-01-31 03:31:07.697389706 +0100
@@ -92,6 +92,13 @@
#define nofloat_pct(_value, _pct) \
( (_value * (1000 + _pct)) / 1000 )
@ -32,11 +32,11 @@ Index: madwifi-dfs-r3252/ath/if_ath_radar.c
struct radar_pattern_specification {
/* The name of the rule/specification (i.e. what did we detect) */
const char *name;
Index: madwifi-dfs-r3252/ath/if_ath.c
Index: madwifi-trunk-r3314/ath/if_ath.c
===================================================================
--- madwifi-dfs-r3252.orig/ath/if_ath.c 2008-01-25 21:13:59.245226430 +0100
+++ madwifi-dfs-r3252/ath/if_ath.c 2008-01-25 21:14:09.797827791 +0100
@@ -4698,6 +4698,46 @@
--- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-01-31 03:30:19.778658973 +0100
+++ madwifi-trunk-r3314/ath/if_ath.c 2008-01-31 03:31:07.709390390 +0100
@@ -4705,6 +4705,46 @@
#undef USE_SHPREAMBLE
}
@ -83,27 +83,10 @@ Index: madwifi-dfs-r3252/ath/if_ath.c
/*
* Generate beacon frame and queue cab data for a VAP.
*/
Index: madwifi-dfs-r3252/net80211/ieee80211_scan_ap.c
===================================================================
--- madwifi-dfs-r3252.orig/net80211/ieee80211_scan_ap.c 2008-01-25 21:13:50.852748172 +0100
+++ madwifi-dfs-r3252/net80211/ieee80211_scan_ap.c 2008-01-25 21:14:33.343169561 +0100
@@ -46,7 +46,12 @@
#include <linux/netdevice.h>
#include <linux/init.h>
#include <linux/delay.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
+#include "sort.c"
+#else
#include <linux/sort.h>
+#endif
#include "if_media.h"
Index: madwifi-dfs-r3252/net80211/sort.c
Index: madwifi-trunk-r3314/net80211/sort.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ madwifi-dfs-r3252/net80211/sort.c 2008-01-25 21:14:09.801828016 +0100
+++ madwifi-trunk-r3314/net80211/sort.c 2008-01-31 03:31:07.717390845 +0100
@@ -0,0 +1,120 @@
+/*
+ * A fast, small, non-recursive O(nlog n) sort for the Linux kernel

View File

@ -1,12 +0,0 @@
Index: madwifi-dfs-r3246/net80211/ieee80211_debug.h
===================================================================
--- madwifi-dfs-r3246.orig/net80211/ieee80211_debug.h 2008-01-25 16:39:52.407138381 +0100
+++ madwifi-dfs-r3246/net80211/ieee80211_debug.h 2008-01-25 16:43:40.104114090 +0100
@@ -119,6 +119,7 @@
#define ieee80211_msg_assoc(_vap) \
ieee80211_msg_is_reported(_vap, IEEE80211_MSG_ASSOC)
#else /* IEEE80211_DEBUG */
+#define ieee80211_msg_is_reported(_vap, m) (0)
#define IEEE80211_DPRINTF(_vap, _m, _fmt, ...)
#define IEEE80211_NOTE(_vap, _m, _wh, _fmt, ...)
#define IEEE80211_NOTE_FRAME(_vap, _m, _wh, _fmt, ...)

View File

@ -1,13 +0,0 @@
Index: madwifi-dfs-r3053/net80211/ieee80211_output.c
===================================================================
--- madwifi-dfs-r3053.orig/net80211/ieee80211_output.c 2008-01-10 15:40:39.777239675 +0100
+++ madwifi-dfs-r3053/net80211/ieee80211_output.c 2008-01-10 15:41:05.214689275 +0100
@@ -1297,7 +1297,7 @@
erp |= IEEE80211_ERP_NON_ERP_PRESENT;
if (ic->ic_flags & IEEE80211_F_USEPROT)
erp |= IEEE80211_ERP_USE_PROTECTION;
- if (ic->ic_flags & IEEE80211_F_USEBARKER)
+ if ((ic->ic_flags & IEEE80211_F_USEBARKER) || (ic->ic_nonerpsta > 0))
erp |= IEEE80211_ERP_LONG_PREAMBLE;
*frm++ = erp;
return frm;

View File

@ -1,13 +0,0 @@
Index: madwifi-trunk-r3280/net80211/ieee80211_input.c
===================================================================
--- madwifi-trunk-r3280.orig/net80211/ieee80211_input.c 2008-01-28 17:36:32.052771162 +0100
+++ madwifi-trunk-r3280/net80211/ieee80211_input.c 2008-01-28 17:36:55.186089457 +0100
@@ -1135,7 +1135,7 @@
if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
/* Create a SKB for the BSS to send out. */
skb1 = skb_copy(skb, GFP_ATOMIC);
- ieee80211_skb_copy_noderef(skb, skb1);
+ SKB_CB(skb1)->ni = ieee80211_ref_node(vap->iv_bss);
}
else {
/*

View File

@ -1,61 +0,0 @@
Index: madwifi-trunk-r3280/net80211/ieee80211_input.c
===================================================================
--- madwifi-trunk-r3280.orig/net80211/ieee80211_input.c 2008-01-28 17:36:55.186089457 +0100
+++ madwifi-trunk-r3280/net80211/ieee80211_input.c 2008-01-28 17:38:42.816222949 +0100
@@ -740,8 +740,10 @@
skb1 = skb_copy(skb, GFP_ATOMIC);
/* Increment reference count after copy */
- if (skb1 != NULL)
- ieee80211_skb_copy_noderef(skb, skb1);
+ if (skb1 == NULL)
+ goto err;
+
+ ieee80211_skb_copy_noderef(skb, skb1);
/* we now have 802.3 MAC hdr followed by 802.2 LLC/SNAP; convert to EthernetII.
* Note that the frame is at least IEEE80211_MIN_LEN, due to the driver code. */
@@ -1056,9 +1058,11 @@
* assemble fragments
*/
ni->ni_rxfrag = skb_copy(skb, GFP_ATOMIC);
- /* We duplicate the reference after skb_copy */
- ieee80211_skb_copy_noderef(skb, ni->ni_rxfrag);
- ieee80211_dev_kfree_skb(&skb);
+ if (ni->ni_rxfrag) {
+ /* We duplicate the reference after skb_copy */
+ ieee80211_skb_copy_noderef(skb, ni->ni_rxfrag);
+ ieee80211_dev_kfree_skb(&skb);
+ }
}
/*
* Check that we have enough space to hold
@@ -1072,7 +1076,7 @@
(skb_end_pointer(skb) - skb->head),
GFP_ATOMIC);
/* We duplicate the reference after skb_copy */
- if (skb != ni->ni_rxfrag)
+ if ((skb != ni->ni_rxfrag) && ni->ni_rxfrag)
ieee80211_skb_copy_noderef(skb, ni->ni_rxfrag);
ieee80211_dev_kfree_skb(&skb);
}
@@ -1135,7 +1139,8 @@
if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
/* Create a SKB for the BSS to send out. */
skb1 = skb_copy(skb, GFP_ATOMIC);
- SKB_CB(skb1)->ni = ieee80211_ref_node(vap->iv_bss);
+ if (skb1)
+ SKB_CB(skb1)->ni = ieee80211_ref_node(vap->iv_bss);
}
else {
/*
@@ -1278,6 +1283,9 @@
/* XXX: does this always work? */
tskb = skb_copy(skb, GFP_ATOMIC);
+ if (!tskb)
+ return skb;
+
/* We duplicate the reference after skb_copy */
ieee80211_skb_copy_noderef(skb, tskb);
ieee80211_dev_kfree_skb(&skb);

View File

@ -1,32 +0,0 @@
Index: madwifi-dfs-r3280/ath/if_ath.c
===================================================================
--- madwifi-dfs-r3280.orig/ath/if_ath.c 2008-01-28 17:18:52.497966105 +0100
+++ madwifi-dfs-r3280/ath/if_ath.c 2008-01-28 17:19:06.982791546 +0100
@@ -526,7 +526,8 @@
/* Allocate space for dynamically determined maximum VAP count */
sc->sc_bslot =
- kzalloc(ath_maxvaps * sizeof(struct ieee80211vap), GFP_KERNEL);
+ kmalloc(ath_maxvaps * sizeof(struct ieee80211vap), GFP_KERNEL);
+ memset(sc->sc_bslot, 0, ath_maxvaps * sizeof(struct ieee80211vap));
/*
* Cache line size is used to size and align various
Index: madwifi-dfs-r3280/ath/if_ath_radar.c
===================================================================
--- madwifi-dfs-r3280.orig/ath/if_ath_radar.c 2008-01-28 17:14:16.411947654 +0100
+++ madwifi-dfs-r3280/ath/if_ath_radar.c 2008-01-28 17:19:07.290809101 +0100
@@ -1539,9 +1539,11 @@
ath_rp_clear(sc);
- sc->sc_rp = (struct ath_rp *)kzalloc(
- sizeof(struct ath_rp) *
+ sc->sc_rp = (struct ath_rp *)kmalloc(
+ sizeof(struct ath_rp) *
ATH_RADAR_PULSE_NR, GFP_KERNEL);
+ memset(sc->sc_rp, 0, sizeof(struct ath_rp) *
+ ATH_RADAR_PULSE_NR);
if (sc->sc_rp == NULL)
return;

View File

@ -1,15 +0,0 @@
Index: madwifi-dfs-r3280/ath/if_ath.c
===================================================================
--- madwifi-dfs-r3280.orig/ath/if_ath.c 2008-01-28 17:19:06.982791546 +0100
+++ madwifi-dfs-r3280/ath/if_ath.c 2008-01-28 17:19:28.448014778 +0100
@@ -3269,10 +3269,6 @@
/* If the clone works, bump the reference count for our copy. */
SKB_CB(skb)->ni = ieee80211_ref_node(SKB_CB(skb_orig)->ni);
ieee80211_dev_kfree_skb(&skb_orig);
- } else {
- if (SKB_CB(skb)->ni != NULL)
- ieee80211_unref_node(&SKB_CB(skb)->ni);
- skb_orphan(skb);
}
eh = (struct ether_header *)skb->data;

View File

@ -1,36 +0,0 @@
Index: madwifi-trunk-r3280/ath/if_ath_ahb.c
===================================================================
--- madwifi-trunk-r3280.orig/ath/if_ath_ahb.c 2008-01-28 17:51:21.800747500 +0100
+++ madwifi-trunk-r3280/ath/if_ath_ahb.c 2008-01-28 17:51:23.700855785 +0100
@@ -31,6 +31,15 @@
#include "ah_devid.h"
#include "if_ath_ahb.h"
#include "ah_soc.h"
+/*
+ * Module glue.
+ */
+#include "release.h"
+static char *version = RELEASE_VERSION;
+static char *dev_info = "ath_ahb";
+
+#include <linux/ethtool.h>
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
#error "Kernel versions older than 2.6.19 are not supported!"
@@ -303,15 +312,6 @@
.remove = ahb_wmac_remove
};
-/*
- * Module glue.
- */
-#include "release.h"
-static char *version = RELEASE_VERSION;
-static char *dev_info = "ath_ahb";
-
-#include <linux/ethtool.h>
-
int
ath_ioctl_ethtool(struct ath_softc *sc, int cmd, void __user *addr)
{

View File

@ -1,8 +1,8 @@
Index: madwifi-trunk-r3280/net80211/ieee80211_input.c
Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
===================================================================
--- madwifi-trunk-r3280.orig/net80211/ieee80211_input.c 2008-01-28 18:38:05.794780412 +0100
+++ madwifi-trunk-r3280/net80211/ieee80211_input.c 2008-01-28 18:38:21.835694529 +0100
@@ -1279,17 +1279,8 @@
--- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c 2008-01-31 03:33:26.665309039 +0100
+++ madwifi-trunk-r3314/net80211/ieee80211_input.c 2008-01-31 03:38:55.116026377 +0100
@@ -1275,14 +1275,8 @@
eh->ether_type = ether_type;
if (!ALIGNED_POINTER(skb->data + sizeof(*eh), u_int32_t)) {
@ -10,11 +10,8 @@ Index: madwifi-trunk-r3280/net80211/ieee80211_input.c
-
- /* XXX: does this always work? */
- tskb = skb_copy(skb, GFP_ATOMIC);
- if (!tskb)
- return skb;
-
- /* We duplicate the reference after skb_copy */
- ieee80211_skb_copy_noderef(skb, tskb);
- if (tskb)
- ieee80211_skb_copy_noderef(skb, tskb);
- ieee80211_dev_kfree_skb(&skb);
- skb = tskb;
+ memmove(skb->data - 2, skb->data, skb->len);

View File

@ -1,90 +0,0 @@
Index: madwifi-trunk-r3280/ath/if_ath_ahb.c
===================================================================
--- madwifi-trunk-r3280.orig/ath/if_ath_ahb.c 2008-01-28 20:00:18.552163264 +0100
+++ madwifi-trunk-r3280/ath/if_ath_ahb.c 2008-01-28 20:00:18.612166683 +0100
@@ -69,27 +69,13 @@
void *
bus_alloc_consistent(void *hwdev, size_t size, dma_addr_t *dma_handle)
{
- void *ret;
-
- ret = (void *) __get_free_pages(GFP_ATOMIC, get_order(size));
-
- if (ret != NULL) {
- memset(ret, 0, size);
- *dma_handle = __pa(ret);
- dma_cache_wback_inv((unsigned long) ret, size);
- ret = UNCAC_ADDR(ret);
- }
-
- return ret;
+ return dma_alloc_coherent(hwdev, size, dma_handle, GFP_ATOMIC);
}
void
bus_free_consistent(void *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
{
- unsigned long addr = (unsigned long) vaddr;
-
- addr = CAC_ADDR(addr);
- free_pages(addr, get_order(size));
+ dma_free_coherent(hwdev, size, vaddr, dma_handle);
}
static int
Index: madwifi-trunk-r3280/ath/if_ath_ahb.h
===================================================================
--- madwifi-trunk-r3280.orig/ath/if_ath_ahb.h 2008-01-28 19:52:49.442569967 +0100
+++ madwifi-trunk-r3280/ath/if_ath_ahb.h 2008-01-28 21:55:51.325773888 +0100
@@ -8,6 +8,7 @@
#ifndef _DEV_ATH_AHB_H_
#define _DEV_ATH_AHB_H_
+#include <linux/dma-mapping.h>
#include <asm/io.h>
#include <asm/uaccess.h>
@@ -89,8 +90,8 @@
#define AR531X_RADIO1_MASK 0x000c
#define AR531X_RADIO1_S 2
-#define BUS_DMA_FROMDEVICE 0
-#define BUS_DMA_TODEVICE 1
+#define BUS_DMA_FROMDEVICE DMA_FROM_DEVICE
+#define BUS_DMA_TODEVICE DMA_TO_DEVICE
#define AR531X_APBBASE 0xbc000000
#define AR531X_RESETTMR (AR531X_APBBASE + 0x3000)
@@ -115,29 +116,19 @@
static __inline void bus_dma_sync_single(void *hwdev, dma_addr_t dma_handle,
size_t size, int direction)
{
- unsigned long addr;
-
- addr = (unsigned long) __va(dma_handle);
- dma_cache_wback_inv(addr, size);
+ dma_sync_single(hwdev, dma_handle, size, direction);
}
static __inline dma_addr_t bus_map_single(void *hwdev, void *ptr,
size_t size, int direction)
{
- dma_cache_wback_inv((unsigned long) ptr, size);
-
- return __pa(ptr);
+ return dma_map_single(hwdev, ptr, size, direction);
}
static __inline void bus_unmap_single(void *hwdev, dma_addr_t dma_addr,
size_t size, int direction)
{
- if (direction != BUS_DMA_TODEVICE) {
- unsigned long addr;
-
- addr = (unsigned long)__va(dma_addr);
- dma_cache_wback_inv(addr, size);
- }
+ dma_unmap_single(hwdev, dma_addr, size, direction);
}
void *bus_alloc_consistent(void *, size_t, dma_addr_t *);
void bus_free_consistent(void *, size_t, void *, dma_addr_t);

View File

@ -1,8 +1,8 @@
Index: madwifi-trunk-r3280/ath/if_ath.c
Index: madwifi-trunk-r3314/ath/if_ath.c
===================================================================
--- madwifi-trunk-r3280.orig/ath/if_ath.c 2008-01-29 17:57:02.738327980 +0100
+++ madwifi-trunk-r3280/ath/if_ath.c 2008-01-29 17:57:02.770329801 +0100
@@ -8336,8 +8336,6 @@
--- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-01-31 03:39:02.140426675 +0100
+++ madwifi-trunk-r3314/ath/if_ath.c 2008-01-31 03:39:41.360481823 +0100
@@ -8357,8 +8357,6 @@
ath_hal_intrset(sc->sc_ah, sc->sc_imask);
local_irq_restore(flags);
@ -11,7 +11,7 @@ Index: madwifi-trunk-r3280/ath/if_ath.c
if (sc->sc_softled)
ath_led_event(sc, ATH_LED_TX);
}
@@ -8384,8 +8382,6 @@
@@ -8405,8 +8403,6 @@
ath_hal_intrset(sc->sc_ah, sc->sc_imask);
local_irq_restore(flags);
@ -20,7 +20,7 @@ Index: madwifi-trunk-r3280/ath/if_ath.c
if (sc->sc_softled)
ath_led_event(sc, ATH_LED_TX);
}
@@ -8418,8 +8414,6 @@
@@ -8439,8 +8435,6 @@
ath_hal_intrset(sc->sc_ah, sc->sc_imask);
local_irq_restore(flags);
@ -29,11 +29,11 @@ Index: madwifi-trunk-r3280/ath/if_ath.c
if (sc->sc_softled)
ath_led_event(sc, ATH_LED_TX);
}
Index: madwifi-trunk-r3280/net80211/ieee80211_input.c
Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
===================================================================
--- madwifi-trunk-r3280.orig/net80211/ieee80211_input.c 2008-01-29 17:57:29.147832972 +0100
+++ madwifi-trunk-r3280/net80211/ieee80211_input.c 2008-01-29 17:58:27.315147737 +0100
@@ -1136,7 +1136,7 @@
--- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c 2008-01-31 03:38:55.116026377 +0100
+++ madwifi-trunk-r3314/net80211/ieee80211_input.c 2008-01-31 03:39:41.364480053 +0100
@@ -1132,7 +1132,7 @@
(vap->iv_flags & IEEE80211_F_NOBRIDGE) == 0) {
struct sk_buff *skb1 = NULL;

View File

@ -0,0 +1,16 @@
Index: madwifi-trunk-r3314/ath/if_ath.c
===================================================================
--- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-01-31 03:59:25.474330368 +0100
+++ madwifi-trunk-r3314/ath/if_ath.c 2008-01-31 04:00:30.254021949 +0100
@@ -6686,8 +6686,9 @@
*budget -= processed;
- /* rx signal state monitoring */
- ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan);
+ /* 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
}

View File

@ -0,0 +1,237 @@
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 */