From 0244e57bb9fb9ebd1dd224bd5789ad9cc24b0175 Mon Sep 17 00:00:00 2001
From: Imre Kaloz <kaloz@openwrt.org>
Date: Wed, 4 Jun 2008 13:16:18 +0000
Subject: refresh madwifi patches using upstream style

SVN-Revision: 11351
---
 package/madwifi/patches/102-multicall_binary.patch |  68 +++-----
 package/madwifi/patches/104-autocreate_none.patch  |   6 +-
 package/madwifi/patches/105-ratectl_attach.patch   |   6 +-
 package/madwifi/patches/111-minstrel_crash.patch   |   6 +-
 package/madwifi/patches/113-no_ibss_pwrsave.patch  |   6 +-
 .../patches/122-replayfail_workaround.patch        |   6 +-
 package/madwifi/patches/123-ccmp_checks.patch      |   6 +-
 package/madwifi/patches/124-linux24_compat.patch   |  22 +--
 package/madwifi/patches/126-rxerr_frames.patch     |   6 +-
 package/madwifi/patches/200-no_debug.patch         |  90 ++++-------
 package/madwifi/patches/201-debug_fix.patch        |   6 +-
 package/madwifi/patches/300-napi_polling.patch     |  36 ++---
 package/madwifi/patches/305-pureg_fix.patch        |  30 ++--
 package/madwifi/patches/309-micfail_detect.patch   |  66 +++-----
 package/madwifi/patches/310-noise_get.patch        |  18 +--
 package/madwifi/patches/311-bssid_alloc.patch      |   6 +-
 package/madwifi/patches/312-erpupdate.patch        |  18 +--
 package/madwifi/patches/317-bmask.patch            |   6 +-
 package/madwifi/patches/323-dfs_optional.patch     |  12 +-
 package/madwifi/patches/324-alignment.patch        |   6 +-
 package/madwifi/patches/325-channel_spam.patch     |   6 +-
 package/madwifi/patches/327-queue.patch            |  12 +-
 package/madwifi/patches/330-beaconcal.patch        |  12 +-
 package/madwifi/patches/331-memory_alloc.patch     |   6 +-
 package/madwifi/patches/332-reset_beacons.patch    |   6 +-
 package/madwifi/patches/333-apscan_mode.patch      |   6 +-
 package/madwifi/patches/334-input.patch            |   6 +-
 package/madwifi/patches/340-maxrate.patch          |  36 ++---
 package/madwifi/patches/341-minrate.patch          |  36 ++---
 package/madwifi/patches/342-performance.patch      |  18 +--
 package/madwifi/patches/343-txqueue_races.patch    |  12 +-
 package/madwifi/patches/344-minstrel_failcnt.patch |   6 +-
 .../madwifi/patches/345-minstrel_sampling.patch    |  24 +--
 package/madwifi/patches/346-protmode_trig.patch    |  36 ++---
 package/madwifi/patches/347-tuning.patch           |  36 ++---
 package/madwifi/patches/348-ackcts.patch           |  12 +-
 package/madwifi/patches/349-reset.patch            |   6 +-
 package/madwifi/patches/350-wisoc_softled.patch    |   6 +-
 package/madwifi/patches/351-scanlist.patch         |  48 ++----
 package/madwifi/patches/400-changeset_r3402.patch  |  35 ++++
 package/madwifi/patches/401-changeset_r3602.patch  |  11 ++
 package/madwifi/patches/402-changeset_r3603.patch  | 176 +++++++++++++++++++++
 package/madwifi/patches/403-changeset_r3605.patch  |  70 ++++++++
 43 files changed, 543 insertions(+), 505 deletions(-)
 create mode 100644 package/madwifi/patches/400-changeset_r3402.patch
 create mode 100644 package/madwifi/patches/401-changeset_r3602.patch
 create mode 100644 package/madwifi/patches/402-changeset_r3603.patch
 create mode 100644 package/madwifi/patches/403-changeset_r3605.patch

diff --git a/package/madwifi/patches/102-multicall_binary.patch b/package/madwifi/patches/102-multicall_binary.patch
index f9ef3f3462..bbf178a74f 100644
--- a/package/madwifi/patches/102-multicall_binary.patch
+++ b/package/madwifi/patches/102-multicall_binary.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/tools/80211debug.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/80211debug.c
-+++ madwifi-trunk-r3314/tools/80211debug.c
+--- a/tools/80211debug.c
++++ b/tools/80211debug.c
 @@ -48,6 +48,7 @@
  #include <ctype.h>
  #include <getopt.h>
@@ -19,10 +17,8 @@ Index: madwifi-trunk-r3314/tools/80211debug.c
  {
  	const char *ifname = "ath0";
  	const char *cp, *tp;
-Index: madwifi-trunk-r3314/tools/80211stats.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/80211stats.c
-+++ madwifi-trunk-r3314/tools/80211stats.c
+--- a/tools/80211stats.c
++++ b/tools/80211stats.c
 @@ -59,6 +59,7 @@
  #include "net80211/ieee80211.h"
  #include "net80211/ieee80211_crypto.h"
@@ -40,10 +36,8 @@ Index: madwifi-trunk-r3314/tools/80211stats.c
  {
  	int c, len;
  	struct ieee80211req_sta_info *si;
-Index: madwifi-trunk-r3314/tools/athchans.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/athchans.c
-+++ madwifi-trunk-r3314/tools/athchans.c
+--- a/tools/athchans.c
++++ b/tools/athchans.c
 @@ -58,6 +58,7 @@
  #include "net80211/ieee80211.h"
  #include "net80211/ieee80211_crypto.h"
@@ -63,10 +57,8 @@ Index: madwifi-trunk-r3314/tools/athchans.c
  {
  	const char *ifname = "wifi0";
  	struct ieee80211req_chanlist chanlist;
-Index: madwifi-trunk-r3314/tools/athctrl.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/athctrl.c
-+++ madwifi-trunk-r3314/tools/athctrl.c
+--- a/tools/athctrl.c
++++ b/tools/athctrl.c
 @@ -52,6 +52,7 @@
  #include <err.h>
  
@@ -84,10 +76,8 @@ Index: madwifi-trunk-r3314/tools/athctrl.c
  {
  	char device[IFNAMSIZ + 1];
  	int distance = -1;
-Index: madwifi-trunk-r3314/tools/athdebug.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/athdebug.c
-+++ madwifi-trunk-r3314/tools/athdebug.c
+--- a/tools/athdebug.c
++++ b/tools/athdebug.c
 @@ -51,6 +51,7 @@
  #include <ctype.h>
  #include <getopt.h>
@@ -105,10 +95,8 @@ Index: madwifi-trunk-r3314/tools/athdebug.c
  {
  #ifdef __linux__
  	const char *ifname = "wifi0";
-Index: madwifi-trunk-r3314/tools/athkey.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/athkey.c
-+++ madwifi-trunk-r3314/tools/athkey.c
+--- a/tools/athkey.c
++++ b/tools/athkey.c
 @@ -58,6 +58,7 @@
  #include "net80211/ieee80211.h"
  #include "net80211/ieee80211_crypto.h"
@@ -127,10 +115,8 @@ Index: madwifi-trunk-r3314/tools/athkey.c
  {
  	const char *ifname = "wifi0";
  	struct ieee80211req_key setkey;
-Index: madwifi-trunk-r3314/tools/athstats.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/athstats.c
-+++ madwifi-trunk-r3314/tools/athstats.c
+--- a/tools/athstats.c
++++ b/tools/athstats.c
 @@ -65,6 +65,7 @@
  
  #undef ARRAY_SIZE
@@ -148,10 +134,8 @@ Index: madwifi-trunk-r3314/tools/athstats.c
  {
  #ifdef __linux__
  	const char *ifname = "wifi0";
-Index: madwifi-trunk-r3314/tools/do_multi.c
-===================================================================
 --- /dev/null
-+++ madwifi-trunk-r3314/tools/do_multi.c
++++ b/tools/do_multi.c
 @@ -0,0 +1,32 @@
 +#include <string.h>
 +#include "do_multi.h"
@@ -185,10 +169,8 @@ Index: madwifi-trunk-r3314/tools/do_multi.c
 +
 +    return ret;
 +}
-Index: madwifi-trunk-r3314/tools/do_multi.h
-===================================================================
 --- /dev/null
-+++ madwifi-trunk-r3314/tools/do_multi.h
++++ b/tools/do_multi.h
 @@ -0,0 +1,15 @@
 +#ifdef DO_MULTI
 +int a80211debug_init(int argc, char *argv[]);
@@ -205,10 +187,8 @@ Index: madwifi-trunk-r3314/tools/do_multi.h
 +#else
 +#define CMD(name) main
 +#endif
-Index: madwifi-trunk-r3314/tools/Makefile
-===================================================================
---- madwifi-trunk-r3314.orig/tools/Makefile
-+++ madwifi-trunk-r3314/tools/Makefile
+--- a/tools/Makefile
++++ b/tools/Makefile
 @@ -46,56 +46,55 @@
  HAL=   $(TOP)/hal
  endif
@@ -293,10 +273,8 @@ Index: madwifi-trunk-r3314/tools/Makefile
  clean:
 -	rm -f $(ALL) core a.out
 +	rm -f $(ALLPROGS) madwifi_multi *.o core a.out
-Index: madwifi-trunk-r3314/tools/wlanconfig.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/wlanconfig.c
-+++ madwifi-trunk-r3314/tools/wlanconfig.c
+--- a/tools/wlanconfig.c
++++ b/tools/wlanconfig.c
 @@ -61,6 +61,7 @@
  #include "net80211/ieee80211.h"
  #include "net80211/ieee80211_crypto.h"
@@ -314,10 +292,8 @@ Index: madwifi-trunk-r3314/tools/wlanconfig.c
  {
  	const char *ifname, *cmd;
  	unsigned char bnounit = 0;
-Index: madwifi-trunk-r3314/tools/ath_info.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/ath_info.c
-+++ madwifi-trunk-r3314/tools/ath_info.c
+--- a/tools/ath_info.c
++++ b/tools/ath_info.c
 @@ -98,6 +98,7 @@
  #include <sys/mman.h>
  #include <endian.h>
diff --git a/package/madwifi/patches/104-autocreate_none.patch b/package/madwifi/patches/104-autocreate_none.patch
index b8c19fb4b5..0979179641 100644
--- a/package/madwifi/patches/104-autocreate_none.patch
+++ b/package/madwifi/patches/104-autocreate_none.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -516,7 +516,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 77b2357a5c..79b08dfb82 100644
--- a/package/madwifi/patches/105-ratectl_attach.patch
+++ b/package/madwifi/patches/105-ratectl_attach.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_rate.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_rate.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_rate.c
+--- a/net80211/ieee80211_rate.c
++++ b/net80211/ieee80211_rate.c
 @@ -100,8 +100,18 @@
  		ieee80211_load_module(buf);
  
diff --git a/package/madwifi/patches/111-minstrel_crash.patch b/package/madwifi/patches/111-minstrel_crash.patch
index 6fa388832d..43998c3ee0 100644
--- a/package/madwifi/patches/111-minstrel_crash.patch
+++ b/package/madwifi/patches/111-minstrel_crash.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c
-+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
 @@ -393,6 +393,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 */
diff --git a/package/madwifi/patches/113-no_ibss_pwrsave.patch b/package/madwifi/patches/113-no_ibss_pwrsave.patch
index 44ee8fd588..0d6a11ef5e 100644
--- a/package/madwifi/patches/113-no_ibss_pwrsave.patch
+++ b/package/madwifi/patches/113-no_ibss_pwrsave.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_scan.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_scan.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_scan.c
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
 @@ -291,7 +291,8 @@
  	struct ieee80211com *ic = vap->iv_ic;
  	int delay;
diff --git a/package/madwifi/patches/122-replayfail_workaround.patch b/package/madwifi/patches/122-replayfail_workaround.patch
index e694cac567..3ed352076a 100644
--- a/package/madwifi/patches/122-replayfail_workaround.patch
+++ b/package/madwifi/patches/122-replayfail_workaround.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_linux.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_linux.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_linux.c
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
 @@ -331,6 +331,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 d59ed5059e..95c7905dd6 100644
--- a/package/madwifi/patches/123-ccmp_checks.patch
+++ b/package/madwifi/patches/123-ccmp_checks.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_ccmp.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_crypto_ccmp.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_crypto_ccmp.c
+--- a/net80211/ieee80211_crypto_ccmp.c
++++ b/net80211/ieee80211_crypto_ccmp.c
 @@ -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 5bde01bbea..ec862bbe1f 100644
--- a/package/madwifi/patches/124-linux24_compat.patch
+++ b/package/madwifi/patches/124-linux24_compat.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_athvar.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_athvar.h
-+++ madwifi-trunk-r3314/ath/if_athvar.h
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
 @@ -126,6 +126,11 @@
  #define ATH_GET_NETDEV_DEV(ndev)	((ndev)->class_dev.dev)
  #endif
@@ -14,10 +12,8 @@ Index: madwifi-trunk-r3314/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-trunk-r3314/ath/if_ath_radar.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath_radar.c
-+++ madwifi-trunk-r3314/ath/if_ath_radar.c
+--- a/ath/if_ath_radar.c
++++ b/ath/if_ath_radar.c
 @@ -92,6 +92,13 @@
  #define nofloat_pct(_value, _pct) \
  	( (_value * (1000 + _pct)) / 1000 )
@@ -32,10 +28,8 @@ Index: madwifi-trunk-r3314/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-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -4705,6 +4705,46 @@
  #undef USE_SHPREAMBLE
  }
@@ -83,10 +77,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  /*
   * Generate beacon frame and queue cab data for a VAP.
   */
-Index: madwifi-trunk-r3314/net80211/sort.c
-===================================================================
 --- /dev/null
-+++ madwifi-trunk-r3314/net80211/sort.c
++++ b/net80211/sort.c
 @@ -0,0 +1,120 @@
 +/*
 + * A fast, small, non-recursive O(nlog n) sort for the Linux kernel
diff --git a/package/madwifi/patches/126-rxerr_frames.patch b/package/madwifi/patches/126-rxerr_frames.patch
index 5ee2a9d92c..ceab9eadc0 100644
--- a/package/madwifi/patches/126-rxerr_frames.patch
+++ b/package/madwifi/patches/126-rxerr_frames.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -6474,8 +6474,9 @@
  			/*
  			 * Reject error frames if we have no vaps that
diff --git a/package/madwifi/patches/200-no_debug.patch b/package/madwifi/patches/200-no_debug.patch
index 3c440c0ae0..5d6a8d0f4b 100644
--- a/package/madwifi/patches/200-no_debug.patch
+++ b/package/madwifi/patches/200-no_debug.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -42,7 +42,6 @@
   * This software is derived from work of Atsushi Onoe; his contribution
   * is greatly appreciated.
@@ -101,10 +99,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  /* If we are shutting down or blowing off the DFS channel availability check
   * then we call this to stop the behavior before we take the rest of the
   * necessary actions (such as a DFS reaction to radar). */
-Index: madwifi-trunk-r3314/ath_rate/amrr/amrr.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/amrr/amrr.c
-+++ madwifi-trunk-r3314/ath_rate/amrr/amrr.c
+--- a/ath_rate/amrr/amrr.c
++++ b/ath_rate/amrr/amrr.c
 @@ -70,7 +70,9 @@
  
  #include "amrr.h"
@@ -115,10 +111,8 @@ Index: madwifi-trunk-r3314/ath_rate/amrr/amrr.c
  #ifdef AMRR_DEBUG
  #define	DPRINTF(sc, _fmt, ...) do {					\
  	if (sc->sc_debug & 0x10)					\
-Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c
-+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
 @@ -117,7 +117,9 @@
  
  #include "minstrel.h"
@@ -129,10 +123,8 @@ Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
  #ifdef MINSTREL_DEBUG
  enum {
  		ATH_DEBUG_RATE		= 0x00000010	/* rate control */
-Index: madwifi-trunk-r3314/ath_rate/onoe/onoe.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/onoe/onoe.c
-+++ madwifi-trunk-r3314/ath_rate/onoe/onoe.c
+--- a/ath_rate/onoe/onoe.c
++++ b/ath_rate/onoe/onoe.c
 @@ -66,7 +66,9 @@
  
  #include "onoe.h"
@@ -143,10 +135,8 @@ Index: madwifi-trunk-r3314/ath_rate/onoe/onoe.c
  #ifdef ONOE_DEBUG
  enum {
  	ATH_DEBUG_RATE	= 0x00000010,	/* rate control */
-Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/sample/sample.c
-+++ madwifi-trunk-r3314/ath_rate/sample/sample.c
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
 @@ -68,7 +68,9 @@
  
  #include "sample.h"
@@ -158,10 +148,8 @@ Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
  #ifdef SAMPLE_DEBUG
  enum {
  	ATH_DEBUG_RATE		= 0x00000010,	/* rate control */
-Index: madwifi-trunk-r3314/tools/do_multi.c
-===================================================================
---- madwifi-trunk-r3314.orig/tools/do_multi.c
-+++ madwifi-trunk-r3314/tools/do_multi.c
+--- a/tools/do_multi.c
++++ b/tools/do_multi.c
 @@ -9,16 +9,20 @@
  
      progname = basename(argv[0]);
@@ -183,10 +171,8 @@ Index: madwifi-trunk-r3314/tools/do_multi.c
      if(strcmp(progname, "athkey") == 0)
  	ret =  athkey_init(argc, argv);
      if(strcmp(progname, "athstats") == 0)
-Index: madwifi-trunk-r3314/tools/Makefile
-===================================================================
---- madwifi-trunk-r3314.orig/tools/Makefile
-+++ madwifi-trunk-r3314/tools/Makefile
+--- a/tools/Makefile
++++ b/tools/Makefile
 @@ -48,6 +48,8 @@
  
  all: compile
@@ -205,10 +191,8 @@ Index: madwifi-trunk-r3314/tools/Makefile
  LDFLAGS=
  
  
-Index: madwifi-trunk-r3314/net80211/ieee80211_linux.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_linux.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_linux.h
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
 @@ -29,8 +29,6 @@
  #ifndef _NET80211_IEEE80211_LINUX_H_
  #define _NET80211_IEEE80211_LINUX_H_
@@ -218,10 +202,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_linux.h
  /* #define ATH_DEBUG_SPINLOCKS */		/* announce before spinlocking */
  
  #include <linux/wireless.h>
-Index: madwifi-trunk-r3314/Makefile.inc
-===================================================================
---- madwifi-trunk-r3314.orig/Makefile.inc
-+++ madwifi-trunk-r3314/Makefile.inc
+--- a/Makefile.inc
++++ b/Makefile.inc
 @@ -148,7 +148,8 @@
  TOOLS=  $(TOP)/tools 
  
@@ -232,10 +214,8 @@ Index: madwifi-trunk-r3314/Makefile.inc
  INCS=	-include $(TOP)/include/compat.h -I$(TOP)/include
  
  # TARGET defines the target platform architecture. It must match one of
-Index: madwifi-trunk-r3314/ath/if_ath_radar.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath_radar.c
-+++ madwifi-trunk-r3314/ath/if_ath_radar.c
+--- a/ath/if_ath_radar.c
++++ b/ath/if_ath_radar.c
 @@ -19,8 +19,6 @@
   * $Id: if_ath_radar.c 2464 2007-06-15 22:51:56Z mtaylor $
   */
@@ -254,10 +234,8 @@ Index: madwifi-trunk-r3314/ath/if_ath_radar.c
  #include "net80211/if_athproto.h"
  #include "if_athvar.h"
  
-Index: madwifi-trunk-r3314/ath/if_ath_hal.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath_hal.h
-+++ madwifi-trunk-r3314/ath/if_ath_hal.h
+--- a/ath/if_ath_hal.h
++++ b/ath/if_ath_hal.h
 @@ -1081,6 +1081,7 @@
  
             tail -f /var/log/messages | sed -f hal_unmangle.sed 
@@ -275,10 +253,8 @@ Index: madwifi-trunk-r3314/ath/if_ath_hal.h
  #include "if_ath_hal_wrappers.h"
  
  #endif				/* #ifndef _IF_ATH_HAL_H_ */
-Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_var.h
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
 @@ -492,9 +492,10 @@
  	/* inject a fake radar signal -- used while on a 802.11h DFS channels */
  	unsigned int (*ic_test_radar)(struct ieee80211com *);
@@ -291,10 +267,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
  	/* DFS channel availability check time (in seconds) */
  	void (*ic_set_dfs_cac_time)(struct ieee80211com *, unsigned int);
  	unsigned int (*ic_get_dfs_cac_time)(struct ieee80211com *);
-Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
 @@ -1548,6 +1548,7 @@
  	return 0;
  }
@@ -333,10 +307,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
  	set_priv(IEEE80211_IOCTL_ADDMAC, ieee80211_ioctl_addmac),
  	set_priv(IEEE80211_IOCTL_DELMAC, ieee80211_ioctl_delmac),
  	set_priv(IEEE80211_IOCTL_WDSADDMAC, ieee80211_ioctl_wdsmac),
-Index: madwifi-trunk-r3314/ath/if_ath_debug.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath_debug.h
-+++ madwifi-trunk-r3314/ath/if_ath_debug.h
+--- a/ath/if_ath_debug.h
++++ b/ath/if_ath_debug.h
 @@ -68,13 +68,6 @@
  		ath_keyprint((_sc), __func__, _ix, _hk, _mac);		\
  } while (0)
@@ -367,10 +339,8 @@ Index: madwifi-trunk-r3314/ath/if_ath_debug.h
 +#endif
  
  #endif /* #ifndef _IF_ATH_DEBUG_H_ */
-Index: madwifi-trunk-r3314/net80211/ieee80211_node.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_node.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_node.c
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
 @@ -920,6 +920,9 @@
  	ni->ni_rxkeyoff = 0;
  }
diff --git a/package/madwifi/patches/201-debug_fix.patch b/package/madwifi/patches/201-debug_fix.patch
index 398a1d9974..57425f7537 100644
--- a/package/madwifi/patches/201-debug_fix.patch
+++ b/package/madwifi/patches/201-debug_fix.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath_hal/ah_os.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_hal/ah_os.c
-+++ madwifi-trunk-r3314/ath_hal/ah_os.c
+--- a/ath_hal/ah_os.c
++++ b/ath_hal/ah_os.c
 @@ -65,7 +65,7 @@
  #include <ah_os.h>
  
diff --git a/package/madwifi/patches/300-napi_polling.patch b/package/madwifi/patches/300-napi_polling.patch
index 081a9a41bd..ba72329f6d 100644
--- a/package/madwifi/patches/300-napi_polling.patch
+++ b/package/madwifi/patches/300-napi_polling.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -184,7 +184,11 @@
  	struct sk_buff *, int, int, u_int64_t);
  static void ath_setdefantenna(struct ath_softc *, u_int);
@@ -375,10 +373,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  	}
  	ATH_UNLOCK(sc);
  
-Index: madwifi-trunk-r3314/ath/if_athvar.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_athvar.h
-+++ madwifi-trunk-r3314/ath/if_athvar.h
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
 @@ -53,6 +53,10 @@
  # include	<asm/bitops.h>
  #endif
@@ -425,10 +421,8 @@ Index: madwifi-trunk-r3314/ath/if_athvar.h
  
  #define	ATH_RXBUF_LOCK_INIT(_sc)	spin_lock_init(&(_sc)->sc_rxbuflock)
  #define	ATH_RXBUF_LOCK_DESTROY(_sc)
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -1198,7 +1198,7 @@
  			/* attach vlan tag */
  			struct ieee80211_node *ni_tmp = SKB_CB(skb)->ni;
@@ -460,10 +454,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
  			 * device was too busy */
  			if (ni_tmp != NULL) {
  				/* node reference was leaked */
-Index: madwifi-trunk-r3314/net80211/ieee80211_monitor.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_monitor.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_monitor.c
+--- a/net80211/ieee80211_monitor.c
++++ b/net80211/ieee80211_monitor.c
 @@ -584,8 +584,8 @@
  			skb1->protocol = 
  				__constant_htons(0x0019); /* ETH_P_80211_RAW */
@@ -475,10 +467,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_monitor.c
  				 * device was too busy, reclaim the ref. in 
  				 * the skb. */
  				if (SKB_CB(skb1)->ni != NULL)
-Index: madwifi-trunk-r3314/net80211/ieee80211_skb.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_skb.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_skb.c
+--- a/net80211/ieee80211_skb.c
++++ b/net80211/ieee80211_skb.c
 @@ -73,7 +73,7 @@
  #undef dev_queue_xmit
  #undef kfree_skb
@@ -508,10 +498,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_skb.c
  EXPORT_SYMBOL(alloc_skb_debug);
  EXPORT_SYMBOL(dev_alloc_skb_debug);
  EXPORT_SYMBOL(skb_clone_debug);
-Index: madwifi-trunk-r3314/net80211/ieee80211_skb.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_skb.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_skb.h
+--- a/net80211/ieee80211_skb.h
++++ b/net80211/ieee80211_skb.h
 @@ -116,7 +116,7 @@
  int  vlan_hwaccel_receive_skb_debug(struct sk_buff *skb, 
  				    struct vlan_group *grp, unsigned short vlan_tag, 
diff --git a/package/madwifi/patches/305-pureg_fix.patch b/package/madwifi/patches/305-pureg_fix.patch
index 8154cbd943..196ac743cf 100644
--- a/package/madwifi/patches/305-pureg_fix.patch
+++ b/package/madwifi/patches/305-pureg_fix.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -4149,7 +4149,9 @@
  		rfilt |= HAL_RX_FILTER_PROM;
  	if (ic->ic_opmode == IEEE80211_M_STA ||
@@ -13,10 +11,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  		rfilt |= HAL_RX_FILTER_BEACON;
  	if (sc->sc_nmonvaps > 0)
  		rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -346,11 +346,12 @@
  				bssid = wh->i_addr3;
  			}
@@ -108,10 +104,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
  		/*
  		 * If scanning, just pass information to the scan module.
  		 */
-Index: madwifi-trunk-r3314/net80211/ieee80211_node.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_node.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_node.c
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
 @@ -383,10 +383,16 @@
  	/* Update country ie information */
  	ieee80211_build_countryie(ic);
@@ -131,10 +125,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_node.c
  
  	(void) ieee80211_sta_join1(PASS_NODE(ni));
  }
-Index: madwifi-trunk-r3314/net80211/ieee80211_proto.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_proto.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_proto.c
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
 @@ -595,6 +595,28 @@
  	{ 4, { 2, 4, 11, 22 } },	/* IEEE80211_MODE_TURBO_G (mixed b/g) */
  };
@@ -164,10 +156,8 @@ Index: madwifi-trunk-r3314/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-trunk-r3314/net80211/ieee80211_var.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_var.h
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
 @@ -708,6 +708,7 @@
  void ieee80211_build_sc_ie(struct ieee80211com *);
  void ieee80211_dfs_action(struct ieee80211com *);
diff --git a/package/madwifi/patches/309-micfail_detect.patch b/package/madwifi/patches/309-micfail_detect.patch
index 3a5d1be9a8..91986cd624 100644
--- a/package/madwifi/patches/309-micfail_detect.patch
+++ b/package/madwifi/patches/309-micfail_detect.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -6446,6 +6446,7 @@
  	int type;
  	u_int phyerr;
@@ -83,10 +81,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  		/*
  		 * Normal receive.
  		 */
-Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_ccmp.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_crypto_ccmp.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_crypto_ccmp.c
+--- a/net80211/ieee80211_crypto_ccmp.c
++++ b/net80211/ieee80211_crypto_ccmp.c
 @@ -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);
@@ -105,10 +101,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_ccmp.c
  {
  	return 1;
  }
-Index: madwifi-trunk-r3314/net80211/ieee80211_crypto.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_crypto.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_crypto.h
+--- a/net80211/ieee80211_crypto.h
++++ b/net80211/ieee80211_crypto.h
 @@ -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);
@@ -131,10 +125,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_crypto.h
  }
  
  /*
-Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_none.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_crypto_none.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_crypto_none.c
+--- a/net80211/ieee80211_crypto_none.c
++++ b/net80211/ieee80211_crypto_none.c
 @@ -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);
@@ -153,10 +145,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_none.c
  {
  	struct ieee80211vap *vap = k->wk_private;
  
-Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_tkip.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_crypto_tkip.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_crypto_tkip.c
+--- a/net80211/ieee80211_crypto_tkip.c
++++ b/net80211/ieee80211_crypto_tkip.c
 @@ -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);
@@ -184,10 +174,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_tkip.c
  		struct ieee80211vap *vap = ctx->tc_vap;
  		u8 mic[IEEE80211_WEP_MICLEN];
  		u8 mic0[IEEE80211_WEP_MICLEN];
-Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_wep.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_crypto_wep.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_crypto_wep.c
+--- a/net80211/ieee80211_crypto_wep.c
++++ b/net80211/ieee80211_crypto_wep.c
 @@ -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);
@@ -206,10 +194,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_crypto_wep.c
  {
  	return 1;
  }
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -669,7 +669,7 @@
  		 * Next strip any MSDU crypto bits.
  		 */
@@ -267,10 +253,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
  #ifdef IEEE80211_DEBUG
  /*
   * Debugging support.
-Index: madwifi-trunk-r3314/net80211/ieee80211_proto.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_proto.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_proto.h
+--- a/net80211/ieee80211_proto.h
++++ b/net80211/ieee80211_proto.h
 @@ -90,6 +90,7 @@
  void ieee80211_set11gbasicrates(struct ieee80211_rateset *, enum ieee80211_phymode);
  enum ieee80211_phymode ieee80211_get11gbasicrates(struct ieee80211_rateset *);
@@ -279,10 +263,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_proto.h
  
  /*
   * Return the size of the 802.11 header for a management or data frame.
-Index: madwifi-trunk-r3314/net80211/ieee80211_linux.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_linux.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_linux.c
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
 @@ -337,8 +337,8 @@
  	/* TODO: needed parameters: count, keyid, key type, src address, TSC */
  	snprintf(buf, sizeof(buf), "%s(keyid=%d %scast addr=" MAC_FMT ")", tag,
@@ -294,10 +276,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_linux.c
  	memset(&wrqu, 0, sizeof(wrqu));
  	wrqu.data.length = strlen(buf);
  	wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
-Index: madwifi-trunk-r3314/net80211/ieee80211_output.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_output.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_output.c
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
 @@ -1074,13 +1074,16 @@
  			cip = (struct ieee80211_cipher *) key->wk_cipher;
  			ciphdrsize = cip->ic_header;
@@ -318,10 +298,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_output.c
  
  		/*
  		 * Allocate sk_buff for each subsequent fragment; First fragment
-Index: madwifi-trunk-r3314/net80211/ieee80211_node.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_node.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_node.c
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
 @@ -2264,11 +2264,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-noise_get.patch b/package/madwifi/patches/310-noise_get.patch
index 841305ee7c..b37ff52922 100644
--- a/package/madwifi/patches/310-noise_get.patch
+++ b/package/madwifi/patches/310-noise_get.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -1695,8 +1695,6 @@
  	 * get to reality.  This value is used in monitor mode and by tools like
  	 * Wireshark and Kismet.
@@ -35,10 +33,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  		/*
  		 * Reset rssi stats; maybe not the best place...
  		 */
-Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
 @@ -4358,6 +4358,7 @@
  	si->isi_state = ni->ni_flags;
  	si->isi_authmode = ni->ni_authmode;
@@ -47,10 +43,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
  	si->isi_capinfo = ni->ni_capinfo;
  	si->isi_athflags = ni->ni_ath_flags;
  	si->isi_erp = ni->ni_erp;
-Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
 @@ -311,6 +311,7 @@
  	u_int16_t isi_state;		/* state flags */
  	u_int8_t isi_authmode;		/* authentication algorithm */
diff --git a/package/madwifi/patches/311-bssid_alloc.patch b/package/madwifi/patches/311-bssid_alloc.patch
index fc515456f1..9d895d2b7f 100644
--- a/package/madwifi/patches/311-bssid_alloc.patch
+++ b/package/madwifi/patches/311-bssid_alloc.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -1354,7 +1354,7 @@
  		TAILQ_FOREACH(v, &ic->ic_vaps, iv_next)
  			id_mask |= (1 << ATH_GET_VAP_ID(v->iv_myaddr));
diff --git a/package/madwifi/patches/312-erpupdate.patch b/package/madwifi/patches/312-erpupdate.patch
index 2af36af264..b4befba5cb 100644
--- a/package/madwifi/patches/312-erpupdate.patch
+++ b/package/madwifi/patches/312-erpupdate.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_beacon.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_beacon.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_beacon.c
+--- a/net80211/ieee80211_beacon.c
++++ b/net80211/ieee80211_beacon.c
 @@ -542,10 +542,10 @@
  			vap->iv_flags &= ~IEEE80211_F_XRUPDATE;
  		}
@@ -15,10 +13,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_beacon.c
  		}
  	}
  	/* if it is a mode change beacon for dynamic turbo case */
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -3431,9 +3431,12 @@
  			/* Assume no ERP IE == 11b AP */
  			if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
@@ -33,10 +29,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
  			}
  		}
  
-Index: madwifi-trunk-r3314/net80211/ieee80211_node.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_node.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_node.c
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
 @@ -2025,8 +2025,12 @@
  		}
  
diff --git a/package/madwifi/patches/317-bmask.patch b/package/madwifi/patches/317-bmask.patch
index 9d55c3e9ec..4654b818c0 100644
--- a/package/madwifi/patches/317-bmask.patch
+++ b/package/madwifi/patches/317-bmask.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -8680,6 +8680,10 @@
  
  	sc->sc_rxbufcur = NULL;
diff --git a/package/madwifi/patches/323-dfs_optional.patch b/package/madwifi/patches/323-dfs_optional.patch
index e5116ce9c5..46c480aac2 100644
--- a/package/madwifi/patches/323-dfs_optional.patch
+++ b/package/madwifi/patches/323-dfs_optional.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -1774,17 +1774,14 @@
  			 * may have occurred in the intervening timeframe. */
  			bf->bf_channoise = ic->ic_channoise;
@@ -27,10 +25,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  
  			/* Prepare wireless header for examination */
  			bus_dma_sync_single(sc->sc_bdev, bf->bf_skbaddr,
-Index: madwifi-trunk-r3314/ath/if_ath_radar.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath_radar.c
-+++ madwifi-trunk-r3314/ath/if_ath_radar.c
+--- a/ath/if_ath_radar.c
++++ b/ath/if_ath_radar.c
 @@ -261,7 +261,7 @@
  		unsigned int new_rxfilt = old_rxfilt;
  
diff --git a/package/madwifi/patches/324-alignment.patch b/package/madwifi/patches/324-alignment.patch
index 52be8ae7f7..338373ec12 100644
--- a/package/madwifi/patches/324-alignment.patch
+++ b/package/madwifi/patches/324-alignment.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -1275,14 +1275,8 @@
  		eh->ether_type = ether_type;
  
diff --git a/package/madwifi/patches/325-channel_spam.patch b/package/madwifi/patches/325-channel_spam.patch
index 1f326ef383..0059ba6546 100644
--- a/package/madwifi/patches/325-channel_spam.patch
+++ b/package/madwifi/patches/325-channel_spam.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -9783,7 +9783,9 @@
  	/*
  	 * Convert HAL channels to ieee80211 ones.
diff --git a/package/madwifi/patches/327-queue.patch b/package/madwifi/patches/327-queue.patch
index 5210bf9364..53a80f6e6f 100644
--- a/package/madwifi/patches/327-queue.patch
+++ b/package/madwifi/patches/327-queue.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -8431,8 +8431,6 @@
  	ath_hal_intrset(sc->sc_ah, sc->sc_imask);
  	local_irq_restore(flags);
@@ -29,10 +27,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  	if (sc->sc_softled)
  		ath_led_event(sc, ATH_LED_TX);
  }
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -1132,7 +1132,7 @@
  	    (vap->iv_flags & IEEE80211_F_NOBRIDGE) == 0) {
  		struct sk_buff *skb1 = NULL;
diff --git a/package/madwifi/patches/330-beaconcal.patch b/package/madwifi/patches/330-beaconcal.patch
index a1c299d1d1..46b8b76a0f 100644
--- a/package/madwifi/patches/330-beaconcal.patch
+++ b/package/madwifi/patches/330-beaconcal.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -397,6 +397,7 @@
  static int maxvaps = -1;
  static int outdoor = -1;
@@ -153,10 +151,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  		/* start periodic recalibration timer */
  		mod_timer(&sc->sc_cal_ch, jiffies + (ath_calinterval * HZ));
  	}
-Index: madwifi-trunk-r3314/ath/if_athvar.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_athvar.h
-+++ madwifi-trunk-r3314/ath/if_athvar.h
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
 @@ -778,6 +778,8 @@
  	struct ieee80211vap **sc_bslot;		/* beacon xmit slots */
  	int sc_bnext;				/* next slot for beacon xmit */
diff --git a/package/madwifi/patches/331-memory_alloc.patch b/package/madwifi/patches/331-memory_alloc.patch
index ae78681a7d..eae4a55368 100644
--- a/package/madwifi/patches/331-memory_alloc.patch
+++ b/package/madwifi/patches/331-memory_alloc.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -3318,17 +3318,18 @@
  	 * without affecting any other bridge ports. */
  	if (skb_cloned(skb)) {
diff --git a/package/madwifi/patches/332-reset_beacons.patch b/package/madwifi/patches/332-reset_beacons.patch
index a2ce279db3..8d4cdabcf0 100644
--- a/package/madwifi/patches/332-reset_beacons.patch
+++ b/package/madwifi/patches/332-reset_beacons.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -8911,7 +8911,7 @@
  		 * re configure beacons when it is a turbo mode switch.
  		 * HW seems to turn off beacons during turbo mode switch.
diff --git a/package/madwifi/patches/333-apscan_mode.patch b/package/madwifi/patches/333-apscan_mode.patch
index e2ffb698d4..d869440de7 100644
--- a/package/madwifi/patches/333-apscan_mode.patch
+++ b/package/madwifi/patches/333-apscan_mode.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_scan_ap.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_scan_ap.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_scan_ap.c
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
 @@ -781,12 +781,6 @@
  				/* break the loop as the subsequent chans won't be 
  				 * better */
diff --git a/package/madwifi/patches/334-input.patch b/package/madwifi/patches/334-input.patch
index 462839e83f..e96e6724a5 100644
--- a/package/madwifi/patches/334-input.patch
+++ b/package/madwifi/patches/334-input.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -950,6 +950,9 @@
  	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
  		struct sk_buff *skb1;
diff --git a/package/madwifi/patches/340-maxrate.patch b/package/madwifi/patches/340-maxrate.patch
index 1d9f4c6547..ecefd82a7f 100644
--- a/package/madwifi/patches/340-maxrate.patch
+++ b/package/madwifi/patches/340-maxrate.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -1307,6 +1307,7 @@
  	vap->iv_key_set = ath_key_set;
  	vap->iv_key_update_begin = ath_key_update_begin;
@@ -10,10 +8,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  	if (sc->sc_default_ieee80211_debug) {
  		/* User specified defaults for new VAPs were provided, so
  		 * use those (only). */
-Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c
-+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
 @@ -622,8 +622,12 @@
  			return;
  		}
@@ -28,10 +24,8 @@ Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
  		for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
  			sn->rs_rateattempts 	[x] = 0;
  			sn->rs_thisprob 	[x] = 0;
-Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/sample/sample.c
-+++ madwifi-trunk-r3314/ath_rate/sample/sample.c
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
 @@ -835,7 +835,12 @@
  	}
  	sn->static_rate_ndx = -1;
@@ -46,10 +40,8 @@ Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
  	for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
  		sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
  		sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
-Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
 @@ -641,6 +641,7 @@
  							   FCC requires 30m, so that is the default. */
  	IEEE80211_PARAM_BEACON_MISS_THRESH	= 73,	/* Beacon miss threshold (in beacons) */
@@ -58,10 +50,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
  };
  
  #define	SIOCG80211STATS			(SIOCDEVPRIVATE+2)
-Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_var.h
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
 @@ -281,6 +281,7 @@
  	struct ieee80211_spy iv_spy;         		/* IWSPY support */
  	struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
@@ -70,10 +60,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
  };
  
  /* Debug functions need the defintion of struct ieee80211vap because iv_debug 
-Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
 @@ -2839,6 +2839,12 @@
  		else
  			ic->ic_flags_ext &= ~IEEE80211_FEXT_MARKDFS;
diff --git a/package/madwifi/patches/341-minrate.patch b/package/madwifi/patches/341-minrate.patch
index 37d09cafa2..1e75ddecf8 100644
--- a/package/madwifi/patches/341-minrate.patch
+++ b/package/madwifi/patches/341-minrate.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -1308,6 +1308,7 @@
  	vap->iv_key_update_begin = ath_key_update_begin;
  	vap->iv_key_update_end = ath_key_update_end;
@@ -10,10 +8,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  	if (sc->sc_default_ieee80211_debug) {
  		/* User specified defaults for new VAPs were provided, so
  		 * use those (only). */
-Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c
-+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
 @@ -638,9 +638,15 @@
  			sn->rs_succ_hist	[x] = 0;
  			sn->rs_att_hist 	[x] = 0;
@@ -40,10 +36,8 @@ Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
  		}
  
  		ath_fill_sample_table(sn);
-Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/sample/sample.c
-+++ madwifi-trunk-r3314/ath_rate/sample/sample.c
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
 @@ -842,8 +842,15 @@
  		sn->num_rates = vap->iv_maxrateindex;
  
@@ -62,10 +56,8 @@ Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
  		if (sn->rates[x].rix == 0xff) {
  			DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %u\n",
  				dev_info, __func__, x);
-Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
 @@ -642,6 +642,7 @@
  	IEEE80211_PARAM_BEACON_MISS_THRESH	= 73,	/* Beacon miss threshold (in beacons) */
  	IEEE80211_PARAM_BEACON_MISS_THRESH_MS	= 74,	/* Beacon miss threshold (in ms) */
@@ -74,10 +66,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
  };
  
  #define	SIOCG80211STATS			(SIOCDEVPRIVATE+2)
-Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_var.h
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
 @@ -282,6 +282,7 @@
  	struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
  	u_int32_t app_filter;				/* filters which management frames are forwarded to app */
@@ -86,10 +76,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
  };
  
  /* Debug functions need the defintion of struct ieee80211vap because iv_debug 
-Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
 @@ -2845,6 +2845,12 @@
  		else
  			vap->iv_maxrateindex = 0;
diff --git a/package/madwifi/patches/342-performance.patch b/package/madwifi/patches/342-performance.patch
index 2252c972c6..d79349dce3 100644
--- a/package/madwifi/patches/342-performance.patch
+++ b/package/madwifi/patches/342-performance.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -3237,7 +3237,6 @@
  	struct ath_softc *sc = dev->priv;
  	struct ieee80211_node *ni = NULL;
@@ -46,10 +44,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  	/* NB: use this lock to protect an->an_tx_ffbuf (and txq->axq_stageq)
  	 *     in athff_can_aggregate() call too. */
  	ATH_TXQ_LOCK_IRQ(txq);
-Index: madwifi-trunk-r3314/net80211/ieee80211_output.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_output.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_output.c
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
 @@ -283,7 +283,7 @@
  	 * normal vap. */
  	if (vap->iv_xrvap && (ni == vap->iv_bss) &&
@@ -216,10 +212,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_output.c
  }
  
  #define	KEY_UNDEFINED(k)	((k).wk_cipher == &ieee80211_cipher_none)
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -204,7 +204,6 @@
  	struct ieee80211_frame *wh;
  	struct ieee80211_key *key;
diff --git a/package/madwifi/patches/343-txqueue_races.patch b/package/madwifi/patches/343-txqueue_races.patch
index afbf115c04..74fd9be21d 100644
--- a/package/madwifi/patches/343-txqueue_races.patch
+++ b/package/madwifi/patches/343-txqueue_races.patch
@@ -1,9 +1,7 @@
 Merged from madwifi trunk r3551, r3552
 
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -8244,6 +8244,17 @@
  			goto bf_fail;
  		}
@@ -22,10 +20,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  		ATH_TXQ_REMOVE_HEAD(txq, bf_list);
  		ATH_TXQ_UNLOCK_IRQ(txq);
  
-Index: madwifi-trunk-r3314/ath/if_athvar.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_athvar.h
-+++ madwifi-trunk-r3314/ath/if_athvar.h
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
 @@ -586,7 +586,8 @@
  } while (0)
  #define ATH_TXQ_REMOVE_HEAD(_tq, _field) do { \
diff --git a/package/madwifi/patches/344-minstrel_failcnt.patch b/package/madwifi/patches/344-minstrel_failcnt.patch
index e2cedcb38d..b17440be3a 100644
--- a/package/madwifi/patches/344-minstrel_failcnt.patch
+++ b/package/madwifi/patches/344-minstrel_failcnt.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c
-+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
 @@ -475,7 +475,7 @@
  		/* 'tries' is the total number of times we have endeavoured to
  		 * send this packet, and is a sum of the #attempts at each
diff --git a/package/madwifi/patches/345-minstrel_sampling.patch b/package/madwifi/patches/345-minstrel_sampling.patch
index 0d4ee9f0ac..51416e5bf8 100644
--- a/package/madwifi/patches/345-minstrel_sampling.patch
+++ b/package/madwifi/patches/345-minstrel_sampling.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -8094,6 +8094,7 @@
  		ath_hal_setupxtxdesc(sc->sc_ah, ds, mrr.rate1, mrr.retries1,
  				     mrr.rate2, mrr.retries2,
@@ -10,10 +8,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  	}
  
  #ifndef ATH_SUPERG_FF
-Index: madwifi-trunk-r3314/ath/if_athvar.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_athvar.h
-+++ madwifi-trunk-r3314/ath/if_athvar.h
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
 @@ -446,6 +446,7 @@
  	u_int16_t bf_flags;				/* tx descriptor flags */
  	u_int64_t bf_tsf;
@@ -22,10 +18,8 @@ Index: madwifi-trunk-r3314/ath/if_athvar.h
  #ifdef ATH_SUPERG_FF
  	/* XXX: combine this with bf_skbaddr if it ever changes to accommodate
  	 *      multiple segments.
-Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c
-+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
 @@ -333,15 +333,19 @@
  		if (sn->static_rate_ndx >= 0) {
  			    ndx = sn->static_rate_ndx;
@@ -74,10 +68,8 @@ Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
  		if  (tries2 < 0)
  			return;
  		tries = tries - tries1;
-Index: madwifi-trunk-r3314/net80211/ieee80211_rate.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_rate.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_rate.h
+--- a/net80211/ieee80211_rate.h
++++ b/net80211/ieee80211_rate.h
 @@ -87,6 +87,7 @@
  	int retries2;
  	int rate3;
diff --git a/package/madwifi/patches/346-protmode_trig.patch b/package/madwifi/patches/346-protmode_trig.patch
index 8aba2d60e7..0abae5181c 100644
--- a/package/madwifi/patches/346-protmode_trig.patch
+++ b/package/madwifi/patches/346-protmode_trig.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211.c
-+++ madwifi-trunk-r3314/net80211/ieee80211.c
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
 @@ -333,7 +333,9 @@
  			IEEE80211_MS_TO_TU(IEEE80211_BMISSTHRESH_DEFAULT_MS), 
  			ic->ic_lintval), ic->ic_lintval);
@@ -13,10 +11,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211.c
  	IEEE80211_LOCK_INIT(ic, "ieee80211com");
  	IEEE80211_VAPS_LOCK_INIT(ic, "ieee80211com_vaps");
  	TAILQ_INIT(&ic->ic_vaps);
-Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_input.c
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
 @@ -3411,14 +3411,18 @@
  			IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
  
@@ -41,10 +37,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
  			}
  		}
  
-Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
 @@ -643,6 +643,8 @@
  	IEEE80211_PARAM_BEACON_MISS_THRESH_MS	= 74,	/* Beacon miss threshold (in ms) */
  	IEEE80211_PARAM_MAXRATE			= 75,	/* Maximum rate (by table index) */
@@ -54,10 +48,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
  };
  
  #define	SIOCG80211STATS			(SIOCDEVPRIVATE+2)
-Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h
-+++ madwifi-trunk-r3314/net80211/ieee80211_var.h
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
 @@ -128,6 +128,9 @@
  
  #define	IEEE80211_APPIE_MAX	1024
@@ -78,10 +70,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
  
  	/* Channel state:
  	 *
-Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
 @@ -2312,6 +2312,12 @@
  		    IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan))
  			retv = ENETRESET;
@@ -123,10 +113,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
  	{ IEEE80211_PARAM_MCASTCIPHER,
  	  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "mcastcipher" },
  	{ IEEE80211_PARAM_MCASTCIPHER,
-Index: madwifi-trunk-r3314/net80211/ieee80211_node.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_node.c
-+++ madwifi-trunk-r3314/net80211/ieee80211_node.c
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
 @@ -1877,6 +1877,17 @@
  
  	ieee80211_scan_timeout(ic);
diff --git a/package/madwifi/patches/347-tuning.patch b/package/madwifi/patches/347-tuning.patch
index 50a56d7966..deddd0de6b 100644
--- a/package/madwifi/patches/347-tuning.patch
+++ b/package/madwifi/patches/347-tuning.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -10265,11 +10265,11 @@
  	sc->sc_currates = rt;
  	sc->sc_curmode = mode;
@@ -17,10 +15,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  	/* rate index used to send mgt frames */
  	sc->sc_minrateix = 0;
  }
-Index: madwifi-trunk-r3314/ath/if_athvar.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_athvar.h
-+++ madwifi-trunk-r3314/ath/if_athvar.h
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
 @@ -272,6 +272,10 @@
  #define AES_ICV_FIELD_SIZE      8       /* AES ICV field size */
  #define EXT_IV_FIELD_SIZE       4       /* ext IV field size */
@@ -32,10 +28,8 @@ Index: madwifi-trunk-r3314/ath/if_athvar.h
  /* XR specific macros */
  
  #define XR_DEFAULT_GRPPOLL_RATE_STR 	"0.25 1 1 3 3 6 6 20"
-Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c
-+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
 @@ -197,7 +197,7 @@
  		unsigned int x = 0, tt = 0;
  		unsigned int cix = rt->info[rix].controlRate;
@@ -54,10 +48,8 @@ Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
  			tt += (t_slot * cw / 2);
  		}
  		return tt;
-Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.h
-+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.h
+--- a/ath_rate/minstrel/minstrel.h
++++ b/ath_rate/minstrel/minstrel.h
 @@ -180,14 +180,6 @@
  #define MAX(a,b)        ((a) > (b) ? (a) : (b))
  #endif
@@ -73,10 +65,8 @@ Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.h
  /*
   * Definitions for pulling the rate and trie counts from
   * a 5212 h/w descriptor. These Don't belong here; the
-Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/sample/sample.c
-+++ madwifi-trunk-r3314/ath_rate/sample/sample.c
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
 @@ -170,7 +170,7 @@
  	struct ieee80211com *ic = &sc->sc_ic;
  	unsigned int tt = 0;
@@ -95,10 +85,8 @@ Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
  		tt += (t_slot * cw / 2);
  	}
  	return tt;
-Index: madwifi-trunk-r3314/ath_rate/sample/sample.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath_rate/sample/sample.h
-+++ madwifi-trunk-r3314/ath_rate/sample/sample.h
+--- a/ath_rate/sample/sample.h
++++ b/ath_rate/sample/sample.h
 @@ -106,9 +106,6 @@
  #define MAX(a,b)        ((a) > (b) ? (a) : (b))
  #endif
diff --git a/package/madwifi/patches/348-ackcts.patch b/package/madwifi/patches/348-ackcts.patch
index 65db2a058b..a505ef86da 100644
--- a/package/madwifi/patches/348-ackcts.patch
+++ b/package/madwifi/patches/348-ackcts.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -2721,6 +2721,9 @@
  static int
  ath_set_ack_bitrate(struct ath_softc *sc, int high)
@@ -28,10 +26,8 @@ Index: madwifi-trunk-r3314/ath/if_ath.c
  				break;
  			case ATH_RP:
  				ath_rp_record(sc,
-Index: madwifi-trunk-r3314/ath/if_athvar.h
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_athvar.h
-+++ madwifi-trunk-r3314/ath/if_athvar.h
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
 @@ -681,6 +681,7 @@
  	unsigned int	sc_devstopped:1;	/* stopped due to of no tx bufs */
  	unsigned int	sc_stagbeacons:1;	/* use staggered beacons */
diff --git a/package/madwifi/patches/349-reset.patch b/package/madwifi/patches/349-reset.patch
index f52f0b0384..783022868a 100644
--- a/package/madwifi/patches/349-reset.patch
+++ b/package/madwifi/patches/349-reset.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath.c
-+++ madwifi-trunk-r3314/ath/if_ath.c
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
 @@ -2479,7 +2479,7 @@
  	 */
  	sc->sc_curchan.channel = ic->ic_curchan->ic_freq;
diff --git a/package/madwifi/patches/350-wisoc_softled.patch b/package/madwifi/patches/350-wisoc_softled.patch
index 19658b91ec..ca5ffdce4b 100644
--- a/package/madwifi/patches/350-wisoc_softled.patch
+++ b/package/madwifi/patches/350-wisoc_softled.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/ath/if_ath_ahb.c
-===================================================================
---- madwifi-trunk-r3314.orig/ath/if_ath_ahb.c
-+++ madwifi-trunk-r3314/ath/if_ath_ahb.c
+--- a/ath/if_ath_ahb.c
++++ b/ath/if_ath_ahb.c
 @@ -245,6 +245,8 @@
  	num_activesc++;
  	/* Ready to process interrupts */
diff --git a/package/madwifi/patches/351-scanlist.patch b/package/madwifi/patches/351-scanlist.patch
index 0895cf699e..6a4ae8b2f5 100644
--- a/package/madwifi/patches/351-scanlist.patch
+++ b/package/madwifi/patches/351-scanlist.patch
@@ -1,7 +1,5 @@
-Index: madwifi-trunk-r3314/net80211/ieee80211_scan_sta.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_scan_sta.c	2008-06-01 04:46:05.000000000 +0200
-+++ madwifi-trunk-r3314/net80211/ieee80211_scan_sta.c	2008-06-01 04:46:33.000000000 +0200
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
 @@ -317,147 +317,6 @@
  #undef ISPROBE
  }
@@ -341,10 +339,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_scan_sta.c
  	.scan_restart		= sta_restart,
  	.scan_cancel		= sta_cancel,
  	.scan_end		= adhoc_pick_bss,
-Index: madwifi-trunk-r3314/net80211/ieee80211.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211.c	2008-06-01 04:46:30.000000000 +0200
-+++ madwifi-trunk-r3314/net80211/ieee80211.c	2008-06-01 04:46:33.000000000 +0200
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
 @@ -278,6 +278,11 @@
  			("channel with bogus ieee number %u", c->ic_ieee));
  		setbit(ic->ic_chan_avail, c->ic_ieee);
@@ -357,10 +353,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211.c
  		/* Identify mode capabilities. */
  		if (IEEE80211_IS_CHAN_A(c))
  			ic->ic_modecaps |= 1 << IEEE80211_MODE_11A;
-Index: madwifi-trunk-r3314/net80211/_ieee80211.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/_ieee80211.h	2008-06-01 04:46:05.000000000 +0200
-+++ madwifi-trunk-r3314/net80211/_ieee80211.h	2008-06-01 04:46:33.000000000 +0200
+--- a/net80211/_ieee80211.h
++++ b/net80211/_ieee80211.h
 @@ -132,6 +132,11 @@
  	IEEE80211_SCAN_FIRST	= 2,	/* take first suitable candidate */
  };
@@ -381,10 +375,8 @@ Index: madwifi-trunk-r3314/net80211/_ieee80211.h
  };
  
  #define	IEEE80211_CHAN_MAX	255
-Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h	2008-06-01 04:46:30.000000000 +0200
-+++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h	2008-06-01 04:46:33.000000000 +0200
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
 @@ -555,6 +555,7 @@
  #define	IEEE80211_IOCTL_WDSADDMAC	(SIOCIWFIRSTPRIV+26)
  #define	IEEE80211_IOCTL_WDSDELMAC	(SIOCIWFIRSTPRIV+28)
@@ -393,10 +385,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
  
  enum {
  	IEEE80211_WMMPARAMS_CWMIN       = 1,
-Index: madwifi-trunk-r3314/net80211/ieee80211_scan_ap.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_scan_ap.c	2008-06-01 04:46:25.000000000 +0200
-+++ madwifi-trunk-r3314/net80211/ieee80211_scan_ap.c	2008-06-01 04:46:33.000000000 +0200
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
 @@ -129,131 +129,7 @@
  
  static int ap_flush(struct ieee80211_scan_state *);
@@ -664,10 +654,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_scan_ap.c
  		/* Verify mode matches any fixed mode specified */
  		if((c->chan->ic_flags & as->as_required_mode) != 
  				as->as_required_mode)
-Index: madwifi-trunk-r3314/net80211/ieee80211_scan.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_scan.c	2008-06-01 04:46:11.000000000 +0200
-+++ madwifi-trunk-r3314/net80211/ieee80211_scan.c	2008-06-01 05:24:44.000000000 +0200
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
 @@ -958,6 +958,80 @@
  	}
  }
@@ -749,10 +737,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_scan.c
  /*
   * Execute radar channel change. This is called when a radar/dfs
   * signal is detected.  AP mode only.  Return 1 on success, 0 on
-Index: madwifi-trunk-r3314/net80211/ieee80211_scan.h
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_scan.h	2008-06-01 04:46:05.000000000 +0200
-+++ madwifi-trunk-r3314/net80211/ieee80211_scan.h	2008-06-01 04:46:33.000000000 +0200
+--- a/net80211/ieee80211_scan.h
++++ b/net80211/ieee80211_scan.h
 @@ -219,4 +219,7 @@
  void ieee80211_scanner_unregister(enum ieee80211_opmode,
  	const struct ieee80211_scanner *);
@@ -761,10 +747,8 @@ Index: madwifi-trunk-r3314/net80211/ieee80211_scan.h
 +	struct ieee80211_scan_state *ss,
 +	enum ieee80211_phymode mode);
  #endif /* _NET80211_IEEE80211_SCAN_H_ */
-Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
-===================================================================
---- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c	2008-06-01 04:46:30.000000000 +0200
-+++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c	2008-06-01 04:46:33.000000000 +0200
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
 @@ -3873,6 +3873,106 @@
  	return ieee80211_ioctl_setmlme(dev, info, w, (char *)&mlme);
  }
diff --git a/package/madwifi/patches/400-changeset_r3402.patch b/package/madwifi/patches/400-changeset_r3402.patch
new file mode 100644
index 0000000000..af7e6d5733
--- /dev/null
+++ b/package/madwifi/patches/400-changeset_r3402.patch
@@ -0,0 +1,35 @@
+--- a/ath_hal/ah_os.h
++++ b/ath_hal/ah_os.h
+@@ -194,10 +194,6 @@
+  */
+ #if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
+ #define is_reg_le(__reg) ((0x4000 <= (__reg) && (__reg) < 0x5000))
+-#else
+-#define is_reg_le(__reg) 1
+-#endif
+-
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+ #define _OS_REG_WRITE(_ah, _reg, _val) do {			\
+ 	 is_reg_le(_reg) ?					\
+@@ -219,6 +215,21 @@
+ 	 readl((_ah)->ah_sh + (_reg)) :				\
+ 	 cpu_to_le32(readl((_ah)->ah_sh + (_reg))))
+ #endif				/* KERNEL_VERSION(2,6,12) */
++#else				/* AH_BYTE_ORDER != AH_BIG_ENDIAN */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
++#define _OS_REG_WRITE(_ah, _reg, _val) do {			\
++	 iowrite32((_val), (_ah)->ah_sh + (_reg));		\
++	} while (0)
++#define _OS_REG_READ(_ah, _reg)					\
++	ioread32((_ah)->ah_sh + (_reg))
++#else
++#define _OS_REG_WRITE(_ah, _reg, _val) do {			\
++	 writel((_val), (_ah)->ah_sh + (_reg));			\
++	} while (0)
++#define _OS_REG_READ(_ah, _reg)					\
++	readl((_ah)->ah_sh + (_reg))
++#endif				/* KERNEL_VERSION(2,6,12) */
++#endif				/* AH_BYTE_ORDER != AH_BIG_ENDIAN */
+ 
+ /*
+  * The functions in this section are not intended to be invoked by MadWifi
diff --git a/package/madwifi/patches/401-changeset_r3602.patch b/package/madwifi/patches/401-changeset_r3602.patch
new file mode 100644
index 0000000000..8e423ca3aa
--- /dev/null
+++ b/package/madwifi/patches/401-changeset_r3602.patch
@@ -0,0 +1,11 @@
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -312,6 +312,8 @@
+ /* __skb_append got a third parameter in 2.6.14 */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+ #define __skb_append(a,b,c)	__skb_append(a, b)
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
++#define __skb_append(a,b,c)	__skb_queue_after(c, a, b)
+ #endif
+ 
+ /*
diff --git a/package/madwifi/patches/402-changeset_r3603.patch b/package/madwifi/patches/402-changeset_r3603.patch
new file mode 100644
index 0000000000..92f6e6ea44
--- /dev/null
+++ b/package/madwifi/patches/402-changeset_r3603.patch
@@ -0,0 +1,176 @@
+--- a/Makefile
++++ b/Makefile
+@@ -40,10 +40,7 @@
+ # Makefile for the HAL-based Atheros driver.
+ #
+ 
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)
+ 
+ ifneq (svnversion.h,$(MAKECMDGOALS))
+--- a/ath/Makefile
++++ b/ath/Makefile
+@@ -40,10 +40,7 @@
+ # Makefile for the Atheros WLAN driver.
+ #
+ 
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ 
+ ifeq ($(strip $(BUS)),AHB)
+--- a/ath_hal/Makefile
++++ b/ath_hal/Makefile
+@@ -40,10 +40,7 @@
+ # Makefile for the Atheros WLAN driver.
+ #
+ 
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ 
+ include $(TOP)/Makefile.inc
+--- a/ath_rate/Makefile
++++ b/ath_rate/Makefile
+@@ -1,7 +1,4 @@
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ 
+ obj-y := amrr/ onoe/ sample/ minstrel/
+--- a/ath_rate/amrr/Makefile
++++ b/ath_rate/amrr/Makefile
+@@ -40,10 +40,7 @@
+ #
+ # Makefile for the Atheros Rate Control Support.
+ #
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ 
+ obj-m		+= ath_rate_amrr.o
+--- a/ath_rate/minstrel/Makefile
++++ b/ath_rate/minstrel/Makefile
+@@ -38,10 +38,7 @@
+ #
+ # Makefile for the Atheros Rate Control Support.
+ #
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ 
+ obj-m		+= ath_rate_minstrel.o
+--- a/ath_rate/onoe/Makefile
++++ b/ath_rate/onoe/Makefile
+@@ -40,10 +40,7 @@
+ #
+ # Makefile for the Atheros Rate Control Support.
+ #
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ 
+ obj-m		+= ath_rate_onoe.o
+--- a/ath_rate/sample/Makefile
++++ b/ath_rate/sample/Makefile
+@@ -38,10 +38,7 @@
+ #
+ # Makefile for the Atheros Rate Control Support.
+ #
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ 
+ obj-m		+= ath_rate_sample.o
+--- a/net80211/Makefile
++++ b/net80211/Makefile
+@@ -39,10 +39,7 @@
+ #
+ # Makefile for the 802.11 WLAN modules.
+ #
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ #
+ # There is one authenticator mechanism: an in-kernel implementation
+--- a/regression/Makefile
++++ b/regression/Makefile
+@@ -1,7 +1,4 @@
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ 
+ obj-y := ccmp/ tkip/ wep/
+--- a/regression/ccmp/Makefile
++++ b/regression/ccmp/Makefile
+@@ -1,10 +1,7 @@
+ #
+ # Makefile for the CCMP regression test.
+ #
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ 
+ obj-m			+= ath_test_ccmp.o
+--- a/regression/tkip/Makefile
++++ b/regression/tkip/Makefile
+@@ -1,10 +1,7 @@
+ #
+ # Makefile for the TKIP regression test.
+ #
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ 
+ obj-m			+= ath_test_tkip.o
+--- a/regression/wep/Makefile
++++ b/regression/wep/Makefile
+@@ -1,10 +1,7 @@
+ #
+ # Makefile for the WEP regression test.
+ #
+-ifeq ($(obj),)
+-obj=	.
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ 
+ obj-m			+= ath_test_wep.o
diff --git a/package/madwifi/patches/403-changeset_r3605.patch b/package/madwifi/patches/403-changeset_r3605.patch
new file mode 100644
index 0000000000..579c2c72cb
--- /dev/null
+++ b/package/madwifi/patches/403-changeset_r3605.patch
@@ -0,0 +1,70 @@
+--- a/include/compat.h
++++ b/include/compat.h
+@@ -182,6 +182,13 @@
+ #define DEV_ATH CTL_UNNUMBERED
+ #endif
+ 
++/* __skb_append got a third parameter in 2.6.14 */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
++#define __skb_queue_after(_list, _old, _new)	__skb_append(_old, _new)
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
++#define __skb_queue_after(_list, _old, _new)	__skb_append(_old, _new, _list)
++#endif
++
+ #endif /* __KERNEL__ */
+ 
+ #endif /* _ATH_COMPAT_H_ */
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -309,13 +309,6 @@
+ #define	ACL_LOCK_CHECK(_as)
+ #endif
+ 
+-/* __skb_append got a third parameter in 2.6.14 */
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+-#define __skb_append(a,b,c)	__skb_append(a, b)
+-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
+-#define __skb_append(a,b,c)	__skb_queue_after(c, a, b)
+-#endif
+-
+ /*
+  * Per-node power-save queue definitions.  Beware of control
+  * flow with IEEE80211_NODE_SAVEQ_LOCK/IEEE80211_NODE_SAVEQ_UNLOCK.
+@@ -359,16 +352,16 @@
+ 	_skb = __skb_dequeue(&(_ni)->ni_savedq);		\
+ 	(_qlen) = skb_queue_len(&(_ni)->ni_savedq);		\
+ } while (0)
+-#define	_IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _skb, _qlen, _age) do {\
+-	struct sk_buff *tail = skb_peek_tail(&(_ni)->ni_savedq);\
+-	if (tail != NULL) {					\
+-		_age -= M_AGE_GET(tail);			\
+-		__skb_append(tail, _skb, &(_ni)->ni_savedq);	\
+-	} else { 						\
+-		__skb_queue_head(&(_ni)->ni_savedq, _skb);	\
+-	}							\
+-	M_AGE_SET(_skb, _age);					\
+-	(_qlen) = skb_queue_len(&(_ni)->ni_savedq); 		\
++#define	_IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _skb, _qlen, _age) do {	\
++	struct sk_buff *tail = skb_peek_tail(&(_ni)->ni_savedq);	\
++	if (tail != NULL) {						\
++		_age -= M_AGE_GET(tail);				\
++		__skb_queue_after(&(_ni)->ni_savedq, tail, _skb);	\
++	} else { 							\
++		__skb_queue_head(&(_ni)->ni_savedq, _skb);		\
++	}								\
++	M_AGE_SET(_skb, _age);						\
++	(_qlen) = skb_queue_len(&(_ni)->ni_savedq); 			\
+ } while (0)
+ 
+ /*
+--- a/net80211/ieee80211_power.c
++++ b/net80211/ieee80211_power.c
+@@ -243,7 +243,7 @@
+ 	tail = skb_peek_tail(&ni->ni_savedq);
+ 	if (tail != NULL) {
+ 		age -= M_AGE_GET(tail);
+-		__skb_append(tail, skb, &ni->ni_savedq);
++		__skb_queue_after(&ni->ni_savedq, tail, skb);
+ 	} else
+ 		__skb_queue_head(&ni->ni_savedq, skb);
+ 	M_AGE_SET(skb, age);
-- 
cgit v1.2.3