Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .built-in.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .hal_init.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .ieee80211.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .mlme_linux.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .os_intfs.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .r8712u.ko.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .r8712u.mod.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .r8712u.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .recv_linux.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl8712_cmd.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl8712_efuse.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl8712_io.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl8712_led.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl8712_recv.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl8712_xmit.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_cmd.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_eeprom.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_io.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_ioctl_linux.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_ioctl_rtl.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_ioctl_set.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_mlme.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_mp.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_mp_ioctl.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_pwrctrl.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_recv.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_security.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_sta_mgt.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .rtl871x_xmit.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .usb_halinit.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .usb_intf.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .usb_ops.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .usb_ops_linux.o.cmd
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: .xmit_linux.o.cmd
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/Kconfig /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/Kconfig
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/Kconfig	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/Kconfig	2012-01-31 16:31:54.000000000 -0500
@@ -16,4 +16,11 @@ config R8712_AP
 	---help---
 	This option allows the Realtek RTL8712 USB device to be an Access Point.
 
+config R8712_TX_AGGR
+	bool "Realtek RTL8712U Transmit Aggregation code"
+	depends on R8712U && BROKEN
+	default N
+	---help---
+	This option provides transmit aggregation for the Realtek RTL8712 USB device.
+
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/basic_types.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/basic_types.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/basic_types.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/basic_types.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __BASIC_TYPES_H__
 #define __BASIC_TYPES_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/big_endian.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/big_endian.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/big_endian.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/big_endian.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
 #define _LINUX_BYTEORDER_BIG_ENDIAN_H
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: built-in.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/drv_types.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/drv_types.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/drv_types.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/drv_types.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 /*---------------------------------------------------------------------
 
 	For type defines and data structure defines
@@ -117,6 +142,11 @@ struct dvobj_priv {
 	struct usb_device *pusbdev;
 };
 
+/**
+ * struct _adapter - the main adapter structure for this device.
+ *
+ * bup: True indicates that the interface is Up.
+ */
 struct _adapter {
 	struct	dvobj_priv dvobjpriv;
 	struct	mlme_priv mlmepriv;
@@ -151,6 +181,9 @@ struct _adapter {
 	struct net_device_stats stats;
 	struct iw_statistics iwstats;
 	int pid; /*process id from UI*/
+	_workitem wkFilterRxFF0;
+	u8 blnEnableRxFF0Filter;
+	spinlock_t lockRxFF0Filter;
 };
 
 static inline u8 *myid(struct eeprom_priv *peepriv)
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/ethernet.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/ethernet.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/ethernet.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/ethernet.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __INC_ETHERNET_H
 #define __INC_ETHERNET_H
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/generic.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/generic.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/generic.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/generic.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _LINUX_BYTEORDER_GENERIC_H
 #define _LINUX_BYTEORDER_GENERIC_H
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/hal_init.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/hal_init.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/hal_init.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/hal_init.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,6 +28,12 @@
 
 #define _HAL_INIT_C_
 
+#include <linux/usb.h>
+#include <linux/device.h>
+#include <linux/usb/ch9.h>
+#include <linux/firmware.h>
+#include <linux/module.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 #include "rtl871x_byteorder.h"
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: hal_init.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/ieee80211.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/ieee80211.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/ieee80211.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/ieee80211.c	2012-01-31 16:31:54.000000000 -0500
@@ -170,17 +170,11 @@ static uint r8712_get_rateset_len(u8 *ra
 	return i;
 }
 
-int r8712_generate_ie(struct registry_priv *pregistrypriv,
-		      struct _adapter *padapter)
+int r8712_generate_ie(struct registry_priv *pregistrypriv)
 {
 	int sz = 0, rateLen;
 	struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network;
 	u8 *ie = pdev_network->IEs;
-	struct ieee80211_ht_cap ht_capie;
-	struct ieee80211_ht_addt_info ht_addt_info;
-	unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00};
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct qos_priv *pqospriv = &pmlmepriv->qospriv;
 
 	/*timestamp will be inserted by hardware*/
 	sz += 8;
@@ -219,33 +213,6 @@ int r8712_generate_ie(struct registry_pr
 	/*IBSS Parameter Set*/
 	ie = r8712_set_ie(ie, _IBSS_PARA_IE_, 2,
 		    (u8 *)&(pdev_network->Configuration.ATIMWindow), &sz);
-	if (pregistrypriv->ht_enable == 1) {
-		if (pqospriv->qos_option == 0) {
-			ie = r8712_set_ie(ie, _VENDOR_SPECIFIC_IE_,
-					   _WMM_IE_Length_, WMM_IE, &sz);
-			pqospriv->qos_option = 1;
-		}
-		memset(&ht_capie, 0, sizeof(struct ieee80211_ht_cap));
-		ht_capie.cap_info = IEEE80211_HT_CAP_SUP_WIDTH |
-				    IEEE80211_HT_CAP_SGI_20 |
-				    IEEE80211_HT_CAP_SGI_40 |
-				    IEEE80211_HT_CAP_TX_STBC |
-				    IEEE80211_HT_CAP_MAX_AMSDU |
-				    IEEE80211_HT_CAP_DSSSCCK40;
-		ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR &
-				0x03) | (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
-		ie = r8712_set_ie(ie, _HT_CAPABILITY_IE_,
-			    sizeof(struct ieee80211_ht_cap),
-			    (unsigned char *)&ht_capie, &sz);
-		/*add HT info ie*/
-		memset(&ht_addt_info, 0,
-			sizeof(struct ieee80211_ht_addt_info));
-		/*need to add the HT additional IEs*/
-		ht_addt_info.control_chan = pregistrypriv->channel;
-		ie = r8712_set_ie(ie, _HT_ADD_INFO_IE_,
-			    sizeof(struct ieee80211_ht_addt_info),
-			    (unsigned char *)&ht_addt_info, &sz);
-	}
 	return sz;
 }
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/ieee80211.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/ieee80211.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/ieee80211.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/ieee80211.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __IEEE80211_H
 #define __IEEE80211_H
 
@@ -112,7 +137,7 @@ struct ieee_ibss_seq {
 	u8 mac[ETH_ALEN];
 	u16 seq_num;
 	u16 frag_num;
-	unsigned int packet_time;
+	unsigned long packet_time;
 	struct list_head list;
 };
 
@@ -644,7 +669,6 @@ struct ieee80211_txb {
 #define CRC_LENGTH                 4U
 
 #define MAX_WPA_IE_LEN 128
-#define MAX_WPS_IE_LEN 512
 
 #define NETWORK_EMPTY_ESSID (1<<0)
 #define NETWORK_HAS_OFDM    (1<<1)
@@ -764,8 +788,7 @@ int r8712_parse_wpa2_ie(u8 *wpa_ie, int
 int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
 		     u8 *wpa_ie, u16 *wpa_len);
 int r8712_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
-int r8712_generate_ie(struct registry_priv *pregistrypriv,
-		      struct _adapter *padapter);
+int r8712_generate_ie(struct registry_priv *pregistrypriv);
 uint r8712_is_cckrates_included(u8 *rate);
 uint r8712_is_cckratesonly_included(u8 *rate);
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: ieee80211.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/if_ether.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/if_ether.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/if_ether.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/if_ether.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 /*
  * INET		An implementation of the TCP/IP protocol suite for the LINUX
  *		operating system.  INET is implemented using the  BSD Socket
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/little_endian.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/little_endian.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/little_endian.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/little_endian.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
 #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: mlme_linux.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/mlme_osdep.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/mlme_osdep.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/mlme_osdep.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/mlme_osdep.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef	__MLME_OSDEP_H_
 #define __MLME_OSDEP_H_
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: modules.order
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/mp_custom_oid.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/mp_custom_oid.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/mp_custom_oid.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/mp_custom_oid.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef	__CUSTOM_OID_H
 #define __CUSTOM_OID_H
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/os_intfs.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/os_intfs.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/os_intfs.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/os_intfs.c	2012-01-31 16:31:54.000000000 -0500
@@ -177,7 +177,7 @@ static uint loadparam(struct _adapter *p
 
 static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(pnetdev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(pnetdev);
 	struct sockaddr *addr = p;
 
 	if (padapter->bup == false)
@@ -187,7 +187,7 @@ static int r871x_net_set_mac_address(str
 
 static struct net_device_stats *r871x_net_get_stats(struct net_device *pnetdev)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(pnetdev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(pnetdev);
 	struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
 	struct recv_priv *precvpriv = &(padapter->recvpriv);
 
@@ -221,7 +221,7 @@ struct net_device *r8712_init_netdev(voi
 		strcpy(ifname, "wlan%d");
 		dev_alloc_name(pnetdev, ifname);
 	}
-	padapter = (struct _adapter *) _netdev_priv(pnetdev);
+	padapter = (struct _adapter *) netdev_priv(pnetdev);
 	padapter->pnetdev = pnetdev;
 	printk(KERN_INFO "r8712u: register rtl8712_netdev_ops to"
 	       " netdev_ops\n");
@@ -261,7 +261,7 @@ static void start_drv_timers(struct _ada
 	_set_timer(&padapter->mlmepriv.wdg_timer, 2000);
 }
 
-static void stop_drv_timers(struct _adapter *padapter)
+void r8712_stop_drv_timers(struct _adapter *padapter)
 {
 	_cancel_timer_ex(&padapter->mlmepriv.assoc_timer);
 	_cancel_timer_ex(&padapter->mlmepriv.sitesurveyctrl.
@@ -286,6 +286,9 @@ static u8 init_default_value(struct _ada
 	pxmitpriv->vcs_type = pregistrypriv->vcs_type;
 	pxmitpriv->rts_thresh = pregistrypriv->rts_thresh;
 	pxmitpriv->frag_len = pregistrypriv->frag_thresh;
+	/* mlme_priv */
+	/* Maybe someday we should rename this variable to "active_mode"(Jeff)*/
+	pmlmepriv->passive_mode = 1; /* 1: active, 0: passive. */
 	/*ht_priv*/
 	{
 		int i;
@@ -348,7 +351,7 @@ u8 r8712_free_drv_sw(struct _adapter *pa
 	_r8712_free_recv_priv(&padapter->recvpriv);
 	mp871xdeinit(padapter);
 	if (pnetdev)
-		os_free_netdev(pnetdev);
+		free_netdev(pnetdev);
 	return _SUCCESS;
 }
 
@@ -375,9 +378,15 @@ static void enable_video_mode(struct _ad
 	r8712_fw_cmd(padapter, intcmd);
 }
 
+/**
+ *
+ * This function intends to handle the activation of an interface
+ * i.e. when it is brought Up/Active from a Down state.
+ *
+ */
 static int netdev_open(struct net_device *pnetdev)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(pnetdev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(pnetdev);
 
 	if (padapter->bup == false) {
 		padapter->bDriverStopped = false;
@@ -434,9 +443,15 @@ netdev_open_error:
 	return -1;
 }
 
+/**
+ *
+ * This function intends to handle the shutdown of an interface
+ * i.e. when it is brought Down from an Up/Active state.
+ *
+ */
 static int netdev_close(struct net_device *pnetdev)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(pnetdev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(pnetdev);
 
 	/* Close LED*/
 	padapter->ledpriv.LedControlHandler(padapter, LED_CTL_POWER_OFF);
@@ -456,8 +471,8 @@ static int netdev_close(struct net_devic
 	r8712_free_assoc_resources(padapter);
 	/*s2-4.*/
 	r8712_free_network_queue(padapter);
-	/*Stop driver mlme relation timer*/
-	stop_drv_timers(padapter);
+	/* The interface is no longer Up: */
+	padapter->bup = false;
 	return 0;
 }
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: os_intfs.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/osdep_intf.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/osdep_intf.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/osdep_intf.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/osdep_intf.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __OSDEP_INTF_H_
 #define __OSDEP_INTF_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/osdep_service.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/osdep_service.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/osdep_service.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/osdep_service.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,40 +1,47 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __OSDEP_SERVICE_H_
 #define __OSDEP_SERVICE_H_
 
 #define _SUCCESS	1
 #define _FAIL		0
 
-#include "basic_types.h"
+#include <linux/version.h>
 #include <linux/spinlock.h>
+
+#include <linux/interrupt.h>
 #include <linux/semaphore.h>
+#include <linux/sched.h>
 #include <linux/sem.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <net/iw_handler.h>
 #include <linux/proc_fs.h>	/* Necessary because we use the proc fs */
-#include <linux/compiler.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/kref.h>
-#include <linux/skbuff.h>
-#include <linux/usb.h>
-#include <linux/usb/ch9.h>
-#include <linux/io.h>
-#include <linux/circ_buf.h>
-#include <linux/uaccess.h>
-#include <asm/byteorder.h>
-#include <linux/atomic.h>
-#include <linux/wireless.h>
-#include <linux/rtnetlink.h>
-#include "ethernet.h"
-#include <linux/if_arp.h>
-#include <linux/firmware.h>
-#define   _usb_alloc_urb(x, y)       usb_alloc_urb(x, y)
-#define   _usb_submit_urb(x, y)     usb_submit_urb(x, y)
+
+#include "basic_types.h"
 
 struct	__queue	{
 	struct	list_head	queue;
@@ -45,7 +52,6 @@ struct	__queue	{
 #define _buffer unsigned char
 #define thread_exit() complete_and_exit(NULL, 0)
 #define _workitem struct work_struct
-#define MSECS(t)        (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
 
 #define _init_queue(pqueue)				\
 	do {						\
@@ -53,16 +59,6 @@ struct	__queue	{
 		spin_lock_init(&((pqueue)->lock));	\
 	} while (0)
 
-static inline void *_netdev_priv(struct net_device *dev)
-{
-	return netdev_priv(dev);
-}
-
-static inline void os_free_netdev(struct net_device *dev)
-{
-	free_netdev(dev);
-}
-
 static inline struct list_head *get_next(struct list_head *list)
 {
 	return list->next;
@@ -203,7 +199,6 @@ static inline unsigned char _cancel_time
 
 static inline void thread_enter(void *context)
 {
-	daemonize("%s", "RTKTHREAD");
 	allow_signal(SIGTERM);
 }
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: r8712u.ko
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: r8712u.mod.c
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: r8712u.mod.o
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: r8712u.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/recv_linux.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/recv_linux.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/recv_linux.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/recv_linux.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,11 +28,15 @@
 
 #define _RECV_OSDEP_C_
 
+#include <linux/usb.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 #include "wifi.h"
 #include "recv_osdep.h"
 #include "osdep_intf.h"
+#include "ethernet.h"
+#include <linux/if_arp.h>
 #include "usb_ops.h"
 
 /*init os related resource in struct recv_priv*/
@@ -51,7 +55,7 @@ int r8712_os_recvbuf_resource_alloc(stru
 	int res = _SUCCESS;
 
 	precvbuf->irp_pending = false;
-	precvbuf->purb = _usb_alloc_urb(0, GFP_KERNEL);
+	precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL);
 	if (precvbuf->purb == NULL)
 		res = _FAIL;
 	precvbuf->pskb = NULL;
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: recv_linux.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/recv_osdep.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/recv_osdep.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/recv_osdep.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/recv_osdep.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RECV_OSDEP_H_
 #define __RECV_OSDEP_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,24 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+
+
 #ifndef __RTL8712_BITDEF_H__
 #define __RTL8712_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_cmd.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_cmd.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_cmd.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_cmd.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,6 +28,24 @@
 
 #define _RTL8712_CMD_C_
 
+#include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/kref.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/usb.h>
+#include <linux/usb/ch9.h>
+#include <linux/circ_buf.h>
+#include <linux/uaccess.h>
+#include <asm/byteorder.h>
+#include <linux/atomic.h>
+#include <linux/semaphore.h>
+#include <linux/rtnetlink.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 #include "recv_osdep.h"
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_cmd.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_cmd.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_cmd.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_cmd.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,9 +1,40 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_CMD_H_
 #define __RTL8712_CMD_H_
 
+#define CMD_HDR_SZ      8
+
 u8 r8712_fw_cmd(struct _adapter *pAdapter, u32 cmd);
 void r8712_fw_cmd_data(struct _adapter *pAdapter, u32 *value, u8 flag);
 
+struct cmd_hdr {
+	u32 cmd_dw0;
+	u32 cmd_dw1;
+};
 
 enum rtl8712_h2c_cmd {
 	GEN_CMD_CODE(_Read_MACREG),	/*0*/
@@ -72,6 +103,40 @@ enum rtl8712_h2c_cmd {
 	GEN_CMD_CODE(_SetPowerTracking),
 	GEN_CMD_CODE(_AMSDU_TO_AMPDU), /*57*/
 	GEN_CMD_CODE(_SetMacAddress), /*58*/
+
+	GEN_CMD_CODE(_DisconnectCtrl), /*59*/
+	GEN_CMD_CODE(_SetChannelPlan), /*60*/
+	GEN_CMD_CODE(_DisconnectCtrlEx), /*61*/
+
+	/* To do, modify these h2c cmd, add or delete */
+	GEN_CMD_CODE(_GetH2cLbk) ,
+
+	/* WPS extra IE */
+	GEN_CMD_CODE(_SetProbeReqExtraIE) ,
+	GEN_CMD_CODE(_SetAssocReqExtraIE) ,
+	GEN_CMD_CODE(_SetProbeRspExtraIE) ,
+	GEN_CMD_CODE(_SetAssocRspExtraIE) ,
+
+	/* the following is driver will do */
+	GEN_CMD_CODE(_GetCurDataRate) ,
+
+	GEN_CMD_CODE(_GetTxRetrycnt),  /* to record times that Tx retry to
+					* transmmit packet after association
+					*/
+	GEN_CMD_CODE(_GetRxRetrycnt),  /* to record total number of the
+					* received frame with ReTry bit set in
+					* the WLAN header
+					*/
+
+	GEN_CMD_CODE(_GetBCNOKcnt),
+	GEN_CMD_CODE(_GetBCNERRcnt),
+	GEN_CMD_CODE(_GetCurTxPwrLevel),
+
+	GEN_CMD_CODE(_SetDIG),
+	GEN_CMD_CODE(_SetRA),
+	GEN_CMD_CODE(_SetPT),
+	GEN_CMD_CODE(_ReadTSSI),
+
 	MAX_H2CCMD
 };
 
@@ -151,6 +216,28 @@ static struct _cmd_callback	cmd_callback
 	{GEN_CMD_CODE(_SetPowerTracking), NULL},
 	{GEN_CMD_CODE(_AMSDU_TO_AMPDU), NULL}, /*57*/
 	{GEN_CMD_CODE(_SetMacAddress), NULL}, /*58*/
+
+	{GEN_CMD_CODE(_DisconnectCtrl), NULL}, /*59*/
+	{GEN_CMD_CODE(_SetChannelPlan), NULL}, /*60*/
+	{GEN_CMD_CODE(_DisconnectCtrlEx), NULL}, /*61*/
+
+	/* To do, modify these h2c cmd, add or delete */
+	{GEN_CMD_CODE(_GetH2cLbk), NULL},
+
+	{_SetProbeReqExtraIE_CMD_, NULL},
+	{_SetAssocReqExtraIE_CMD_, NULL},
+	{_SetProbeRspExtraIE_CMD_, NULL},
+	{_SetAssocRspExtraIE_CMD_, NULL},
+	{_GetCurDataRate_CMD_, NULL},
+	{_GetTxRetrycnt_CMD_, NULL},
+	{_GetRxRetrycnt_CMD_, NULL},
+	{_GetBCNOKcnt_CMD_, NULL},
+	{_GetBCNERRcnt_CMD_, NULL},
+	{_GetCurTxPwrLevel_CMD_, NULL},
+	{_SetDIG_CMD_, NULL},
+	{_SetRA_CMD_, NULL},
+	{_SetPT_CMD_, NULL},
+	{GEN_CMD_CODE(_ReadTSSI), &r8712_readtssi_cmdrsp_callback}
 };
 #endif
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl8712_cmd.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_CMDCTRL_BITDEF_H__
 #define __RTL8712_CMDCTRL_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_cmdctrl_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_cmdctrl_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_cmdctrl_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_cmdctrl_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_CMDCTRL_REGDEF_H__
 #define __RTL8712_CMDCTRL_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_debugctrl_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_debugctrl_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_debugctrl_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_debugctrl_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_DEBUGCTRL_BITDEF_H__
 #define __RTL8712_DEBUGCTRL_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_debugctrl_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_debugctrl_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_debugctrl_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_debugctrl_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_DEBUGCTRL_REGDEF_H__
 #define __RTL8712_DEBUGCTRL_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_edcasetting_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_edcasetting_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_edcasetting_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_edcasetting_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_EDCASETTING_BITDEF_H__
 #define __RTL8712_EDCASETTING_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_edcasetting_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_edcasetting_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_edcasetting_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_edcasetting_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_EDCASETTING_REGDEF_H__
 #define __RTL8712_EDCASETTING_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_efuse.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_efuse.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_efuse.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_efuse.c	2012-01-31 16:31:54.000000000 -0500
@@ -307,34 +307,39 @@ static u8 fix_header(struct _adapter *pa
 			continue;
 		}
 		for (i = 0; i < PGPKG_MAX_WORDS; i++) {
-			if (BIT(i) & word_en)
-				continue;
-			if (!(BIT(i) & pkt.word_en)) {
-				if (efuse_one_byte_read(padapter, addr,
+			if (BIT(i) & word_en) {
+				if (BIT(i) & pkt.word_en) {
+					if (efuse_one_byte_read(
+							padapter, addr,
 				    &value) == true)
 					pkt.data[i*2] = value;
 				else
 					return false;
-				if (efuse_one_byte_read(padapter, addr + 1,
+					if (efuse_one_byte_read(
+							padapter,
+							addr + 1,
 				    &value) == true)
-					pkt.data[i*2 + 1] = value;
+						pkt.data[i*2 + 1] =
+							value;
 				else
 					return false;
 			}
 			addr += 2;
 		}
 	}
+	}
 	if (addr != header_addr)
 		return false;
 	addr++;
 	/* fill original data */
 	for (i = 0; i < PGPKG_MAX_WORDS; i++) {
-		if (BIT(i) & pkt.word_en)
-			continue;
+		if (BIT(i) & pkt.word_en) {
 		efuse_one_byte_write(padapter, addr, pkt.data[i*2]);
-		efuse_one_byte_write(padapter, addr+1, pkt.data[i*2 + 1]);
+			efuse_one_byte_write(padapter, addr+1,
+					pkt.data[i*2 + 1]);
 		/* additional check */
-		if (efuse_one_byte_read(padapter, addr, &value) == false)
+			if (efuse_one_byte_read(padapter, addr, &value)
+				== false)
 			ret = false;
 		else if (pkt.data[i*2] != value) {
 			ret = false;
@@ -342,7 +347,8 @@ static u8 fix_header(struct _adapter *pa
 				efuse_one_byte_write(padapter, addr,
 						     pkt.data[i * 2]);
 		}
-		if (efuse_one_byte_read(padapter, addr+1, &value) == false)
+			if (efuse_one_byte_read(padapter, addr+1, &value) ==
+				false)
 			ret = false;
 		else if (pkt.data[i*2 + 1] != value) {
 			ret = false;
@@ -350,6 +356,7 @@ static u8 fix_header(struct _adapter *pa
 				efuse_one_byte_write(padapter, addr+1,
 						     pkt.data[i*2 + 1]);
 		}
+		}
 		addr += 2;
 	}
 	return ret;
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl8712_efuse.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_event.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_event.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_event.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_event.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL8712_EVENT_H_
 #define _RTL8712_EVENT_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_fifoctrl_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_fifoctrl_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_fifoctrl_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_fifoctrl_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_FIFOCTRL_BITDEF_H__
 #define __RTL8712_FIFOCTRL_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_fifoctrl_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_fifoctrl_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_fifoctrl_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_fifoctrl_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_FIFOCTRL_REGDEF_H__
 #define __RTL8712_FIFOCTRL_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_gp_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_gp_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_gp_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_gp_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_GP_BITDEF_H__
 #define __RTL8712_GP_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_gp_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_gp_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_gp_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_gp_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_GP_REGDEF_H__
 #define __RTL8712_GP_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_hal.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_hal.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_hal.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_hal.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_HAL_H__
 #define __RTL8712_HAL_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_interrupt_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_interrupt_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_interrupt_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_interrupt_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_INTERRUPT_BITDEF_H__
 #define __RTL8712_INTERRUPT_BITDEF_H__
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl8712_io.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_led.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_led.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_led.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_led.c	2012-01-31 16:31:54.000000000 -0500
@@ -1786,7 +1786,7 @@ void LedControl871x(struct _adapter *pad
 {
 	struct led_priv	*ledpriv = &(padapter->ledpriv);
 
-	if (ledpriv == NULL || ledpriv->bRegUseLed == false)
+	if (ledpriv->bRegUseLed == false)
 		return;
 	switch (ledpriv->LedStrategy) {
 	case SW_LED_MODE0:
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl8712_led.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_macsetting_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_macsetting_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_macsetting_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_macsetting_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_MACSETTING_BITDEF_H__
 #define __RTL8712_MACSETTING_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_macsetting_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_macsetting_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_macsetting_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_macsetting_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_MACSETTING_REGDEF_H__
 #define __RTL8712_MACSETTING_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_powersave_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_powersave_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_powersave_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_powersave_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_POWERSAVE_BITDEF_H__
 #define __RTL8712_POWERSAVE_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_powersave_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_powersave_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_powersave_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_powersave_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_POWERSAVE_REGDEF_H__
 #define __RTL8712_POWERSAVE_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_ratectrl_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_ratectrl_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_ratectrl_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_ratectrl_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_RATECTRL_BITDEF_H__
 #define __RTL8712_RATECTRL_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_ratectrl_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_ratectrl_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_ratectrl_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_ratectrl_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_RATECTRL_REGDEF_H__
 #define __RTL8712_RATECTRL_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_recv.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_recv.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_recv.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_recv.c	2012-01-31 16:31:54.000000000 -0500
@@ -192,7 +192,7 @@ static void update_recvframe_attrib_from
 	} else
 		pattrib->tcpchk_valid = 0; /* invalid */
 	pattrib->mcs_rate = (u8)((le32_to_cpu(prxstat->rxdw3)) & 0x3f);
-	pattrib->htc = (u8)((le32_to_cpu(prxstat->rxdw3) >> 6) & 0x1);
+	pattrib->htc = (u8)((le32_to_cpu(prxstat->rxdw3) >> 14) & 0x1);
 	/*Offset 16*/
 	/*Offset 20*/
 	/*phy_info*/
@@ -207,7 +207,7 @@ static union recv_frame *recvframe_defra
 				   struct  __queue *defrag_q)
 {
 	struct list_head *plist, *phead;
-	u8	wlanhdr_offset;
+	u8	*data, wlanhdr_offset;
 	u8	curfragnum;
 	struct recv_frame_hdr *pfhdr, *pnfhdr;
 	union recv_frame *prframe, *pnextrframe;
@@ -224,22 +224,25 @@ static union recv_frame *recvframe_defra
 		/*the first fragment number must be 0
 		 *free the whole queue*/
 		r8712_free_recvframe(prframe, pfree_recv_queue);
-		prframe = NULL;
-		goto exit;
+		r8712_free_recvframe_queue(defrag_q, pfree_recv_queue);
+		return NULL;
 	}
-	plist = get_next(phead);
+	curfragnum++;
+	plist = get_list_head(defrag_q);
+	plist = get_next(plist);
+	data = get_recvframe_data(prframe);
 	while (end_of_queue_search(phead, plist) == false) {
 		pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
-		/*check the fragment sequence  (2nd ~n fragment frame) */
 		pnfhdr = &pnextrframe->u.hdr;
-		curfragnum++;
+		/*check the fragment sequence  (2nd ~n fragment frame) */
 		if (curfragnum != pnfhdr->attrib.frag_num) {
 			/* the fragment number must increase  (after decache)
 			 * release the defrag_q & prframe */
 			r8712_free_recvframe(prframe, pfree_recv_queue);
-			prframe = NULL;
-			goto exit;
+			r8712_free_recvframe_queue(defrag_q, pfree_recv_queue);
+			return NULL;
 		}
+		curfragnum++;
 		/* copy the 2nd~n fragment frame's payload to the first fragment
 		 * get the 2nd~last fragment frame's payload */
 		wlanhdr_offset = pnfhdr->attrib.hdrlen + pnfhdr->attrib.iv_len;
@@ -252,7 +255,6 @@ static union recv_frame *recvframe_defra
 		pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
 		plist = get_next(plist);
 	}
-exit:
 	/* free the defrag_q queue and return the prframe */
 	r8712_free_recvframe_queue(defrag_q, pfree_recv_queue);
 	return prframe;
@@ -1074,7 +1076,7 @@ static int recvbuf2recvframe(struct _ada
 		/* for first fragment packet, driver need allocate 1536 +
 		 * drvinfo_sz + RXDESC_SIZE to defrag packet. */
 		if ((mf == 1) && (frag == 0))
-			alloc_sz = 1658;
+			alloc_sz = 1658;/*1658+6=1664, 1664 is 128 alignment.*/
 		else
 			alloc_sz = tmp_len;
 		/* 2 is for IP header 4 bytes alignment in QoS packet case.
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_recv.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_recv.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_recv.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_recv.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,10 +1,40 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL8712_RECV_H_
 #define _RTL8712_RECV_H_
 
 #include "osdep_service.h"
 #include "drv_types.h"
 
+/* Realtek's v2.6.6 reduced this to 4. However, under heavy network and CPU
+ * loads, even 8 receive buffers might not be enough; cutting it to 4 seemed
+ * unwise.
+ */
 #define NR_RECVBUFF (8)
+
 #define NR_PREALLOC_RECV_SKB (8)
 #define RXDESC_SIZE	24
 #define RXDESC_OFFSET RXDESC_SIZE
@@ -115,7 +145,6 @@ union recv_frame {
 	union {
 		struct list_head list;
 		struct recv_frame_hdr hdr;
-		addr_t mem[RECVFRAME_HDR_ALIGN>>2];
 	} u;
 };
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl8712_recv.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_REGDEF_H__
 #define __RTL8712_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_security_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_security_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_security_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_security_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_SECURITY_BITDEF_H__
 #define __RTL8712_SECURITY_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_spec.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_spec.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_spec.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_spec.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_SPEC_H__
 #define __RTL8712_SPEC_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_syscfg_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_syscfg_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_syscfg_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_syscfg_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_SYSCFG_BITDEF_H__
 #define __RTL8712_SYSCFG_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_syscfg_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_syscfg_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_syscfg_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_syscfg_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_SYSCFG_REGDEF_H__
 #define __RTL8712_SYSCFG_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_timectrl_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_timectrl_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_timectrl_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_timectrl_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_TIMECTRL_BITDEF_H__
 #define __RTL8712_TIMECTRL_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_timectrl_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_timectrl_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_timectrl_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_timectrl_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_TIMECTRL_REGDEF_H__
 #define __RTL8712_TIMECTRL_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_wmac_bitdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_wmac_bitdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_wmac_bitdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_wmac_bitdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_WMAC_BITDEF_H__
 #define __RTL8712_WMAC_BITDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_wmac_regdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_wmac_regdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_wmac_regdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_wmac_regdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_WMAC_REGDEF_H__
 #define __RTL8712_WMAC_REGDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_xmit.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_xmit.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_xmit.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_xmit.c	2012-01-31 16:31:54.000000000 -0500
@@ -37,6 +37,7 @@
 
 static void dump_xframe(struct _adapter *padapter,
 			struct xmit_frame *pxmitframe);
+static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz);
 
 sint _r8712_init_hw_txqueue(struct hw_txqueue *phw_txqueue, u8 ac_tag)
 {
@@ -238,16 +239,180 @@ exit_dequeue_xframe_ex:
 void r8712_do_queue_select(struct _adapter *padapter,
 			   struct pkt_attrib *pattrib)
 {
-	u8 qsel = 0;
+	unsigned int qsel = 0;
 	struct dvobj_priv *pdvobj = (struct dvobj_priv *)&padapter->dvobjpriv;
 
 	if (pdvobj->nr_endpoint == 6)
-		qsel = pattrib->priority;
-	else if (pdvobj->nr_endpoint == 4)
-		qsel = pattrib->priority;
+		qsel = (unsigned int) pattrib->priority;
+	else if (pdvobj->nr_endpoint == 4) {
+		qsel = (unsigned int) pattrib->priority;
+		if (qsel == 0 || qsel == 3)
+			qsel = 3;
+		else if (qsel == 1 || qsel == 2)
+			qsel = 1;
+		else if (qsel == 4 || qsel == 5)
+			qsel = 5;
+		else if (qsel == 6 || qsel == 7)
+			qsel = 7;
+		else
+			qsel = 3;
+	}
 	pattrib->qsel = qsel;
 }
 
+#ifdef CONFIG_R8712_TX_AGGR
+u8 r8712_construct_txaggr_cmd_desc(struct xmit_buf *pxmitbuf)
+{
+	struct tx_desc *ptx_desc = (struct tx_desc *)pxmitbuf->pbuf;
+
+	/* Fill up TxCmd Descriptor according as USB FW Tx Aaggregation info.*/
+	/* dw0 */
+	ptx_desc->txdw0 = cpu_to_le32(CMD_HDR_SZ&0xffff);
+	ptx_desc->txdw0 |=
+		cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ)<<OFFSET_SHT)&0x00ff0000);
+	ptx_desc->txdw0 |= cpu_to_le32(OWN | FSG | LSG);
+
+	/* dw1 */
+	ptx_desc->txdw1 |= cpu_to_le32((0x13<<QSEL_SHT)&0x00001f00);
+
+	return _SUCCESS;
+}
+
+u8 r8712_construct_txaggr_cmd_hdr(struct xmit_buf *pxmitbuf)
+{
+	struct xmit_frame *pxmitframe = (struct xmit_frame *)
+		pxmitbuf->priv_data;
+	struct _adapter *padapter = pxmitframe->padapter;
+	struct cmd_priv *pcmdpriv = &(padapter->cmdpriv);
+	struct cmd_hdr *pcmd_hdr = (struct cmd_hdr  *)
+		(pxmitbuf->pbuf + TXDESC_SIZE);
+
+	/* Fill up Cmd Header for USB FW Tx Aggregation.*/
+	/* dw0 */
+	pcmd_hdr->cmd_dw0 = cpu_to_le32((GEN_CMD_CODE(_AMSDU_TO_AMPDU) << 16) |
+					(pcmdpriv->cmd_seq << 24));
+	pcmdpriv->cmd_seq++;
+
+	return _SUCCESS;
+}
+
+u8 r8712_append_mpdu_unit(struct xmit_buf *pxmitbuf,
+			struct xmit_frame *pxmitframe)
+{
+	struct _adapter *padapter = pxmitframe->padapter;
+	struct tx_desc *ptx_desc = (struct tx_desc *)pxmitbuf->pbuf;
+	int last_txcmdsz = 0;
+	int padding_sz = 0;
+
+	/* 802.3->802.11 convertor */
+	r8712_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe);
+	/* free skb struct */
+	r8712_xmit_complete(padapter, pxmitframe);
+	if (pxmitframe->attrib.ether_type != 0x0806) {
+		if ((pxmitframe->attrib.ether_type != 0x888e) &&
+			(pxmitframe->attrib.dhcp_pkt != 1)) {
+			r8712_issue_addbareq_cmd(padapter,
+					pxmitframe->attrib.priority);
+		}
+	}
+	pxmitframe->last[0] = 1;
+	update_txdesc(pxmitframe, (uint *)(pxmitframe->buf_addr),
+		pxmitframe->attrib.last_txcmdsz);
+	/*padding zero */
+	last_txcmdsz = pxmitframe->attrib.last_txcmdsz;
+	padding_sz = (8 - (last_txcmdsz % 8));
+	if ((last_txcmdsz % 8) != 0) {
+		int i;
+		for (i = 0; i < padding_sz; i++)
+			*(pxmitframe->buf_addr+TXDESC_SIZE+last_txcmdsz+i) = 0;
+	}
+	/* Add the new mpdu's length */
+	ptx_desc->txdw0 = cpu_to_le32((ptx_desc->txdw0&0xffff0000) |
+		((ptx_desc->txdw0&0x0000ffff)+
+			((TXDESC_SIZE+last_txcmdsz+padding_sz)&0x0000ffff)));
+
+	return _SUCCESS;
+}
+
+
+u8 r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
+			struct xmit_frame *pxmitframe)
+{
+	/* linux complete context doesnt need to protect */
+	pxmitframe->pxmitbuf = pxmitbuf;
+	pxmitbuf->priv_data = pxmitframe;
+	pxmitframe->pxmit_urb[0] = pxmitbuf->pxmit_urb[0];
+	/* buffer addr assoc */
+	pxmitframe->buf_addr = pxmitbuf->pbuf+TXDESC_SIZE+CMD_HDR_SZ;
+	/*RTL8712_DMA_H2CCMD */
+	r8712_construct_txaggr_cmd_desc(pxmitbuf);
+	r8712_construct_txaggr_cmd_hdr(pxmitbuf);
+	if (r8712_append_mpdu_unit(pxmitbuf, pxmitframe) == _SUCCESS)
+		pxmitbuf->aggr_nr = 1;
+
+	return _SUCCESS;
+}
+
+u16 r8712_xmitframe_aggr_next(struct xmit_buf *pxmitbuf,
+			struct xmit_frame *pxmitframe)
+{
+	pxmitframe->pxmitbuf = pxmitbuf;
+	pxmitbuf->priv_data = pxmitframe;
+	pxmitframe->pxmit_urb[0] = pxmitbuf->pxmit_urb[0];
+	/* buffer addr assoc */
+	pxmitframe->buf_addr = pxmitbuf->pbuf + TXDESC_SIZE +
+		(((struct tx_desc *)pxmitbuf->pbuf)->txdw0 & 0x0000ffff);
+	if (r8712_append_mpdu_unit(pxmitbuf, pxmitframe) == _SUCCESS) {
+		r8712_free_xmitframe_ex(&pxmitframe->padapter->xmitpriv,
+					pxmitframe);
+		pxmitbuf->aggr_nr++;
+	}
+
+	return TXDESC_SIZE +
+		(((struct tx_desc *)pxmitbuf->pbuf)->txdw0 & 0x0000ffff);
+}
+
+u8 r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
+			struct xmit_frame *pxmitframe)
+{
+	struct _adapter *padapter = pxmitframe->padapter;
+	struct dvobj_priv *pdvobj = (struct dvobj_priv *) &padapter->dvobjpriv;
+	struct tx_desc * ptxdesc = (struct tx_desc *)pxmitbuf->pbuf;
+	struct cmd_hdr *pcmd_hdr = (struct cmd_hdr *)
+		(pxmitbuf->pbuf + TXDESC_SIZE);
+	u16 total_length = (u16) (ptxdesc->txdw0 & 0xffff);
+
+	/* use 1st xmitframe as media */
+	xmitframe_xmitbuf_attach(pxmitframe, pxmitbuf);
+	pcmd_hdr->cmd_dw0 = cpu_to_le32(((total_length-CMD_HDR_SZ)&0x0000ffff)|
+					(pcmd_hdr->cmd_dw0&0xffff0000));
+
+	/* urb length in cmd_dw1 */
+	pcmd_hdr->cmd_dw1 = cpu_to_le32((pxmitbuf->aggr_nr & 0xff)|
+					((total_length+TXDESC_SIZE) << 16));
+	pxmitframe->last[0] = 1;
+	pxmitframe->bpending[0] = false;
+	pxmitframe->mem_addr = pxmitbuf->pbuf;
+
+	if ((pdvobj->ishighspeed && ((total_length+TXDESC_SIZE)%0x200) == 0) ||
+		((!pdvobj->ishighspeed &&
+			((total_length+TXDESC_SIZE)%0x40) == 0))) {
+		ptxdesc->txdw0 |= cpu_to_le32
+			(((TXDESC_SIZE+OFFSET_SZ+8)<<OFFSET_SHT)&0x00ff0000);
+		/*32 bytes for TX Desc + 8 bytes pending*/
+	} else {
+		ptxdesc->txdw0 |= cpu_to_le32
+			(((TXDESC_SIZE+OFFSET_SZ)<<OFFSET_SHT)&0x00ff0000);
+		/*default = 32 bytes for TX Desc*/
+	}
+	r8712_write_port(pxmitframe->padapter, RTL8712_DMA_H2CCMD,
+			total_length+TXDESC_SIZE, (u8 *)pxmitframe);
+
+	return _SUCCESS;
+}
+
+#endif
+
 static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz)
 {
 	uint qsel;
@@ -258,6 +423,9 @@ static void update_txdesc(struct xmit_fr
 	struct pkt_attrib *pattrib = &pxmitframe->attrib;
 	struct tx_desc *ptxdesc = (struct tx_desc *)pmem;
 	struct dvobj_priv *pdvobj = (struct dvobj_priv *)&padapter->dvobjpriv;
+#ifdef CONFIG_R8712_TX_AGGR
+	struct cmd_priv *pcmdpriv = (struct cmd_priv *)&padapter->cmdpriv;
+#endif
 	u8 blnSetTxDescOffset;
 	sint bmcst = IS_MCAST(pattrib->ra);
 	struct ht_priv *phtpriv = &pmlmepriv->htpriv;
@@ -291,8 +459,40 @@ static void update_txdesc(struct xmit_fr
 	if (pxmitframe->frame_tag == DATA_FRAMETAG) {
 		/* offset 4 */
 		ptxdesc->txdw1 |= cpu_to_le32((pattrib->mac_id)&0x1f);
+
+#ifdef CONFIG_R8712_TX_AGGR
+		/* dirty workaround, need to check if it is aggr cmd. */
+		if ((u8 *)pmem != (u8 *)pxmitframe->pxmitbuf->pbuf) {
+			ptxdesc->txdw0 |= cpu_to_le32
+				((0x3 << TYPE_SHT)&TYPE_MSK);
+			qsel = (uint)(pattrib->qsel & 0x0000001f);
+			if (qsel == 2)
+				qsel = 0;
+			ptxdesc->txdw1 |= cpu_to_le32
+				((qsel << QSEL_SHT) & 0x00001f00);
+			ptxdesc->txdw2 = cpu_to_le32
+				((qsel << RTS_RC_SHT)&0x001f0000);
+			ptxdesc->txdw6 |= cpu_to_le32
+				((0x5 << RSVD6_SHT)&RSVD6_MSK);
+		} else {
+			ptxdesc->txdw0 |= cpu_to_le32
+				((0x3 << TYPE_SHT)&TYPE_MSK);
+			ptxdesc->txdw1 |= cpu_to_le32
+				((0x13 << QSEL_SHT) & 0x00001f00);
+			qsel = (uint)(pattrib->qsel & 0x0000001f);
+			if (qsel == 2)
+				qsel = 0;
+			ptxdesc->txdw2 = cpu_to_le32
+				((qsel << RTS_RC_SHT)&0x0001f000);
+			ptxdesc->txdw7 |= cpu_to_le32
+				(pcmdpriv->cmd_seq << 24);
+			pcmdpriv->cmd_seq++;
+		}
+		pattrib->qsel = 0x13;
+#else
 		qsel = (uint)(pattrib->qsel & 0x0000001f);
 		ptxdesc->txdw1 |= cpu_to_le32((qsel << QSEL_SHT) & 0x00001f00);
+#endif
 		if (!pqospriv->qos_option)
 			ptxdesc->txdw1 |= cpu_to_le32(BIT(16));/*Non-QoS*/
 		if ((pattrib->encrypt > 0) && !pattrib->bswenc) {
@@ -414,7 +614,11 @@ int r8712_xmitframe_complete(struct _ada
 	struct hw_xmit *phwxmits;
 	sint hwentry;
 	struct xmit_frame *pxmitframe = NULL;
+#ifdef CONFIG_R8712_TX_AGGR
+	struct xmit_frame *p2ndxmitframe = NULL;
+#else
 	int res = _SUCCESS, xcnt = 0;
+#endif
 
 	phwxmits = pxmitpriv->hwxmits;
 	hwentry = pxmitpriv->hwxmit_entry;
@@ -422,13 +626,55 @@ int r8712_xmitframe_complete(struct _ada
 		pxmitbuf = r8712_alloc_xmitbuf(pxmitpriv);
 		if (!pxmitbuf)
 			return false;
+#ifdef CONFIG_R8712_TX_AGGR
+		pxmitbuf->aggr_nr = 0;
+#endif
 	}
-	do {
+	/* 1st frame dequeued */
 		pxmitframe = dequeue_xframe_ex(pxmitpriv, phwxmits, hwentry);
-		if (pxmitframe) {
-			pxmitframe->pxmitbuf = pxmitbuf;
-			pxmitframe->pxmit_urb[0] = pxmitbuf->pxmit_urb[0];
-			pxmitframe->buf_addr = pxmitbuf->pbuf;
+	/* need to remember the 1st frame */
+	if (pxmitframe != NULL) {
+
+#ifdef CONFIG_R8712_TX_AGGR
+		/* 1. dequeue 2nd frame
+		 * 2. aggr if 2nd xframe is dequeued, else dump directly
+		 */
+		if (AGGR_NR_HIGH_BOUND > 1)
+			p2ndxmitframe = dequeue_xframe_ex(pxmitpriv, phwxmits,
+							hwentry);
+		if (pxmitframe->frame_tag != DATA_FRAMETAG) {
+			r8712_free_xmitbuf(pxmitpriv, pxmitbuf);
+			return false;
+		}
+		if (p2ndxmitframe != NULL)
+			if (p2ndxmitframe->frame_tag != DATA_FRAMETAG) {
+				r8712_free_xmitbuf(pxmitpriv, pxmitbuf);
+				return false;
+			}
+		r8712_xmitframe_aggr_1st(pxmitbuf, pxmitframe);
+		if (p2ndxmitframe != NULL) {
+			u16 total_length;
+			total_length = r8712_xmitframe_aggr_next(
+				pxmitbuf, p2ndxmitframe);
+			do {
+				p2ndxmitframe = dequeue_xframe_ex(
+					pxmitpriv, phwxmits, hwentry);
+				if (p2ndxmitframe != NULL)
+					total_length =
+						r8712_xmitframe_aggr_next(
+							pxmitbuf,
+							p2ndxmitframe);
+				else
+					break;
+			} while (total_length <= 0x1800 &&
+				pxmitbuf->aggr_nr <= AGGR_NR_HIGH_BOUND);
+		}
+		if (pxmitbuf->aggr_nr > 0)
+			r8712_dump_aggr_xframe(pxmitbuf, pxmitframe);
+
+#else
+
+		xmitframe_xmitbuf_attach(pxmitframe, pxmitbuf);
 			if (pxmitframe->frame_tag == DATA_FRAMETAG) {
 				if (pxmitframe->attrib.priority <= 15)
 					res = r8712_xmitframe_coalesce(padapter,
@@ -442,12 +688,12 @@ int r8712_xmitframe_complete(struct _ada
 			else
 				r8712_free_xmitframe_ex(pxmitpriv, pxmitframe);
 			xcnt++;
-		} else {
+#endif
+
+	} else { /* pxmitframe == NULL && p2ndxmitframe == NULL */
 			r8712_free_xmitbuf(pxmitpriv, pxmitbuf);
 			return false;
 		}
-		break;
-	} while (0);
 	return true;
 }
 
@@ -481,8 +727,13 @@ static void dump_xframe(struct _adapter
 		pxmitframe->mem_addr = mem_addr;
 		pxmitframe->bpending[t] = false;
 		ff_hwaddr = get_ff_hwaddr(pxmitframe);
+#ifdef CONFIG_R8712_TX_AGGR
+		r8712_write_port(padapter, RTL8712_DMA_H2CCMD, w_sz,
+				(unsigned char *)pxmitframe);
+#else
 		r8712_write_port(padapter, ff_hwaddr, w_sz,
 			   (unsigned char *)pxmitframe);
+#endif
 		mem_addr += w_sz;
 		mem_addr = (u8 *)RND4(((addr_t)(mem_addr)));
 	}
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_xmit.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_xmit.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl8712_xmit.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl8712_xmit.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL8712_XMIT_H_
 #define _RTL8712_XMIT_H_
 
@@ -39,6 +64,8 @@
 #define OWN	BIT(31)
 #define FSG	BIT(27)
 #define LSG	BIT(26)
+#define TYPE_SHT (24)
+#define TYPE_MSK (0x03000000)
 
 /*OFFSET 4*/
 #define PKT_OFFSET_SZ (0)
@@ -49,6 +76,7 @@
 #define BMC BIT(7)
 #define BK BIT(30)
 #define AGG_EN BIT(29)
+#define RTS_RC_SHT (16)
 
 /*OFFSET 12*/
 #define SEQ_SHT (16)
@@ -58,6 +86,8 @@
 
 /*OFFSET 20*/
 #define DISFB BIT(15)
+#define RSVD6_MSK (0x00E00000)
+#define RSVD6_SHT (21)
 
 struct tx_desc {
 	/*DWORD 0*/
@@ -83,4 +113,11 @@ int r8712_xmitframe_complete(struct _ada
 void r8712_do_queue_select(struct _adapter *padapter,
 			   struct pkt_attrib *pattrib);
 
+#ifdef CONFIG_R8712_TX_AGGR
+u8 r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
+			struct xmit_frame *pxmitframe);
+u8 r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
+			struct xmit_frame *pxmitframe);
+#endif
+
 #endif
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl8712_xmit.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_byteorder.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_byteorder.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_byteorder.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_byteorder.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef _RTL871X_BYTEORDER_H_
 #define _RTL871X_BYTEORDER_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_cmd.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_cmd.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_cmd.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_cmd.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,6 +28,24 @@
 
 #define _RTL871X_CMD_C_
 
+#include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/kref.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/usb.h>
+#include <linux/usb/ch9.h>
+#include <linux/circ_buf.h>
+#include <linux/uaccess.h>
+#include <asm/byteorder.h>
+#include <linux/atomic.h>
+#include <linux/semaphore.h>
+#include <linux/rtnetlink.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 #include "recv_osdep.h"
@@ -222,7 +240,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter
 	init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara,
 				   GEN_CMD_CODE(_SiteSurvey));
 	psurveyPara->bsslimit = cpu_to_le32(48);
-	psurveyPara->passive_mode = cpu_to_le32(1);
+	psurveyPara->passive_mode = cpu_to_le32(pmlmepriv->passive_mode);
 	psurveyPara->ss_ssidlen = 0;
 	memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
 	if ((pssid != NULL) && (pssid->SsidLength)) {
@@ -233,6 +251,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter
 	r8712_enqueue_cmd(pcmdpriv, ph2c);
 	_set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT);
 	padapter->ledpriv.LedControlHandler(padapter, LED_CTL_SITE_SURVEY);
+	padapter->blnEnableRxFF0Filter = 0;
 	return _SUCCESS;
 }
 
@@ -259,6 +278,28 @@ u8 r8712_setdatarate_cmd(struct _adapter
 	return _SUCCESS;
 }
 
+u8 r8712_set_chplan_cmd(struct _adapter *padapter, int chplan)
+{
+	struct cmd_obj *ph2c;
+	struct SetChannelPlan_param *psetchplanpara;
+	struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
+
+	ph2c = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
+	if (ph2c == NULL)
+		return _FAIL;
+	psetchplanpara = (struct SetChannelPlan_param *)
+		_malloc(sizeof(struct SetChannelPlan_param));
+	if (psetchplanpara == NULL) {
+		kfree((u8 *) ph2c);
+		return _FAIL;
+	}
+	init_h2fwcmd_w_parm_no_rsp(ph2c, psetchplanpara,
+				GEN_CMD_CODE(_SetChannelPlan));
+	psetchplanpara->ChannelPlan = chplan;
+	r8712_enqueue_cmd(pcmdpriv, ph2c);
+	return _SUCCESS;
+}
+
 u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset)
 {
 	struct cmd_obj *ph2c;
@@ -285,20 +326,62 @@ u8 r8712_setbasicrate_cmd(struct _adapte
 u8 r8712_setptm_cmd(struct _adapter *padapter, u8 type)
 {
 	struct cmd_obj		*ph2c;
-	struct PT_param		*pptparm;
+	struct writePTM_parm	*pwriteptmparm;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
 
 	ph2c = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
 	if (ph2c == NULL)
 		return _FAIL;
-	pptparm = (struct PT_param *)_malloc(sizeof(struct PT_param));
-	if (pptparm == NULL) {
+	pwriteptmparm = (struct writePTM_parm *)
+		_malloc(sizeof(struct writePTM_parm));
+	if (pwriteptmparm == NULL) {
 		kfree((u8 *) ph2c);
 		return _FAIL;
 	}
-	init_h2fwcmd_w_parm_no_rsp(ph2c, pptparm,
-				   GEN_CMD_CODE(_SetPowerTracking));
-	pptparm->PT_En = type;
+	init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetPT));
+	pwriteptmparm->type = type;
+	r8712_enqueue_cmd(pcmdpriv, ph2c);
+	return _SUCCESS;
+}
+
+u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type)
+{
+	struct cmd_obj *ph2c;
+	struct writePTM_parm *pwriteptmparm;
+	struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
+
+	ph2c = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
+	if (ph2c == NULL)
+		return _FAIL;
+	pwriteptmparm = (struct writePTM_parm *)
+		_malloc(sizeof(struct setdig_parm));
+	if (pwriteptmparm == NULL) {
+		kfree((u8 *) ph2c);
+		return _FAIL;
+	}
+	init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetDIG));
+	pwriteptmparm->type = type;
+	r8712_enqueue_cmd(pcmdpriv, ph2c);
+	return _SUCCESS;
+}
+
+u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type)
+{
+	struct cmd_obj *ph2c;
+	struct writePTM_parm *pwriteptmparm;
+	struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
+
+	ph2c = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
+	if (ph2c == NULL)
+		return _FAIL;
+	pwriteptmparm = (struct writePTM_parm *)
+		_malloc(sizeof(struct setra_parm));
+	if (pwriteptmparm == NULL) {
+		kfree((u8 *) ph2c);
+		return _FAIL;
+	}
+	init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetRA));
+	pwriteptmparm->type = type;
 	r8712_enqueue_cmd(pcmdpriv, ph2c);
 	return _SUCCESS;
 }
@@ -353,8 +436,17 @@ u8 r8712_getrfreg_cmd(struct _adapter *p
 void r8712_getbbrfreg_cmdrsp_callback(struct _adapter *padapter,
 				      struct cmd_obj *pcmd)
 {
-	kfree((unsigned char *) pcmd->parmbuf);
-	kfree((unsigned char *) pcmd);
+	kfree(pcmd->parmbuf);
+	kfree(pcmd);
+	padapter->mppriv.workparam.bcompleted = true;
+}
+
+void r8712_readtssi_cmdrsp_callback(struct _adapter *padapter,
+				struct cmd_obj *pcmd)
+{
+	kfree(pcmd->parmbuf);
+	kfree(pcmd);
+
 	padapter->mppriv.workparam.bcompleted = true;
 }
 
@@ -485,12 +577,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *p
 						&psecnetwork->IEs[0],
 						pnetwork->network.IELength,
 						&psecnetwork->IELength);
-			if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE))
-				r8712_add_ht_addt_info(padapter,
-						&pnetwork->network.IEs[0],
-						&psecnetwork->IEs[0],
-						pnetwork->network.IELength,
-						&psecnetwork->IELength);
 		}
 	}
 	psecuritypriv->supplicant_ie[0] = (u8)psecnetwork->IELength;
@@ -675,6 +761,33 @@ u8 r8712_setrttbl_cmd(struct _adapter *p
 	return _SUCCESS;
 }
 
+u8 r8712_gettssi_cmd(struct _adapter *padapter, u8 offset, u8 *pval)
+{
+	struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
+	struct cmd_obj *ph2c;
+	struct readTSSI_parm *prdtssiparm;
+
+	ph2c = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
+	if (ph2c == NULL)
+		return _FAIL;
+	prdtssiparm = (struct readTSSI_parm *)
+		_malloc(sizeof(struct readTSSI_parm));
+	if (prdtssiparm == NULL) {
+		kfree((unsigned char *) ph2c);
+		return _FAIL;
+	}
+	_init_listhead(&ph2c->list);
+	ph2c->cmdcode = GEN_CMD_CODE(_ReadTSSI);
+	ph2c->parmbuf = (unsigned char *)prdtssiparm;
+	ph2c->cmdsz = sizeof(struct readTSSI_parm);
+	ph2c->rsp = pval;
+	ph2c->rspsz = sizeof(struct readTSSI_rsp);
+
+	prdtssiparm->offset = offset;
+	r8712_enqueue_cmd(pcmdpriv, ph2c);
+	return _SUCCESS;
+}
+
 u8 r8712_setMacAddr_cmd(struct _adapter *padapter, u8 *mac_addr)
 {
 	struct cmd_priv	*pcmdpriv = &padapter->cmdpriv;
@@ -923,3 +1036,32 @@ void r8712_setassocsta_cmdrsp_callback(s
 	spin_unlock_irqrestore(&pmlmepriv->lock, irqL);
 	r8712_free_cmd_obj(pcmd);
 }
+
+u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl,
+			u32 tryPktCnt, u32 tryPktInterval, u32 firstStageTO)
+{
+	struct cmd_obj *ph2c;
+	struct DisconnectCtrlEx_param *param;
+	struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
+
+	ph2c = (struct cmd_obj *)_malloc(sizeof(struct cmd_obj));
+	if (ph2c == NULL)
+		return _FAIL;
+	param = (struct DisconnectCtrlEx_param *)
+		_malloc(sizeof(struct DisconnectCtrlEx_param));
+	if (param == NULL) {
+		kfree((unsigned char *) ph2c);
+		return _FAIL;
+	}
+	memset(param, 0, sizeof(struct DisconnectCtrlEx_param));
+
+	param->EnableDrvCtrl = (unsigned char)enableDrvCtrl;
+	param->TryPktCnt = (unsigned char)tryPktCnt;
+	param->TryPktInterval = (unsigned char)tryPktInterval;
+	param->FirstStageTO = (unsigned int)firstStageTO;
+
+	init_h2fwcmd_w_parm_no_rsp(ph2c, param,
+				GEN_CMD_CODE(_DisconnectCtrlEx));
+	r8712_enqueue_cmd(pcmdpriv, ph2c);
+	return _SUCCESS;
+}
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_cmd.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_cmd.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_cmd.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_cmd.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL871X_CMD_H_
 #define __RTL871X_CMD_H_
 
@@ -295,6 +320,35 @@ struct setdatarate_parm {
 	u8	datarates[NumRates];
 };
 
+enum _RT_CHANNEL_DOMAIN {
+	RT_CHANNEL_DOMAIN_FCC = 0,
+	RT_CHANNEL_DOMAIN_IC = 1,
+	RT_CHANNEL_DOMAIN_ETSI = 2,
+	RT_CHANNEL_DOMAIN_SPAIN = 3,
+	RT_CHANNEL_DOMAIN_FRANCE = 4,
+	RT_CHANNEL_DOMAIN_MKK = 5,
+	RT_CHANNEL_DOMAIN_MKK1 = 6,
+	RT_CHANNEL_DOMAIN_ISRAEL = 7,
+	RT_CHANNEL_DOMAIN_TELEC = 8,
+
+	/* Be compatible with old channel plan. No good! */
+	RT_CHANNEL_DOMAIN_MIC = 9,
+	RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 10,
+	RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 11,
+	RT_CHANNEL_DOMAIN_TELEC_NETGEAR = 12,
+
+	RT_CHANNEL_DOMAIN_NCC = 13,
+	RT_CHANNEL_DOMAIN_5G = 14,
+	RT_CHANNEL_DOMAIN_5G_40M = 15,
+ /*===== Add new channel plan above this line===============*/
+	RT_CHANNEL_DOMAIN_MAX,
+};
+
+
+struct SetChannelPlan_param {
+	enum _RT_CHANNEL_DOMAIN ChannelPlan;
+};
+
 /*
 Caller Mode: Any
 
@@ -367,6 +421,10 @@ struct writeBB_parm {
 	u8	value;
 };
 
+struct writePTM_parm {
+	u8	type;
+};
+
 struct readRF_parm {
 	u8	offset;
 };
@@ -646,9 +704,14 @@ struct SetChannel_parm {
 	u32 curr_ch;
 };
 
-/*H2C Handler index: 56 */
-struct PT_param {
-	u8 PT_En;
+/*H2C Handler index: 61 */
+struct DisconnectCtrlEx_param {
+	/* MAXTIME = (2 * FirstStageTO) + (TryPktCnt * TryPktInterval) */
+	unsigned char EnableDrvCtrl;
+	unsigned char TryPktCnt;
+	unsigned char TryPktInterval; /* Unit: ms */
+	unsigned char rsvd;
+	unsigned int  FirstStageTO; /* Unit: ms */
 };
 
 #define GEN_CMD_CODE(cmd)	cmd ## _CMD_
@@ -684,13 +747,17 @@ u8 r8712_disassoc_cmd(struct _adapter *p
 u8 r8712_setopmode_cmd(struct _adapter *padapter,
 		 enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
 u8 r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset);
+u8 r8712_set_chplan_cmd(struct _adapter  *padapter, int chplan);
 u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset);
 u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 * pval);
 u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode);
 u8 r8712_setrfreg_cmd(struct _adapter  *padapter, u8 offset, u32 val);
 u8 r8712_setrttbl_cmd(struct _adapter  *padapter,
 		      struct setratable_parm *prate_table);
+u8 r8712_gettssi_cmd(struct _adapter  *padapter, u8 offset, u8 *pval);
 u8 r8712_setptm_cmd(struct _adapter *padapter, u8 type);
+u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type);
+u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type);
 u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid);
 u8 r8712_wdg_wk_cmd(struct _adapter *padapter);
 void r8712_survey_cmd_callback(struct _adapter  *padapter,
@@ -703,10 +770,14 @@ void r8712_createbss_cmd_callback(struct
 				  struct cmd_obj *pcmd);
 void r8712_getbbrfreg_cmdrsp_callback(struct _adapter *padapter,
 				      struct cmd_obj *pcmd);
+void r8712_readtssi_cmdrsp_callback(struct _adapter *padapter,
+				struct cmd_obj *pcmd);
 void r8712_setstaKey_cmdrsp_callback(struct _adapter  *padapter,
 				     struct cmd_obj *pcmd);
 void r8712_setassocsta_cmdrsp_callback(struct _adapter  *padapter,
 				       struct cmd_obj *pcmd);
+u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl,
+			u32 tryPktCnt, u32 tryPktInterval, u32 firstStageTO);
 
 struct _cmd_callback {
 	u32	cmd_code;
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_cmd.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_debug.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_debug.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_debug.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_debug.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL871X_DEBUG_H__
 #define __RTL871X_DEBUG_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_eeprom.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_eeprom.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_eeprom.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_eeprom.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,22 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
 #ifndef __RTL871X_EEPROM_H__
 #define __RTL871X_EEPROM_H__
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_eeprom.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_event.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_event.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_event.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_event.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL871x_EVENT_H_
 #define _RTL871x_EVENT_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ht.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ht.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ht.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ht.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL871X_HT_H_
 #define _RTL871X_HT_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_io.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_io.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_io.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_io.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _IO_H_
 #define _IO_H_
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_io.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ioctl_linux.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ioctl_linux.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ioctl_linux.c	2012-01-31 16:31:54.000000000 -0500
@@ -39,8 +39,17 @@
 #include "rtl871x_ioctl_set.h"
 #include "rtl871x_mp_ioctl.h"
 #include "mlme_osdep.h"
+#include <linux/wireless.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/version.h>
+#include <linux/io.h>
+#include <linux/semaphore.h>
+#include <net/iw_handler.h>
+#include <linux/if_arp.h>
 
-#define RTL_IOCTL_WPA_SUPPLICANT	(SIOCIWFIRSTPRIV + 30)
+#define RTL_IOCTL_WPA_SUPPLICANT	(SIOCIWFIRSTPRIV + 0x1E)
 
 #define SCAN_ITEM_SIZE 768
 #define MAX_CUSTOM_LEN 64
@@ -160,10 +169,6 @@ static inline char *translate_scan(struc
 	struct iw_event iwe;
 	struct ieee80211_ht_cap *pht_capie;
 	char *current_val;
-	u8 *buf = (u8 *)_malloc(pnetwork->network.IELength * 2);
-	u8 *wpa_ie = (u8 *)_malloc(255);
-	u8 *rsn_ie = (u8 *)_malloc(255);
-	u8 *wps_ie = (u8 *)_malloc(MAX_WPS_IE_LEN);
 	s8 *p;
 	u32 i = 0, ht_ielen = 0;
 	u16	cap, ht_cap = false, mcs_rate;
@@ -280,6 +285,8 @@ static inline char *translate_scan(struc
 		start = current_val;
 	/* parsing WPA/WPA2 IE */
 	{
+		u8 buf[MAX_WPA_IE_LEN];
+		u8 wpa_ie[255], rsn_ie[255];
 		u16 wpa_len = 0, rsn_len = 0;
 		int n;
 		sint out_len = 0;
@@ -330,6 +337,7 @@ static inline char *translate_scan(struc
 	}
 
 	{ /* parsing WPS IE */
+		u8 wps_ie[512];
 		uint wps_ielen;
 
 		if (r8712_get_wps_ie(pnetwork->network.IEs,
@@ -354,16 +362,12 @@ static inline char *translate_scan(struc
 	iwe.u.qual.noise = 0; /* noise level */
 	start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN);
 	/* how to translate rssi to ?% */
-	kfree(buf);
-	kfree(wpa_ie);
-	kfree(rsn_ie);
-	kfree(wps_ie);
 	return start;
 }
 
 static int wpa_set_auth_algs(struct net_device *dev, u32 value)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 	int ret = 0;
 
 	if ((value & AUTH_ALG_SHARED_KEY) && (value & AUTH_ALG_OPEN_SYSTEM)) {
@@ -395,7 +399,7 @@ static int wpa_set_encryption(struct net
 	int ret = 0;
 	u32 wep_key_idx, wep_key_len = 0;
 	struct NDIS_802_11_WEP	 *pwep = NULL;
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct security_priv *psecuritypriv = &padapter->securitypriv;
 
@@ -526,7 +530,7 @@ static int r871x_set_wpa_ie(struct _adap
 		memcpy(buf, pie , ielen);
 		pos = buf;
 		if (ielen < RSN_HEADER_LEN) {
-			ret  = -1;
+			ret  = -EINVAL;
 			goto exit;
 		}
 		if (r8712_parse_wpa_ie(buf, ielen, &group_cipher,
@@ -637,7 +641,7 @@ static int r8711_wx_get_name(struct net_
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	u32 ht_ielen = 0;
 	char *p;
 	u8 ht_cap = false;
@@ -693,7 +697,7 @@ static int r8711_wx_set_freq(struct net_
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct iw_freq *fwrq = &wrqu->freq;
 	int rc = 0;
 
@@ -727,7 +731,7 @@ static int r8711_wx_get_freq(struct net_
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
 
@@ -736,8 +740,9 @@ static int r8711_wx_get_freq(struct net_
 			       pcur_bss->Configuration.DSConfig-1] * 100000;
 		wrqu->freq.e = 1;
 		wrqu->freq.i = pcur_bss->Configuration.DSConfig;
-	} else
-		return -1;
+	} else {
+		return -ENOLINK;
+	}
 	return 0;
 }
 
@@ -745,7 +750,7 @@ static int r8711_wx_set_mode(struct net_
 			     struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	enum NDIS_802_11_NETWORK_INFRASTRUCTURE networkType;
 
 	switch (wrqu->mode) {
@@ -768,15 +773,15 @@ static int r8711_wx_set_mode(struct net_
 		r8712_setopmode_cmd(padapter, networkType);
 	else
 		r8712_setopmode_cmd(padapter, Ndis802_11AutoUnknown);
-	if (!r8712_set_802_11_infrastructure_mode(padapter, networkType))
-		return -1;
+
+	r8712_set_802_11_infrastructure_mode(padapter, networkType);
 	return 0;
 }
 
 static int r8711_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true)
@@ -795,7 +800,7 @@ static int r871x_wx_set_pmkid(struct net
 			     struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct security_priv *psecuritypriv = &padapter->securitypriv;
 	struct iw_pmksa *pPMK = (struct iw_pmksa *) extra;
 	u8 strZeroMacAddress[ETH_ALEN] = {0x00};
@@ -949,6 +954,10 @@ static int r8711_wx_get_range(struct net
 	return 0;
 }
 
+static int r8711_wx_get_rate(struct net_device *dev,
+			     struct iw_request_info *info,
+			     union iwreq_data *wrqu, char *extra);
+
 static int r871x_wx_set_priv(struct net_device *dev,
 				struct iw_request_info *info,
 				union iwreq_data *awrq,
@@ -956,6 +965,7 @@ static int r871x_wx_set_priv(struct net_
 {
 	int ret = 0, len = 0;
 	char *ext;
+	struct _adapter *padapter = netdev_priv(dev);
 	struct iw_point *dwrq = (struct iw_point *)awrq;
 
 	len = dwrq->length;
@@ -966,6 +976,87 @@ static int r871x_wx_set_priv(struct net_
 		kfree(ext);
 		return -EFAULT;
 	}
+
+	if (0 == strcasecmp(ext, "RSSI")) {
+		/*Return received signal strength indicator in -db for */
+		/* current AP */
+		/*<ssid> Rssi xx */
+		struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+		struct wlan_network *pcur_network = &pmlmepriv->cur_network;
+		/*static u8 xxxx; */
+		if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
+			sprintf(ext, "%s rssi %d",
+				pcur_network->network.Ssid.Ssid,
+				/*(xxxx=xxxx+10) */
+				((padapter->recvpriv.fw_rssi)>>1)-95
+				/*pcur_network->network.Rssi */
+				);
+		} else {
+			sprintf(ext, "OK");
+		}
+	} else if (0 == strcasecmp(ext, "LINKSPEED")) {
+		/*Return link speed in MBPS */
+		/*LinkSpeed xx */
+		union iwreq_data wrqd;
+		int ret_inner;
+		int mbps;
+
+		ret_inner = r8711_wx_get_rate(dev, info, &wrqd, extra);
+		if (0 != ret_inner)
+			mbps = 0;
+		else
+			mbps = wrqd.bitrate.value / 1000000;
+		sprintf(ext, "LINKSPEED %d", mbps);
+	} else if (0 == strcasecmp(ext, "MACADDR")) {
+		/*Return mac address of the station */
+		/*Macaddr = xx.xx.xx.xx.xx.xx */
+		sprintf(ext,
+			"MACADDR = %02x.%02x.%02x.%02x.%02x.%02x",
+			*(dev->dev_addr), *(dev->dev_addr+1),
+			*(dev->dev_addr+2), *(dev->dev_addr+3),
+			*(dev->dev_addr+4), *(dev->dev_addr+5));
+	} else if (0 == strcasecmp(ext, "SCAN-ACTIVE")) {
+		/*Set scan type to active */
+		/*OK if successful */
+		struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+		pmlmepriv->passive_mode = 1;
+		sprintf(ext, "OK");
+	} else if (0 == strcasecmp(ext, "SCAN-PASSIVE")) {
+		/*Set scan type to passive */
+		/*OK if successful */
+		struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+		pmlmepriv->passive_mode = 0;
+		sprintf(ext, "OK");
+	} else if (0 == strncmp(ext, "DCE-E", 5)) {
+		/*Set scan type to passive */
+		/*OK if successful */
+		r8712_disconnectCtrlEx_cmd(padapter
+			, 1 /*u32 enableDrvCtrl */
+			, 5 /*u32 tryPktCnt */
+			, 100 /*u32 tryPktInterval */
+			, 5000 /*u32 firstStageTO */
+		);
+		sprintf(ext, "OK");
+	} else if (0 == strncmp(ext, "DCE-D", 5)) {
+		/*Set scan type to passive */
+		/*OK if successfu */
+		r8712_disconnectCtrlEx_cmd(padapter
+			, 0 /*u32 enableDrvCtrl */
+			, 5 /*u32 tryPktCnt */
+			, 100 /*u32 tryPktInterval */
+			, 5000 /*u32 firstStageTO */
+		);
+		sprintf(ext, "OK");
+	} else {
+		printk(KERN_INFO "r8712u: r871x_wx_set_priv: unknown Command"
+		       " %s.\n", ext);
+		goto FREE_EXT;
+	}
+	if (copy_to_user(dwrq->pointer, ext,
+				min(dwrq->length, (__u16)(strlen(ext)+1))))
+		ret = -EFAULT;
+
+FREE_EXT:
 	kfree(ext);
 	return ret;
 }
@@ -975,6 +1066,13 @@ static int r871x_wx_set_priv(struct net_
  * s2. set_802_11_authentication_mode()
  * s3. set_802_11_encryption_mode()
  * s4. set_802_11_bssid()
+ *
+ * This function intends to handle the Set AP command, which specifies the
+ * MAC# of a preferred Access Point.
+ * Currently, the request comes via Wireless Extensions' SIOCSIWAP ioctl.
+ *
+ * For this operation to succeed, there is no need for the interface to be Up.
+ *
  */
 static int r8711_wx_set_wap(struct net_device *dev,
 			 struct iw_request_info *info,
@@ -982,7 +1080,7 @@ static int r8711_wx_set_wap(struct net_d
 			 char *extra)
 {
 	int ret = -EINPROGRESS;
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct  __queue *queue = &pmlmepriv->scanned_queue;
 	struct sockaddr *temp = (struct sockaddr *)awrq;
@@ -992,10 +1090,8 @@ static int r8711_wx_set_wap(struct net_d
 	struct wlan_network *pnetwork = NULL;
 	enum NDIS_802_11_AUTHENTICATION_MODE	authmode;
 
-	if (padapter->bup == false)
-		return -1;
 	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
-		return -1;
+		return -EBUSY;
 	if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
 		return ret;
 	if (temp->sa_family != ARPHRD_ETHER)
@@ -1012,16 +1108,15 @@ static int r8711_wx_set_wap(struct net_d
 		pmlmepriv->pscanned = get_next(pmlmepriv->pscanned);
 		dst_bssid = pnetwork->network.MacAddress;
 		if (!memcmp(dst_bssid, temp->sa_data, ETH_ALEN)) {
-			if (r8712_set_802_11_infrastructure_mode(padapter,
-			    pnetwork->network.InfrastructureMode) == false)
-				ret = -1;
+			r8712_set_802_11_infrastructure_mode(padapter,
+			    pnetwork->network.InfrastructureMode);
 			break;
 		}
 	}
 	spin_unlock_irqrestore(&queue->lock, irqL);
 	if (!ret) {
 		if (!r8712_set_802_11_authentication_mode(padapter, authmode))
-			ret = -1;
+			ret = -ENOMEM;
 		else {
 			if (!r8712_set_802_11_bssid(padapter, temp->sa_data))
 				ret = -1;
@@ -1034,7 +1129,7 @@ static int r8711_wx_get_wap(struct net_d
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
 
@@ -1053,7 +1148,7 @@ static int r871x_wx_set_mlme(struct net_
 {
 	int ret = 0;
 	u16 reason;
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct iw_mlme *mlme = (struct iw_mlme *) extra;
 
 	if (mlme == NULL)
@@ -1074,11 +1169,19 @@ static int r871x_wx_set_mlme(struct net_
 	return ret;
 }
 
+/**
+ *
+ * This function intends to handle the Set Scan command.
+ * Currently, the request comes via Wireless Extensions' SIOCSIWSCAN ioctl.
+ *
+ * For this operation to succeed, the interface is brought Up beforehand.
+ *
+ */
 static int r8711_wx_set_scan(struct net_device *dev,
 			struct iw_request_info *a,
 			union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	u8 status = true;
 
@@ -1088,7 +1191,7 @@ static int r8711_wx_set_scan(struct net_
 		return -1;
 	}
 	if (padapter->bup == false)
-		return -1;
+		return -ENETDOWN;
 	if (padapter->hw_init_completed == false)
 		return -1;
 	if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) ||
@@ -1126,7 +1229,7 @@ static int r8711_wx_get_scan(struct net_
 				struct iw_request_info *a,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct  __queue *queue = &pmlmepriv->scanned_queue;
 	struct wlan_network *pnetwork = NULL;
@@ -1141,7 +1244,7 @@ static int r8711_wx_get_scan(struct net_
 	while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) {
 		msleep(30);
 		cnt++;
-		if (cnt > 1000)
+		if (cnt > 100)
 			break;
 	}
 	spin_lock_irqsave(&queue->lock, irqL);
@@ -1169,12 +1272,18 @@ static int r8711_wx_get_scan(struct net_
  * s2. set_802_11_authenticaion_mode()
  * s3. set_802_11_encryption_mode()
  * s4. set_802_11_ssid()
+ *
+ * This function intends to handle the Set ESSID command.
+ * Currently, the request comes via the Wireless Extensions' SIOCSIWESSID ioctl.
+ *
+ * For this operation to succeed, there is no need for the interface to be Up.
+ *
  */
 static int r8711_wx_set_essid(struct net_device *dev,
 				struct iw_request_info *a,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct  __queue *queue = &pmlmepriv->scanned_queue;
 	struct wlan_network *pnetwork = NULL;
@@ -1184,10 +1293,8 @@ static int r8711_wx_set_essid(struct net
 	struct list_head *phead;
 	u32 len;
 
-	if (padapter->bup == false)
-		return -1;
 	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
-		return -1;
+		return -EBUSY;
 	if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
 		return 0;
 	if (wrqu->essid.length > IW_ESSID_MAX_SIZE)
@@ -1212,10 +1319,20 @@ static int r8711_wx_set_essid(struct net
 			if ((!memcmp(dst_ssid, src_ssid, ndis_ssid.SsidLength))
 			    && (pnetwork->network.Ssid.SsidLength ==
 			     ndis_ssid.SsidLength)) {
-				if (!r8712_set_802_11_infrastructure_mode(
+				if (check_fwstate(pmlmepriv,
+							WIFI_ADHOC_STATE)) {
+					if (pnetwork->network.
+						InfrastructureMode
+						!=
+						padapter->mlmepriv.
+						cur_network.network.
+						InfrastructureMode)
+						continue;
+				}
+
+				r8712_set_802_11_infrastructure_mode(
 				     padapter,
-				     pnetwork->network.InfrastructureMode))
-					return -1;
+				     pnetwork->network.InfrastructureMode);
 				break;
 			}
 		}
@@ -1229,7 +1346,7 @@ static int r8711_wx_get_essid(struct net
 				struct iw_request_info *a,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
 	u32 len, ret = 0;
@@ -1239,8 +1356,9 @@ static int r8711_wx_get_essid(struct net
 		wrqu->essid.length = len;
 		memcpy(extra, pcur_bss->Ssid.Ssid, len);
 		wrqu->essid.flags = 1;
-	} else
-		ret = -1;
+	} else {
+		ret = -ENOLINK;
+	}
 	return ret;
 }
 
@@ -1248,7 +1366,7 @@ static int r8711_wx_set_rate(struct net_
 				struct iw_request_info *a,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	u32 target_rate = wrqu->bitrate.value;
 	u32 fixed = wrqu->bitrate.fixed;
 	u32 ratevalue = 0;
@@ -1312,7 +1430,7 @@ set_rate:
 			datarates[i] = 0xff;
 	}
 	if (r8712_setdatarate_cmd(padapter, datarates) != _SUCCESS)
-		ret = -1;
+		ret = -ENOMEM;
 	return ret;
 }
 
@@ -1320,10 +1438,11 @@ static int r8711_wx_get_rate(struct net_
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
 	struct ieee80211_ht_cap *pht_capie;
+	unsigned char rf_type = padapter->registrypriv.rf_config;
 	int i;
 	u8 *p;
 	u16 rate, max_rate = 0, ht_cap = false;
@@ -1356,7 +1475,9 @@ static int r8711_wx_get_rate(struct net_
 			i++;
 		}
 		if (ht_cap == true) {
-			if (mcs_rate & 0x8000) /* MCS15 */
+			if (mcs_rate & 0x8000 /* MCS15 */
+				&&
+				RTL8712_RF_2T2R == rf_type)
 				max_rate = (bw_40MHz) ? ((short_GI) ? 300 :
 					    270) : ((short_GI) ? 144 : 130);
 			else if (mcs_rate & 0x0080) /* MCS7 */
@@ -1371,7 +1492,7 @@ static int r8711_wx_get_rate(struct net_
 			wrqu->bitrate.value = max_rate * 500000;
 		}
 	} else
-		return -1;
+		return -ENOLINK;
 	return 0;
 }
 
@@ -1379,7 +1500,7 @@ static int r8711_wx_get_rts(struct net_d
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 
 	wrqu->rts.value = padapter->registrypriv.rts_thresh;
 	wrqu->rts.fixed = 0;	/* no auto select */
@@ -1390,7 +1511,7 @@ static int r8711_wx_set_frag(struct net_
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 
 	if (wrqu->frag.disabled)
 		padapter->xmitpriv.frag_len = MAX_FRAG_THRESHOLD;
@@ -1407,7 +1528,7 @@ static int r8711_wx_get_frag(struct net_
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 
 	wrqu->frag.value = padapter->xmitpriv.frag_len;
 	wrqu->frag.fixed = 0;	/* no auto select */
@@ -1433,7 +1554,7 @@ static int r8711_wx_set_enc(struct net_d
 	struct NDIS_802_11_WEP	 wep;
 	enum NDIS_802_11_AUTHENTICATION_MODE authmode;
 	struct iw_point *erq = &(wrqu->encoding);
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 
 	key = erq->flags & IW_ENCODE_INDEX;
 	memset(&wep, 0, sizeof(struct NDIS_802_11_WEP));
@@ -1527,7 +1648,7 @@ static int r8711_wx_get_enc(struct net_d
 				union iwreq_data *wrqu, char *keybuf)
 {
 	uint key, ret = 0;
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 	struct iw_point *erq = &(wrqu->encoding);
 	struct	mlme_priv	*pmlmepriv = &(padapter->mlmepriv);
 
@@ -1599,7 +1720,7 @@ static int r871x_wx_set_gen_ie(struct ne
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 
 	return r871x_set_wpa_ie(padapter, extra, wrqu->data.length);
 }
@@ -1608,7 +1729,7 @@ static int r871x_wx_set_auth(struct net_
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct iw_param *param = (struct iw_param *)&(wrqu->param);
 	int paramid;
 	int paramval;
@@ -1701,7 +1822,7 @@ static int r871x_wx_set_enc_ext(struct n
 	param_len = sizeof(struct ieee_param) + pext->key_len;
 	param = (struct ieee_param *)_malloc(param_len);
 	if (param == NULL)
-		return -1;
+		return -ENOMEM;
 	memset(param, 0, param_len);
 	param->cmd = IEEE_CMD_SET_ENCRYPTION;
 	memset(param->sta_addr, 0xff, ETH_ALEN);
@@ -1719,7 +1840,7 @@ static int r871x_wx_set_enc_ext(struct n
 		alg_name = "CCMP";
 		break;
 	default:
-		return -1;
+		return -EINVAL;
 	}
 	strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN);
 	if (pext->ext_flags & IW_ENCODE_EXT_GROUP_KEY)
@@ -1754,7 +1875,7 @@ static int r8711_wx_read32(struct net_de
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *keybuf)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 	u32 addr;
 	u32 data32;
 
@@ -1771,7 +1892,7 @@ static int r8711_wx_write32(struct net_d
 				 struct iw_request_info *info,
 				 union iwreq_data *wrqu, char *keybuf)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 	u32 addr;
 	u32 data32;
 
@@ -1785,7 +1906,7 @@ static int dummy(struct net_device *dev,
 		struct iw_request_info *a,
 		union iwreq_data *wrqu, char *b)
 {
-	return -1;
+	return -ENOSYS;
 }
 
 static int r8711_drvext_hdl(struct net_device *dev,
@@ -1799,7 +1920,7 @@ static int r871x_mp_ioctl_hdl(struct net
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct iw_point *p = &wrqu->data;
 	struct oid_par_priv oid_par;
 	struct mp_ioctl_handler *phandler;
@@ -1882,7 +2003,7 @@ static int r871x_get_ap_info(struct net_
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct  __queue *queue = &pmlmepriv->scanned_queue;
 	struct iw_point *pdata = &wrqu->data;
@@ -1953,7 +2074,7 @@ static int r871x_set_pid(struct net_devi
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 	struct iw_point *pdata = &wrqu->data;
 
 	if ((padapter->bDriverStopped) || (pdata == NULL))
@@ -1963,11 +2084,32 @@ static int r871x_set_pid(struct net_devi
 	return 0;
 }
 
+static int r871x_set_chplan(struct net_device *dev,
+				struct iw_request_info *info,
+				union iwreq_data *wrqu, char *extra)
+{
+	int ret = 0;
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
+	struct iw_point *pdata = &wrqu->data;
+	int ch_plan = -1;
+
+	if ((padapter->bDriverStopped) || (pdata == NULL)) {
+		ret = -EINVAL;
+		goto exit;
+	}
+	ch_plan = (int)*extra;
+	r8712_set_chplan_cmd(padapter, ch_plan);
+
+exit:
+
+	return ret;
+}
+
 static int r871x_wps_start(struct net_device *dev,
 			   struct iw_request_info *info,
 			   union iwreq_data *wrqu, char *extra)
 {
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(dev);
 	struct iw_point *pdata = &wrqu->data;
 	u32   u32wps_start = 0;
 
@@ -1991,7 +2133,7 @@ static int r871x_wps_start(struct net_de
 
 static int wpa_set_param(struct net_device *dev, u8 name, u32 value)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 
 	switch (name) {
 	case IEEE_PARAM_WPA_ENABLED:
@@ -2044,7 +2186,7 @@ static int wpa_set_param(struct net_devi
 
 static int wpa_mlme(struct net_device *dev, u32 command, u32 reason)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 
 	switch (command) {
 	case IEEE_MLME_STA_DEAUTH:
@@ -2065,16 +2207,17 @@ static int wpa_supplicant_ioctl(struct n
 {
 	struct ieee_param *param;
 	int ret = 0;
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 
 	if (p->length < sizeof(struct ieee_param) || !p->pointer)
 		return -EINVAL;
 	param = (struct ieee_param *)_malloc(p->length);
 	if (param == NULL)
 		return -ENOMEM;
-	if (copy_from_user(param, p->pointer, p->length))
+	if (copy_from_user(param, p->pointer, p->length)) {
 		kfree((u8 *)param);
 		return -EFAULT;
+	}
 	switch (param->cmd) {
 	case IEEE_CMD_SET_WPA_PARAM:
 		ret = wpa_set_param(dev, param->u.wpa_param.name,
@@ -2201,6 +2344,10 @@ static const struct iw_priv_args r8711_p
 	{
 		SIOCIWFIRSTPRIV + 0x6,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_start"
+	},
+	{
+		SIOCIWFIRSTPRIV + 0x7,
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "chplan"
 	}
 };
 
@@ -2212,11 +2359,12 @@ static iw_handler r8711_private_handler[
 	r871x_get_ap_info, /*for MM DTV platform*/
 	r871x_set_pid,
 	 r871x_wps_start,
+	r871x_set_chplan
 };
 
 static struct iw_statistics *r871x_get_wireless_stats(struct net_device *dev)
 {
-	struct _adapter *padapter = (struct _adapter *) _netdev_priv(dev);
+	struct _adapter *padapter = (struct _adapter *) netdev_priv(dev);
 	struct iw_statistics *piwstats = &padapter->iwstats;
 	int tmp_level = 0;
 	int tmp_qual = 0;
@@ -2232,7 +2380,13 @@ static struct iw_statistics *r871x_get_w
 		tmp_qual = padapter->recvpriv.signal;
 		tmp_noise = padapter->recvpriv.noise;
 		piwstats->qual.level = tmp_level;
-		piwstats->qual.qual = tmp_qual;
+		/*piwstats->qual.qual = tmp_qual;
+		 * The NetworkManager of Fedora 10, 13 will use the link
+		 * quality for its display.
+		 * So, use the fw_rssi on link quality variable because
+		 * fw_rssi will be updated per 2 seconds.
+		 */
+		piwstats->qual.qual = tmp_level;
 		piwstats->qual.noise = tmp_noise;
 	}
 	piwstats->qual.updated = IW_QUAL_ALL_UPDATED;
@@ -2247,5 +2401,5 @@ struct iw_handler_def r871x_handlers_def
 	.num_private = sizeof(r8711_private_handler) / sizeof(iw_handler),
 	.num_private_args = sizeof(r8711_private_args) /
 			    sizeof(struct iw_priv_args),
-	.get_wireless_stats = r871x_get_wireless_stats,
+	.get_wireless_stats = r871x_get_wireless_stats
 };
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_ioctl_linux.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ioctl_rtl.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ioctl_rtl.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ioctl_rtl.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ioctl_rtl.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL871X_IOCTL_RTL_H
 #define _RTL871X_IOCTL_RTL_H
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_ioctl_rtl.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ioctl_set.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ioctl_set.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ioctl_set.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ioctl_set.c	2012-01-31 16:31:54.000000000 -0500
@@ -243,7 +243,7 @@ done:
 	spin_unlock_irqrestore(&pmlmepriv->lock, irqL);
 }
 
-u8 r8712_set_802_11_infrastructure_mode(struct _adapter *padapter,
+void r8712_set_802_11_infrastructure_mode(struct _adapter *padapter,
 	enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype)
 {
 	unsigned long irqL;
@@ -290,7 +290,6 @@ u8 r8712_set_802_11_infrastructure_mode(
 		}
 		spin_unlock_irqrestore(&pmlmepriv->lock, irqL);
 	}
-	return true;
 }
 
 u8 r8712_set_802_11_disassociate(struct _adapter *padapter)
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ioctl_set.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ioctl_set.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_ioctl_set.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_ioctl_set.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __IOCTL_SET_H
 #define __IOCTL_SET_H
 
@@ -22,7 +47,7 @@ u8 r8712_set_802_11_disassociate(struct
 
 u8 r8712_set_802_11_bssid_list_scan(struct _adapter *padapter);
 
-u8 r8712_set_802_11_infrastructure_mode(struct _adapter *padapter,
+void r8712_set_802_11_infrastructure_mode(struct _adapter *padapter,
 			enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
 
 void r8712_set_802_11_ssid(struct _adapter *padapter,
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_ioctl_set.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_led.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_led.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_led.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_led.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL8712_LED_H
 #define __RTL8712_LED_H
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mlme.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mlme.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mlme.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mlme.c	2012-01-31 16:31:54.000000000 -0500
@@ -52,6 +52,8 @@ static sint _init_mlme_priv(struct _adap
 	pmlmepriv->fw_state = 0;
 	pmlmepriv->cur_network.network.InfrastructureMode =
 				 Ndis802_11AutoUnknown;
+	/* Maybe someday we should rename this variable to "active_mode"(Jeff)*/
+	pmlmepriv->passive_mode = 1; /* 1: active, 0: passive. */
 	spin_lock_init(&(pmlmepriv->lock));
 	spin_lock_init(&(pmlmepriv->lock2));
 	_init_queue(&(pmlmepriv->free_bss_pool));
@@ -485,6 +487,12 @@ static int is_desired_network(struct _ad
 	if ((psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_) &&
 		    (pnetwork->network.Privacy == 0))
 		bselected = false;
+	if (check_fwstate(&adapter->mlmepriv, WIFI_ADHOC_STATE) == true) {
+		if (pnetwork->network.InfrastructureMode !=
+			adapter->mlmepriv.cur_network.network.
+			InfrastructureMode)
+			bselected = false;
+	}
 	return bselected;
 }
 
@@ -543,7 +551,7 @@ void r8712_survey_event_callback(struct
 			ibss_wlan = r8712_find_network(
 						&pmlmepriv->scanned_queue,
 						pnetwork->MacAddress);
-			if (!ibss_wlan) {
+			if (ibss_wlan) {
 				memcpy(ibss_wlan->network.IEs,
 					pnetwork->IEs, 8);
 				goto exit;
@@ -683,9 +691,11 @@ void r8712_ind_disconnect(struct _adapte
 {
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
+	if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
 	_clr_fwstate_(pmlmepriv, _FW_LINKED);
 	padapter->ledpriv.LedControlHandler(padapter, LED_CTL_NO_LINK);
 	r8712_os_indicate_disconnect(padapter);
+	}
 	if (padapter->pwrctrlpriv.pwr_mode !=
 	    padapter->registrypriv.power_mgnt) {
 		_cancel_timer_ex(&pmlmepriv->dhcp_timer);
@@ -1271,12 +1281,16 @@ sint r8712_set_key(struct _adapter *adap
 			psecuritypriv->DefKey[keyid].skey, keylen);
 		break;
 	case _TKIP_:
+		if (keyid < 1 || keyid > 2)
+			return _FAIL;
 		keylen = 16;
 		memcpy(psetkeyparm->key,
 			&psecuritypriv->XGrpKey[keyid - 1], keylen);
 		psetkeyparm->grpkey = 1;
 		break;
 	case _AES_:
+		if (keyid < 1 || keyid > 2)
+			return _FAIL;
 		keylen = 16;
 		memcpy(psetkeyparm->key,
 			&psecuritypriv->XGrpKey[keyid - 1], keylen);
@@ -1657,7 +1671,7 @@ void r8712_update_registrypriv_dev_netwo
 	/* 1. Supported rates
 	 * 2. IE
 	 */
-	sz = r8712_generate_ie(pregistrypriv, adapter);
+	sz = r8712_generate_ie(pregistrypriv);
 	pdev_network->IELength = sz;
 	pdev_network->Length = r8712_get_ndis_wlan_bssid_ex_sz(
 			      (struct ndis_wlan_bssid_ex *)pdev_network);
@@ -1802,39 +1816,3 @@ void r8712_issue_addbareq_cmd(struct _ad
 		}
 	}
 }
-
-/*the function is >= passive_level*/
-unsigned int r8712_add_ht_addt_info(struct _adapter *padapter,
-			      u8 *in_ie, u8 *out_ie,
-			      uint in_len, uint *pout_len)
-{
-	u32 ielen, out_len =  0;
-	unsigned char *p, *pframe;
-	struct ieee80211_ht_addt_info ht_addt_info;
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct ht_priv *phtpriv = &pmlmepriv->htpriv;
-	struct registry_priv *pregistrypriv = &padapter->registrypriv;
-	out_len = *pout_len;
-
-	if (pregistrypriv->ht_enable == 1) {
-		p = r8712_get_ie(in_ie+12, _HT_ADD_INFO_IE_,
-				 &ielen, in_len - 12);
-		if (p && (ielen > 0)) {
-			; /* dummy branch */
-		} else {
-			if (p == NULL) {
-				int sz = sizeof(struct ieee80211_ht_addt_info);
-				memset(&ht_addt_info, 0, sz);
-				/*need to add the HT additional IEs*/
-				ht_addt_info.control_chan =
-						pregistrypriv->channel;
-				pframe = r8712_set_ie(out_ie + out_len,
-						_HT_ADD_INFO_IE_,
-						sz,
-						(unsigned char *)&ht_addt_info,
-						pout_len);
-			}
-		}
-	}
-	return phtpriv->ht_option;
-}
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mlme.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mlme.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mlme.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mlme.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL871X_MLME_H_
 #define __RTL871X_MLME_H_
 
@@ -70,6 +95,7 @@ struct mlme_priv {
 	struct  __queue scanned_queue;
 	u8 *free_bss_buf;
 	unsigned long num_of_scanned;
+	u8 passive_mode; /*add for Android's SCAN-ACTIVE/SCAN-PASSIVE */
 	struct ndis_802_11_ssid	assoc_ssid;
 	u8 assoc_bssid[6];
 	struct wlan_network cur_network;
@@ -201,8 +227,6 @@ void r8712_joinbss_reset(struct _adapter
 unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie,
 				     u8 *out_ie, uint in_len, uint *pout_len);
 void r8712_issue_addbareq_cmd(struct _adapter *padapter, int priority);
-unsigned int r8712_add_ht_addt_info(struct _adapter *padapter, u8 *in_ie,
-				    u8 *out_ie, uint in_len, uint *pout_len);
 int r8712_is_same_ibss(struct _adapter *adapter, struct wlan_network *pnetwork);
 
 #endif /*__RTL871X_MLME_H_*/
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_mlme.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mp.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mp.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mp.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mp.c	2012-01-31 16:31:54.000000000 -0500
@@ -1,18 +1,28 @@
 /******************************************************************************
- * rtl871x_mp.c
  *
- * Description :
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
  *
- * Author :
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
  *
- * History :
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
  *
- * Copyright 2007, Realtek Corp.
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  *
- * The contents of this file is the sole property of Realtek Corp. It can not be
- * be used, copied or modified without written permission from Realtek Corp.
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
  *
-*******************************************************************************/
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #define _RTL871X_MP_C_
 
 #include "osdep_service.h"
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mp.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mp.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mp.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mp.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL871X_MP_H_
 #define __RTL871X_MP_H_
 
@@ -101,7 +126,6 @@ struct mp_xmit_frame {
 	struct urb *pxmit_urb[8];
 	u8 bpending[8];
 	u8 last[8];
-	uint mem[(MAX_MP_XMITBUF_SZ >> 2)];
 };
 
 struct mp_wiparam {
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_mp.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mp_ioctl.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mp_ioctl.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_mp_ioctl.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_mp_ioctl.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL871X_MP_IOCTL_H
 #define _RTL871X_MP_IOCTL_H
 
@@ -307,7 +332,6 @@ struct rfintfs_parm {
 
 struct mp_xmit_packet {
 	unsigned int len;
-	unsigned int mem[MAX_MP_XMITBUF_SZ >> 2];
 };
 
 struct psmode_param {
@@ -410,8 +434,7 @@ static struct mp_ioctl_handler mp_ioctl_
 	{sizeof(struct psmode_param), NULL, 0},/*13*/
 	{sizeof(struct eeprom_rw_param), NULL, 0},/*14*/
 	{sizeof(struct eeprom_rw_param), NULL, 0},/*15*/
-	{sizeof(u8), oid_rt_pro_set_power_tracking_hdl,
-			     OID_RT_PRO_SET_POWER_TRACKING},/*16*/
+	{sizeof(unsigned char), NULL, 0},/*16*/
 	{sizeof(u32), NULL, 0},/*17*/
 	{sizeof(u32), oid_rt_pro_set_continuous_tx_hdl,
 			     OID_RT_PRO_SET_CONTINUOUS_TX},/*18*/
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_mp_ioctl.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_pwrctrl.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_pwrctrl.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_pwrctrl.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_pwrctrl.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL871X_PWRCTRL_H_
 #define __RTL871X_PWRCTRL_H_
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_pwrctrl.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_recv.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_recv.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_recv.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_recv.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,6 +28,9 @@
 
 #define _RTL871X_RECV_C_
 
+#include <linux/slab.h>
+#include <linux/kmemleak.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 #include "recv_osdep.h"
@@ -73,6 +76,7 @@ sint _r8712_init_recv_priv(struct recv_p
 					   RXFRAME_ALIGN_SZ);
 	if (precvpriv->pallocated_frame_buf == NULL)
 		return _FAIL;
+	kmemleak_not_leak(precvpriv->pallocated_frame_buf);
 	memset(precvpriv->pallocated_frame_buf, 0, NR_RECVFRAME *
 		sizeof(union recv_frame) + RXFRAME_ALIGN_SZ);
 	precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf +
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_recv.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_rf.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_rf.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_rf.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_rf.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef	__RTL871X_RF_H_
 #define __RTL871X_RF_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_security.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_security.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_security.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_security.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,6 +28,21 @@
 
 #define  _RTL871X_SECURITY_C_
 
+#include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/kref.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/circ_buf.h>
+#include <linux/uaccess.h>
+#include <asm/byteorder.h>
+#include <linux/atomic.h>
+#include <linux/semaphore.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 #include "wifi.h"
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_security.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_security.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_security.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_security.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __RTL871X_SECURITY_H_
 #define __RTL871X_SECURITY_H_
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_security.o
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_sta_mgt.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_wlan_sme.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_wlan_sme.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_wlan_sme.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_wlan_sme.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL871X_WLAN_SME_H_
 #define _RTL871X_WLAN_SME_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_xmit.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_xmit.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_xmit.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_xmit.c	2012-01-31 16:31:54.000000000 -0500
@@ -152,11 +152,12 @@ sint _r8712_init_xmit_priv(struct xmit_p
 		pxmitbuf++;
 	}
 	pxmitpriv->free_xmitbuf_cnt = NR_XMITBUFF;
+	_init_workitem(&padapter->wkFilterRxFF0, r8712_SetFilter, padapter);
 	alloc_hwxmits(padapter);
 	init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
 	tasklet_init(&pxmitpriv->xmit_tasklet,
-	     (void(*)(addr_t))r8712_xmit_bh,
-	     (addr_t)padapter);
+		(void(*)(unsigned long))r8712_xmit_bh,
+		(unsigned long)padapter);
 	return _SUCCESS;
 }
 
@@ -612,7 +613,7 @@ sint r8712_xmitframe_coalesce(struct _ad
 	if (make_wlanhdr(padapter, mem_start, pattrib) == _FAIL)
 		return _FAIL;
 	_r8712_open_pktfile(pkt, &pktfile);
-	_r8712_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen);
+	_r8712_pktfile_read(&pktfile, NULL, (uint) pattrib->pkt_hdrlen);
 	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
 		/* truncate TXDESC_SIZE bytes txcmd if at mp mode for 871x */
 		if (pattrib->ether_type == 0x8712) {
@@ -826,13 +827,16 @@ void r8712_free_xmitframe(struct xmit_pr
 	unsigned long irqL;
 	struct  __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;
 	struct _adapter *padapter = pxmitpriv->adapter;
+	struct sk_buff *pndis_pkt = NULL;
 
 	if (pxmitframe == NULL)
 		return;
-	if (pxmitframe->pkt)
-		r8712_xmit_complete(padapter, pxmitframe);
 	spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
 	list_delete(&pxmitframe->list);
+	if (pxmitframe->pkt) {
+		pndis_pkt = pxmitframe->pkt;
+		pxmitframe->pkt = NULL;
+	}
 	list_insert_tail(&pxmitframe->list, get_list_head(pfree_xmit_queue));
 	pxmitpriv->free_xmitframe_cnt++;
 	spin_unlock_irqrestore(&pfree_xmit_queue->lock, irqL);
@@ -1011,6 +1015,19 @@ static void init_hwxmits(struct hw_xmit
 	}
 }
 
+void xmitframe_xmitbuf_attach(struct xmit_frame *pxmitframe,
+			struct xmit_buf *pxmitbuf)
+{
+	/* pxmitbuf attach to pxmitframe */
+	pxmitframe->pxmitbuf = pxmitbuf;
+	/* urb and irp connection */
+	pxmitframe->pxmit_urb[0] = pxmitbuf->pxmit_urb[0];
+	/* buffer addr assoc */
+	pxmitframe->buf_addr = pxmitbuf->pbuf;
+	/* pxmitframe attach to pxmitbuf */
+	pxmitbuf->priv_data = pxmitframe;
+}
+
 /*
  * tx_action == 0 == no frames to transmit
  * tx_action > 0 ==> we have frames to transmit
@@ -1042,9 +1059,7 @@ int r8712_pre_xmit(struct _adapter *pada
 	} else { /*dump packet directly*/
 		spin_unlock_irqrestore(&pxmitpriv->lock, irqL);
 		ret = true;
-		pxmitframe->pxmitbuf = pxmitbuf;
-		pxmitframe->pxmit_urb[0] = pxmitbuf->pxmit_urb[0];
-		pxmitframe->buf_addr = pxmitbuf->pbuf;
+		xmitframe_xmitbuf_attach(pxmitframe, pxmitbuf);
 		r8712_xmit_direct(padapter, pxmitframe);
 	}
 	return ret;
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_xmit.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_xmit.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/rtl871x_xmit.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/rtl871x_xmit.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _RTL871X_XMIT_H_
 #define _RTL871X_XMIT_H_
 
@@ -5,8 +30,19 @@
 #include "drv_types.h"
 #include "xmit_osdep.h"
 
+#ifdef CONFIG_R8712_TX_AGGR
+#define MAX_XMITBUF_SZ  (16384)
+#else
 #define MAX_XMITBUF_SZ	(2048)
+#endif
+
 #define NR_XMITBUFF	(4)
+
+#ifdef CONFIG_R8712_TX_AGGR
+#define AGGR_NR_HIGH_BOUND      (4) /*(8) */
+#define AGGR_NR_LOW_BOUND       (2)
+#endif
+
 #define XMITBUF_ALIGN_SZ 512
 #define TX_GUARD_BAND		5
 #define MAX_NUMBLKS		(1)
@@ -68,9 +104,9 @@ struct pkt_attrib {
 
 	u16	seqnum;
 	u16	ether_type;
-	u32	pktlen;		/* the original 802.3 pkt raw_data len
+	u16	pktlen;		/* the original 802.3 pkt raw_data len
 				 * (not include ether_hdr data) */
-	u32	last_txcmdsz;
+	u16	last_txcmdsz;
 
 	u8	pkt_hdrlen;	/*the original 802.3 pkt header len*/
 	u8	hdrlen;		/*the WLAN Header Len*/
@@ -110,7 +146,9 @@ struct xmit_buf {
 
 	u8 *pallocated_buf;
 	u8 *pbuf;
+	void *priv_data;
 	struct urb *pxmit_urb[8];
+	u32 aggr_nr;
 };
 
 struct xmit_frame {
@@ -198,6 +236,9 @@ struct	xmit_priv {
 	struct semaphore tx_retevt;/*all tx return event;*/
 	u8	txirp_cnt;
 	struct tasklet_struct xmit_tasklet;
+	_workitem xmit_pipe4_reset_wi;
+	_workitem xmit_pipe6_reset_wi;
+	_workitem xmit_piped_reset_wi;
 	/*per AC pending irp*/
 	int beq_cnt;
 	int bkq_cnt;
@@ -255,6 +296,9 @@ int r8712_xmit_enqueue(struct _adapter *
 int r8712_xmit_direct(struct _adapter *padapter, struct xmit_frame *pxmitframe);
 void r8712_xmit_bh(void *priv);
 
+void xmitframe_xmitbuf_attach(struct xmit_frame *pxmitframe,
+			struct xmit_buf *pxmitbuf);
+
 #include "rtl8712_xmit.h"
 
 #endif	/*_RTL871X_XMIT_H_*/
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: rtl871x_xmit.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/sta_info.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/sta_info.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/sta_info.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/sta_info.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __STA_INFO_H_
 #define __STA_INFO_H_
 
@@ -38,8 +63,8 @@ struct sta_info {
 	struct sta_recv_priv sta_recvpriv;
 	uint state;
 	uint aid;
-	u8	mac_id;
-	u8	qos_option;
+	uint	mac_id;
+	uint	qos_option;
 	u8	hwaddr[ETH_ALEN];
 	uint	ieee8021x_blocked;	/*0: allowed, 1:blocked */
 	uint	XPrivacy; /*aes, tkip...*/
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/swab.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/swab.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/swab.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/swab.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _LINUX_BYTEORDER_SWAB_H
 #define _LINUX_BYTEORDER_SWAB_H
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: usb_halinit.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_intf.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_intf.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_intf.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_intf.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,6 +28,9 @@
 
 #define _HCI_INTF_C_
 
+#include <linux/usb.h>
+#include <linux/module.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 #include "recv_osdep.h"
@@ -367,23 +370,25 @@ static int r871xu_drv_init(struct usb_in
 	struct _adapter *padapter = NULL;
 	struct dvobj_priv *pdvobjpriv;
 	struct net_device *pnetdev;
+	struct usb_device *udev;
 
 	printk(KERN_INFO "r8712u: DriverVersion: %s\n", DRVER);
 	/* In this probe function, O.S. will provide the usb interface pointer
 	 * to driver. We have to increase the reference count of the usb device
 	 * structure by using the usb_get_dev function.
 	 */
-	usb_get_dev(interface_to_usbdev(pusb_intf));
+	udev = interface_to_usbdev(pusb_intf);
+	usb_get_dev(udev);
 	pintf = pusb_intf;
 	/* step 1. */
 	pnetdev = r8712_init_netdev();
 	if (!pnetdev)
 		goto error;
-	padapter = (struct _adapter *)_netdev_priv(pnetdev);
+	padapter = netdev_priv(pnetdev);
 	disable_ht_for_spec_devid(pdid, padapter);
 	pdvobjpriv = &padapter->dvobjpriv;
 	pdvobjpriv->padapter = padapter;
-	padapter->dvobjpriv.pusbdev = interface_to_usbdev(pusb_intf);
+	padapter->dvobjpriv.pusbdev = udev;
 	usb_set_intfdata(pusb_intf, pnetdev);
 	SET_NETDEV_DEV(pnetdev, &pusb_intf->dev);
 	/* step 2. */
@@ -593,14 +598,15 @@ static int r871xu_drv_init(struct usb_in
 	/* step 6. Tell the network stack we exist */
 	if (register_netdev(pnetdev) != 0)
 		goto error;
+	spin_lock_init(&padapter->lockRxFF0Filter);
 	return 0;
 error:
-	usb_put_dev(interface_to_usbdev(pusb_intf));
+	usb_put_dev(udev);
 	usb_set_intfdata(pusb_intf, NULL);
 	if (padapter->dvobj_deinit != NULL)
 		padapter->dvobj_deinit(padapter);
 	if (pnetdev)
-		os_free_netdev(pnetdev);
+		free_netdev(pnetdev);
 	return -ENODEV;
 }
 
@@ -612,6 +618,7 @@ static void r871xu_dev_remove(struct usb
 	struct _adapter *padapter = netdev_priv(pnetdev);
 	struct usb_device *udev = interface_to_usbdev(pusb_intf);
 
+	usb_set_intfdata(pusb_intf, NULL);
 	if (padapter) {
 		if (drvpriv.drv_registered == true)
 			padapter->bSurpriseRemoved = true;
@@ -621,6 +628,8 @@ static void r871xu_dev_remove(struct usb
 		}
 		flush_scheduled_work();
 		udelay(1);
+		/*Stop driver mlme relation timer */
+		r8712_stop_drv_timers(padapter);
 		r871x_dev_unload(padapter);
 		r8712_free_drv_sw(padapter);
 	}
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: usb_intf.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_ops.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_ops.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_ops.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_ops.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __USB_OPS_H_
 #define __USB_OPS_H_
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: usb_ops.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_ops_linux.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_ops_linux.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_ops_linux.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_ops_linux.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,6 +28,8 @@
 
 #define _HCI_OPS_OS_C_
 
+#include <linux/usb.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 #include "osdep_intf.h"
@@ -48,7 +50,7 @@ struct zero_bulkout_context {
 
 uint r8712_usb_init_intf_priv(struct intf_priv *pintfpriv)
 {
-	pintfpriv->piorw_urb = _usb_alloc_urb(0, GFP_ATOMIC);
+	pintfpriv->piorw_urb = usb_alloc_urb(0, GFP_ATOMIC);
 	if (!pintfpriv->piorw_urb)
 		return _FAIL;
 	sema_init(&(pintfpriv->io_retevt), 0);
@@ -187,7 +189,7 @@ void r8712_usb_write_mem(struct intf_hdl
 	usb_fill_bulk_urb(piorw_urb, pusbd, pipe,
 			  wmem, cnt, usb_write_mem_complete,
 			  pio_queue);
-	status = _usb_submit_urb(piorw_urb, GFP_ATOMIC);
+	status = usb_submit_urb(piorw_urb, GFP_ATOMIC);
 	_down_sema(&pintfpriv->io_retevt);
 }
 
@@ -305,7 +307,7 @@ u32 r8712_usb_read_port(struct intf_hdl
 				  precvbuf->pbuf, MAX_RECVBUF_SZ,
 				  r8712_usb_read_port_complete,
 				  precvbuf);
-		err = _usb_submit_urb(purb, GFP_ATOMIC);
+		err = usb_submit_urb(purb, GFP_ATOMIC);
 		if ((err) && (err != (-EPERM)))
 			ret = _FAIL;
 	} else
@@ -332,17 +334,16 @@ void r8712_xmit_bh(void *priv)
 	struct _adapter *padapter = (struct _adapter *)priv;
 	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
 
-	while (1) {
 		if ((padapter->bDriverStopped == true) ||
 		    (padapter->bSurpriseRemoved == true)) {
 			printk(KERN_ERR "r8712u: xmit_bh => bDriverStopped"
 			       " or bSurpriseRemoved\n");
-			break;
+		return;
 		}
 		ret = r8712_xmitframe_complete(padapter, pxmitpriv, NULL);
 		if (ret == false)
-			break;
-	}
+		return;
+	tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
 }
 
 static void usb_write_port_complete(struct urb *purb)
@@ -462,7 +463,7 @@ u32 r8712_usb_write_port(struct intf_hdl
 			  pxmitframe->mem_addr,
 			  cnt, usb_write_port_complete,
 			  pxmitframe); /* context is xmit_frame */
-	status = _usb_submit_urb(purb, GFP_ATOMIC);
+	status = usb_submit_urb(purb, GFP_ATOMIC);
 	if (!status)
 		ret = _SUCCESS;
 	else
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: usb_ops_linux.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_osintf.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_osintf.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_osintf.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_osintf.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __USB_OSINTF_H
 #define __USB_OSINTF_H
 
@@ -17,6 +42,7 @@ uint rtl8712_hal_deinit(struct _adapter
 void rtl871x_intf_stop(struct _adapter *padapter);
 void r871x_dev_unload(struct _adapter *padapter);
 void r8712_stop_drv_threads(struct _adapter *padapter);
+void r8712_stop_drv_timers(struct _adapter *padapter);
 u8 r8712_init_drv_sw(struct _adapter *padapter);
 u8 r8712_free_drv_sw(struct _adapter *padapter);
 struct net_device *r8712_init_netdev(void);
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_vendor_req.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_vendor_req.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/usb_vendor_req.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/usb_vendor_req.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _USB_VENDOR_REQUEST_H_
 #define _USB_VENDOR_REQUEST_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/wifi.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/wifi.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/wifi.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/wifi.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef _WIFI_H_
 #define _WIFI_H_
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/wlan_bssdef.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/wlan_bssdef.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/wlan_bssdef.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/wlan_bssdef.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __WLAN_BSSDEF_H__
 #define __WLAN_BSSDEF_H__
 
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/xmit_linux.c /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/xmit_linux.c
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/xmit_linux.c	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/xmit_linux.c	2012-01-31 16:31:54.000000000 -0500
@@ -28,6 +28,8 @@
 
 #define _XMIT_OSDEP_C_
 
+#include <linux/usb.h>
+
 #include "osdep_service.h"
 #include "drv_types.h"
 
@@ -42,7 +44,6 @@
 
 static uint remainder_len(struct pkt_file *pfile)
 {
-	/* Kovich: Need to extend the buf_len to 64 bit ?(unsigned long long) */
 	return (uint)(pfile->buf_len - ((addr_t)(pfile->cur_addr) -
 	       (addr_t)(pfile->buf_start)));
 }
@@ -107,13 +108,33 @@ void r8712_set_qos(struct pkt_file *ppkt
 	pattrib->subtype = WIFI_QOS_DATA_TYPE;
 }
 
+void r8712_SetFilter(struct work_struct *work)
+{
+	struct _adapter *padapter = container_of(work, struct _adapter,
+						wkFilterRxFF0);
+	u8  oldvalue = 0x00, newvalue = 0x00;
+	unsigned long irqL;
+
+	oldvalue = r8712_read8(padapter, 0x117);
+	newvalue = oldvalue & 0xfe;
+	r8712_write8(padapter, 0x117, newvalue);
+
+	spin_lock_irqsave(&padapter->lockRxFF0Filter, irqL);
+	padapter->blnEnableRxFF0Filter = 1;
+	spin_unlock_irqrestore(&padapter->lockRxFF0Filter, irqL);
+	do {
+		msleep(100);
+	} while (padapter->blnEnableRxFF0Filter == 1);
+	r8712_write8(padapter, 0x117, oldvalue);
+}
+
 int r8712_xmit_resource_alloc(struct _adapter *padapter,
 			      struct xmit_buf *pxmitbuf)
 {
 	int i;
 
 	for (i = 0; i < 8; i++) {
-		pxmitbuf->pxmit_urb[i] = _usb_alloc_urb(0, GFP_KERNEL);
+		pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
 		if (pxmitbuf->pxmit_urb[i] == NULL) {
 			printk(KERN_ERR "r8712u: pxmitbuf->pxmit_urb[i]"
 			    " == NULL");
@@ -146,7 +167,7 @@ void r8712_xmit_complete(struct _adapter
 int r8712_xmit_entry(_pkt *pkt, struct  net_device *pnetdev)
 {
 	struct xmit_frame *pxmitframe = NULL;
-	struct _adapter *padapter = (struct _adapter *)_netdev_priv(pnetdev);
+	struct _adapter *padapter = (struct _adapter *)netdev_priv(pnetdev);
 	struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
 	int ret = 0;
 
Only in /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/: xmit_linux.o
diff -upwr /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/xmit_osdep.h /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/xmit_osdep.h
--- /home/wrc/kern/linux-3.1.9/drivers/staging/rtl8712/xmit_osdep.h	2012-01-12 14:53:18.000000000 -0500
+++ /home/wrc/kern/linux-3.3-rc2/drivers/staging/rtl8712/xmit_osdep.h	2012-01-31 16:31:54.000000000 -0500
@@ -1,3 +1,28 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Modifications for inclusion into the Linux staging tree are
+ * Copyright(c) 2010 Larry Finger. All rights reserved.
+ *
+ * Contact information:
+ * WLAN FAE <wlanfae@realtek.com>
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ ******************************************************************************/
 #ifndef __XMIT_OSDEP_H_
 #define __XMIT_OSDEP_H_
 
@@ -22,6 +47,7 @@ struct xmit_frame;
 struct xmit_buf;
 
 int r8712_xmit_entry(_pkt *pkt, struct  net_device *pnetdev);
+void r8712_SetFilter(struct work_struct *work);
 int r8712_xmit_resource_alloc(struct _adapter *padapter,
 			   struct xmit_buf *pxmitbuf);
 void r8712_xmit_resource_free(struct _adapter *padapter,