From 65edd13209cfb70986a94ec017c775a3ab4eba5c Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Wed, 11 Jul 2007 21:13:50 +0000
Subject: [PATCH] sync with latest madwifi snapshot, refresh patches, add tpc
 fix by mdtaylor (should fix #1949)

SVN-Revision: 7929
---
 package/madwifi/Makefile                      |  4 +-
 .../madwifi/patches/100-kernel_cflags.patch   | 18 ++--
 .../patches/102-multicall_binary.patch        | 62 ++++++-------
 .../madwifi/patches/104-autocreate_none.patch |  6 +-
 .../madwifi/patches/105-ratectl_attach.patch  |  6 +-
 .../madwifi/patches/110-init_fix_PR_914.patch |  6 +-
 .../madwifi/patches/111-minstrel_crash.patch  | 10 +--
 .../madwifi/patches/112-keycache_PR_962.patch | 20 ++---
 .../madwifi/patches/113-no_ibss_pwrsave.patch |  6 +-
 .../patches/116-adhoc_beacon_PR_1033.patch    | 20 ++---
 package/madwifi/patches/120-soc_fix.patch     |  6 +-
 package/madwifi/patches/121-ibss_hostap.patch | 42 ++++-----
 .../patches/122-replayfail_workaround.patch   |  6 +-
 package/madwifi/patches/123-ccmp_checks.patch |  6 +-
 .../madwifi/patches/124-linux24_compat.patch  | 10 +--
 package/madwifi/patches/125-tpc_PR_1435.patch | 87 +++++++++++++++++++
 package/madwifi/patches/200-no_debug.patch    | 54 ++++++------
 .../madwifi/patches/300-napi_polling.patch    | 62 ++++++-------
 package/madwifi/patches/301-tx_locking.patch  | 28 +++---
 package/madwifi/patches/305-pureg_fix.patch   | 32 +++----
 .../madwifi/patches/309-micfail_detect.patch  | 76 ++++++++--------
 .../patches/310-erp_beacon_check.patch        |  6 +-
 22 files changed, 330 insertions(+), 243 deletions(-)
 create mode 100644 package/madwifi/patches/125-tpc_PR_1435.patch

diff --git a/package/madwifi/Makefile b/package/madwifi/Makefile
index 0ad852f871..4aa4e0a746 100644
--- a/package/madwifi/Makefile
+++ b/package/madwifi/Makefile
@@ -10,14 +10,14 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=madwifi
-PKG_VERSION:=r2537-20070704
+PKG_VERSION:=r2568-20070710
 PKG_BRANCH:=madwifi-ng
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_BRANCH)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://snapshots.madwifi.org/$(PKG_BRANCH)
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_BRANCH)-$(PKG_VERSION)
-PKG_MD5SUM:=ae4856030e5ffb939370bcd459e260af
+PKG_MD5SUM:=fe5d41acd085d2c46934be3f8839e694
 
 include $(INCLUDE_DIR)/package.mk
 
diff --git a/package/madwifi/patches/100-kernel_cflags.patch b/package/madwifi/patches/100-kernel_cflags.patch
index b16e89e403..aeea704128 100644
--- a/package/madwifi/patches/100-kernel_cflags.patch
+++ b/package/madwifi/patches/100-kernel_cflags.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/hal/public/mips-be-elf.inc
+Index: madwifi-ng-r2568-20070710/hal/public/mips-be-elf.inc
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/hal/public/mips-be-elf.inc	2007-07-03 23:02:26.509700500 +0200
-+++ madwifi-ng-r2525-20070630/hal/public/mips-be-elf.inc	2007-07-03 23:02:26.653709500 +0200
+--- madwifi-ng-r2568-20070710.orig/hal/public/mips-be-elf.inc	2007-07-11 22:59:39.612105910 +0200
++++ madwifi-ng-r2568-20070710/hal/public/mips-be-elf.inc	2007-07-11 22:59:39.756114120 +0200
 @@ -71,5 +71,5 @@
  
  LDOPTS=	-EB
@@ -9,10 +9,10 @@ Index: madwifi-ng-r2525-20070630/hal/public/mips-be-elf.inc
 -COPTS+=	-G 0 -EB -mno-abicalls -fno-pic -mips2 -Wa,--trap \
 +COPTS+=	-G 0 -mno-abicalls -fno-pic -mips32 -Wa,--trap \
  	-fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls
-Index: madwifi-ng-r2525-20070630/hal/public/mips-le-elf.inc
+Index: madwifi-ng-r2568-20070710/hal/public/mips-le-elf.inc
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/hal/public/mips-le-elf.inc	2007-07-03 23:02:26.517701000 +0200
-+++ madwifi-ng-r2525-20070630/hal/public/mips-le-elf.inc	2007-07-03 23:02:26.669710500 +0200
+--- madwifi-ng-r2568-20070710.orig/hal/public/mips-le-elf.inc	2007-07-11 22:59:39.616106139 +0200
++++ madwifi-ng-r2568-20070710/hal/public/mips-le-elf.inc	2007-07-11 22:59:39.760114346 +0200
 @@ -68,5 +68,5 @@
  
  LDOPTS=	-EL
@@ -20,10 +20,10 @@ Index: madwifi-ng-r2525-20070630/hal/public/mips-le-elf.inc
 -COPTS+=	-G 0 -EL -mno-abicalls -fno-pic -mips2 -Wa,--trap \
 +COPTS+=	-G 0 -mno-abicalls -fno-pic -mips32 -Wa,--trap \
  	-fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls
-Index: madwifi-ng-r2525-20070630/hal/public/xscale-be-elf.inc
+Index: madwifi-ng-r2568-20070710/hal/public/xscale-be-elf.inc
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/hal/public/xscale-be-elf.inc	2007-07-03 23:02:26.529701750 +0200
-+++ madwifi-ng-r2525-20070630/hal/public/xscale-be-elf.inc	2007-07-03 23:02:26.705712750 +0200
+--- madwifi-ng-r2568-20070710.orig/hal/public/xscale-be-elf.inc	2007-07-11 22:59:39.628106822 +0200
++++ madwifi-ng-r2568-20070710/hal/public/xscale-be-elf.inc	2007-07-11 22:59:39.788115941 +0200
 @@ -77,5 +77,5 @@
  
  LDOPTS=	-EB
diff --git a/package/madwifi/patches/102-multicall_binary.patch b/package/madwifi/patches/102-multicall_binary.patch
index 725b9968ad..15ea8a035b 100644
--- a/package/madwifi/patches/102-multicall_binary.patch
+++ b/package/madwifi/patches/102-multicall_binary.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/tools/80211debug.c
+Index: madwifi-ng-r2568-20070710/tools/80211debug.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/80211debug.c	2007-07-03 23:02:26.373692000 +0200
-+++ madwifi-ng-r2525-20070630/tools/80211debug.c	2007-07-03 23:02:27.357753500 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/80211debug.c	2007-07-11 22:59:39.484098617 +0200
++++ madwifi-ng-r2568-20070710/tools/80211debug.c	2007-07-11 22:59:40.108134179 +0200
 @@ -49,6 +49,10 @@
  #include <getopt.h>
  #include <err.h>
@@ -33,10 +33,10 @@ Index: madwifi-ng-r2525-20070630/tools/80211debug.c
  	const char *ifname = "ath0";
  	const char *cp, *tp;
  	const char *sep;
-Index: madwifi-ng-r2525-20070630/tools/80211stats.c
+Index: madwifi-ng-r2568-20070710/tools/80211stats.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/80211stats.c	2007-07-03 23:02:26.381692500 +0200
-+++ madwifi-ng-r2525-20070630/tools/80211stats.c	2007-07-03 23:02:27.357753500 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/80211stats.c	2007-07-11 22:59:39.488098843 +0200
++++ madwifi-ng-r2568-20070710/tools/80211stats.c	2007-07-11 22:59:40.112134405 +0200
 @@ -60,6 +60,10 @@
  #include "net80211/ieee80211_crypto.h"
  #include "net80211/ieee80211_ioctl.h"
@@ -68,10 +68,10 @@ Index: madwifi-ng-r2525-20070630/tools/80211stats.c
  	int c, len;
  	struct ieee80211req_sta_info *si;
  	u_int8_t buf[24*1024], *cp;
-Index: madwifi-ng-r2525-20070630/tools/athchans.c
+Index: madwifi-ng-r2568-20070710/tools/athchans.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/athchans.c	2007-07-03 23:02:26.389693000 +0200
-+++ madwifi-ng-r2525-20070630/tools/athchans.c	2007-07-03 23:02:27.401756250 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/athchans.c	2007-07-11 22:59:39.496099302 +0200
++++ madwifi-ng-r2568-20070710/tools/athchans.c	2007-07-11 22:59:40.184138509 +0200
 @@ -59,6 +59,10 @@
  #include "net80211/ieee80211_crypto.h"
  #include "net80211/ieee80211_ioctl.h"
@@ -104,10 +104,10 @@ Index: madwifi-ng-r2525-20070630/tools/athchans.c
  	const char *ifname = "wifi0";
  	struct ieee80211req_chanlist chanlist;
  	int c;
-Index: madwifi-ng-r2525-20070630/tools/athctrl.c
+Index: madwifi-ng-r2568-20070710/tools/athctrl.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/athctrl.c	2007-07-03 23:02:26.397693500 +0200
-+++ madwifi-ng-r2525-20070630/tools/athctrl.c	2007-07-03 23:02:27.433758250 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/athctrl.c	2007-07-11 22:59:39.504099754 +0200
++++ madwifi-ng-r2568-20070710/tools/athctrl.c	2007-07-11 22:59:40.216140332 +0200
 @@ -53,6 +53,10 @@
  
  #include <net/if.h>
@@ -139,10 +139,10 @@ Index: madwifi-ng-r2525-20070630/tools/athctrl.c
  	char device[IFNAMSIZ + 1];
  	int distance = -1;
  	int c;
-Index: madwifi-ng-r2525-20070630/tools/athdebug.c
+Index: madwifi-ng-r2568-20070710/tools/athdebug.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/athdebug.c	2007-07-03 23:02:26.405694000 +0200
-+++ madwifi-ng-r2525-20070630/tools/athdebug.c	2007-07-03 23:02:27.453759500 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/athdebug.c	2007-07-11 22:59:39.508099983 +0200
++++ madwifi-ng-r2568-20070710/tools/athdebug.c	2007-07-11 22:59:40.236141472 +0200
 @@ -52,6 +52,10 @@
  #include <getopt.h>
  #include <err.h>
@@ -175,10 +175,10 @@ Index: madwifi-ng-r2525-20070630/tools/athdebug.c
  #ifdef __linux__
  	const char *ifname = "wifi0";
  #else
-Index: madwifi-ng-r2525-20070630/tools/athkey.c
+Index: madwifi-ng-r2568-20070710/tools/athkey.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/athkey.c	2007-07-03 23:02:26.413694500 +0200
-+++ madwifi-ng-r2525-20070630/tools/athkey.c	2007-07-03 23:02:27.477761000 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/athkey.c	2007-07-11 22:59:39.516100443 +0200
++++ madwifi-ng-r2568-20070710/tools/athkey.c	2007-07-11 22:59:40.288144436 +0200
 @@ -59,6 +59,10 @@
  #include "net80211/ieee80211_crypto.h"
  #include "net80211/ieee80211_ioctl.h"
@@ -210,10 +210,10 @@ Index: madwifi-ng-r2525-20070630/tools/athkey.c
  	const char *ifname = "wifi0";
  	struct ieee80211req_key setkey;
  	struct ieee80211req_del_key delkey;
-Index: madwifi-ng-r2525-20070630/tools/athstats.c
+Index: madwifi-ng-r2568-20070710/tools/athstats.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/athstats.c	2007-07-03 23:02:26.421695000 +0200
-+++ madwifi-ng-r2525-20070630/tools/athstats.c	2007-07-03 23:02:27.505762750 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/athstats.c	2007-07-11 22:59:39.524100895 +0200
++++ madwifi-ng-r2568-20070710/tools/athstats.c	2007-07-11 22:59:40.328146718 +0200
 @@ -63,6 +63,10 @@
  #include "wireless_copy.h"
  #include "if_athioctl.h"
@@ -246,10 +246,10 @@ Index: madwifi-ng-r2525-20070630/tools/athstats.c
  #ifdef __linux__
  	const char *ifname = "wifi0";
  #else
-Index: madwifi-ng-r2525-20070630/tools/do_multi.c
+Index: madwifi-ng-r2568-20070710/tools/do_multi.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ madwifi-ng-r2525-20070630/tools/do_multi.c	2007-07-03 23:02:27.557766000 +0200
++++ madwifi-ng-r2568-20070710/tools/do_multi.c	2007-07-11 22:59:40.348147859 +0200
 @@ -0,0 +1,30 @@
 +#include <string.h>
 +#include "do_multi.h"
@@ -281,10 +281,10 @@ Index: madwifi-ng-r2525-20070630/tools/do_multi.c
 +    
 +    return ret;
 +}
-Index: madwifi-ng-r2525-20070630/tools/do_multi.h
+Index: madwifi-ng-r2568-20070710/tools/do_multi.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ madwifi-ng-r2525-20070630/tools/do_multi.h	2007-07-03 23:02:27.581767500 +0200
++++ madwifi-ng-r2568-20070710/tools/do_multi.h	2007-07-11 22:59:40.372149222 +0200
 @@ -0,0 +1,9 @@
 +
 +int a80211debug_init(int argc, char *argv[]);
@@ -295,10 +295,10 @@ Index: madwifi-ng-r2525-20070630/tools/do_multi.h
 +int athkey_init(int argc, char *argv[]);
 +int athstats_init(int argc, char *argv[]);
 +int wlanconfig_init(int argc, char *argv[]);
-Index: madwifi-ng-r2525-20070630/tools/Makefile
+Index: madwifi-ng-r2568-20070710/tools/Makefile
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/Makefile	2007-07-03 23:02:26.437696000 +0200
-+++ madwifi-ng-r2525-20070630/tools/Makefile	2007-07-03 23:02:27.605769000 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/Makefile	2007-07-11 22:59:39.540101806 +0200
++++ madwifi-ng-r2568-20070710/tools/Makefile	2007-07-11 22:59:40.388150134 +0200
 @@ -49,6 +49,12 @@
  
  ALL=	athstats 80211stats athkey athchans athctrl \
@@ -343,10 +343,10 @@ Index: madwifi-ng-r2525-20070630/tools/Makefile
  athstats: athstats.c
  	$(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
  80211stats: 80211stats.c
-Index: madwifi-ng-r2525-20070630/tools/wlanconfig.c
+Index: madwifi-ng-r2568-20070710/tools/wlanconfig.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/wlanconfig.c	2007-07-03 23:02:26.449696750 +0200
-+++ madwifi-ng-r2525-20070630/tools/wlanconfig.c	2007-07-03 23:02:27.669773000 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/wlanconfig.c	2007-07-11 22:59:39.548102266 +0200
++++ madwifi-ng-r2568-20070710/tools/wlanconfig.c	2007-07-11 22:59:40.404151049 +0200
 @@ -62,6 +62,10 @@
  #include "net80211/ieee80211_crypto.h"
  #include "net80211/ieee80211_ioctl.h"
diff --git a/package/madwifi/patches/104-autocreate_none.patch b/package/madwifi/patches/104-autocreate_none.patch
index a7f3f37e60..0a9774572a 100644
--- a/package/madwifi/patches/104-autocreate_none.patch
+++ b/package/madwifi/patches/104-autocreate_none.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:26.289686750 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:28.081798750 +0200
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:39.408094285 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:40.828175211 +0200
 @@ -427,7 +427,7 @@
  	HAL_STATUS status;
  	int error = 0;
diff --git a/package/madwifi/patches/105-ratectl_attach.patch b/package/madwifi/patches/105-ratectl_attach.patch
index 687620d6bf..92878457f1 100644
--- a/package/madwifi/patches/105-ratectl_attach.patch
+++ b/package/madwifi/patches/105-ratectl_attach.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_rate.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_rate.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_rate.c	2007-07-03 23:02:26.205681500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_rate.c	2007-07-03 23:02:28.337814750 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_rate.c	2007-07-11 22:59:39.332089952 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_rate.c	2007-07-11 22:59:41.136192763 +0200
 @@ -100,8 +100,18 @@
  		ieee80211_load_module(buf);
  
diff --git a/package/madwifi/patches/110-init_fix_PR_914.patch b/package/madwifi/patches/110-init_fix_PR_914.patch
index 5df989def8..89b42318d0 100644
--- a/package/madwifi/patches/110-init_fix_PR_914.patch
+++ b/package/madwifi/patches/110-init_fix_PR_914.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:28.081798750 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:28.585830250 +0200
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:40.828175211 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:41.372206215 +0200
 @@ -1988,7 +1988,10 @@
  		ath_draintxq(sc);
  		if (!sc->sc_invalid) {
diff --git a/package/madwifi/patches/111-minstrel_crash.patch b/package/madwifi/patches/111-minstrel_crash.patch
index bf90dcabc5..d88e602e3f 100644
--- a/package/madwifi/patches/111-minstrel_crash.patch
+++ b/package/madwifi/patches/111-minstrel_crash.patch
@@ -1,10 +1,10 @@
-Index: madwifi-ng-r2525-20070630/ath_rate/minstrel/minstrel.c
+Index: madwifi-ng-r2568-20070710/ath_rate/minstrel/minstrel.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath_rate/minstrel/minstrel.c	2007-07-03 23:02:26.041671250 +0200
-+++ madwifi-ng-r2525-20070630/ath_rate/minstrel/minstrel.c	2007-07-03 23:02:28.825845250 +0200
-@@ -389,6 +389,9 @@
+--- madwifi-ng-r2568-20070710.orig/ath_rate/minstrel/minstrel.c	2007-07-11 22:59:39.180081291 +0200
++++ madwifi-ng-r2568-20070710/ath_rate/minstrel/minstrel.c	2007-07-11 22:59:41.620220346 +0200
+@@ -388,6 +388,9 @@
+ 		struct minstrel_node *sn = ATH_NODE_MINSTREL(an);
  		int rc1, rc2, rc3;         /* Index into the rate table, so for example, it is  0..11 */
- 		int rixc1, rixc2, rixc3;   /* The actual bit rate used */
  
 +		if (sn->num_rates <= 0)
 +			return;
diff --git a/package/madwifi/patches/112-keycache_PR_962.patch b/package/madwifi/patches/112-keycache_PR_962.patch
index 4fa772d607..e63696127a 100644
--- a/package/madwifi/patches/112-keycache_PR_962.patch
+++ b/package/madwifi/patches/112-keycache_PR_962.patch
@@ -1,8 +1,8 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:28.585830250 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:29.069860500 +0200
-@@ -5726,7 +5726,8 @@
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:41.372206215 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:41.856233797 +0200
+@@ -5732,7 +5732,8 @@
  		 * frame; it'll be dropped where it's not wanted.
  		 */
  		if (rs->rs_keyix != HAL_RXKEYIX_INVALID &&
@@ -12,10 +12,10 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  			struct ath_node *an;
  			/*
  			 * Fast path: node is present in the key map;
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_node.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_node.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_node.c	2007-07-03 23:02:25.905662750 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_node.c	2007-07-03 23:02:29.073860750 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_node.c	2007-07-11 22:59:39.096076505 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_node.c	2007-07-11 22:59:41.860234023 +0200
 @@ -1271,8 +1271,6 @@
  	IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
  
@@ -46,10 +46,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_node.c
  /*
   * Return a reference to the appropriate node for sending
   * a data frame.  This handles node discovery in adhoc networks.
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_node.h
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_node.h
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_node.h	2007-07-03 23:02:25.917663500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_node.h	2007-07-03 23:02:29.121863750 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_node.h	2007-07-11 22:59:39.104076962 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_node.h	2007-07-11 22:59:41.884235392 +0200
 @@ -328,6 +328,8 @@
  	*pni = NULL;			/* guard against use */
  }
diff --git a/package/madwifi/patches/113-no_ibss_pwrsave.patch b/package/madwifi/patches/113-no_ibss_pwrsave.patch
index eebb5cf6f2..a4917646a9 100644
--- a/package/madwifi/patches/113-no_ibss_pwrsave.patch
+++ b/package/madwifi/patches/113-no_ibss_pwrsave.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_scan.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_scan.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_scan.c	2007-07-03 23:02:25.817657250 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_scan.c	2007-07-03 23:02:29.401881250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_scan.c	2007-07-11 22:59:39.012071719 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_scan.c	2007-07-11 22:59:42.172251804 +0200
 @@ -291,7 +291,8 @@
  	struct ieee80211com *ic = vap->iv_ic;
  	int delay;
diff --git a/package/madwifi/patches/116-adhoc_beacon_PR_1033.patch b/package/madwifi/patches/116-adhoc_beacon_PR_1033.patch
index 429ed164aa..781635c919 100644
--- a/package/madwifi/patches/116-adhoc_beacon_PR_1033.patch
+++ b/package/madwifi/patches/116-adhoc_beacon_PR_1033.patch
@@ -1,8 +1,8 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:29.069860500 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:29.657897250 +0200
-@@ -4422,16 +4422,31 @@
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:41.856233797 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:42.416265710 +0200
+@@ -4426,16 +4426,31 @@
  	struct ieee80211com *ic = &sc->sc_ic;
  	struct ath_hal *ah = sc->sc_ah;
  	struct ieee80211_node *ni;
@@ -38,7 +38,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	/* XXX conditionalize multi-bss support? */
  	if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
  		/*
-@@ -4445,20 +4460,61 @@
+@@ -4449,20 +4464,61 @@
  		if (sc->sc_stagbeacons)
  			intval /= ATH_BCBUF;	/* for staggered beacons */
  		if ((sc->sc_nostabeacons) &&
@@ -109,7 +109,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  		int dtimperiod, dtimcount;
  		int cfpperiod, cfpcount;
  
-@@ -4474,13 +4530,13 @@
+@@ -4478,13 +4534,13 @@
  			dtimcount = 0;		/* XXX? */
  		cfpperiod = 1;			/* NB: no PCF support yet */
  		cfpcount = 0;
@@ -126,7 +126,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  		do {
  			nexttbtt += intval;
  			if (--dtimcount < 0) {
-@@ -4488,7 +4544,7 @@
+@@ -4492,7 +4548,7 @@
  				if (--cfpcount < 0)
  					cfpcount = cfpperiod - 1;
  			}
@@ -135,7 +135,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  #undef FUDGE
  		memset(&bs, 0, sizeof(bs));
  		bs.bs_intval = intval;
-@@ -4540,7 +4596,7 @@
+@@ -4544,7 +4600,7 @@
  		DPRINTF(sc, ATH_DEBUG_BEACON,
  			"%s: tsf %llu tsf:tu %u intval %u nexttbtt %u dtim %u nextdtim %u bmiss %u sleep %u cfp:period %u maxdur %u next %u timoffset %u\n",
  			__func__,
@@ -144,7 +144,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  			bs.bs_intval,
  			bs.bs_nexttbtt,
  			bs.bs_dtimperiod,
-@@ -4562,7 +4618,7 @@
+@@ -4566,7 +4622,7 @@
  		ath_hal_intrset(ah, sc->sc_imask);
  	} else {
  		ath_hal_intrset(ah, 0);
@@ -153,7 +153,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  			intval |= HAL_BEACON_RESET_TSF;
  		if (ic->ic_opmode == IEEE80211_M_IBSS) {
  			/*
-@@ -4599,8 +4655,40 @@
+@@ -4603,8 +4659,40 @@
  		if (ic->ic_opmode == IEEE80211_M_IBSS && sc->sc_hasveol)
  			ath_beacon_start_adhoc(sc, vap);
  	}
diff --git a/package/madwifi/patches/120-soc_fix.patch b/package/madwifi/patches/120-soc_fix.patch
index 5aae795da9..2b06e1db51 100644
--- a/package/madwifi/patches/120-soc_fix.patch
+++ b/package/madwifi/patches/120-soc_fix.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath_ahb.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath_ahb.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath_ahb.c	2007-07-03 23:02:25.509638000 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath_ahb.c	2007-07-03 23:02:30.709963000 +0200
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath_ahb.c	2007-07-11 22:59:38.860063056 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath_ahb.c	2007-07-11 22:59:42.668280075 +0200
 @@ -275,11 +275,10 @@
  
  
diff --git a/package/madwifi/patches/121-ibss_hostap.patch b/package/madwifi/patches/121-ibss_hostap.patch
index 1705dd9f5e..9caf16b355 100644
--- a/package/madwifi/patches/121-ibss_hostap.patch
+++ b/package/madwifi/patches/121-ibss_hostap.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:29.917913500 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:30.957978500 +0200
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:42.416265710 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:42.904293522 +0200
 @@ -410,7 +410,6 @@
   * and use the next two bits as the index of the VAP.
   */
@@ -117,7 +117,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  		sc->sc_nstavaps--;
  		sc->sc_nostabeacons = 0;
  	} else if (vap->iv_opmode == IEEE80211_M_MONITOR)
-@@ -3390,7 +3380,7 @@
+@@ -3383,7 +3373,7 @@
  	    sc->sc_opmode == HAL_M_IBSS ||	/* NB: AHDEMO too */
  	    (sc->sc_nostabeacons) || sc->sc_scanning)
  		rfilt |= HAL_RX_FILTER_BEACON;
@@ -126,7 +126,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  		rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
  			  HAL_RX_FILTER_PROBEREQ | HAL_RX_FILTER_PROM);
  	return rfilt;
-@@ -5837,12 +5827,20 @@
+@@ -5832,12 +5822,20 @@
  			type = ieee80211_input(ni, skb, rs->rs_rssi, rs_tsf);
  			ieee80211_unref_node(&ni);
  		} else {
@@ -149,11 +149,11 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  			if (ni != NULL) {
  				struct ath_node *an = ATH_NODE(ni);
  				ieee80211_keyix_t keyix;
-Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
+Index: madwifi-ng-r2568-20070710/ath/if_athvar.h
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_athvar.h	2007-07-03 23:02:29.917913500 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_athvar.h	2007-07-03 23:02:30.957978500 +0200
-@@ -199,7 +199,7 @@
+--- madwifi-ng-r2568-20070710.orig/ath/if_athvar.h	2007-07-11 22:59:38.760057354 +0200
++++ madwifi-ng-r2568-20070710/ath/if_athvar.h	2007-07-11 22:59:42.904293522 +0200
+@@ -204,7 +204,7 @@
  #define	ATH_RXBUF	40		/* number of RX buffers */
  #define	ATH_TXBUF	200		/* number of TX buffers */
  
@@ -162,7 +162,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
  
  /* free buffer threshold to restart net dev */
  #define	ATH_TXBUF_FREE_THRESHOLD  (ATH_TXBUF / 20)
-@@ -598,6 +598,7 @@
+@@ -603,6 +603,7 @@
  	u_int16_t sc_nvaps;			/* # of active virtual APs */
  	u_int8_t sc_nstavaps;			/* # of active station VAPs */
  	u_int8_t sc_nmonvaps;			/* # of monitor VAPs */
@@ -170,10 +170,10 @@ Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
  	u_int8_t sc_nbcnvaps;			/* # of vaps sending beacons */
  	u_int sc_fftxqmin;			/* aggregation threshold */
  	HAL_INT sc_imask;			/* interrupt mask copy */
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_beacon.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_beacon.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_beacon.c	2007-07-03 23:02:25.413632000 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_beacon.c	2007-07-03 23:02:30.981980000 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_beacon.c	2007-07-11 22:59:38.764057583 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_beacon.c	2007-07-11 22:59:42.932295119 +0200
 @@ -111,7 +111,7 @@
  	bo->bo_tim = frm;
  
@@ -183,11 +183,11 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_beacon.c
  		*frm++ = IEEE80211_ELEMID_IBSSPARMS;
  		*frm++ = 2;
  		*frm++ = 0; *frm++ = 0;		/* TODO: ATIM window */
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_input.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_input.c	2007-07-03 23:02:25.421632500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_input.c	2007-07-03 23:02:31.005981500 +0200
-@@ -2980,7 +2980,13 @@
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_input.c	2007-07-11 22:59:38.772058042 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_input.c	2007-07-11 22:59:42.956296485 +0200
+@@ -2981,7 +2981,13 @@
  			return;
  		}
  		if (ni == vap->iv_bss) {
@@ -202,7 +202,7 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
  				/*
  				 * XXX Cannot tell if the sender is operating
  				 * in ibss mode.  But we need a new node to
-@@ -2989,12 +2995,13 @@
+@@ -2990,12 +2996,13 @@
  				 */
  				ni = ieee80211_fakeup_adhoc_node(vap,
  					wh->i_addr2);
@@ -217,10 +217,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
  		}
  
  		IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_INPUT, wh->i_addr2,
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_node.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_node.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_node.c	2007-07-03 23:02:29.073860750 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_node.c	2007-07-03 23:02:31.037983500 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_node.c	2007-07-11 22:59:41.860234023 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_node.c	2007-07-11 22:59:43.008299449 +0200
 @@ -1084,8 +1084,25 @@
  	IEEE80211_NODE_TABLE_LOCK_ASSERT(nt);
  
diff --git a/package/madwifi/patches/122-replayfail_workaround.patch b/package/madwifi/patches/122-replayfail_workaround.patch
index c7cfc0186c..2d6f9224b0 100644
--- a/package/madwifi/patches/122-replayfail_workaround.patch
+++ b/package/madwifi/patches/122-replayfail_workaround.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_linux.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_linux.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_linux.c	2007-07-03 23:02:25.321626250 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_linux.c	2007-07-03 23:02:31.362003750 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_linux.c	2007-07-11 22:59:38.668052115 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_linux.c	2007-07-11 22:59:43.336318141 +0200
 @@ -285,6 +285,9 @@
  		k->wk_cipher->ic_name, k->wk_keyix,
  		(unsigned long long)rsc );
diff --git a/package/madwifi/patches/123-ccmp_checks.patch b/package/madwifi/patches/123-ccmp_checks.patch
index 0ae9ece671..1e0dd7672c 100644
--- a/package/madwifi/patches/123-ccmp_checks.patch
+++ b/package/madwifi/patches/123-ccmp_checks.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_ccmp.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_ccmp.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_crypto_ccmp.c	2007-07-03 23:02:25.245621500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_ccmp.c	2007-07-03 23:02:31.690024250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_crypto_ccmp.c	2007-07-11 22:59:38.584047327 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_ccmp.c	2007-07-11 22:59:43.580332047 +0200
 @@ -475,6 +475,9 @@
  	uint8_t *mic, *pos;
  	u_int space;
diff --git a/package/madwifi/patches/124-linux24_compat.patch b/package/madwifi/patches/124-linux24_compat.patch
index f8b42ec69d..8f857e88e9 100644
--- a/package/madwifi/patches/124-linux24_compat.patch
+++ b/package/madwifi/patches/124-linux24_compat.patch
@@ -1,9 +1,9 @@
-Index: madwifi-ng-r2537-20070704/ath/if_athvar.h
+Index: madwifi-ng-r2568-20070710/ath/if_athvar.h
 ===================================================================
---- madwifi-ng-r2537-20070704.orig/ath/if_athvar.h	2007-07-07 11:28:00.232371000 +0200
-+++ madwifi-ng-r2537-20070704/ath/if_athvar.h	2007-07-07 11:28:09.784968000 +0200
-@@ -118,6 +118,11 @@
- #define ATH_GET_NETDEV_DEV(ndev)	((ndev)->class_dev.dev)
+--- madwifi-ng-r2568-20070710.orig/ath/if_athvar.h	2007-07-11 22:59:42.904293522 +0200
++++ madwifi-ng-r2568-20070710/ath/if_athvar.h	2007-07-11 22:59:43.812345272 +0200
+@@ -123,6 +123,11 @@
+ #define	NETDEV_TX_BUSY	1
  #endif
  
 +#ifndef NETDEV_TX_OK
diff --git a/package/madwifi/patches/125-tpc_PR_1435.patch b/package/madwifi/patches/125-tpc_PR_1435.patch
new file mode 100644
index 0000000000..5ecb9c6550
--- /dev/null
+++ b/package/madwifi/patches/125-tpc_PR_1435.patch
@@ -0,0 +1,87 @@
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
+===================================================================
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:42.904293522 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:44.052358947 +0200
+@@ -273,9 +273,7 @@
+ static char *autocreate = NULL;
+ static char *ratectl = DEF_RATE_CTL;
+ static int rfkill = 0;
+-#ifdef ATH_CAP_TPC
+ static int tpc = 0;
+-#endif
+ static int countrycode = -1;
+ static int outdoor = -1;
+ static int xchanmode = -1;
+@@ -533,12 +531,6 @@
+ 		rfkill ? "on" : "off");
+ 	ath_hal_setrfsilent(ah, rfkill);
+ 
+-#ifdef ATH_CAP_TPC
+-	printk(KERN_INFO "ath_pci: ath_pci: switching per-packet transmit power control %s\n",
+-		tpc ? "on" : "off");
+-	ath_hal_settpc(ah, tpc);
+-#endif
+-
+ 	/*
+ 	 * Setup rate tables for all potential media types.
+ 	 */
+@@ -818,11 +810,18 @@
+ 	 */
+ #ifdef ATH_CAP_TPC
+ 	sc->sc_hastpc = ath_hal_hastpc(ah);
+-	if (sc->sc_hastpc || ath_hal_hastxpowlimit(ah))
++	if(tpc && !sc->sc_hastpc) {
++		printk(KERN_WARNING "ath_pci: WARNING: per-packet transmit power control was requested, but is not supported by the hardware.\n");
++		tpc = 0;
++	}
++	printk(KERN_INFO "ath_pci: switching per-packet transmit power control %s\n",
++		tpc ? "on" : "off");
++	ath_hal_settpc(ah, tpc);
+ #else
+ 	sc->sc_hastpc = 0;
+-	if (ath_hal_hastxpowlimit(ah))
++	tpc = 0; /* TPC is always zero, when compiled without ATH_CAP_TPC */
+ #endif
++	if (sc->sc_hastpc || ath_hal_hastxpowlimit(ah))
+ 		ic->ic_caps |= IEEE80211_C_TXPMGT;
+ 
+ 	/*
+@@ -1836,7 +1835,7 @@
+ 	ath_stop_locked(dev);
+ 
+ #ifdef ATH_CAP_TPC
+-	/* Re-enable after suspend (?) */
++	/* Re-enable after suspend */
+ 	ath_hal_settpc(ah, tpc);
+ #endif
+ 
+@@ -8787,26 +8786,17 @@
+ 	 * Search for the VAP that needs a txpow change, if any
+ 	 */
+ 	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+-#ifdef ATH_CAP_TPC
+-		if (ic->ic_newtxpowlimit == vap->iv_bss->ni_txpower) {
++		if (!tpc || ic->ic_newtxpowlimit >= vap->iv_bss->ni_txpower) {
+ 			vap->iv_bss->ni_txpower = clamped_txpow;
+ 			ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, set_node_txpower, &clamped_txpow);
+ 		}
+-#else
+-		vap->iv_bss->ni_txpower = clamped_txpow;
+-		ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, set_node_txpower, &clamped_txpow);
+-#endif
+ 	}
+ 
+ 	ic->ic_newtxpowlimit = sc->sc_curtxpow = clamped_txpow;
+ 
+-#ifdef ATH_CAP_TPC
+-	if (ic->ic_newtxpowlimit >= txpowlimit)
+-		ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
+-#else
+-	if (ic->ic_newtxpowlimit != txpowlimit)
++	if ((tpc && ic->ic_newtxpowlimit >= txpowlimit) ||
++	    (ic->ic_newtxpowlimit != txpowlimit))
+ 		ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
+-#endif
+ }
+ 
+ 
diff --git a/package/madwifi/patches/200-no_debug.patch b/package/madwifi/patches/200-no_debug.patch
index 71675e5a11..d3461166e0 100644
--- a/package/madwifi/patches/200-no_debug.patch
+++ b/package/madwifi/patches/200-no_debug.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:30.957978500 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:32.178054750 +0200
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:44.052358947 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:44.300373081 +0200
 @@ -75,7 +75,7 @@
  #include <net80211/if_llc.h>
  #endif
@@ -11,10 +11,10 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  
  #include "net80211/if_athproto.h"
  #include "if_athvar.h"
-Index: madwifi-ng-r2525-20070630/ath_rate/amrr/amrr.c
+Index: madwifi-ng-r2568-20070710/ath_rate/amrr/amrr.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath_rate/amrr/amrr.c	2007-07-03 23:02:25.053609500 +0200
-+++ madwifi-ng-r2525-20070630/ath_rate/amrr/amrr.c	2007-07-03 23:02:32.178054750 +0200
+--- madwifi-ng-r2568-20070710.orig/ath_rate/amrr/amrr.c	2007-07-11 22:59:38.296030912 +0200
++++ madwifi-ng-r2568-20070710/ath_rate/amrr/amrr.c	2007-07-11 22:59:44.304373307 +0200
 @@ -70,7 +70,7 @@
  
  #include "amrr.h"
@@ -24,10 +24,10 @@ Index: madwifi-ng-r2525-20070630/ath_rate/amrr/amrr.c
  #ifdef AMRR_DEBUG
  #define	DPRINTF(sc, _fmt, ...) do {					\
  	if (sc->sc_debug & 0x10)					\
-Index: madwifi-ng-r2525-20070630/ath_rate/minstrel/minstrel.c
+Index: madwifi-ng-r2568-20070710/ath_rate/minstrel/minstrel.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath_rate/minstrel/minstrel.c	2007-07-03 23:02:30.209931750 +0200
-+++ madwifi-ng-r2525-20070630/ath_rate/minstrel/minstrel.c	2007-07-03 23:02:32.230058000 +0200
+--- madwifi-ng-r2568-20070710.orig/ath_rate/minstrel/minstrel.c	2007-07-11 22:59:41.620220346 +0200
++++ madwifi-ng-r2568-20070710/ath_rate/minstrel/minstrel.c	2007-07-11 22:59:44.320374218 +0200
 @@ -117,7 +117,7 @@
  
  #include "minstrel.h"
@@ -37,10 +37,10 @@ Index: madwifi-ng-r2525-20070630/ath_rate/minstrel/minstrel.c
  #ifdef MINSTREL_DEBUG
  enum {
  		ATH_DEBUG_RATE		= 0x00000010	/* rate control */
-Index: madwifi-ng-r2525-20070630/ath_rate/onoe/onoe.c
+Index: madwifi-ng-r2568-20070710/ath_rate/onoe/onoe.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath_rate/onoe/onoe.c	2007-07-03 23:02:25.073610750 +0200
-+++ madwifi-ng-r2525-20070630/ath_rate/onoe/onoe.c	2007-07-03 23:02:32.254059500 +0200
+--- madwifi-ng-r2568-20070710.orig/ath_rate/onoe/onoe.c	2007-07-11 22:59:38.312031823 +0200
++++ madwifi-ng-r2568-20070710/ath_rate/onoe/onoe.c	2007-07-11 22:59:44.336375133 +0200
 @@ -66,7 +66,7 @@
  
  #include "onoe.h"
@@ -50,10 +50,10 @@ Index: madwifi-ng-r2525-20070630/ath_rate/onoe/onoe.c
  #ifdef ONOE_DEBUG
  enum {
  	ATH_DEBUG_RATE	= 0x00000010,	/* rate control */
-Index: madwifi-ng-r2525-20070630/ath_rate/sample/sample.c
+Index: madwifi-ng-r2568-20070710/ath_rate/sample/sample.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath_rate/sample/sample.c	2007-07-03 23:02:25.081611250 +0200
-+++ madwifi-ng-r2525-20070630/ath_rate/sample/sample.c	2007-07-03 23:02:32.282061250 +0200
+--- madwifi-ng-r2568-20070710.orig/ath_rate/sample/sample.c	2007-07-11 22:59:38.320032282 +0200
++++ madwifi-ng-r2568-20070710/ath_rate/sample/sample.c	2007-07-11 22:59:44.352376045 +0200
 @@ -68,7 +68,7 @@
  
  #include "sample.h"
@@ -63,10 +63,10 @@ Index: madwifi-ng-r2525-20070630/ath_rate/sample/sample.c
  #ifdef SAMPLE_DEBUG
  enum {
  	ATH_DEBUG_NODE		= 0x00080000,	/* node management */
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_proto.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_proto.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_proto.c	2007-07-03 23:02:25.089611750 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_proto.c	2007-07-03 23:02:32.306062750 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_proto.c	2007-07-11 22:59:38.324032509 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_proto.c	2007-07-11 22:59:44.372377182 +0200
 @@ -286,6 +286,7 @@
  }
  EXPORT_SYMBOL(ieee80211_aclator_get);
@@ -83,10 +83,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_proto.c
  void
  ieee80211_dump_pkt(struct ieee80211com *ic,
  	const u_int8_t *buf, int len, int rate, int rssi)
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_var.h
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_var.h
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_var.h	2007-07-03 23:02:25.101612500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_var.h	2007-07-03 23:02:32.330064250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_var.h	2007-07-11 22:59:38.332032964 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_var.h	2007-07-11 22:59:44.412379463 +0200
 @@ -35,8 +35,8 @@
  #ifndef _NET80211_IEEE80211_VAR_H_
  #define _NET80211_IEEE80211_VAR_H_
@@ -98,10 +98,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_var.h
  
  /* Definitions for IEEE 802.11 drivers. */
  #include <net80211/ieee80211_linux.h>
-Index: madwifi-ng-r2525-20070630/tools/do_multi.c
+Index: madwifi-ng-r2568-20070710/tools/do_multi.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/do_multi.c	2007-07-03 23:02:27.557766000 +0200
-+++ madwifi-ng-r2525-20070630/tools/do_multi.c	2007-07-03 23:02:32.386067750 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/do_multi.c	2007-07-11 22:59:40.348147859 +0200
++++ madwifi-ng-r2568-20070710/tools/do_multi.c	2007-07-11 22:59:44.432380603 +0200
 @@ -9,16 +9,20 @@
  
      progname = basename(argv[0]);
@@ -123,10 +123,10 @@ Index: madwifi-ng-r2525-20070630/tools/do_multi.c
      if(strcmp(progname, "athkey") == 0)
  	ret =  athkey_init(argc, argv);
      if(strcmp(progname, "athstats") == 0)
-Index: madwifi-ng-r2525-20070630/tools/Makefile
+Index: madwifi-ng-r2568-20070710/tools/Makefile
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/tools/Makefile	2007-07-03 23:02:27.605769000 +0200
-+++ madwifi-ng-r2525-20070630/tools/Makefile	2007-07-03 23:02:32.406069000 +0200
+--- madwifi-ng-r2568-20070710.orig/tools/Makefile	2007-07-11 22:59:40.388150134 +0200
++++ madwifi-ng-r2568-20070710/tools/Makefile	2007-07-11 22:59:44.448381515 +0200
 @@ -52,7 +52,7 @@
  	
  ifdef DOMULTI
diff --git a/package/madwifi/patches/300-napi_polling.patch b/package/madwifi/patches/300-napi_polling.patch
index bdaf9d078c..e62a84515a 100644
--- a/package/madwifi/patches/300-napi_polling.patch
+++ b/package/madwifi/patches/300-napi_polling.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:32.178054750 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:32.998106000 +0200
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:44.300373081 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:44.896407046 +0200
 @@ -170,7 +170,7 @@
  	int, u_int64_t);
  static void ath_setdefantenna(struct ath_softc *, u_int);
@@ -11,7 +11,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  static int ath_hardstart(struct sk_buff *, struct net_device *);
  static int ath_mgtstart(struct ieee80211com *, struct sk_buff *);
  #ifdef ATH_SUPERG_COMP
-@@ -446,7 +446,6 @@
+@@ -444,7 +444,6 @@
  	ATH_TXBUF_LOCK_INIT(sc);
  	ATH_RXBUF_LOCK_INIT(sc);
  
@@ -19,7 +19,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	ATH_INIT_TQUEUE(&sc->sc_txtq,	  ath_tx_tasklet,	dev);
  	ATH_INIT_TQUEUE(&sc->sc_bmisstq,  ath_bmiss_tasklet,	dev);
  	ATH_INIT_TQUEUE(&sc->sc_bstucktq, ath_bstuck_tasklet,	dev);
-@@ -699,6 +698,8 @@
+@@ -691,6 +690,8 @@
  	dev->set_mac_address = ath_set_mac_address;
   	dev->change_mtu = ath_change_mtu;
  	dev->tx_queue_len = ATH_TXBUF - 1;		/* 1 for mgmt frame */
@@ -28,7 +28,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  #ifdef USE_HEADERLEN_RESV
  	dev->hard_header_len += sizeof(struct ieee80211_qosframe) +
  				sizeof(struct llc) +
-@@ -1668,6 +1669,7 @@
+@@ -1667,6 +1668,7 @@
  	 */
  	ath_hal_getisr(ah, &status);		/* NB: clears ISR too */
  	DPRINTF(sc, ATH_DEBUG_INTR, "%s: status 0x%x\n", __func__, status);
@@ -36,7 +36,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	status &= sc->sc_imask;			/* discard unasked for bits */
  	if (status & HAL_INT_FATAL) {
  		sc->sc_stats.ast_hardware++;
-@@ -1703,7 +1705,14 @@
+@@ -1702,7 +1704,14 @@
  		if (status & HAL_INT_RX) {
  			sc->sc_tsf = ath_hal_gettsf64(ah);
  			ath_uapsd_processtriggers(sc);
@@ -52,7 +52,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  		}
  		if (status & HAL_INT_TX) {
  #ifdef ATH_SUPERG_DYNTURBO
-@@ -1729,6 +1738,11 @@
+@@ -1728,6 +1737,11 @@
  				}
  			}
  #endif
@@ -64,7 +64,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  			ATH_SCHEDULE_TQUEUE(&sc->sc_txtq, &needmark);
  		}
  		if (status & HAL_INT_BMISS) {
-@@ -3323,10 +3337,10 @@
+@@ -3315,10 +3329,10 @@
  	 *
  	 * XXX Using in_softirq is not right since we might
  	 * be called from other soft irq contexts than
@@ -77,7 +77,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	netif_stop_queue(dev);
  }
  
-@@ -3339,7 +3353,7 @@
+@@ -3331,7 +3345,7 @@
  	DPRINTF(sc, ATH_DEBUG_KEYCACHE, "%s:\n", __func__);
  	netif_start_queue(dev);
  	if (!in_softirq())		/* NB: see above */
@@ -86,7 +86,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  }
  
  /*
-@@ -5590,13 +5604,12 @@
+@@ -5584,13 +5598,12 @@
  	sc->sc_rxotherant = 0;
  }
  
@@ -102,7 +102,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	struct ath_buf *bf;
  	struct ath_softc *sc = dev->priv;
  	struct ieee80211com *ic = &sc->sc_ic;
-@@ -5609,12 +5622,15 @@
+@@ -5603,12 +5616,15 @@
  	int type;
  	u_int phyerr;
  	u_int64_t rs_tsf;
@@ -118,7 +118,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	do {
  		bf = STAILQ_FIRST(&sc->sc_rxbuf);
  		if (bf == NULL) {		/* XXX ??? can this happen */
-@@ -5638,6 +5654,13 @@
+@@ -5632,6 +5648,13 @@
  			/* NB: never process the self-linked entry at the end */
  			break;
  		}
@@ -132,7 +132,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  		skb = bf->bf_skb;
  		if (skb == NULL) {		/* XXX ??? can this happen */
  			printk("%s: no skbuff (%s)\n", DEV_NAME(dev), __func__);
-@@ -5676,6 +5699,7 @@
+@@ -5670,6 +5693,7 @@
  				sc->sc_stats.ast_rx_phyerr++;
  				phyerr = rs->rs_phyerr & 0x1f;
  				sc->sc_stats.ast_rx_phy[phyerr]++;
@@ -140,7 +140,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  			}
  			if (rs->rs_status & HAL_RXERR_DECRYPT) {
  				/*
-@@ -5892,9 +5916,33 @@
+@@ -5886,9 +5910,33 @@
  		STAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list);
  		ATH_RXBUF_UNLOCK_IRQ(sc);
  	} while (ath_rxbuf_init(sc, bf) == 0);
@@ -174,7 +174,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  #undef PA2DESC
  }
  
-@@ -7513,11 +7561,22 @@
+@@ -7511,11 +7559,22 @@
  	struct net_device *dev = (struct net_device *)data;
  	struct ath_softc *sc = dev->priv;
  
@@ -197,7 +197,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	netif_wake_queue(dev);
  
  	if (sc->sc_softled)
-@@ -7534,6 +7593,7 @@
+@@ -7532,6 +7591,7 @@
  	struct net_device *dev = (struct net_device *)data;
  	struct ath_softc *sc = dev->priv;
  
@@ -205,7 +205,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	/*
  	 * Process each active queue.
  	 */
-@@ -7554,6 +7614,16 @@
+@@ -7552,6 +7612,16 @@
  	if (sc->sc_uapsdq && txqactive(sc->sc_ah, sc->sc_uapsdq->axq_qnum))
  		ath_tx_processq(sc, sc->sc_uapsdq);
  
@@ -222,7 +222,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	netif_wake_queue(dev);
  
  	if (sc->sc_softled)
-@@ -7571,6 +7641,7 @@
+@@ -7569,6 +7639,7 @@
  	unsigned int i;
  
  	/* Process each active queue. */
@@ -230,7 +230,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	for (i = 0; i < HAL_NUM_TX_QUEUES; i++)
  		if (ATH_TXQ_SETUP(sc, i) && txqactive(sc->sc_ah, i))
  			ath_tx_processq(sc, &sc->sc_txq[i]);
-@@ -7579,6 +7650,16 @@
+@@ -7577,6 +7648,16 @@
  		ath_tx_processq(sc, sc->sc_xrtxq);
  #endif
  
@@ -247,7 +247,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	netif_wake_queue(dev);
  
  	if (sc->sc_softled)
-@@ -7677,6 +7758,7 @@
+@@ -7675,6 +7756,7 @@
  ath_draintxq(struct ath_softc *sc)
  {
  	struct ath_hal *ah = sc->sc_ah;
@@ -255,7 +255,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	unsigned int i;
  
  	/* XXX return value */
-@@ -9195,9 +9277,9 @@
+@@ -9184,9 +9266,9 @@
  	dev->mtu = mtu;
  	if ((dev->flags & IFF_RUNNING) && !sc->sc_invalid) {
  		/* NB: the rx buffers may need to be reallocated */
@@ -267,10 +267,10 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	}
  	ATH_UNLOCK(sc);
  
-Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
+Index: madwifi-ng-r2568-20070710/ath/if_athvar.h
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_athvar.h	2007-07-03 23:02:30.957978500 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_athvar.h	2007-07-03 23:02:33.002106250 +0200
+--- madwifi-ng-r2568-20070710.orig/ath/if_athvar.h	2007-07-11 22:59:43.812345272 +0200
++++ madwifi-ng-r2568-20070710/ath/if_athvar.h	2007-07-11 22:59:44.896407046 +0200
 @@ -49,6 +49,10 @@
  #include "net80211/ieee80211.h"		/* XXX for WME_NUM_AC */
  #include <asm/io.h>
@@ -282,7 +282,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
  /*
   * Deduce if tasklets are available.  If not then
   * fall back to using the immediate work queue.
-@@ -625,7 +629,6 @@
+@@ -635,7 +639,6 @@
  	struct ath_buf *sc_rxbufcur;		/* current rx buffer */
  	u_int32_t *sc_rxlink;			/* link ptr in last RX desc */
  	spinlock_t sc_rxbuflock;
@@ -290,7 +290,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
  	struct ATH_TQ_STRUCT sc_rxorntq;	/* rxorn intr tasklet */
  	u_int8_t sc_defant;			/* current default antenna */
  	u_int8_t sc_rxotherant;			/* RXs on non-default antenna */
-@@ -638,6 +641,7 @@
+@@ -648,6 +651,7 @@
  	u_int sc_txintrperiod;			/* tx interrupt batching */
  	struct ath_txq sc_txq[HAL_NUM_TX_QUEUES];
  	struct ath_txq *sc_ac2q[WME_NUM_AC];	/* WME AC -> h/w qnum */
@@ -298,7 +298,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
  	struct ATH_TQ_STRUCT sc_txtq;		/* tx intr tasklet */
  	u_int8_t sc_grppoll_str[GRPPOLL_RATE_STR_LEN];
  	struct ath_descdma sc_bdma;		/* beacon descriptors */
-@@ -718,6 +722,8 @@
+@@ -720,6 +724,8 @@
  #define	ATH_TXBUF_LOCK_ASSERT(_sc) \
  	KASSERT(spin_is_locked(&(_sc)->sc_txbuflock), ("txbuf not locked!"))
  
@@ -307,10 +307,10 @@ Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
  
  #define	ATH_RXBUF_LOCK_INIT(_sc)	spin_lock_init(&(_sc)->sc_rxbuflock)
  #define	ATH_RXBUF_LOCK_DESTROY(_sc)
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_input.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_input.c	2007-07-03 23:02:31.926039000 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_input.c	2007-07-03 23:02:33.002106250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_input.c	2007-07-11 22:59:42.956296485 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_input.c	2007-07-11 22:59:44.916408186 +0200
 @@ -1128,8 +1128,9 @@
  		if (ni->ni_vlan != 0 && vap->iv_vlgrp != NULL) {
  			/* attach vlan tag */
diff --git a/package/madwifi/patches/301-tx_locking.patch b/package/madwifi/patches/301-tx_locking.patch
index edf138558f..2bfc22e403 100644
--- a/package/madwifi/patches/301-tx_locking.patch
+++ b/package/madwifi/patches/301-tx_locking.patch
@@ -1,8 +1,8 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:32.998106000 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:33.302125000 +0200
-@@ -2567,7 +2567,7 @@
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:44.896407046 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:45.332431894 +0200
+@@ -2558,7 +2558,7 @@
  	/* NB: use this lock to protect an->an_tx_ffbuf (and txq->axq_stageq)
  	 *	in athff_can_aggregate() call too.
  	 */
@@ -11,7 +11,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  	if (athff_can_aggregate(sc, eh, an, skb, vap->iv_fragthreshold, &ff_flush)) {
  		if (an->an_tx_ffbuf[skb->priority]) { /* i.e., frame on the staging queue */
  			bf = an->an_tx_ffbuf[skb->priority];
-@@ -2575,6 +2575,7 @@
+@@ -2566,6 +2566,7 @@
  			/* get (and remove) the frame from staging queue */
  			TAILQ_REMOVE(&txq->axq_stageq, bf, bf_stagelist);
  			an->an_tx_ffbuf[skb->priority] = NULL;
@@ -19,7 +19,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  
  			/*
  			 * chain skbs and add FF magic
-@@ -2597,7 +2598,7 @@
+@@ -2588,7 +2589,7 @@
  			 */
  			ATH_HARDSTART_GET_TX_BUF_WITH_LOCK;
  			if (bf == NULL) {
@@ -28,7 +28,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  				goto hardstart_fail;
  			}
  			DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_FF,
-@@ -2609,8 +2610,7 @@
+@@ -2600,8 +2601,7 @@
  			an->an_tx_ffbuf[skb->priority] = bf;
  
  			TAILQ_INSERT_HEAD(&txq->axq_stageq, bf, bf_stagelist);
@@ -36,9 +36,9 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
 -			ATH_TXQ_UNLOCK_IRQ_EARLY(txq);
 +			ATH_TXQ_UNLOCK_BH(txq);
  
- 			return 0;
+ 			return NETDEV_TX_OK;
  		}
-@@ -2623,7 +2623,7 @@
+@@ -2614,7 +2614,7 @@
  			an->an_tx_ffbuf[skb->priority] = NULL;
  
  			/* NB: ath_tx_start -> ath_tx_txqaddbuf uses ATH_TXQ_LOCK too */
@@ -47,7 +47,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  
  			/* encap and xmit */
  			bf_ff->bf_skb = ieee80211_encap(ni, bf_ff->bf_skb, &framecnt);
-@@ -2674,12 +2674,12 @@
+@@ -2663,12 +2663,12 @@
  
  		ATH_HARDSTART_GET_TX_BUF_WITH_LOCK;
  		if (bf == NULL) {
@@ -62,11 +62,11 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  
  ff_flush_done:
  ff_bypass:
-Index: madwifi-ng-r2525-20070630/ath/if_athvar.h
+Index: madwifi-ng-r2568-20070710/ath/if_athvar.h
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_athvar.h	2007-07-03 23:02:33.002106250 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_athvar.h	2007-07-03 23:02:33.302125000 +0200
-@@ -487,6 +487,8 @@
+--- madwifi-ng-r2568-20070710.orig/ath/if_athvar.h	2007-07-11 22:59:44.896407046 +0200
++++ madwifi-ng-r2568-20070710/ath/if_athvar.h	2007-07-11 22:59:45.332431894 +0200
+@@ -497,6 +497,8 @@
  #define ATH_TXQ_INTR_PERIOD		5  /* axq_intrcnt period for intr gen */
  #define	ATH_TXQ_LOCK_INIT(_tq)		spin_lock_init(&(_tq)->axq_lock)
  #define	ATH_TXQ_LOCK_DESTROY(_tq)
diff --git a/package/madwifi/patches/305-pureg_fix.patch b/package/madwifi/patches/305-pureg_fix.patch
index c3542831c1..71dcbdd103 100644
--- a/package/madwifi/patches/305-pureg_fix.patch
+++ b/package/madwifi/patches/305-pureg_fix.patch
@@ -1,8 +1,8 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:33.302125000 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:33.594143250 +0200
-@@ -3392,7 +3392,9 @@
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:45.332431894 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:45.608447623 +0200
+@@ -3384,7 +3384,9 @@
  		rfilt |= HAL_RX_FILTER_PROM;
  	if (ic->ic_opmode == IEEE80211_M_STA ||
  	    sc->sc_opmode == HAL_M_IBSS ||	/* NB: AHDEMO too */
@@ -13,10 +13,10 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  		rfilt |= HAL_RX_FILTER_BEACON;
  	if ((sc->sc_nmonvaps > 0) || ((sc->sc_nvaps > 0) && (sc->sc_nibssvaps > 0)))
  		rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_input.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_input.c	2007-07-03 23:02:33.002106250 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_input.c	2007-07-03 23:02:33.598143500 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_input.c	2007-07-11 22:59:44.916408186 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_input.c	2007-07-11 22:59:45.608447623 +0200
 @@ -321,11 +321,12 @@
  				bssid = wh->i_addr3;
  			}
@@ -97,10 +97,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
  		/*
  		 * If scanning, just pass information to the scan module.
  		 */
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_node.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_node.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_node.c	2007-07-03 23:02:31.037983500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_node.c	2007-07-03 23:02:33.598143500 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_node.c	2007-07-11 22:59:43.008299449 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_node.c	2007-07-11 22:59:45.632448994 +0200
 @@ -332,10 +332,16 @@
  	/* Update country ie information */
  	ieee80211_build_countryie(ic);
@@ -120,10 +120,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_node.c
  
  	(void) ieee80211_sta_join1(PASS_NODE(ni));
  }
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_proto.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_proto.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_proto.c	2007-07-03 23:02:32.306062750 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_proto.c	2007-07-03 23:02:33.630145500 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_proto.c	2007-07-11 22:59:44.372377182 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_proto.c	2007-07-11 22:59:45.660450586 +0200
 @@ -586,6 +586,28 @@
  	{ 4, { 2, 4, 11, 22 } },	/* IEEE80211_MODE_TURBO_G (mixed b/g) */
  };
@@ -153,10 +153,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_proto.c
  /*
   * Mark the basic rates for the 11g rate table based on the
   * specified mode.  For 11b compatibility we mark only 11b
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_var.h
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_var.h
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_var.h	2007-07-03 23:02:32.330064250 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_var.h	2007-07-03 23:02:33.678148500 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_var.h	2007-07-11 22:59:44.412379463 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_var.h	2007-07-11 22:59:45.700452869 +0200
 @@ -592,6 +592,8 @@
  void ieee80211_build_countryie(struct ieee80211com *);
  int ieee80211_media_setup(struct ieee80211com *, struct ifmedia *, u_int32_t,
diff --git a/package/madwifi/patches/309-micfail_detect.patch b/package/madwifi/patches/309-micfail_detect.patch
index ef10cd1f92..b910282c63 100644
--- a/package/madwifi/patches/309-micfail_detect.patch
+++ b/package/madwifi/patches/309-micfail_detect.patch
@@ -1,8 +1,8 @@
-Index: madwifi-ng-r2525-20070630/ath/if_ath.c
+Index: madwifi-ng-r2568-20070710/ath/if_ath.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/ath/if_ath.c	2007-07-03 23:02:33.594143250 +0200
-+++ madwifi-ng-r2525-20070630/ath/if_ath.c	2007-07-03 23:02:34.014169500 +0200
-@@ -5626,6 +5626,7 @@
+--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c	2007-07-11 22:59:45.608447623 +0200
++++ madwifi-ng-r2568-20070710/ath/if_ath.c	2007-07-11 22:59:46.016470876 +0200
+@@ -5620,6 +5620,7 @@
  	u_int64_t rs_tsf;
  	u_int processed = 0, early_stop = 0;
  	u_int rx_limit = dev->quota;
@@ -10,7 +10,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  
  	/* Let the 802.11 layer know about the new noise floor */
  	sc->sc_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
-@@ -5720,25 +5721,7 @@
+@@ -5714,25 +5715,7 @@
  			}
  			if (rs->rs_status & HAL_RXERR_MIC) {
  				sc->sc_stats.ast_rx_badmic++;
@@ -37,7 +37,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  			}
  			/*
  			 * Reject error frames if we have no vaps that 
-@@ -5802,8 +5785,9 @@
+@@ -5796,8 +5779,9 @@
  		/*
  		 * Finished monitor mode handling, now reject
  		 * error frames before passing to other vaps
@@ -48,7 +48,7 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  			dev_kfree_skb(skb);
  			skb = NULL;
  			goto rx_next;
-@@ -5834,6 +5818,27 @@
+@@ -5828,6 +5812,27 @@
  				   sc->sc_hwmap[rs->rs_rate].ieeerate,
  				   rs->rs_rssi);
  
@@ -76,10 +76,10 @@ Index: madwifi-ng-r2525-20070630/ath/if_ath.c
  		/*
  		 * Locate the node for sender, track state, and then
  		 * pass the (referenced) node up to the 802.11 layer
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_ccmp.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_ccmp.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_crypto_ccmp.c	2007-07-03 23:02:31.690024250 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_ccmp.c	2007-07-03 23:02:34.026170250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_crypto_ccmp.c	2007-07-11 22:59:43.580332047 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_ccmp.c	2007-07-11 22:59:46.020471102 +0200
 @@ -73,7 +73,7 @@
  static int ccmp_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
  static int ccmp_decap(struct ieee80211_key *, struct sk_buff *, int);
@@ -98,10 +98,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_ccmp.c
  {
  	return 1;
  }
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto.h
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_crypto.h
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_crypto.h	2007-07-03 23:02:24.549578000 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_crypto.h	2007-07-03 23:02:34.054172000 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_crypto.h	2007-07-11 22:59:37.880007204 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_crypto.h	2007-07-11 22:59:46.060473383 +0200
 @@ -145,7 +145,7 @@
  	int (*ic_encap)(struct ieee80211_key *, struct sk_buff *, u_int8_t);
  	int (*ic_decap)(struct ieee80211_key *, struct sk_buff *, int);
@@ -124,10 +124,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto.h
  }
  
  /*
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_none.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_none.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_crypto_none.c	2007-07-03 23:02:24.557578500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_none.c	2007-07-03 23:02:34.074173250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_crypto_none.c	2007-07-11 22:59:37.888007663 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_none.c	2007-07-11 22:59:46.084474751 +0200
 @@ -52,7 +52,7 @@
  static int none_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
  static int none_decap(struct ieee80211_key *, struct sk_buff *, int);
@@ -146,10 +146,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_none.c
  {
  	struct ieee80211vap *vap = k->wk_private;
  
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_tkip.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_tkip.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_crypto_tkip.c	2007-07-03 23:02:24.565579000 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_tkip.c	2007-07-03 23:02:34.114175750 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_crypto_tkip.c	2007-07-11 22:59:37.896008115 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_tkip.c	2007-07-11 22:59:46.112476346 +0200
 @@ -57,7 +57,7 @@
  static int tkip_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
  static int tkip_enmic(struct ieee80211_key *, struct sk_buff *, int);
@@ -177,10 +177,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_tkip.c
  		struct ieee80211vap *vap = ctx->tc_vap;
  		u8 mic[IEEE80211_WEP_MICLEN];
  		u8 mic0[IEEE80211_WEP_MICLEN];
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_wep.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_wep.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_crypto_wep.c	2007-07-03 23:02:24.573579500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_wep.c	2007-07-03 23:02:34.134177000 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_crypto_wep.c	2007-07-11 22:59:37.900008344 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_crypto_wep.c	2007-07-11 22:59:46.136477715 +0200
 @@ -54,7 +54,7 @@
  static int wep_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
  static int wep_decap(struct ieee80211_key *, struct sk_buff *, int);
@@ -199,10 +199,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_crypto_wep.c
  {
  	return 1;
  }
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_input.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_input.c	2007-07-03 23:02:33.598143500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_input.c	2007-07-03 23:02:34.134177000 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_input.c	2007-07-11 22:59:45.608447623 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_input.c	2007-07-11 22:59:46.180480221 +0200
 @@ -632,7 +632,7 @@
  		 * Next strip any MSDU crypto bits.
  		 */
@@ -212,7 +212,7 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
  			IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
  				ni->ni_macaddr, "data", "%s", "demic error");
  			IEEE80211_NODE_STAT(ni, rx_demicfail);
-@@ -3771,6 +3771,47 @@
+@@ -3772,6 +3772,47 @@
  }
  #endif
  
@@ -260,10 +260,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_input.c
  #ifdef IEEE80211_DEBUG
  /*
   * Debugging support.
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_proto.h
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_proto.h
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_proto.h	2007-07-03 23:02:24.589580500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_proto.h	2007-07-03 23:02:34.190180500 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_proto.h	2007-07-11 22:59:37.916009256 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_proto.h	2007-07-11 22:59:46.204481592 +0200
 @@ -91,6 +91,7 @@
  void ieee80211_set11gbasicrates(struct ieee80211_rateset *, enum ieee80211_phymode);
  enum ieee80211_phymode ieee80211_get11gbasicrates(struct ieee80211_rateset *);
@@ -272,10 +272,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_proto.h
  
  /*
   * Return the size of the 802.11 header for a management or data frame.
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_linux.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_linux.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_linux.c	2007-07-03 23:02:31.362003750 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_linux.c	2007-07-03 23:02:34.218182250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_linux.c	2007-07-11 22:59:43.336318141 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_linux.c	2007-07-11 22:59:46.228482956 +0200
 @@ -291,8 +291,8 @@
  	/* TODO: needed parameters: count, keyid, key type, src address, TSC */
  	snprintf(buf, sizeof(buf), "%s(keyid=%d %scast addr=%s)", tag,
@@ -287,10 +287,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_linux.c
  	memset(&wrqu, 0, sizeof(wrqu));
  	wrqu.data.length = strlen(buf);
  	wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_output.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_output.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_output.c	2007-07-03 23:02:24.605581500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_output.c	2007-07-03 23:02:34.218182250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_output.c	2007-07-11 22:59:37.928009938 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_output.c	2007-07-11 22:59:46.252484325 +0200
 @@ -1079,13 +1079,16 @@
  			cip = (struct ieee80211_cipher *) key->wk_cipher;
  			ciphdrsize = cip->ic_header;
@@ -311,10 +311,10 @@ Index: madwifi-ng-r2525-20070630/net80211/ieee80211_output.c
  
  		/*
  		 * Allocate sk_buff for each subsequent fragment; First fragment
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_node.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_node.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_node.c	2007-07-03 23:02:33.598143500 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_node.c	2007-07-03 23:02:34.266185250 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_node.c	2007-07-11 22:59:45.632448994 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_node.c	2007-07-11 22:59:46.304487289 +0200
 @@ -1891,11 +1891,13 @@
  	/* From this point onwards we can no longer find the node,
  	 * so no more references are generated
diff --git a/package/madwifi/patches/310-erp_beacon_check.patch b/package/madwifi/patches/310-erp_beacon_check.patch
index a985e4bfe8..1503a41481 100644
--- a/package/madwifi/patches/310-erp_beacon_check.patch
+++ b/package/madwifi/patches/310-erp_beacon_check.patch
@@ -1,7 +1,7 @@
-Index: madwifi-ng-r2525-20070630/net80211/ieee80211_beacon.c
+Index: madwifi-ng-r2568-20070710/net80211/ieee80211_beacon.c
 ===================================================================
---- madwifi-ng-r2525-20070630.orig/net80211/ieee80211_beacon.c	2007-07-03 23:02:30.981980000 +0200
-+++ madwifi-ng-r2525-20070630/net80211/ieee80211_beacon.c	2007-07-03 23:02:34.674210750 +0200
+--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_beacon.c	2007-07-11 22:59:42.932295119 +0200
++++ madwifi-ng-r2568-20070710/net80211/ieee80211_beacon.c	2007-07-11 22:59:46.676508490 +0200
 @@ -512,7 +512,7 @@
  			vap->iv_flags &= ~IEEE80211_F_XRUPDATE;
  		}
-- 
2.30.2