-From f74f54da3639f0dc1fb203c7d5b987b9b9fb0bb4 Mon Sep 17 00:00:00 2001
+From 5aec58e64fb0ba4e582150d0506e9dddea6efbe3 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Sat, 9 Nov 2013 12:17:56 +0000
-Subject: [PATCH 097/174] wifi: Update to newer rtl8192cu driver release
+Subject: [PATCH 097/196] wifi: Update to newer rtl8192cu driver release
---
drivers/net/wireless/rtl8192cu/Kconfig | 4 +-
create mode 100755 drivers/net/wireless/rtl8192cu/runwpa
mode change 100644 => 100755 drivers/net/wireless/rtl8192cu/wlan0dhcp
+diff --git a/drivers/net/wireless/rtl8192cu/Kconfig b/drivers/net/wireless/rtl8192cu/Kconfig
+index ef46361..bee5ed6 100644
--- a/drivers/net/wireless/rtl8192cu/Kconfig
+++ b/drivers/net/wireless/rtl8192cu/Kconfig
@@ -1,8 +1,6 @@
- Enable wireless network adapters based on Realtek RTL8192C chipset family, such as EDUP nano series
+ Help message of RTL8192CU
+diff --git a/drivers/net/wireless/rtl8192cu/Makefile b/drivers/net/wireless/rtl8192cu/Makefile
+index b52cace..c399011 100644
--- a/drivers/net/wireless/rtl8192cu/Makefile
+++ b/drivers/net/wireless/rtl8192cu/Makefile
@@ -1,15 +1,15 @@
-CONFIG_BT_COEXISTENCE = n
-CONFIG_RTL8192CU_REDEFINE_1X1 =n
-CONFIG_WAKE_ON_WLAN = n
+-
+-CONFIG_PLATFORM_I386_PC = n
+CONFIG_POWER_SAVING = y
+CONFIG_USB_AUTOSUSPEND = n
+CONFIG_HW_PWRP_DETECTION = n
+CONFIG_RTL8192CU_REDEFINE_1X1 = n
+CONFIG_INTEL_WIDI = n
+CONFIG_WAKE_ON_WLAN = n
-
--CONFIG_PLATFORM_I386_PC = n
++
+CONFIG_PLATFORM_I386_PC = y
CONFIG_PLATFORM_TI_AM3517 = n
CONFIG_PLATFORM_ANDROID_X86 = n
endif
ifeq ($(CONFIG_PLATFORM_ANDROID_X86), y)
-@@ -291,6 +280,18 @@ KSRC := /media/DATA-2/android-x86/ics-x8
+@@ -291,6 +280,18 @@ KSRC := /media/DATA-2/android-x86/ics-x86_20120130/out/target/product/generic_x8
MODULE_NAME :=wlan
endif
endif
ifeq ($(CONFIG_PLATFORM_MT53XX), y)
-@@ -385,7 +386,16 @@ CROSS_COMPILE := /opt/freescale/usr/loca
+@@ -385,7 +386,16 @@ CROSS_COMPILE := /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-li
KVER := 2.6.31
KSRC ?= /lib/modules/2.6.31-770-g0e46b52/source
endif
MODULE_NAME := wlan
endif
-@@ -461,11 +501,39 @@ KSRC := /home/winuser/work/Plat_sLD2T_V3
+@@ -461,11 +501,39 @@ KSRC := /home/winuser/work/Plat_sLD2T_V3010/usr/src/linux-2.6.32.2
INSTALL_PREFIX :=
endif
+ cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
endif
+diff --git a/drivers/net/wireless/rtl8192cu/clean b/drivers/net/wireless/rtl8192cu/clean
+old mode 100644
+new mode 100755
+index 34686a0..8766421
--- a/drivers/net/wireless/rtl8192cu/clean
+++ b/drivers/net/wireless/rtl8192cu/clean
@@ -3,7 +3,3 @@ rmmod 8192cu
-rmmod rtl8192c_common
-rmmod rtlwifi
\ No newline at end of file
+diff --git a/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c b/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c
+index 4908d6e..3d341ac 100644
--- a/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c
+++ b/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c
@@ -1,7 +1,7 @@
void
EFUSE_Write1Byte(
IN PADAPTER Adapter,
-@@ -709,12 +736,12 @@ u8 rtw_efuse_map_write(PADAPTER padapter
+@@ -709,12 +736,12 @@ u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
if (word_en != 0xF) {
ret = Efuse_PgPacketWrite(padapter, offset, word_en, newdata, _FALSE);
)
{
u8 i;
-@@ -1056,7 +1106,7 @@ int storeAdaptorInfoFile(char *path, str
+@@ -1056,7 +1106,7 @@ int storeAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv)
else
ret = _FAIL;
} else {
ret = _FAIL;
}
return ret;
-@@ -1086,7 +1136,7 @@ int retriveAdaptorInfoFile(char *path, s
+@@ -1086,7 +1136,7 @@ int retriveAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv)
#endif
} else {
ret = _FAIL;
}
return ret;
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_ap.c b/drivers/net/wireless/rtl8192cu/core/rtw_ap.c
+new file mode 100644
+index 0000000..405e7fe
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_ap.c
@@ -0,0 +1,2940 @@
+#endif //CONFIG_NATIVEAP_MLME
+#endif //CONFIG_AP_MODE
+
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c b/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c
+index 1fcdf1e..6bb924e 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c
-@@ -126,10 +126,10 @@ static int skb_pull_and_merge(struct sk_
+@@ -126,10 +126,10 @@ static int skb_pull_and_merge(struct sk_buff *skb, unsigned char *src, int len)
int tail_len;
unsigned long end, tail;
end = (unsigned long)src+len;
if (tail < end)
return -1;
-@@ -522,7 +522,7 @@ static void __nat25_db_network_insert(_a
+@@ -522,7 +522,7 @@ static void __nat25_db_network_insert(_adapter *priv,
db = db->next_hash;
}
}
}
-@@ -848,6 +848,11 @@ int nat25_db_handle(_adapter *priv, stru
+@@ -848,6 +848,11 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
else {
// forward unknow IP packet to upper TCP/IP
DEBUG_INFO("NAT25: Replace DA with BR's MAC\n");
memcpy(skb->data, priv->br_mac, ETH_ALEN);
}
}
-@@ -1533,7 +1538,7 @@ int nat25_handle_frame(_adapter *priv, s
+@@ -1533,7 +1538,7 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
_exit_critical_bh(&priv->br_ext_lock, &irqL);
retval = nat25_db_handle(priv, skb, NAT25_LOOKUP);
}
else {
if (((*((unsigned short *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_IP)) &&
-@@ -1633,13 +1638,13 @@ void dhcp_flag_bcast(_adapter *priv, str
+@@ -1633,13 +1638,13 @@ void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb)
if(iph->protocol == IPPROTO_UDP) // UDP
{
if(dhcph->cookie == __constant_htonl(DHCP_MAGIC)) // match magic word
{
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c b/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c
+index bdfec5d..f906eb3 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c
@@ -16,7 +16,7 @@
RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("-_rtw_free_evt_priv \n"));
_func_exit_;
-@@ -229,8 +247,7 @@ struct cmd_obj *_rtw_dequeue_cmd(_queue
+@@ -229,8 +247,7 @@ struct cmd_obj *_rtw_dequeue_cmd(_queue *queue)
_func_enter_;
//_enter_critical_bh(&(queue->lock), &irqL);
int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
{
u8 bAllow = _FALSE; //set to _TRUE to allow enqueuing cmd when hw_init_completed is _FALSE
-@@ -292,23 +310,23 @@ int rtw_cmd_filter(struct cmd_priv *pcmd
+@@ -292,23 +310,23 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
)
{
if(cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) )
{
//DBG_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __FUNCTION__,
// cmd_obj->cmdcode,
-@@ -326,6 +344,7 @@ int rtw_cmd_filter(struct cmd_priv *pcmd
+@@ -326,6 +344,7 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
{
int res = _FAIL;
thread_return rtw_cmd_thread(thread_context context)
{
-@@ -408,11 +445,12 @@ thread_return rtw_cmd_thread(thread_cont
+@@ -408,11 +445,12 @@ thread_return rtw_cmd_thread(thread_context context)
_func_enter_;
u8 rtw_setrttbl_cmd(_adapter *padapter, struct setratable_parm *prate_table)
{
struct cmd_obj* ph2c;
-@@ -1570,8 +1708,47 @@ _func_enter_;
+@@ -1570,7 +1708,7 @@ _func_enter_;
init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, GEN_CMD_CODE(_AddBAReq));
- //DBG_8192C("rtw_addbareq_cmd, tid=%d\n", tid);
+ //DBG_871X("rtw_addbareq_cmd, tid=%d\n", tid);
-+
-+ //rtw_enqueue_cmd(pcmdpriv, ph2c);
-+ res = rtw_enqueue_cmd(pcmdpriv, ph2c);
-+
-+exit:
-+
-+_func_exit_;
-+
-+ return res;
-+}
+
+ //rtw_enqueue_cmd(pcmdpriv, ph2c);
+ res = rtw_enqueue_cmd(pcmdpriv, ph2c);
+@@ -1581,6 +1719,87 @@ _func_exit_;
+
+ return res;
+ }
+//add for CONFIG_IEEE80211W, none 11w can use it
+u8 rtw_reset_securitypriv_cmd(_adapter*padapter)
+{
+ pdrvextra_cmd_parm->ec_id = RESET_SECURITYPRIV;
+ pdrvextra_cmd_parm->type_size = 0;
+ pdrvextra_cmd_parm->pbuf = (u8 *)padapter;
-
++
+ init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
+
+
- //rtw_enqueue_cmd(pcmdpriv, ph2c);
- res = rtw_enqueue_cmd(pcmdpriv, ph2c);
-
-@@ -1580,8 +1757,50 @@ exit:
- _func_exit_;
-
- return res;
++ //rtw_enqueue_cmd(pcmdpriv, ph2c);
++ res = rtw_enqueue_cmd(pcmdpriv, ph2c);
++
++exit:
++
++_func_exit_;
++
++ return res;
++
++}
+
- }
-
+u8 rtw_free_assoc_resources_cmd(_adapter*padapter)
+{
+ struct cmd_obj* ph2c;
+
+}
+
-+
+
u8 rtw_dynamic_chk_wk_cmd(_adapter*padapter)
{
- struct cmd_obj* ph2c;
-@@ -1591,6 +1810,15 @@ u8 rtw_dynamic_chk_wk_cmd(_adapter*padap
+@@ -1591,6 +1810,15 @@ u8 rtw_dynamic_chk_wk_cmd(_adapter*padapter)
_func_enter_;
if(setChannelSwitch_param == NULL) {
rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj));
res= _FAIL;
-@@ -1806,9 +2088,8 @@ static void traffic_status_watchdog(_ada
+@@ -1806,9 +2088,8 @@ static void traffic_status_watchdog(_adapter *padapter)
{
#ifdef CONFIG_LPS
u8 bEnterPS;
u8 bBusyTraffic = _FALSE, bTxBusyTraffic = _FALSE, bRxBusyTraffic = _FALSE;
u8 bHigherBusyTraffic = _FALSE, bHigherBusyRxTraffic = _FALSE, bHigherBusyTxTraffic = _FALSE;
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-@@ -1816,6 +2097,8 @@ static void traffic_status_watchdog(_ada
+@@ -1816,6 +2097,8 @@ static void traffic_status_watchdog(_adapter *padapter)
struct tdls_info *ptdlsinfo = &(padapter->tdlsinfo);
#endif //CONFIG_TDLS
//
// Determine if our traffic is busy now
//
-@@ -1823,15 +2106,18 @@ static void traffic_status_watchdog(_ada
+@@ -1823,15 +2106,18 @@ static void traffic_status_watchdog(_adapter *padapter)
/*&& !MgntInitAdapterInProgress(pMgntInfo)*/)
{
bTxBusyTraffic = _TRUE;
}
-@@ -1849,29 +2135,39 @@ static void traffic_status_watchdog(_ada
+@@ -1849,29 +2135,39 @@ static void traffic_status_watchdog(_adapter *padapter)
if(pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 5000)
bHigherBusyTxTraffic = _TRUE;
}
bEnterPS= _FALSE;
}
else
-@@ -1905,15 +2201,39 @@ static void traffic_status_watchdog(_ada
+@@ -1905,15 +2201,39 @@ static void traffic_status_watchdog(_adapter *padapter)
pmlmepriv->LinkDetectInfo.bRxBusyTraffic = bRxBusyTraffic;
pmlmepriv->LinkDetectInfo.bHigherBusyTraffic = bHigherBusyTraffic;
pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic = bHigherBusyRxTraffic;
#endif
//if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING|_FW_UNDER_SURVEY)==_FALSE)
-@@ -1922,13 +2242,15 @@ void dynamic_chk_wk_hdl(_adapter *padapt
+@@ -1922,13 +2242,15 @@ void dynamic_chk_wk_hdl(_adapter *padapter, u8 *pbuf, int sz)
traffic_status_watchdog(padapter);
}
pwrpriv->DelayLPSLastTimeStamp = rtw_get_current_time();
LPS_Leave(padapter);
break;
-@@ -1984,7 +2306,7 @@ u8 rtw_lps_ctrl_wk_cmd(_adapter*padapter
+@@ -1984,7 +2306,7 @@ u8 rtw_lps_ctrl_wk_cmd(_adapter*padapter, u8 lps_ctrl_type, u8 enqueue)
struct cmd_obj *ph2c;
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
}
u8 rtw_antenna_select_cmd(_adapter*padapter, u8 antenna,u8 enqueue)
-@@ -2045,7 +2372,7 @@ u8 rtw_antenna_select_cmd(_adapter*padap
+@@ -2045,7 +2372,7 @@ u8 rtw_antenna_select_cmd(_adapter*padapter, u8 antenna,u8 enqueue)
u8 res = _SUCCESS;
_func_enter_;
#ifdef CONFIG_P2P
u8 p2p_protocol_wk_cmd(_adapter*padapter, int intCmdType )
{
-@@ -2098,7 +2437,7 @@ u8 p2p_protocol_wk_cmd(_adapter*padapter
+@@ -2098,7 +2437,7 @@ u8 p2p_protocol_wk_cmd(_adapter*padapter, int intCmdType )
_func_enter_;
u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
{
struct drvextra_cmd_parm *pdrvextra_cmd;
-@@ -2268,24 +2713,39 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapt
+@@ -2268,24 +2713,39 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
antenna_select_wk_hdl(padapter, pdrvextra_cmd->type_size);
break;
#endif
void rtw_getrttbl_cmd_cmdrsp_callback(_adapter* padapter, struct cmd_obj *pcmd)
{
_func_enter_;
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_debug.c b/drivers/net/wireless/rtl8192cu/core/rtw_debug.c
+index 04e472d..f70fcb7 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_debug.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_debug.c
@@ -1,7 +1,7 @@
#ifdef CONFIG_PROC_DEBUG
#include <rtw_version.h>
-@@ -76,6 +77,65 @@ int proc_get_drv_version(char *page, cha
+@@ -76,6 +77,65 @@ int proc_get_drv_version(char *page, char **start,
return len;
}
int proc_get_write_reg(char *page, char **start,
off_t offset, int count,
int *eof, void *data)
-@@ -94,7 +154,7 @@ int proc_set_write_reg(struct file *file
+@@ -94,7 +154,7 @@ int proc_set_write_reg(struct file *file, const char *buffer,
if (count < 3)
{
return -EFAULT;
}
-@@ -103,7 +163,7 @@ int proc_set_write_reg(struct file *file
+@@ -103,7 +163,7 @@ int proc_set_write_reg(struct file *file, const char *buffer,
int num = sscanf(tmp, "%x %x %x", &addr, &val, &len);
if (num != 3) {
return count;
}
-@@ -119,7 +179,7 @@ int proc_set_write_reg(struct file *file
+@@ -119,7 +179,7 @@ int proc_set_write_reg(struct file *file, const char *buffer,
rtw_write32(padapter, addr, val);
break;
default:
break;
}
-@@ -171,14 +231,12 @@ int proc_get_read_reg(char *page, char *
+@@ -171,14 +231,12 @@ int proc_get_read_reg(char *page, char **start,
int proc_set_read_reg(struct file *file, const char *buffer,
unsigned long count, void *data)
{
return -EFAULT;
}
-@@ -187,7 +245,7 @@ int proc_set_read_reg(struct file *file,
+@@ -187,7 +245,7 @@ int proc_set_read_reg(struct file *file, const char *buffer,
int num = sscanf(tmp, "%x %x", &addr, &len);
if (num != 2) {
return count;
}
-@@ -289,17 +347,17 @@ int proc_get_rf_info(char *page, char **
+@@ -289,17 +347,17 @@ int proc_get_rf_info(char *page, char **start,
int *eof, void *data)
{
struct net_device *dev = data;
}
int proc_get_ap_info(char *page, char **start,
-@@ -371,23 +429,282 @@ int proc_get_trx_info(char *page, char *
+@@ -371,23 +429,282 @@ int proc_get_trx_info(char *page, char **start,
off_t offset, int count,
int *eof, void *data)
{
+ if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n");
+ }
+
- *eof = 1;
- return len;
-
- }
++ *eof = 1;
++ return len;
++
++}
+
+int proc_get_mac_reg_dump2(char *page, char **start,
+ off_t offset, int count,
+ if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n");
+ }
+
-+ *eof = 1;
-+ return len;
-+
-+}
+ *eof = 1;
+ return len;
+
+ }
+
+int proc_get_mac_reg_dump3(char *page, char **start,
+ off_t offset, int count,
int proc_get_rx_signal(char *page, char **start,
off_t offset, int count,
-@@ -453,6 +770,101 @@ int proc_set_rx_signal(struct file *file
+@@ -453,6 +770,101 @@ int proc_set_rx_signal(struct file *file, const char *buffer,
}
int proc_get_ampdu_enable(char *page, char **start,
off_t offset, int count,
int *eof, void *data)
-@@ -500,6 +912,112 @@ int proc_set_ampdu_enable(struct file *f
+@@ -500,6 +912,112 @@ int proc_set_ampdu_enable(struct file *file, const char *buffer,
}
int proc_get_rssi_disp(char *page, char **start,
off_t offset, int count,
int *eof, void *data)
-@@ -703,7 +1221,117 @@ int proc_get_best_channel(char *page, ch
+@@ -703,7 +1221,117 @@ int proc_get_best_channel(char *page, char **start,
return len;
}
+
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c b/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c
+index 4a0832b..fd07d64 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c
@@ -16,8 +16,7 @@
#define _RTW_EEPROM_C_
#include <drv_conf.h>
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c b/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c
+index 2b85af9..6305ba3 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c
@@ -25,7 +25,27 @@
+ return HAL_PRIME_CHNL_OFFSET_UPPER;
+ else if(ch_offset == SCB)
+ return HAL_PRIME_CHNL_OFFSET_LOWER;
-
++
+ return HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+}
+
+ ie_data[1] = flags;
+ RTW_PUT_LE16((u8*)&ie_data[2], reason);
+ RTW_PUT_LE16((u8*)&ie_data[4], precedence);
-+
+
+ return rtw_set_ie(buf, 0x118, 6, ie_data, buf_len);
+}
u8 *pbuf = pie;
while(1)
-@@ -351,34 +520,31 @@ unsigned char *rtw_get_wpa_ie(unsigned c
+@@ -351,34 +520,31 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
val16 = le16_to_cpu(val16);
if (val16 != 0x0001)
}
unsigned char *rtw_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int limit)
-@@ -434,7 +600,7 @@ int rtw_parse_wpa_ie(u8* wpa_ie, int wpa
+@@ -434,7 +600,7 @@ int rtw_parse_wpa_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
if ((*wpa_ie != _WPA_IE_ID_) || (*(wpa_ie+1) != (u8)(wpa_ie_len - 2)) ||
{
return _FAIL;
}
-@@ -787,7 +953,7 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie,
+@@ -787,7 +953,7 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8
}
static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
int show_errors)
{
unsigned int oui;
-@@ -892,7 +1058,7 @@ static int rtw_ieee802_11_parse_vendor_s
+@@ -892,7 +1058,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
* Returns: Parsing result
*/
ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
int show_errors)
{
uint left = len;
-@@ -1018,7 +1184,8 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *
+@@ -1018,7 +1184,8 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
}
{
uint cnt = 0;
u8 *p2p_ie_ptr;
-@@ -1166,7 +1411,12 @@ u8 *rtw_get_p2p_ie(u8 *in_ie, uint in_le
+@@ -1166,7 +1411,12 @@ u8 *rtw_get_p2p_ie(u8 *in_ie, uint in_len, u8 *p2p_ie, uint *p2p_ielen)
while(cnt<in_len)
{
eid = in_ie[cnt];
if( ( eid == _VENDOR_SPECIFIC_IE_ ) && ( _rtw_memcmp( &in_ie[cnt+2], p2p_oui, 4) == _TRUE ) )
{
p2p_ie_ptr = in_ie + cnt;
-@@ -1215,7 +1465,7 @@ u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2
+@@ -1215,7 +1465,7 @@ u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_attr
if(len_attr)
*len_attr = 0;
( _rtw_memcmp( p2p_ie + 2, p2p_oui , 4 ) != _TRUE ) )
{
return attr_ptr;
-@@ -1381,8 +1631,10 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(W
+@@ -1381,8 +1631,10 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id)
}
}
{
int match;
uint cnt = 0;
-@@ -1390,6 +1642,12 @@ int rtw_get_wfd_ie(u8 *in_ie, uint in_le
+@@ -1390,6 +1642,12 @@ int rtw_get_wfd_ie(u8 *in_ie, uint in_len, u8 *wfd_ie, uint *wfd_ielen)
match=_FALSE;
while(cnt<in_len)
{
eid = in_ie[cnt];
-@@ -1399,10 +1657,7 @@ int rtw_get_wfd_ie(u8 *in_ie, uint in_le
+@@ -1399,10 +1657,7 @@ int rtw_get_wfd_ie(u8 *in_ie, uint in_len, u8 *wfd_ie, uint *wfd_ielen)
if ( wfd_ie != NULL )
{
_rtw_memcpy( wfd_ie, &in_ie[ cnt ], in_ie[ cnt + 1 ] + 2 );
}
else
{
-@@ -1412,6 +1667,11 @@ int rtw_get_wfd_ie(u8 *in_ie, uint in_le
+@@ -1412,6 +1667,11 @@ int rtw_get_wfd_ie(u8 *in_ie, uint in_len, u8 *wfd_ie, uint *wfd_ielen)
}
}
cnt += in_ie[ cnt + 1 ] + 2;
match = _TRUE;
-@@ -1454,7 +1714,7 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie,
+@@ -1454,7 +1714,7 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *
cnt = 6;
while( cnt < wfd_ielen )
{
attr_id = wfd_ie[cnt];
if( attr_id == target_attr_id )
-@@ -1464,7 +1724,7 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie,
+@@ -1464,7 +1724,7 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *
_rtw_memcpy( attr_content, &wfd_ie[ cnt + 3 ], attrlen );
if(attr_contentlen)
cnt += attrlen + 3;
-@@ -1482,5 +1742,174 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie,
+@@ -1482,5 +1742,174 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *
}
#endif // CONFIG_WFD
+ return _action_public_str[action];
+}
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_io.c b/drivers/net/wireless/rtl8192cu/core/rtw_io.c
+index 2efe719..4ffaa50 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_io.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_io.c
@@ -1,7 +1,7 @@
b. provides the protocol engine
-@@ -101,7 +100,7 @@ u16 _rtw_read16(_adapter *adapter, u32 a
+@@ -101,7 +100,7 @@ u16 _rtw_read16(_adapter *adapter, u32 addr)
_func_exit_;
return r_val;
}
u32 _rtw_read32(_adapter *adapter, u32 addr)
{
u32 r_val;
-@@ -114,7 +113,7 @@ u32 _rtw_read32(_adapter *adapter, u32 a
+@@ -114,7 +113,7 @@ u32 _rtw_read32(_adapter *adapter, u32 addr)
r_val = _read32(pintfhdl, addr);
_func_exit_;
}
-@@ -142,7 +141,7 @@ int _rtw_write16(_adapter *adapter, u32
+@@ -142,7 +141,7 @@ int _rtw_write16(_adapter *adapter, u32 addr, u16 val)
int ret;
_func_enter_;
_write16 = pintfhdl->io_ops._write16;
ret = _write16(pintfhdl, addr, val);
_func_exit_;
-@@ -174,7 +173,7 @@ int _rtw_writeN(_adapter *adapter, u32 a
+@@ -174,7 +173,7 @@ int _rtw_writeN(_adapter *adapter, u32 addr ,u32 length , u8 *pdata)
_func_enter_;
_writeN = pintfhdl->io_ops._writeN;
_func_exit_;
return RTW_STATUS_CODE(ret);
-@@ -188,8 +187,8 @@ int _rtw_write8_async(_adapter *adapter,
+@@ -188,8 +187,8 @@ int _rtw_write8_async(_adapter *adapter, u32 addr, u8 val)
int ret;
_func_enter_;
_write8_async = pintfhdl->io_ops._write8_async;
_func_exit_;
return RTW_STATUS_CODE(ret);
-@@ -203,8 +202,8 @@ int _rtw_write16_async(_adapter *adapter
+@@ -203,8 +202,8 @@ int _rtw_write16_async(_adapter *adapter, u32 addr, u16 val)
int ret;
_func_enter_;
_write16_async = pintfhdl->io_ops._write16_async;
_func_exit_;
return RTW_STATUS_CODE(ret);
-@@ -218,71 +217,71 @@ int _rtw_write32_async(_adapter *adapter
+@@ -218,71 +217,71 @@ int _rtw_write32_async(_adapter *adapter, u32 addr, u32 val)
int ret;
_func_enter_;
_write32_async = pintfhdl->io_ops._write32_async;
_func_exit_;
}
-@@ -292,51 +291,48 @@ void _rtw_read_port_cancel(_adapter *ada
+@@ -292,51 +291,48 @@ void _rtw_read_port_cancel(_adapter *adapter)
void (*_read_port_cancel)(struct intf_hdl *pintfhdl);
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
}
void _rtw_write_port_cancel(_adapter *adapter)
-@@ -344,143 +340,121 @@ void _rtw_write_port_cancel(_adapter *ad
+@@ -344,143 +340,121 @@ void _rtw_write_port_cancel(_adapter *adapter)
void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
-#ifdef CONFIG_RTL8192C
- set_intf_ops = &rtl8192cu_set_intf_ops;
-#endif
+- }
+- else if(padapter->chip_type == RTL8192D)
+- {
+-#ifdef CONFIG_RTL8192D
+- set_intf_ops = &rtl8192du_set_intf_ops;
+-#endif
+- }
+- else
+- {
+- set_intf_ops = NULL;
+- }
+-#endif //END OF CONFIG_USB_HCI
+u16 read_sniff_ranges[][2] = {
+ //{0x550, 0x551},
+};
-+
+
+-#ifdef CONFIG_PCI_HCI
+u16 write_sniff_ranges[][2] = {
+ //{0x550, 0x551},
+ //{0x4c, 0x4c},
+};
-+
+
+- if(padapter->chip_type == RTL8188C_8192C)
+- {
+-#ifdef CONFIG_RTL8192C
+- set_intf_ops = &rtl8192ce_set_intf_ops;
+-#endif
+- }
+- else if(padapter->chip_type == RTL8192D)
+- {
+-#ifdef CONFIG_RTL8192D
+- set_intf_ops = &rtl8192de_set_intf_ops;
+-#endif
+int read_sniff_num = sizeof(read_sniff_ranges)/sizeof(u16)/2;
+int write_sniff_num = sizeof(write_sniff_ranges)/sizeof(u16)/2;
+
+ if (addr + len > read_sniff_ranges[i][0] && addr <= read_sniff_ranges[i][1])
+ return _TRUE;
}
-- else if(padapter->chip_type == RTL8192D)
-- {
--#ifdef CONFIG_RTL8192D
-- set_intf_ops = &rtl8192du_set_intf_ops;
--#endif
-- }
- else
- {
- set_intf_ops = NULL;
+ if (addr + len > write_sniff_ranges[i][0] && addr <= write_sniff_ranges[i][1])
+ return _TRUE;
}
--#endif //END OF CONFIG_USB_HCI
+-#endif //END OF CONFIG_PCI_HCI
+
+ return _FALSE;
+}
--#ifdef CONFIG_PCI_HCI
+u8 dbg_rtw_read8(_adapter *adapter, u32 addr, const char *caller, const int line)
+{
+ u8 val = _rtw_read8(adapter, addr);
-- if(padapter->chip_type == RTL8188C_8192C)
-- {
--#ifdef CONFIG_RTL8192C
-- set_intf_ops = &rtl8192ce_set_intf_ops;
--#endif
-- }
-- else if(padapter->chip_type == RTL8192D)
-- {
--#ifdef CONFIG_RTL8192D
-- set_intf_ops = &rtl8192de_set_intf_ops;
--#endif
-- }
-- else
-- {
-- set_intf_ops = NULL;
-- }
--#endif //END OF CONFIG_PCI_HCI
+- if(set_intf_ops==NULL)
+- return _FAIL;
+ if (match_read_sniff_ranges(addr, 1))
+ DBG_871X("DBG_IO %s:%d rtw_read8(0x%04x) return 0x%02x\n", caller, line, addr, val);
+- set_intf_ops(&pintf->io_ops);
+ return val;
+}
-- if(set_intf_ops==NULL)
-- return _FAIL;
+- return _SUCCESS;
+u16 dbg_rtw_read16(_adapter *adapter, u32 addr, const char *caller, const int line)
+{
+ u16 val = _rtw_read16(adapter, addr);
+ if (match_read_sniff_ranges(addr, 2))
+ DBG_871X("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x\n", caller, line, addr, val);
-- set_intf_ops(&pintf->io_ops);
+ return val;
+}
-
-- return _SUCCESS;
++
+u32 dbg_rtw_read32(_adapter *adapter, u32 addr, const char *caller, const int line)
+{
+ u32 val = _rtw_read32(adapter, addr);
+
+ if (match_read_sniff_ranges(addr, 4))
+ DBG_871X("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x\n", caller, line, addr, val);
-
++
+ return val;
}
DBG_871X("DBG_IO %s:%d rtw_writeN(0x%04x, %u)\n", caller, line, addr, length);
return _rtw_writeN(adapter, addr, length, data);
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c b/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c
+index 156640c..0601886 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c
@@ -16,8 +16,7 @@
#define _RTW_IOCTL_QUERY_C_
#include <drv_conf.h>
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c b/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c
+index 87348a2..31b4704 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c
@@ -16,8 +16,7 @@
#define _RTW_IOCTL_RTL_C_
#include <drv_conf.h>
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c b/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c
+index 946d875..e67f219 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c
@@ -16,7 +16,7 @@
#ifdef CONFIG_USB_HCI
#include <usb_osintf.h>
-@@ -43,6 +43,20 @@ extern void indicate_wx_scan_complete_ev
+@@ -43,6 +43,20 @@ extern void indicate_wx_scan_complete_event(_adapter *padapter);
(addr[4] == 0xff) && (addr[5] == 0xff) ) ? _TRUE : _FALSE \
)
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("do_join(): site survey return error\n."));
}
}
-@@ -317,8 +330,8 @@ u8 rtw_set_802_11_bssid(_adapter* padapt
+@@ -317,8 +330,8 @@ u8 rtw_set_802_11_bssid(_adapter* padapter, u8 *bssid)
_irqL irqL;
u8 status=_SUCCESS;
u32 cur_time = 0;
_rtw_memcpy(&pmlmepriv->assoc_bssid, bssid, ETH_ALEN);
pmlmepriv->assoc_by_bssid=_TRUE;
-@@ -419,7 +418,6 @@ u8 rtw_set_802_11_ssid(_adapter* padapte
+@@ -419,7 +418,6 @@ u8 rtw_set_802_11_ssid(_adapter* padapter, NDIS_802_11_SSID *ssid)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *pnetwork = &pmlmepriv->cur_network;
}
return max_rate;
-@@ -1408,19 +1453,42 @@ int rtw_set_channel_plan(_adapter *adapt
+@@ -1408,19 +1453,42 @@ int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan)
*/
int rtw_set_country(_adapter *adapter, const char *country_code)
{
+ return _FAIL;
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_iol.c b/drivers/net/wireless/rtl8192cu/core/rtw_iol.c
+index f725ad4..872cc42 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_iol.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_iol.c
-@@ -38,7 +38,7 @@ struct xmit_frame *rtw_IOL_accquire_xmit
+@@ -38,7 +38,7 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter)
if ((xmitbuf = rtw_alloc_xmitbuf(pxmitpriv)) == NULL)
{
DBG_871X("%s rtw_alloc_xmitbuf return null\n", __FUNCTION__);
xmit_frame=NULL;
goto exit;
}
-@@ -145,7 +145,7 @@ int _rtw_IOL_append_WD_cmd(struct xmit_f
+@@ -145,7 +145,7 @@ int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value)
#ifdef DBG_IO
int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line)
{
DBG_871X("DBG_IO %s:%d IOL_WB(0x%04x, 0x%02x)\n", caller, line, addr, value);
return _rtw_IOL_append_WB_cmd(xmit_frame, addr, value);
-@@ -153,7 +153,7 @@ int dbg_rtw_IOL_append_WB_cmd(struct xmi
+@@ -153,7 +153,7 @@ int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value,
int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line)
{
DBG_871X("DBG_IO %s:%d IOL_WW(0x%04x, 0x%04x)\n", caller, line, addr, value);
return _rtw_IOL_append_WW_cmd(xmit_frame, addr, value);
-@@ -161,7 +161,7 @@ int dbg_rtw_IOL_append_WW_cmd(struct xmi
+@@ -161,7 +161,7 @@ int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value
int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line)
{
DBG_871X("DBG_IO %s:%d IOL_WD(0x%04x, 0x%08x)\n", caller, line, addr, value);
return _rtw_IOL_append_WD_cmd(xmit_frame, addr, value);
-@@ -224,10 +224,7 @@ int rtw_IOL_append_END_cmd(struct xmit_f
+@@ -224,10 +224,7 @@ int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
int rtw_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms)
{
return _TRUE;
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c b/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c
+index 2e11d9d..00edd9c 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c
@@ -16,7 +16,7 @@
void rtw_mfree_mlme_priv_lock (struct mlme_priv *pmlmepriv)
{
_rtw_spinlock_free(&pmlmepriv->lock);
-@@ -108,7 +115,7 @@ static void rtw_free_mlme_ie_data(u8 **p
+@@ -108,7 +115,7 @@ static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen)
{
if(*ppie)
{
*plen = 0;
*ppie=NULL;
}
-@@ -117,6 +124,8 @@ static void rtw_free_mlme_ie_data(u8 **p
+@@ -117,6 +124,8 @@ static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen)
void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)
{
#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
rtw_free_mlme_ie_data(&pmlmepriv->wps_beacon_ie, &pmlmepriv->wps_beacon_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_req_ie, &pmlmepriv->wps_probe_req_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_resp_ie, &pmlmepriv->wps_probe_resp_ie_len);
-@@ -128,6 +137,15 @@ void rtw_free_mlme_priv_ie_data(struct m
+@@ -128,6 +137,15 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)
rtw_free_mlme_ie_data(&pmlmepriv->p2p_go_probe_resp_ie, &pmlmepriv->p2p_go_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->p2p_assoc_req_ie, &pmlmepriv->p2p_assoc_req_ie_len);
#endif
}
_enter_critical_bh(&free_queue->lock, &irqL);
-@@ -385,8 +414,6 @@ void _rtw_free_network_queue(_adapter *p
+@@ -385,8 +414,6 @@ void _rtw_free_network_queue(_adapter *padapter, u8 isfreeall)
struct wlan_network *pnetwork;
struct mlme_priv* pmlmepriv = &padapter->mlmepriv;
_queue *scanned_queue = &pmlmepriv->scanned_queue;
void rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork )
{
_func_enter_;
-@@ -585,6 +615,7 @@ int rtw_is_same_ibss(_adapter *adapter,
+@@ -585,6 +615,7 @@ int rtw_is_same_ibss(_adapter *adapter, struct wlan_network *pnetwork)
}
inline int is_same_ess(WLAN_BSSID_EX *a, WLAN_BSSID_EX *b)
{
//RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("(%s,%d)(%s,%d)\n",
-@@ -593,7 +624,7 @@ inline int is_same_ess(WLAN_BSSID_EX *a,
+@@ -593,7 +624,7 @@ inline int is_same_ess(WLAN_BSSID_EX *a, WLAN_BSSID_EX *b)
&& _rtw_memcmp(a->Ssid.Ssid, b->Ssid.Ssid, a->Ssid.SsidLength)==_TRUE;
}
u8 ss_ori = dst->PhyInfo.SignalStrength;
u8 sq_ori = dst->PhyInfo.SignalQuality;
long rssi_ori = dst->Rssi;
-@@ -678,16 +709,20 @@ static void update_network(WLAN_BSSID_EX
+@@ -678,16 +709,20 @@ static void update_network(WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src,_adapter * pad
u8 sq_smp = src->PhyInfo.SignalQuality;
long rssi_smp = src->Rssi;
rtw_update_protection(adapter, (pmlmepriv->cur_network.network.IEs) + sizeof (NDIS_802_11_FIXED_IEs),
pmlmepriv->cur_network.network.IELength);
}
-@@ -824,6 +855,7 @@ void rtw_update_scanned_network(_adapter
+@@ -824,6 +855,7 @@ void rtw_update_scanned_network(_adapter *adapter, WLAN_BSSID_EX *target)
struct wlan_network *oldest = NULL;
_func_enter_;
int rtw_is_desired_network(_adapter *adapter, struct wlan_network *pnetwork)
{
struct security_priv *psecuritypriv = &adapter->securitypriv;
-@@ -965,7 +1009,7 @@ int rtw_is_desired_network(_adapter *ada
+@@ -965,7 +1009,7 @@ int rtw_is_desired_network(_adapter *adapter, struct wlan_network *pnetwork)
desired_encmode = psecuritypriv->ndisencryptstatus;
privacy = pnetwork->network.Privacy;
{
if(rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen)!=NULL)
{
-@@ -978,8 +1022,20 @@ int rtw_is_desired_network(_adapter *ada
+@@ -978,8 +1022,20 @@ int rtw_is_desired_network(_adapter *adapter, struct wlan_network *pnetwork)
}
if (adapter->registrypriv.wifi_spec == 1) //for correct flow of 8021X to do....
{
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
#ifdef CONFIG_MLME_EXT
-@@ -1108,7 +1165,6 @@ void rtw_surveydone_event_callback(_adap
+@@ -1108,7 +1165,6 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf)
_func_enter_;
_enter_critical_bh(&pmlmepriv->lock, &irqL);
#ifdef CONFIG_IOCTL_CFG80211
rtw_cfg80211_surveydone_event_callback(adapter);
-@@ -1297,19 +1374,15 @@ void rtw_free_assoc_resources(_adapter *
+@@ -1297,19 +1374,15 @@ void rtw_free_assoc_resources(_adapter *adapter, int lock_scanned_queue)
_irqL irqL;
struct wlan_network* pwlan = NULL;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
_func_exit_;
}
-@@ -1468,16 +1590,45 @@ inline void rtw_indicate_scan_done( _ada
+@@ -1468,16 +1590,45 @@ inline void rtw_indicate_scan_done( _adapter *padapter, bool aborted)
rtw_os_indicate_scan_done(padapter, aborted);
}
psta = rtw_get_stainfo(pstapriv, pnetwork->network.MacAddress);
if(psta==NULL) {
-@@ -1490,16 +1641,16 @@ static struct sta_info *rtw_joinbss_upda
+@@ -1490,16 +1641,16 @@ static struct sta_info *rtw_joinbss_update_stainfo(_adapter *padapter, struct wl
psta->aid = pnetwork->join_res;
#ifdef CONFIG_CONCURRENT_MODE
//security related
if(padapter->securitypriv.dot11AuthAlgrthm== dot11AuthAlgrthm_8021X)
-@@ -1516,10 +1667,22 @@ static struct sta_info *rtw_joinbss_upda
+@@ -1516,10 +1667,22 @@ static struct sta_info *rtw_joinbss_update_stainfo(_adapter *padapter, struct wl
_rtw_memset((u8 *)&psta->dot11tkiprxmickey, 0, sizeof (union Keytype));
_rtw_memset((u8 *)&psta->dot11tkiptxmickey, 0, sizeof (union Keytype));
//for A-MPDU Rx reordering buffer control for bmc_sta & sta_info
//if A-MPDU Rx is enabled, reseting rx_ordering_ctrl wstart_b(indicate_seq) to default value=0xffff
-@@ -1582,7 +1745,6 @@ static void rtw_joinbss_update_network(_
+@@ -1582,7 +1745,6 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network *
// why not use ptarget_wlan??
_rtw_memcpy(&cur_network->network, &pnetwork->network, pnetwork->network.Length);
cur_network->aid = pnetwork->join_res;
-@@ -1594,15 +1756,29 @@ static void rtw_joinbss_update_network(_
+@@ -1594,15 +1756,29 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network *
padapter->recvpriv.signal_qual = ptarget_wlan->network.PhyInfo.SignalQuality;
//the ptarget_wlan->network.Rssi is raw data, we use ptarget_wlan->network.PhyInfo.SignalStrength instead (has scaled)
padapter->recvpriv.rssi = translate_percentage_to_dbm(ptarget_wlan->network.PhyInfo.SignalStrength);
break;
case Ndis802_11IBSS:
pmlmepriv->fw_state = WIFI_ADHOC_STATE;
-@@ -1617,7 +1793,7 @@ static void rtw_joinbss_update_network(_
+@@ -1617,7 +1793,7 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network *
(cur_network->network.IELength));
#ifdef CONFIG_80211N_HT
#endif
-@@ -1634,7 +1810,6 @@ static void rtw_joinbss_update_network(_
+@@ -1634,7 +1810,6 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network *
void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf)
{
_irqL irqL,irqL2;
_func_exit_;
}
-@@ -1871,8 +2051,7 @@ void rtw_stassoc_event_callback(_adapter
+@@ -1871,8 +2051,7 @@ void rtw_stassoc_event_callback(_adapter *adapter, u8 *pbuf)
_func_enter_;
}
goto exit;
-@@ -1992,15 +2173,19 @@ void rtw_stadel_event_callback(_adapter
+@@ -1992,15 +2173,19 @@ void rtw_stadel_event_callback(_adapter *adapter, u8 *pbuf)
_func_enter_;
#endif
_func_exit_;
-@@ -2120,7 +2313,9 @@ void _rtw_join_timeout_handler (_adapter
+@@ -2120,7 +2313,9 @@ void _rtw_join_timeout_handler (_adapter *adapter)
{
_irqL irqL;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
#if 0
if (adapter->bDriverStopped == _TRUE){
-@@ -2130,6 +2325,24 @@ void _rtw_join_timeout_handler (_adapter
+@@ -2130,6 +2325,24 @@ void _rtw_join_timeout_handler (_adapter *adapter)
#endif
_func_enter_;
/*
* rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey
* @adapter: pointer to _adapter structure
-@@ -2185,18 +2414,16 @@ void rtw_scan_timeout_handler (_adapter
+@@ -2185,18 +2414,16 @@ void rtw_scan_timeout_handler (_adapter *adapter)
_irqL irqL;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
}
static void rtw_auto_scan_handler(_adapter *padapter)
-@@ -2210,26 +2437,35 @@ static void rtw_auto_scan_handler(_adapt
+@@ -2210,26 +2437,35 @@ static void rtw_auto_scan_handler(_adapter *padapter)
pmlmepriv->scan_interval--;
if(pmlmepriv->scan_interval==0)
{
pmlmepriv->scan_interval = SCAN_INTERVAL;// 30*2 sec = 60sec
-@@ -2245,6 +2481,12 @@ void rtw_dynamic_check_timer_handlder(_a
+@@ -2245,6 +2481,12 @@ void rtw_dynamic_check_timer_handlder(_adapter *adapter)
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
#endif //CONFIG_AP_MODE
struct registry_priv *pregistrypriv = &adapter->registrypriv;
if(adapter->hw_init_completed == _FALSE)
return;
-@@ -2252,8 +2494,21 @@ void rtw_dynamic_check_timer_handlder(_a
+@@ -2252,8 +2494,21 @@ void rtw_dynamic_check_timer_handlder(_adapter *adapter)
if ((adapter->bDriverStopped == _TRUE)||(adapter->bSurpriseRemoved== _TRUE))
return;
rtw_dynamic_chk_wk_cmd(adapter);
-@@ -2269,12 +2524,14 @@ void rtw_dynamic_check_timer_handlder(_a
+@@ -2269,12 +2524,14 @@ void rtw_dynamic_check_timer_handlder(_adapter *adapter)
}
}
#ifdef CONFIG_BR_EXT
-@@ -2313,27 +2570,58 @@ void rtw_dynamic_check_timer_handlder(_a
+@@ -2313,27 +2570,58 @@ void rtw_dynamic_check_timer_handlder(_adapter *adapter)
#ifdef CONFIG_SET_SCAN_DENY_TIMER
/*
* Select a new join candidate from the original @param candidate and @param competitor
* @return _TRUE: candidate is updated
-@@ -2364,7 +2652,7 @@ static int rtw_check_join_candidate(stru
+@@ -2364,7 +2652,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
goto exit;
#ifdef CONFIG_LAYER2_ROAMING
if( rtw_get_passing_time_ms((u32)competitor->last_scanned) >= RTW_SCAN_RESULT_EXPIRE
|| is_same_ess(&competitor->network, &pmlmepriv->cur_network.network) == _FALSE
)
-@@ -2393,7 +2681,7 @@ static int rtw_check_join_candidate(stru
+@@ -2393,7 +2681,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
}
} else
#ifdef CONFIG_LAYER2_ROAMING
if( (*candidate == NULL ||(*candidate)->network.Rssi<competitor->network.Rssi )
&& is_same_ess(&competitor->network, &pmlmepriv->cur_network.network)
//&&(!is_same_network(&competitor->network, &pmlmepriv->cur_network.network))
-@@ -2423,14 +2711,15 @@ static int rtw_check_join_candidate(stru
+@@ -2423,14 +2711,15 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
#ifdef CONFIG_LAYER2_ROAMING
"[to_roaming:%u] "
#endif
iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid);
if(iEntry<0)
{
-@@ -3097,7 +3384,7 @@ void rtw_update_registrypriv_dev_network
+@@ -3097,7 +3384,7 @@ void rtw_update_registrypriv_dev_network(_adapter* adapter)
WLAN_BSSID_EX *pdev_network = &pregistrypriv->dev_network;
struct security_priv* psecuritypriv = &adapter->securitypriv;
struct wlan_network *cur_network = &adapter->mlmepriv.cur_network;
_func_enter_;
-@@ -3211,12 +3495,12 @@ void rtw_joinbss_reset(_adapter *padapte
+@@ -3211,12 +3495,12 @@ void rtw_joinbss_reset(_adapter *padapter)
threshold = 1;
else
threshold = 0;
}
#endif
-@@ -3228,7 +3512,7 @@ void rtw_joinbss_reset(_adapter *padapte
+@@ -3228,7 +3512,7 @@ void rtw_joinbss_reset(_adapter *padapter)
#ifdef CONFIG_80211N_HT
//the fucntion is >= passive_level
{
u32 ielen, out_len;
unsigned char *p, *pframe;
-@@ -3237,7 +3521,8 @@ unsigned int rtw_restructure_ht_ie(_adap
+@@ -3237,7 +3521,8 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv= &pmlmepriv->qospriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
phtpriv->ht_option = _FALSE;
-@@ -3258,19 +3543,31 @@ unsigned int rtw_restructure_ht_ie(_adap
+@@ -3258,19 +3543,31 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
_rtw_memset(&ht_capie, 0, sizeof(struct rtw_ieee80211_ht_cap));
}
ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR&0x03);
-@@ -3305,7 +3602,7 @@ unsigned int rtw_restructure_ht_ie(_adap
+@@ -3305,7 +3602,7 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
}
//the fucntion is > passive_level (in critical_section)
{
u8 *p, max_ampdu_sz;
int len;
-@@ -3320,7 +3617,7 @@ void rtw_update_ht_cap(_adapter *padapte
+@@ -3320,7 +3617,7 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len)
//struct wlan_network *pcur_network = &(pmlmepriv->cur_network);;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
if(!phtpriv->ht_option)
return;
-@@ -3333,11 +3630,12 @@ void rtw_update_ht_cap(_adapter *padapte
+@@ -3333,11 +3630,12 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len)
//maybe needs check if ap supports rx ampdu.
if((phtpriv->ampdu_enable==_FALSE) &&(pregistrypriv->ampdu_enable==1))
{
{
phtpriv->ampdu_enable = _TRUE;
}
-@@ -3357,13 +3655,13 @@ void rtw_update_ht_cap(_adapter *padapte
+@@ -3357,13 +3655,13 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len)
max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR);
max_ampdu_sz = 1 << (max_ampdu_sz+3); // max_ampdu_sz (kbytes);
p = rtw_get_ie(pie+sizeof (NDIS_802_11_FIXED_IEs), _HT_ADD_INFO_IE_, &len, ie_len-sizeof (NDIS_802_11_FIXED_IEs));
if(p && len>0)
{
-@@ -3371,12 +3669,56 @@ void rtw_update_ht_cap(_adapter *padapte
+@@ -3371,12 +3669,56 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len)
//todo:
}
//switch to the 40M Hz mode accoring to the AP
pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40;
switch ((pmlmeinfo->HT_info.infos[0] & 0x3))
-@@ -3392,13 +3734,13 @@ void rtw_update_ht_cap(_adapter *padapte
+@@ -3392,13 +3734,13 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len)
default:
pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
break;
if(pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
{
/*u8 i;
-@@ -3467,7 +3809,6 @@ void rtw_issue_addbareq_cmd(_adapter *pa
+@@ -3467,7 +3809,6 @@ void rtw_issue_addbareq_cmd(_adapter *padapter, struct xmit_frame *pxmitframe)
struct sta_info *psta=NULL;
struct ht_priv *phtpriv;
struct pkt_attrib *pattrib =&pxmitframe->attrib;
s32 bmcst = IS_MCAST(pattrib->ra);
if(bmcst || (padapter->mlmepriv.LinkDetectInfo.bTxBusyTraffic == _FALSE))
-@@ -3478,10 +3819,23 @@ void rtw_issue_addbareq_cmd(_adapter *pa
+@@ -3478,10 +3819,23 @@ void rtw_issue_addbareq_cmd(_adapter *padapter, struct xmit_frame *pxmitframe)
if (pattrib->psta)
psta = pattrib->psta;
else
phtpriv = &psta->htpriv;
-@@ -3503,6 +3857,18 @@ void rtw_issue_addbareq_cmd(_adapter *pa
+@@ -3503,6 +3857,18 @@ void rtw_issue_addbareq_cmd(_adapter *padapter, struct xmit_frame *pxmitframe)
#endif
#ifdef CONFIG_LAYER2_ROAMING
void rtw_roaming(_adapter *padapter, struct wlan_network *tgt_network)
{
_irqL irqL;
-@@ -3524,7 +3890,7 @@ void _rtw_roaming(_adapter *padapter, st
+@@ -3524,7 +3890,7 @@ void _rtw_roaming(_adapter *padapter, struct wlan_network *tgt_network)
else
pnetwork = &pmlmepriv->cur_network;
DBG_871X("roaming from %s("MAC_FMT"), length:%d\n",
pnetwork->network.Ssid.Ssid, MAC_ARG(pnetwork->network.MacAddress),
pnetwork->network.Ssid.SsidLength);
-@@ -3539,7 +3905,7 @@ void _rtw_roaming(_adapter *padapter, st
+@@ -3539,7 +3905,7 @@ void _rtw_roaming(_adapter *padapter, struct wlan_network *tgt_network)
DBG_871X("roaming do_join return %d\n", do_join_r);
pmlmepriv->to_roaming--;
continue;
} else {
DBG_871X("%s(%d) -to roaming fail, indicate_disconnect\n", __FUNCTION__,__LINE__);
-@@ -3553,3 +3919,49 @@ void _rtw_roaming(_adapter *padapter, st
+@@ -3553,3 +3919,49 @@ void _rtw_roaming(_adapter *padapter, struct wlan_network *tgt_network)
}
#endif
+}
+#endif //CONFIG_CONCURRENT_MODE
+
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c b/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c
+index e1e496d..d29a20c 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c
@@ -1,6 +1,6 @@
#else //CONFIG_DISABLE_MCS13TO15
unsigned char MCS_rate_2R[16] = {0xff, 0xff, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
#endif //CONFIG_DISABLE_MCS13TO15
-@@ -147,6 +157,7 @@ static RT_CHANNEL_PLAN_2G RTW_ChannelPla
+@@ -147,6 +157,7 @@ static RT_CHANNEL_PLAN_2G RTW_ChannelPlan2G[RT_CHANNEL_DOMAIN_2G_MAX] = {
{{1,2,3,4,5,6,7,8,9,10,11},11}, // 0x02, RT_CHANNEL_DOMAIN_2G_FCC1
{{1,2,3,4,5,6,7,8,9,10,11,12,13,14},14}, // 0x03, RT_CHANNEL_DOMAIN_2G_MIKK1
{{10,11,12,13},4}, // 0x04, RT_CHANNEL_DOMAIN_2G_ETSI2
};
static RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = {
-@@ -171,6 +182,7 @@ static RT_CHANNEL_PLAN_5G RTW_ChannelPla
+@@ -171,6 +182,7 @@ static RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = {
//===== Driver self defined for old channel plan Compatible ,Remember to modify if have new channel plan definition =====
{{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161,165},21}, // 0x11, RT_CHANNEL_DOMAIN_5G_FCC
{{36,40,44,48},4}, // 0x12, RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS
};
static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = {
-@@ -180,8 +192,8 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPl
+@@ -180,8 +192,8 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = {
{0x01,0x01}, //0x02, RT_CHANNEL_DOMAIN_ETSI
{0x01,0x00}, //0x03, RT_CHANNEL_DOMAIN_SPAIN
{0x01,0x00}, //0x04, RT_CHANNEL_DOMAIN_FRANCE
{0x01,0x09}, //0x07, RT_CHANNEL_DOMAIN_ISRAEL
{0x03,0x09}, //0x08, RT_CHANNEL_DOMAIN_TELEC
{0x03,0x00}, //0x09, RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN
-@@ -196,18 +208,17 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPl
+@@ -196,18 +208,17 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = {
{0x01,0x12}, //0x12, RT_CHANNEL_DOMAIN_JAPAN_NO_DFS
{0x00,0x04}, //0x13, RT_CHANNEL_DOMAIN_WORLD_WIDE_5G
{0x02,0x10}, //0x14, RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS
//===== 0x20 ~ 0x7F ,New Define =====
{0x00,0x00}, //0x20, RT_CHANNEL_DOMAIN_WORLD_NULL
{0x01,0x00}, //0x21, RT_CHANNEL_DOMAIN_ETSI1_NULL
-@@ -244,24 +255,44 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPl
+@@ -244,24 +255,44 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = {
{0x02,0x10}, //0x40, RT_CHANNEL_DOMAIN_FCC1_NCC2
};
}
/****************************************************************************
-@@ -286,20 +317,21 @@ static void init_mlme_ext_priv_value(_ad
+@@ -286,20 +317,21 @@ static void init_mlme_ext_priv_value(_adapter* padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
pmlmeext->retry = 0;
pmlmeext->cur_wireless_mode = padapter->registrypriv.wireless_mode;
-@@ -309,10 +341,14 @@ static void init_mlme_ext_priv_value(_ad
+@@ -309,10 +341,14 @@ static void init_mlme_ext_priv_value(_adapter* padapter)
_rtw_memcpy(pmlmeext->datarate, mixed_datarate, NumRates);
_rtw_memcpy(pmlmeext->basicrate, mixed_basicrate, NumRates);
pmlmeext->scan_abort = _FALSE;
pmlmeinfo->state = WIFI_FW_NULL_STATE;
-@@ -333,6 +369,79 @@ static void init_mlme_ext_priv_value(_ad
+@@ -333,6 +369,79 @@ static void init_mlme_ext_priv_value(_adapter* padapter)
pmlmeinfo->preamble_mode = PREAMBLE_AUTO;
pmlmeinfo->dialogToken = 0;
}
static u8 init_channel_set(_adapter* padapter, u8 ChannelPlan, RT_CHANNEL_INFO *channel_set)
-@@ -407,7 +516,7 @@ static u8 init_channel_set(_adapter* pad
+@@ -407,7 +516,7 @@ static u8 init_channel_set(_adapter* padapter, u8 ChannelPlan, RT_CHANNEL_INFO *
if ( channel_set[chanset_size].ChannelNum <= 48
|| channel_set[chanset_size].ChannelNum >= 149 )
{
channel_set[chanset_size].ScanType = SCAN_PASSIVE;
else
channel_set[chanset_size].ScanType = SCAN_ACTIVE;
-@@ -421,7 +530,7 @@ static u8 init_channel_set(_adapter* pad
+@@ -421,7 +530,7 @@ static u8 init_channel_set(_adapter* padapter, u8 ChannelPlan, RT_CHANNEL_INFO *
if ( RTW_ChannelPlan5G[Index5G].Channel[index] <= 48
|| RTW_ChannelPlan5G[Index5G].Channel[index] >= 149 ) {
channel_set[chanset_size].ChannelNum = RTW_ChannelPlan5G[Index5G].Channel[index];
channel_set[chanset_size].ScanType = SCAN_PASSIVE;
else
channel_set[chanset_size].ScanType = SCAN_ACTIVE;
-@@ -460,10 +569,16 @@ int init_mlme_ext_priv(_adapter* padapte
+@@ -460,10 +569,16 @@ int init_mlme_ext_priv(_adapter* padapter)
#endif
pmlmeext->max_chan_nums = init_channel_set(padapter, pmlmepriv->ChannelPlan,pmlmeext->channel_set);
return res;
}
-@@ -483,69 +598,6 @@ void free_mlme_ext_priv (struct mlme_ext
+@@ -483,69 +598,6 @@ void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext)
}
}
static u8 cmp_pkt_chnl_diff(_adapter *padapter,u8* pframe,uint packet_len)
{ // if the channel is same, return 0. else return channel differential
uint len;
-@@ -569,11 +621,11 @@ static u8 cmp_pkt_chnl_diff(_adapter *pa
+@@ -569,11 +621,11 @@ static u8 cmp_pkt_chnl_diff(_adapter *padapter,u8* pframe,uint packet_len)
return 0;
}
}
if(ptable->func)
{
-@@ -593,10 +645,12 @@ void mgt_dispatcher(_adapter *padapter,
+@@ -593,10 +645,12 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
{
int index;
struct mlme_handler *ptable;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
("+mgt_dispatcher: type(0x%x) subtype(0x%x)\n",
-@@ -606,11 +660,11 @@ void mgt_dispatcher(_adapter *padapter,
+@@ -606,11 +660,11 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
{
u8 *pbuf;
pbuf = GetAddr1Ptr(pframe);
}
#endif
-@@ -633,13 +687,15 @@ void mgt_dispatcher(_adapter *padapter,
+@@ -633,13 +687,15 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
#ifdef CONFIG_TDLS
if((index << 4)==WIFI_ACTION){
if (index > 13)
{
-@@ -648,18 +704,19 @@ void mgt_dispatcher(_adapter *padapter,
+@@ -648,18 +704,19 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
}
ptable += index;
}
#else
-@@ -723,7 +780,37 @@ void mgt_dispatcher(_adapter *padapter,
+@@ -723,7 +780,37 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
#ifdef CONFIG_P2P
u32 p2p_listen_state_process(_adapter *padapter, unsigned char *da)
{
return _SUCCESS;
}
#endif //CONFIG_P2P
-@@ -750,6 +837,7 @@ unsigned int OnProbeReq(_adapter *padapt
+@@ -750,6 +837,7 @@ unsigned int OnProbeReq(_adapter *padapter, union recv_frame *precv_frame)
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
if ( !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) &&
!rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE) &&
-@@ -764,7 +852,17 @@ unsigned int OnProbeReq(_adapter *padapt
+@@ -764,7 +852,17 @@ unsigned int OnProbeReq(_adapter *padapter, union recv_frame *precv_frame)
// mcs_rate = 2 -> CCK 5.5M rate
// mcs_rate = 3 -> CCK 11M rate
// In the P2P mode, the driver should not support the CCK rate
}
-@@ -857,7 +1080,6 @@ unsigned int OnProbeRsp(_adapter *padapt
+@@ -857,7 +1080,6 @@ unsigned int OnProbeRsp(_adapter *padapter, union recv_frame *precv_frame)
{
pwdinfo->tx_prov_disc_info.benable = _FALSE;
issue_p2p_provision_request( padapter,
pwdinfo->tx_prov_disc_info.ssid.Ssid,
pwdinfo->tx_prov_disc_info.ssid.SsidLength,
pwdinfo->tx_prov_disc_info.peerDevAddr );
-@@ -866,7 +1088,6 @@ unsigned int OnProbeRsp(_adapter *padapt
+@@ -866,7 +1088,6 @@ unsigned int OnProbeRsp(_adapter *padapter, union recv_frame *precv_frame)
{
pwdinfo->tx_prov_disc_info.benable = _FALSE;
issue_p2p_provision_request( padapter,
NULL,
0,
pwdinfo->tx_prov_disc_info.peerDevAddr );
-@@ -887,12 +1108,30 @@ unsigned int OnProbeRsp(_adapter *padapt
+@@ -887,12 +1108,30 @@ unsigned int OnProbeRsp(_adapter *padapter, union recv_frame *precv_frame)
}
}
}
return _SUCCESS;
}
-@@ -922,10 +1161,33 @@ unsigned int OnBeacon(_adapter *padapter
+@@ -922,10 +1161,33 @@ unsigned int OnBeacon(_adapter *padapter, union recv_frame *precv_frame)
struct sta_priv *pstapriv = &padapter->stapriv;
u8 *pframe = precv_frame->u.hdr.rx_data;
uint len = precv_frame->u.hdr.len;
return _SUCCESS;
}
-@@ -935,6 +1197,10 @@ unsigned int OnBeacon(_adapter *padapter
+@@ -935,6 +1197,10 @@ unsigned int OnBeacon(_adapter *padapter, union recv_frame *precv_frame)
{
//check the vendor of the assoc AP
pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pframe+sizeof(struct rtw_ieee80211_hdr_3addr), len-sizeof(struct rtw_ieee80211_hdr_3addr));
//update TSF Value
update_TSF(pmlmeext, pframe, len);
-@@ -973,9 +1239,10 @@ unsigned int OnBeacon(_adapter *padapter
+@@ -973,9 +1239,10 @@ unsigned int OnBeacon(_adapter *padapter, union recv_frame *precv_frame)
process_csa_ie(padapter, pframe, len); //channel switch announcement
#endif //CONFIG_DFS
#if 0 //move to validate_recv_mgnt_frame
psta->sta_stats.rx_mgnt_pkts++;
-@@ -1045,6 +1312,16 @@ unsigned int OnAuth(_adapter *padapter,
+@@ -1045,6 +1312,16 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
u8 *pframe = precv_frame->u.hdr.rx_data;
uint len = precv_frame->u.hdr.len;
if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
return _FAIL;
-@@ -1053,8 +1330,8 @@ unsigned int OnAuth(_adapter *padapter,
+@@ -1053,8 +1330,8 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
sa = GetAddr2Ptr(pframe);
auth_mode = psecuritypriv->dot11AuthAlgrthm;
if (GetPrivacy(pframe))
{
-@@ -1096,7 +1373,7 @@ unsigned int OnAuth(_adapter *padapter,
+@@ -1096,7 +1373,7 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
goto auth_fail;
}
phead = &priv->wlan_acl_list;
plist = phead->next;
//check sa
-@@ -1125,13 +1402,19 @@ unsigned int OnAuth(_adapter *padapter,
+@@ -1125,13 +1402,19 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,"auth abort because ACL!\n");
return FAIL;
}
pstat = rtw_alloc_stainfo(pstapriv, sa);
if (pstat == NULL)
{
-@@ -1152,6 +1435,7 @@ unsigned int OnAuth(_adapter *padapter,
+@@ -1152,6 +1435,7 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
if(rtw_is_list_empty(&pstat->asoc_list)==_FALSE)
{
rtw_list_delete(&pstat->asoc_list);
if (pstat->expire_to > 0)
{
//TODO: STA re_auth within expire_to
-@@ -1168,6 +1452,7 @@ unsigned int OnAuth(_adapter *padapter,
+@@ -1168,6 +1452,7 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
if (rtw_is_list_empty(&pstat->auth_list))
{
rtw_list_insert_tail(&pstat->auth_list, &pstapriv->auth_list);
}
_exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
-@@ -1266,13 +1551,13 @@ unsigned int OnAuth(_adapter *padapter,
+@@ -1266,13 +1551,13 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
auth_fail:
#ifdef CONFIG_NATIVEAP_MLME
issue_auth(padapter, pstat, (unsigned short)status);
-@@ -1334,7 +1619,7 @@ unsigned int OnAuthClient(_adapter *pada
+@@ -1334,7 +1619,7 @@ unsigned int OnAuthClient(_adapter *padapter, union recv_frame *precv_frame)
if (p == NULL)
{
goto authclnt_fail;
}
-@@ -1365,7 +1650,7 @@ unsigned int OnAuthClient(_adapter *pada
+@@ -1365,7 +1650,7 @@ unsigned int OnAuthClient(_adapter *padapter, union recv_frame *precv_frame)
else
{
// this is also illegal
goto authclnt_fail;
}
-@@ -1388,13 +1673,11 @@ unsigned int OnAssocReq(_adapter *padapt
+@@ -1388,13 +1673,11 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame)
#ifdef CONFIG_AP_MODE
_irqL irqL;
u16 capab_info, listen_interval;
unsigned char supportRate[16];
int supportRateNum;
unsigned short status = _STATS_SUCCESSFUL_;
-@@ -1418,6 +1701,15 @@ unsigned int OnAssocReq(_adapter *padapt
+@@ -1418,6 +1701,15 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame)
#endif // CONFIG_WFD
#endif //CONFIG_P2P
if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
return _FAIL;
-@@ -1668,7 +1960,7 @@ unsigned int OnAssocReq(_adapter *padapt
+@@ -1668,7 +1960,7 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame)
{
u8 selected_registrar = 0;
if(!selected_registrar)
{
-@@ -1709,7 +2001,7 @@ unsigned int OnAssocReq(_adapter *padapt
+@@ -1709,7 +2001,7 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame)
copy_len = ((wpa_ie_len+2) > sizeof(pstat->wpa_ie)) ? (sizeof(pstat->wpa_ie)):(wpa_ie_len+2);
}
if(copy_len>0)
_rtw_memcpy(pstat->wpa_ie, wpa_ie-2, copy_len);
-@@ -1859,12 +2151,12 @@ unsigned int OnAssocReq(_adapter *padapt
+@@ -1859,12 +2151,12 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame)
rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen);
if ( attr_contentlen )
{
pstat->p2p_status_code = p2p_status_code;
#endif //CONFIG_P2P
-@@ -1910,6 +2202,7 @@ unsigned int OnAssocReq(_adapter *padapt
+@@ -1910,6 +2202,7 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame)
if (!rtw_is_list_empty(&pstat->auth_list))
{
rtw_list_delete(&pstat->auth_list);
}
_exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
-@@ -1917,7 +2210,8 @@ unsigned int OnAssocReq(_adapter *padapt
+@@ -1917,7 +2210,8 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame)
if (rtw_is_list_empty(&pstat->asoc_list))
{
pstat->expire_to = pstapriv->expire_to;
}
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-@@ -1926,53 +2220,54 @@ unsigned int OnAssocReq(_adapter *padapt
+@@ -1926,53 +2220,54 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame)
{
#ifdef CONFIG_NATIVEAP_MLME
//.1 bss_cap_update & sta_info_update
#endif
}
-@@ -2011,6 +2306,7 @@ unsigned int OnAssocRsp(_adapter *padapt
+@@ -2011,6 +2306,7 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame)
int res;
unsigned short status;
PNDIS_802_11_VARIABLE_IEs pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
//WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
-@@ -2063,13 +2359,13 @@ unsigned int OnAssocRsp(_adapter *padapt
+@@ -2063,13 +2359,13 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame)
{
WMM_param_handler(padapter, pIE);
}
break;
case _HT_CAPABILITY_IE_: //HT caps
-@@ -2096,10 +2392,22 @@ unsigned int OnAssocRsp(_adapter *padapt
+@@ -2096,10 +2392,22 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame)
//Update Basic Rate Table for spec, 2010-12-28 , by thomas
UpdateBrateTbl(padapter, pmlmeinfo->network.SupportedRates);
return _SUCCESS;
}
-@@ -2110,11 +2418,22 @@ unsigned int OnDeAuth(_adapter *padapter
+@@ -2110,11 +2418,22 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 *pframe = precv_frame->u.hdr.rx_data;
reason = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN));
DBG_871X("%s Reason code(%d)\n", __FUNCTION__,reason);
-@@ -2128,48 +2447,87 @@ unsigned int OnDeAuth(_adapter *padapter
+@@ -2128,31 +2447,59 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame)
//_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
//rtw_free_stainfo(padapter, psta);
-
- receive_disconnect(padapter, GetAddr3Ptr(pframe) ,reason);
- }
-- pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE;
-- return _SUCCESS;
--
--}
+ int ignore_received_deauth = 0;
-
--unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
++
+ // Commented by Albert 20130604
+ // Before sending the auth frame to start the STA/GC mode connection with AP/GO,
+ // we will send the deauth first.
+ receive_disconnect(padapter, GetAddr3Ptr(pframe) ,reason);
+ }
+ }
-+ pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE;
-+ return _SUCCESS;
-+
-+}
-+
-+unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
- {
- unsigned short reason;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE;
+ return _SUCCESS;
+
+@@ -2165,11 +2512,22 @@ unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 *pframe = precv_frame->u.hdr.rx_data;
reason = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN));
DBG_871X("%s Reason code(%d)\n", __FUNCTION__,reason);
-@@ -2183,21 +2541,26 @@ unsigned int OnDisassoc(_adapter *padapt
+@@ -2183,21 +2541,26 @@ unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame)
//_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
//rtw_free_stainfo(padapter, psta);
}
return _SUCCESS;
-@@ -2220,6 +2583,107 @@ unsigned int OnAtim(_adapter *padapter,
+@@ -2220,6 +2583,107 @@ unsigned int OnAtim(_adapter *padapter, union recv_frame *precv_frame)
return _SUCCESS;
}
unsigned int OnAction_qos(_adapter *padapter, union recv_frame *precv_frame)
{
return _SUCCESS;
-@@ -2242,8 +2706,6 @@ unsigned int OnAction_back(_adapter *pad
+@@ -2242,8 +2706,6 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 *pframe = precv_frame->u.hdr.rx_data;
struct sta_priv *pstapriv = &padapter->stapriv;
//check RA matches or not
if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))//for if1, sta/ap mode
-@@ -2271,6 +2733,15 @@ unsigned int OnAction_back(_adapter *pad
+@@ -2271,6 +2733,15 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame)
category = frame_body[0];
if (category == RTW_WLAN_CATEGORY_BACK)// representing Block Ack
{
if (!pmlmeinfo->HT_enable)
{
return _SUCCESS;
-@@ -2314,7 +2785,7 @@ unsigned int OnAction_back(_adapter *pad
+@@ -2314,7 +2785,7 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame)
psta->htpriv.agg_enable_bitmap &= ~BIT(tid);
}
break;
case RTW_WLAN_ACTION_DELBA: //DELBA
-@@ -2339,7 +2810,7 @@ unsigned int OnAction_back(_adapter *pad
+@@ -2339,7 +2810,7 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame)
#endif
}
//todo: how to notify the host while receiving DELETE BA
break;
-@@ -2352,6 +2823,45 @@ unsigned int OnAction_back(_adapter *pad
+@@ -2352,6 +2823,45 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame)
}
#ifdef CONFIG_P2P
void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
{
-@@ -2361,10 +2871,11 @@ void issue_p2p_GO_request(_adapter *pada
+@@ -2361,10 +2871,11 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
u8 oui_subtype = P2P_GO_NEGO_REQ;
u8 wpsie[ 255 ] = { 0x00 }, p2pie[ 255 ] = { 0x00 };
u8 wpsielen = 0, p2pielen = 0, i;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
-@@ -2382,7 +2893,7 @@ void issue_p2p_GO_request(_adapter *pada
+@@ -2382,7 +2893,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
return;
}
//update attribute
pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib);
-@@ -2494,12 +3005,18 @@ void issue_p2p_GO_request(_adapter *pada
+@@ -2494,12 +3005,18 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
// Value:
// Device Capability Bitmap, 1 byte
// Group Owner Intent
// Type:
-@@ -2536,8 +3053,8 @@ void issue_p2p_GO_request(_adapter *pada
+@@ -2536,8 +3053,8 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
// Value:
// Country String
// The third byte should be set to 0x04.
// Described in the "Operating Channel Attribute" section.
-@@ -2585,33 +3102,104 @@ void issue_p2p_GO_request(_adapter *pada
+@@ -2585,33 +3102,104 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
// Type:
p2pie[ p2pielen++ ] = P2P_ATTR_CH_LIST;
// Device Info
// Type:
-@@ -2637,7 +3225,7 @@ void issue_p2p_GO_request(_adapter *pada
+@@ -2637,7 +3225,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
// Primary Device Type
// Category ID
p2pielen += 2;
// OUI
-@@ -2645,7 +3233,7 @@ void issue_p2p_GO_request(_adapter *pada
+@@ -2645,7 +3233,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
p2pielen += 4;
// Sub Category ID
p2pielen += 2;
// Number of Secondary Device Types
-@@ -2675,16 +3263,30 @@ void issue_p2p_GO_request(_adapter *pada
+@@ -2675,16 +3263,30 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr)
// Value:
// Country String
// Channel Number
p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // operating channel number
-@@ -2717,10 +3319,8 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -2717,10 +3319,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
uint wpsielen = 0;
u16 wps_devicepassword_id = 0x0000;
uint wps_devicepassword_id_len = 0;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
-@@ -2732,13 +3332,16 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -2732,13 +3332,16 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct wifidirect_info *pwdinfo = &( padapter->wdinfo);
//update attribute
pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib);
-@@ -2839,7 +3442,7 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -2839,7 +3442,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
_rtw_memcpy( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "pbc", 3 );
}
}
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen );
-@@ -2899,13 +3502,18 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -2899,13 +3502,18 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
else
{
// Be group owner or meet the error case
// Group Owner Intent
// Type:
-@@ -2950,15 +3558,29 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -2950,15 +3558,29 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
// Value:
// Country String
// Channel Number
p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // operating channel number
-@@ -2979,33 +3601,103 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -2979,33 +3601,103 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
// Type:
p2pie[ p2pielen++ ] = P2P_ATTR_CH_LIST;
+ p2pie[ p2pielen++ ] = pbuddy_mlmeext->cur_channel;
+ }
+ else
-+ {
+ {
+- p2pie[ p2pielen++ ] = pmlmeext->channel_set[ i ].ChannelNum;
+ int i, j;
+ for (j = 0; j < pmlmeext->channel_list.reg_classes; j++) {
+ // Operating Class
+ }
+ }
+#else // CONFIG_CONCURRENT_MODE
- {
-- p2pie[ p2pielen++ ] = pmlmeext->channel_set[ i ].ChannelNum;
++ {
+ int i, j;
+ for (j = 0; j < pmlmeext->channel_list.reg_classes; j++) {
+ // Operating Class
// Device Info
// Type:
-@@ -3031,7 +3723,7 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -3031,7 +3723,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
// Primary Device Type
// Category ID
p2pielen += 2;
// OUI
-@@ -3039,7 +3731,7 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -3039,7 +3731,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
p2pielen += 4;
// Sub Category ID
p2pielen += 2;
// Number of Secondary Device Types
-@@ -3080,12 +3772,12 @@ void issue_p2p_GO_response(_adapter *pad
+@@ -3080,12 +3772,12 @@ void issue_p2p_GO_response(_adapter *padapter, u8* raddr, u8* frame_body,uint le
}
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen );
pattrib->last_txcmdsz = pattrib->pktlen;
-@@ -3104,9 +3796,6 @@ void issue_p2p_GO_confirm(_adapter *pada
+@@ -3104,9 +3796,6 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8* raddr, u8 result)
u8 oui_subtype = P2P_GO_NEGO_CONF;
u8 wpsie[ 255 ] = { 0x00 }, p2pie[ 255 ] = { 0x00 };
u8 wpsielen = 0, p2pielen = 0;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
-@@ -3117,14 +3806,16 @@ void issue_p2p_GO_confirm(_adapter *pada
+@@ -3117,14 +3806,16 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8* raddr, u8 result)
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct wifidirect_info *pwdinfo = &( padapter->wdinfo);
//update attribute
pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib);
-@@ -3194,12 +3885,17 @@ void issue_p2p_GO_confirm(_adapter *pada
+@@ -3194,12 +3885,17 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8* raddr, u8 result)
// Value:
// Device Capability Bitmap, 1 byte
// Operating Channel
-@@ -3212,24 +3908,54 @@ void issue_p2p_GO_confirm(_adapter *pada
+@@ -3212,22 +3908,52 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8* raddr, u8 result)
// Value:
// Country String
if ( rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) )
{
-- p2pie[ p2pielen++ ] = pwdinfo->peer_operating_ch;
-- }
-- else
-- {
-- // Channel Number
-- p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // Use the listen channel as the operating channel
+ if ( pwdinfo->peer_operating_ch <= 14 )
+ {
+ // Operating Class
+ p2pie[ p2pielen++ ] = 0x7c;
+ }
+
-+ p2pie[ p2pielen++ ] = pwdinfo->peer_operating_ch;
-+ }
-+ else
-+ {
+ p2pie[ p2pielen++ ] = pwdinfo->peer_operating_ch;
+ }
+ else
+ {
+ if ( pwdinfo->operating_channel <= 14 )
+ {
+ // Operating Class
+ p2pie[ p2pielen++ ] = 0x7c;
+ }
+
-+ // Channel Number
-+ p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // Use the listen channel as the operating channel
+ // Channel Number
+ p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // Use the listen channel as the operating channel
}
-
-
-@@ -3237,29 +3963,60 @@ void issue_p2p_GO_confirm(_adapter *pada
+@@ -3237,29 +3963,60 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8* raddr, u8 result)
// Type:
p2pie[ p2pielen++ ] = P2P_ATTR_CH_LIST;
if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) )
{
-@@ -3282,12 +4039,12 @@ void issue_p2p_GO_confirm(_adapter *pada
+@@ -3282,12 +4039,12 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8* raddr, u8 result)
}
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen );
pattrib->last_txcmdsz = pattrib->pktlen;
-@@ -3305,9 +4062,20 @@ void issue_p2p_invitation_request(_adapt
+@@ -3305,9 +4062,20 @@ void issue_p2p_invitation_request(_adapter *padapter, u8* raddr )
u32 p2poui = cpu_to_be32(P2POUI);
u8 oui_subtype = P2P_INVIT_REQ;
u8 p2pie[ 255 ] = { 0x00 };
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
-@@ -3367,7 +4135,7 @@ void issue_p2p_invitation_request(_adapt
+@@ -3367,7 +4135,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8* raddr )
// 1. Configuration Timeout
// 2. Invitation Flags
// 3. Operating Channel ( Only GO )
// 5. Channel List
// 6. P2P Group ID
// 7. P2P Device Info
-@@ -3396,42 +4164,153 @@ void issue_p2p_invitation_request(_adapt
+@@ -3396,42 +4164,153 @@ void issue_p2p_invitation_request(_adapter *padapter, u8* raddr )
p2pie[ p2pielen++ ] = P2P_INVITATION_FLAGS_PERSISTENT;
+
+ // Channel Number
+ p2pie[ p2pielen++ ] = pwdinfo->invitereq_info.operating_ch; // operating channel number
-+
+
+- // Number of Channels
+- p2pie[ p2pielen++ ] = 0x0B; // support channel 1 - 11
+ if ( _rtw_memcmp( myid( &padapter->eeprompriv ), pwdinfo->invitereq_info.go_bssid, ETH_ALEN ) )
+ {
+ // P2P Group BSSID
+ // Type:
+ p2pie[ p2pielen++ ] = P2P_ATTR_GROUP_BSSID;
-
-- // Number of Channels
-- p2pie[ p2pielen++ ] = 0x0B; // support channel 1 - 11
++
+ // Length:
+ *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( ETH_ALEN );
+ p2pielen += 2;
// P2P Group ID
// Type:
-@@ -3443,11 +4322,11 @@ void issue_p2p_invitation_request(_adapt
+@@ -3443,11 +4322,11 @@ void issue_p2p_invitation_request(_adapter *padapter, u8* raddr )
// Value:
// P2P Device Address for GO
p2pielen += pwdinfo->invitereq_info.ssidlen;
-@@ -3473,7 +4352,7 @@ void issue_p2p_invitation_request(_adapt
+@@ -3473,7 +4352,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8* raddr )
// Primary Device Type
// Category ID
p2pielen += 2;
// OUI
-@@ -3481,7 +4360,7 @@ void issue_p2p_invitation_request(_adapt
+@@ -3481,7 +4360,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8* raddr )
p2pielen += 4;
// Sub Category ID
p2pielen += 2;
// Number of Secondary Device Types
-@@ -3501,7 +4380,12 @@ void issue_p2p_invitation_request(_adapt
+@@ -3501,7 +4380,12 @@ void issue_p2p_invitation_request(_adapter *padapter, u8* raddr )
p2pielen += pwdinfo->device_name_len;
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen );
pattrib->last_txcmdsz = pattrib->pktlen;
-@@ -3511,7 +4395,7 @@ void issue_p2p_invitation_request(_adapt
+@@ -3511,7 +4395,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8* raddr )
}
{
unsigned char category = RTW_WLAN_CATEGORY_PUBLIC;
-@@ -3519,7 +4403,18 @@ void issue_p2p_invitation_response(_adap
+@@ -3519,7 +4403,18 @@ void issue_p2p_invitation_response(_adapter *padapter, u8* raddr, u8 dialogToken
u32 p2poui = cpu_to_be32(P2POUI);
u8 oui_subtype = P2P_INVIT_RESP;
u8 p2pie[ 255 ] = { 0x00 };
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
-@@ -3592,19 +4487,13 @@ void issue_p2p_invitation_response(_adap
+@@ -3592,19 +4487,13 @@ void issue_p2p_invitation_response(_adapter *padapter, u8* raddr, u8 dialogToken
p2pielen += 2;
// Value:
// Configuration Timeout
// Type:
-@@ -3618,49 +4507,164 @@ void issue_p2p_invitation_response(_adap
+@@ -3618,49 +4507,164 @@ void issue_p2p_invitation_response(_adapter *padapter, u8* raddr, u8 dialogToken
p2pie[ p2pielen++ ] = 200; // 2 seconds needed to be the P2P GO
p2pie[ p2pielen++ ] = 200; // 2 seconds needed to be the P2P Client
pattrib->last_txcmdsz = pattrib->pktlen;
-@@ -3670,7 +4674,7 @@ void issue_p2p_invitation_response(_adap
+@@ -3670,7 +4674,7 @@ void issue_p2p_invitation_response(_adapter *padapter, u8* raddr, u8 dialogToken
}
{
unsigned char category = RTW_WLAN_CATEGORY_PUBLIC;
u8 action = P2P_PUB_ACTION_ACTION;
-@@ -3700,7 +4704,7 @@ void issue_p2p_provision_request(_adapte
+@@ -3700,7 +4704,7 @@ void issue_p2p_provision_request(_adapter *padapter, u8* pinterface_raddr, u8* p
return;
}
//update attribute
pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib);
-@@ -3713,10 +4717,9 @@ void issue_p2p_provision_request(_adapte
+@@ -3713,10 +4717,9 @@ void issue_p2p_provision_request(_adapter *padapter, u8* pinterface_raddr, u8* p
fctrl = &(pwlanhdr->frame_ctl);
*(fctrl) = 0;
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
-@@ -3783,21 +4786,22 @@ void issue_p2p_provision_request(_adapte
+@@ -3783,21 +4786,22 @@ void issue_p2p_provision_request(_adapter *padapter, u8* pinterface_raddr, u8* p
}
break;
}
}
-@@ -3816,6 +4820,7 @@ void issue_probersp_p2p(_adapter *padapt
+@@ -3816,6 +4820,7 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
//WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
u16 beacon_interval = 100;
u16 capInfo = 0;
-@@ -3825,13 +4830,10 @@ void issue_probersp_p2p(_adapter *padapt
+@@ -3825,13 +4830,10 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
#ifdef CONFIG_WFD
u32 wfdielen = 0;
#endif //CONFIG_WFD
//DBG_871X("%s\n", __FUNCTION__);
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
-@@ -3893,20 +4895,10 @@ void issue_probersp_p2p(_adapter *padapt
+@@ -3893,20 +4895,10 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, pwdinfo->support_rate, &pattrib->pktlen);
// DS parameter set
{
if( pmlmepriv->wps_probe_resp_ie != NULL && pmlmepriv->p2p_probe_resp_ie != NULL )
{
-@@ -3922,7 +4914,7 @@ void issue_probersp_p2p(_adapter *padapt
+@@ -3922,7 +4914,7 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
}
}
else
{
// Todo: WPS IE
-@@ -3946,6 +4938,41 @@ void issue_probersp_p2p(_adapter *padapt
+@@ -3946,9 +4938,44 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
// Value:
wpsie[wpsielen++] = WPS_VERSION_1; // Version 1.0
+- // WiFi Simple Config State
+- // Type:
+- *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_SIMPLE_CONF_STATE );
+#ifdef CONFIG_INTEL_WIDI
+ // Commented by Kurt
+ // Appended WiDi info. only if we did issued_probereq_widi(), and then we saved ven. ext. in pmlmepriv->sa_ext.
+ }
+#endif //CONFIG_INTEL_WIDI
+
- // WiFi Simple Config State
- // Type:
- *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_SIMPLE_CONF_STATE );
-@@ -3980,7 +5007,12 @@ void issue_probersp_p2p(_adapter *padapt
++ // WiFi Simple Config State
++ // Type:
++ *(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_SIMPLE_CONF_STATE );
+ wpsielen += 2;
+
+ // Length:
+@@ -3980,7 +5007,12 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
wpsielen += 2;
// Value:
wpsielen += 0x10;
// Manufacturer
-@@ -4081,7 +5113,7 @@ void issue_probersp_p2p(_adapter *padapt
+@@ -4081,7 +5113,7 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
// Value:
*(u16*) ( wpsie + wpsielen ) = cpu_to_be16( pwdinfo->supported_wps_cm );
wpsielen += 2;
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen );
-@@ -4092,10 +5124,24 @@ void issue_probersp_p2p(_adapter *padapt
+@@ -4092,10 +5124,24 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
}
#ifdef CONFIG_WFD
pattrib->last_txcmdsz = pattrib->pktlen;
-@@ -4106,8 +5152,9 @@ void issue_probersp_p2p(_adapter *padapt
+@@ -4106,8 +5152,9 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da)
}
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
-@@ -4126,12 +5173,13 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4126,12 +5173,13 @@ void issue_probereq_p2p(_adapter *padapter)
#ifdef CONFIG_WFD
u32 wfdielen = 0;
#endif //CONFIG_WFD
}
//update attribute
-@@ -4149,9 +5197,23 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4149,9 +5197,23 @@ void issue_probereq_p2p(_adapter *padapter)
fctrl = &(pwlanhdr->frame_ctl);
*(fctrl) = 0;
_rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
-@@ -4168,14 +5230,14 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4168,14 +5230,14 @@ void issue_probereq_p2p(_adapter *padapter)
else
{
pframe = rtw_set_ie(pframe, _SSID_IE_, P2P_WILDCARD_SSID_LEN, pwdinfo->p2p_wildcard_ssid, &(pattrib->pktlen));
{
//WPS IE
_rtw_memcpy(pframe, pmlmepriv->wps_probe_req_ie, pmlmepriv->wps_probe_req_ie_len);
-@@ -4213,6 +5275,40 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4213,6 +5275,40 @@ void issue_probereq_p2p(_adapter *padapter)
// Value:
wpsie[wpsielen++] = WPS_VERSION_1; // Version 1.0
// Device Name
// Type:
*(u16*) ( wpsie + wpsielen ) = cpu_to_be16( WPS_ATTR_DEVICE_NAME );
-@@ -4237,7 +5333,7 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4237,7 +5333,7 @@ void issue_probereq_p2p(_adapter *padapter)
// Value:
// Category ID
wpsielen += 2;
// OUI
-@@ -4245,7 +5341,20 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4245,7 +5341,20 @@ void issue_probereq_p2p(_adapter *padapter)
wpsielen += 4;
// Sub Category ID
wpsielen += 2;
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen );
-@@ -4275,12 +5384,13 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4275,12 +5384,13 @@ void issue_probereq_p2p(_adapter *padapter)
// Value:
// Device Capability Bitmap, 1 byte
// Listen Channel
// Type:
-@@ -4292,8 +5402,8 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4292,8 +5402,8 @@ void issue_probereq_p2p(_adapter *padapter)
// Value:
// Country String
// The third byte should be set to 0x04.
// Described in the "Operating Channel Attribute" section.
-@@ -4335,8 +5445,8 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4335,8 +5445,8 @@ void issue_probereq_p2p(_adapter *padapter)
// Value:
// Country String
// The third byte should be set to 0x04.
// Described in the "Operating Channel Attribute" section.
-@@ -4349,283 +5459,702 @@ void issue_probereq_p2p(_adapter *padapt
+@@ -4349,283 +5459,702 @@ void issue_probereq_p2p(_adapter *padapter)
p2pie[ p2pielen++ ] = pwdinfo->operating_channel; // operating channel number
}
+ // After having the peer interface address, the sigma can find the correct conf file for wpa_supplicant.
+
+ if ( attr_contentlen )
++ {
++ DBG_871X( "[%s] GO's BSSID = %.2X %.2X %.2X %.2X %.2X %.2X\n", __FUNCTION__,
++ pwdinfo->p2p_peer_interface_addr[0], pwdinfo->p2p_peer_interface_addr[1],
++ pwdinfo->p2p_peer_interface_addr[2], pwdinfo->p2p_peer_interface_addr[3],
++ pwdinfo->p2p_peer_interface_addr[4], pwdinfo->p2p_peer_interface_addr[5] );
++ }
++
++ if ( invitation_flag & P2P_INVITATION_FLAGS_PERSISTENT )
{
- // Parse the necessary information from the P2P Invitation Request frame.
- // For example: The MAC address of sending this P2P Invitation Request frame.
- rtw_p2p_set_state(pwdinfo, P2P_STATE_RECV_INVITE_REQ);
- DBG_871X( "[%s] peer address %.2X %.2X %.2X %.2X %.2X %.2X\n", __FUNCTION__,
- groupid[0], groupid[1], groupid[2], groupid[3], groupid[4], groupid[5] );
-+ DBG_871X( "[%s] GO's BSSID = %.2X %.2X %.2X %.2X %.2X %.2X\n", __FUNCTION__,
-+ pwdinfo->p2p_peer_interface_addr[0], pwdinfo->p2p_peer_interface_addr[1],
-+ pwdinfo->p2p_peer_interface_addr[2], pwdinfo->p2p_peer_interface_addr[3],
-+ pwdinfo->p2p_peer_interface_addr[4], pwdinfo->p2p_peer_interface_addr[5] );
-+ }
-
+-
- if ( is_matched_in_profilelist( pwdinfo->p2p_peer_interface_addr, &pwdinfo->profileinfo[ 0 ] ) )
-+ if ( invitation_flag & P2P_INVITATION_FLAGS_PERSISTENT )
-+ {
+ // Re-invoke the persistent group.
+
+ _rtw_memset( &group_id, 0x00, sizeof( struct group_id_info ) );
+ DBG_871X( "[%s] P2P Invitation Flags Attribute NOT FOUND!\n", __FUNCTION__ );
+ status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE;
+ }
-+
+
+- process_p2p_devdisc_req(pwdinfo, pframe, len);
+ DBG_871X( "[%s] status_code = %d\n", __FUNCTION__, status_code );
-+
+
+- break;
+ pwdinfo->inviteresp_info.token = frame_body[ 7 ];
+ issue_p2p_invitation_response( padapter, GetAddr2Ptr(pframe), pwdinfo->inviteresp_info.token, status_code );
+ _set_timer( &pwdinfo->restore_p2p_state_timer, 3000 );
+ {
+ DBG_871X( "[%s] Status = %d\n", __FUNCTION__, attr_content );
+ pwdinfo->invitereq_info.benable = _FALSE;
-
-- process_p2p_devdisc_req(pwdinfo, pframe, len);
++
+ if ( attr_content == P2P_STATUS_SUCCESS )
+ {
+ if ( _rtw_memcmp( pwdinfo->invitereq_info.go_bssid, myid( &padapter->eeprompriv ), ETH_ALEN ))
+ rtw_p2p_set_state( pwdinfo, P2P_STATE_RX_INVITE_RESP_FAIL );
+ }
-- break;
+- case P2P_DEVDISC_RESP:
+ if ( rtw_p2p_chk_state( pwdinfo, P2P_STATE_RX_INVITE_RESP_FAIL ) )
+ {
+ _set_timer( &pwdinfo->restore_p2p_state_timer, 5000 );
+ }
+ case P2P_DEVDISC_REQ:
-- case P2P_DEVDISC_RESP:
-+ process_p2p_devdisc_req(pwdinfo, pframe, len);
-
- process_p2p_devdisc_resp(pwdinfo, pframe, len);
-+ break;
++ process_p2p_devdisc_req(pwdinfo, pframe, len);
- break;
-+ case P2P_DEVDISC_RESP:
++ break;
- case P2P_PROVISION_DISC_REQ:
- DBG_871X( "[%s] Got Provisioning Discovery Request Frame\n", __FUNCTION__ );
- process_p2p_provdisc_req(pwdinfo, pframe, len);
- _rtw_memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN);
--
++ case P2P_DEVDISC_RESP:
+
- //20110902 Kurt
- //Add the following statement to avoid receiving duplicate prov disc req. such that pre_p2p_state would be covered.
- if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ))
+ process_p2p_provdisc_req(pwdinfo, pframe, len);
+ _rtw_memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN);
-- }
-- }
+ //20110902 Kurt
+ //Add the following statement to avoid receiving duplicate prov disc req. such that pre_p2p_state would be covered.
+ if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ))
+ padapter->mlmepriv.widi_state = INTEL_WIDI_STATE_WFD_CONNECTION;
+ _cancel_timer_ex(&(padapter->mlmepriv.listen_timer));
+ intel_widi_wk_cmd(padapter, INTEL_WIDI_LISTEN_STOP_WK, NULL);
-+ }
+ }
+- }
+#endif //CONFIG_INTEL_WIDI
+ break;
-+
+
+- }
+ case P2P_PROVISION_DISC_RESP:
+ // Commented by Albert 20110707
+ // Should we check the pwdinfo->tx_prov_disc_info.bsent flag here??
+ process_p2p_provdisc_resp(pwdinfo, pframe);
+ _set_timer( &pwdinfo->restore_p2p_state_timer, P2P_PROVISION_TIMEOUT );
+ break;
-
-- }
++
+ }
+ }
#endif //CONFIG_P2P
unsigned int OnAction_wmm(_adapter *padapter, union recv_frame *precv_frame)
{
return _SUCCESS;
-@@ -4657,7 +6186,7 @@ unsigned int OnAction_p2p(_adapter *pada
+@@ -4657,7 +6186,7 @@ unsigned int OnAction_p2p(_adapter *padapter, union recv_frame *precv_frame)
return _SUCCESS;
#ifdef CONFIG_IOCTL_CFG80211
{
rtw_cfg80211_rx_action_p2p(padapter, pframe, len);
return _SUCCESS;
-@@ -4665,7 +6194,7 @@ unsigned int OnAction_p2p(_adapter *pada
+@@ -4665,7 +6194,7 @@ unsigned int OnAction_p2p(_adapter *padapter, union recv_frame *precv_frame)
else
#endif //CONFIG_IOCTL_CFG80211
{
OUI_Subtype = frame_body[5];
dialogToken = frame_body[6];
-@@ -4694,7 +6223,6 @@ unsigned int OnAction_p2p(_adapter *pada
+@@ -4694,7 +6223,6 @@ unsigned int OnAction_p2p(_adapter *padapter, union recv_frame *precv_frame)
}
}
#endif //CONFIG_P2P
return _SUCCESS;
-@@ -4728,43 +6256,53 @@ unsigned int OnAction(_adapter *padapter
+@@ -4728,43 +6256,53 @@ unsigned int OnAction(_adapter *padapter, union recv_frame *precv_frame)
unsigned int DoReserved(_adapter *padapter, union recv_frame *precv_frame)
{
/****************************************************************************
-@@ -4772,6 +6310,15 @@ Following are some TX fuctions for WiFi
+@@ -4772,6 +6310,15 @@ Following are some TX fuctions for WiFi MLME
*****************************************************************************/
void update_mgntframe_attrib(_adapter *padapter, struct pkt_attrib *pattrib)
{
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-@@ -4810,810 +6357,135 @@ void dump_mgntframe(_adapter *padapter,
+@@ -4810,1305 +6357,1051 @@ void dump_mgntframe(_adapter *padapter, struct xmit_frame *pmgntframe)
{
if(padapter->bSurpriseRemoved == _TRUE ||
padapter->bDriverStopped == _TRUE)
- _rtw_memcpy(pwlanhdr->addr1, ptdls_sta->hwaddr, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
--
++ rtw_sctx_init(&sctx, timeout_ms);
++ pxmitbuf->sctx = &sctx;
+
- ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]++;
- ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF;
- pattrib->seqnum = ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority];
- SetSeqNum(pwlanhdr, pattrib->seqnum);
-+ rtw_sctx_init(&sctx, timeout_ms);
-+ pxmitbuf->sctx = &sctx;
-
+-
- SetFrameSubType(pframe, WIFI_DATA_NULL);
+ ret = rtw_hal_mgnt_xmit(padapter, pmgntframe);
- struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct qos_priv *pqospriv= &pmlmepriv->qospriv;
--
++ if(padapter->bSurpriseRemoved == _TRUE ||
++ padapter->bDriverStopped == _TRUE)
++ {
++ rtw_free_xmitbuf(&padapter->xmitpriv, pmgntframe->pxmitbuf);
++ rtw_free_xmitframe(&padapter->xmitpriv, pmgntframe);
++ return -1;
++ }
+
- s32 res=_SUCCESS;
- sint bmcast;
--
++ _enter_critical_mutex(&pxmitpriv->ack_tx_mutex, NULL);
++ pxmitpriv->ack_tx = _TRUE;
+
- bmcast = IS_MCAST(pattrib->ra);
-
- psta = rtw_get_stainfo(pstapriv, pattrib->ra);
- if (psta == NULL) {
- res =_FAIL;
- goto exit;
-+ if(padapter->bSurpriseRemoved == _TRUE ||
-+ padapter->bDriverStopped == _TRUE)
-+ {
-+ rtw_free_xmitbuf(&padapter->xmitpriv, pmgntframe->pxmitbuf);
-+ rtw_free_xmitframe(&padapter->xmitpriv, pmgntframe);
-+ return -1;
++ pmgntframe->ack_report = 1;
++ if (rtw_hal_mgnt_xmit(padapter, pmgntframe) == _SUCCESS) {
++ ret = rtw_ack_tx_wait(pxmitpriv, timeout_ms);
}
- pattrib->mac_id = psta->mac_id;
-
- pattrib->psta = psta;
--
++ pxmitpriv->ack_tx = _FALSE;
++ _exit_critical_mutex(&pxmitpriv->ack_tx_mutex, NULL);
+
- pattrib->ack_policy = 0;
- // get ether_hdr_len
- pattrib->pkt_hdrlen = ETH_HLEN;//(pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; //vlan tag
-+ _enter_critical_mutex(&pxmitpriv->ack_tx_mutex, NULL);
-+ pxmitpriv->ack_tx = _TRUE;
++ return ret;
++#else //!CONFIG_XMIT_ACK
++ dump_mgntframe(padapter, pmgntframe);
++ rtw_msleep_os(50);
++ return _SUCCESS;
++#endif //!CONFIG_XMIT_ACK
++}
- if (pqospriv->qos_option && psta->qos_option) {
- pattrib->priority = 1; //tdls management frame should be AC_BK
- pattrib->hdrlen = WLAN_HDR_A3_LEN;
- pattrib->subtype = WIFI_DATA_TYPE;
- pattrib->priority = 0;
-+ pmgntframe->ack_report = 1;
-+ if (rtw_hal_mgnt_xmit(padapter, pmgntframe) == _SUCCESS) {
-+ ret = rtw_ack_tx_wait(pxmitpriv, timeout_ms);
- }
-
-- if (psta->ieee8021x_blocked == _TRUE)
-- {
-- pattrib->encrypt = 0;
- }
-- else
-- {
-- GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
-+ pxmitpriv->ack_tx = _FALSE;
-+ _exit_critical_mutex(&pxmitpriv->ack_tx_mutex, NULL);
-+
-+ return ret;
-+#else //!CONFIG_XMIT_ACK
-+ dump_mgntframe(padapter, pmgntframe);
-+ rtw_msleep_os(50);
-+ return _SUCCESS;
-+#endif //!CONFIG_XMIT_ACK
-+}
-+
+int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode)
+{
+ u8 *ssid_ie;
+
+ ssid_ie = rtw_get_ie(ies, WLAN_EID_SSID, &ssid_len_ori, ies_len);
-- switch(psecuritypriv->dot11AuthAlgrthm)
+- if (psta->ieee8021x_blocked == _TRUE)
+- {
+- pattrib->encrypt = 0;
+- }
+- else
+ //DBG_871X("%s hidden_ssid_mode:%u, ssid_ie:%p, ssid_len_ori:%d\n", __FUNCTION__, hidden_ssid_mode, ssid_ie, ssid_len_ori);
+
+ if(ssid_ie && ssid_len_ori>0)
-+ {
+ {
+- GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
+-
+- switch(psecuritypriv->dot11AuthAlgrthm)
+ switch(hidden_ssid_mode)
{
- case dot11AuthAlgrthm_Open:
}
-void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta)
--{
++void issue_beacon(_adapter *padapter)
+ {
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- struct sta_priv *pstapriv = &padapter->stapriv;
-- _irqL irqL;
++ struct xmit_frame *pmgntframe;
++ struct pkt_attrib *pattrib;
++ unsigned char *pframe;
++ struct rtw_ieee80211_hdr *pwlanhdr;
++ unsigned short *fctrl;
++ unsigned int rate_len;
++ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
++#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
+ _irqL irqL;
-
- //free peer sta_info
- DBG_8192C("Free sta_info\n");
- rtw_free_stainfo(padapter, ptdls_sta);
-
-}
--
++ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
++#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
++ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++ WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
++ u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
++#ifdef CONFIG_P2P
++ struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
++#endif //CONFIG_P2P
+
-void issue_tdls_setup_req(_adapter *padapter, u8 *mac_addr)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- _irqL irqL;
- static u8 dialogtoken = 0;
- u32 timeout_interval= TPK_RESEND_COUNT * 1000; //retry timer should set at least 301 sec, using TPK_count counting 301 times.
--
+
- if(ptdlsinfo->ap_prohibited == _TRUE)
- goto exit;
--
-- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
-- {
-- return;
-- }
++ //DBG_871X("%s\n", __FUNCTION__);
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
++ DBG_871X("%s, alloc mgnt frame fail\n", __FUNCTION__);
+ return;
+ }
-
-- //update attribute
-- pattrib = &pmgntframe->attrib;
--
++#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
++ _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
++#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
++
+ //update attribute
+ pattrib = &pmgntframe->attrib;
++ update_mgntframe_attrib(padapter, pattrib);
++ pattrib->qsel = 0x10;
++
++ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
++
++ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
++ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
++
++
++ fctrl = &(pwlanhdr->frame_ctl);
++ *(fctrl) = 0;
++
++ _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN);
+
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
- pattrib->pctrl =0;
-
- _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
--
++ SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
++ //pmlmeext->mgnt_seq++;
++ SetFrameSubType(pframe, WIFI_BEACON);
++
++ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
++ pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr);
++
++ if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
++ {
++ //DBG_871X("ie len=%d\n", cur_network->IELength);
++#ifdef CONFIG_P2P
++ // for P2P : Primary Device Type & Device Name
++ u32 wpsielen=0, insert_len=0;
++ u8 *wpsie=NULL;
++ wpsie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen);
++
++ if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && wpsie && wpsielen>0)
++ {
++ uint wps_offset, remainder_ielen;
++ u8 *premainder_ie, *pframe_wscie;
++
++ wps_offset = (uint)(wpsie - cur_network->IEs);
+
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
--
++ premainder_ie = wpsie + wpsielen;
+
- update_tdls_attrib(padapter, pattrib);
--
++ remainder_ielen = cur_network->IELength - wps_offset - wpsielen;
+
- //init peer sta_info
- ptdls_sta = rtw_get_stainfo(pstapriv, mac_addr);
- if(ptdls_sta==NULL)
- ptdlsinfo->sta_cnt++;
- _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- if( ptdlsinfo->sta_cnt == (NUM_STA - 1) )
-- {
++#ifdef CONFIG_IOCTL_CFG80211
++ if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 )
+ {
- ptdlsinfo->sta_maximum = _TRUE;
-- }
++ if(pmlmepriv->wps_beacon_ie && pmlmepriv->wps_beacon_ie_len>0)
++ {
++ _rtw_memcpy(pframe, cur_network->IEs, wps_offset);
++ pframe += wps_offset;
++ pattrib->pktlen += wps_offset;
++
++ _rtw_memcpy(pframe, pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len);
++ pframe += pmlmepriv->wps_beacon_ie_len;
++ pattrib->pktlen += pmlmepriv->wps_beacon_ie_len;
++
++ //copy remainder_ie to pframe
++ _rtw_memcpy(pframe, premainder_ie, remainder_ielen);
++ pframe += remainder_ielen;
++ pattrib->pktlen += remainder_ielen;
++ }
++ else
++ {
++ _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength);
++ pframe += cur_network->IELength;
++ pattrib->pktlen += cur_network->IELength;
++ }
+ }
- }
- else
- {
- ptdls_sta->TDLS_PeerKey_Lifetime = timeout_interval;
- _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME );
- }
--
++ else
++#endif //CONFIG_IOCTL_CFG80211
++ {
++ pframe_wscie = pframe + wps_offset;
++ _rtw_memcpy(pframe, cur_network->IEs, wps_offset+wpsielen);
++ pframe += (wps_offset + wpsielen);
++ pattrib->pktlen += (wps_offset + wpsielen);
+
- pattrib->qsel=pattrib->priority;
- if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_REQUEST) !=_SUCCESS ){
- rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
- goto exit;
- }
- rtw_dump_xframe(padapter, pmgntframe);
--
++ //now pframe is end of wsc ie, insert Primary Device Type & Device Name
++ // Primary Device Type
++ // Type:
++ *(u16*) ( pframe + insert_len) = cpu_to_be16( WPS_ATTR_PRIMARY_DEV_TYPE );
++ insert_len += 2;
++
++ // Length:
++ *(u16*) ( pframe + insert_len ) = cpu_to_be16( 0x0008 );
++ insert_len += 2;
++
++ // Value:
++ // Category ID
++ *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_CID_MULIT_MEDIA );
++ insert_len += 2;
+
-exit:
--
++ // OUI
++ *(u32*) ( pframe + insert_len ) = cpu_to_be32( WPSOUI );
++ insert_len += 4;
+
- return;
-}
--
++ // Sub Category ID
++ *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_SCID_MEDIA_SERVER );
++ insert_len += 2;
+
-void issue_tdls_teardown(_adapter *padapter, u8 *mac_addr)
-{
- struct xmit_frame *pmgntframe;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *ptdls_sta=NULL;
- _irqL irqL;
--
+
- ptdls_sta = rtw_get_stainfo(pstapriv, mac_addr);
- if(ptdls_sta==NULL){
- DBG_8192C("issue tdls teardown unsuccessful\n");
- }else{
- ptdls_sta->tdls_sta_state=UN_TDLS_STATE;
- }
--
++ // Device Name
++ // Type:
++ *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_ATTR_DEVICE_NAME );
++ insert_len += 2;
+
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- return;
-
- //update attribute
- pattrib = &pmgntframe->attrib;
--
++ // Length:
++ *(u16*) ( pframe + insert_len ) = cpu_to_be16( pwdinfo->device_name_len );
++ insert_len += 2;
+
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
- pattrib->pctrl =0;
--
++ // Value:
++ _rtw_memcpy( pframe + insert_len, pwdinfo->device_name, pwdinfo->device_name_len );
++ insert_len += pwdinfo->device_name_len;
+
- _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
--
+
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
--
++ //update wsc ie length
++ *(pframe_wscie+1) = (wpsielen -2) + insert_len;
+
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel=pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_TEARDOWN) != _SUCCESS) {
- goto exit;
- }
- rtw_dump_xframe(padapter, pmgntframe);
--
++ //pframe move to end
++ pframe+=insert_len;
++ pattrib->pktlen += insert_len;
+
- if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){
- ptdls_sta->option =3;
- rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF);
- }
- else
- rtw_tdls_cmd(padapter, mac_addr, TDLS_FREE_STA );
--
--
++ //copy remainder_ie to pframe
++ _rtw_memcpy(pframe, premainder_ie, remainder_ielen);
++ pframe += remainder_ielen;
++ pattrib->pktlen += remainder_ielen;
++ }
++ }
++ else
++#endif //CONFIG_P2P
++ {
++ int len_diff;
++ _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength);
++ len_diff = update_hidden_ssid(
++ pframe+_BEACON_IE_OFFSET_
++ , cur_network->IELength-_BEACON_IE_OFFSET_
++ , pmlmeinfo->hidden_ssid_mode
++ );
++ pframe += (cur_network->IELength+len_diff);
++ pattrib->pktlen += (cur_network->IELength+len_diff);
++ }
+
++ {
++ u8 *wps_ie;
++ uint wps_ielen;
++ u8 sr = 0;
++ wps_ie = rtw_get_wps_ie(pmgntframe->buf_addr+TXDESC_OFFSET+sizeof (struct rtw_ieee80211_hdr_3addr)+_BEACON_IE_OFFSET_,
++ pattrib->pktlen-sizeof (struct rtw_ieee80211_hdr_3addr)-_BEACON_IE_OFFSET_, NULL, &wps_ielen);
++ if (wps_ie && wps_ielen>0) {
++ rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL);
++ }
++ if (sr != 0)
++ set_fwstate(pmlmepriv, WIFI_UNDER_WPS);
++ else
++ _clr_fwstate_(pmlmepriv, WIFI_UNDER_WPS);
++ }
+
-exit:
--
++#ifdef CONFIG_P2P
++ if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
++ {
++ u32 len;
++#ifdef CONFIG_IOCTL_CFG80211
++ if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 )
++ {
++ len = pmlmepriv->p2p_beacon_ie_len;
++ if(pmlmepriv->p2p_beacon_ie && len>0)
++ _rtw_memcpy(pframe, pmlmepriv->p2p_beacon_ie, len);
++ }
++ else
++#endif //CONFIG_IOCTL_CFG80211
++ {
++ len = build_beacon_p2p_ie(pwdinfo, pframe);
++ }
+
- return;
-}
--
++ pframe += len;
++ pattrib->pktlen += len;
++#ifdef CONFIG_WFD
++#ifdef CONFIG_IOCTL_CFG80211
++ if(_TRUE == pwdinfo->wfd_info->wfd_enable)
++#endif //CONFIG_IOCTL_CFG80211
++ {
++ len = build_beacon_wfd_ie( pwdinfo, pframe );
++ }
++#ifdef CONFIG_IOCTL_CFG80211
++ else
++ {
++ len = 0;
++ if(pmlmepriv->wfd_beacon_ie && pmlmepriv->wfd_beacon_ie_len>0)
++ {
++ len = pmlmepriv->wfd_beacon_ie_len;
++ _rtw_memcpy(pframe, pmlmepriv->wfd_beacon_ie, len);
++ }
++ }
++#endif //CONFIG_IOCTL_CFG80211
++ pframe += len;
++ pattrib->pktlen += len;
++#endif //CONFIG_WFD
++ }
++#endif //CONFIG_P2P
++
++ goto _issue_bcn;
+
-void issue_tdls_dis_req(_adapter *padapter, u8 *mac_addr)
-{
- struct xmit_frame *pmgntframe;
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- return;
-- }
+ }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
--
+
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
- pattrib->pctrl =0;
--
++ //below for ad-hoc mode
+
- if(mac_addr == NULL)
- _rtw_memcpy(pattrib->dst, baddr, ETH_ALEN);
- else
- _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
-
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
--
++ //timestamp will be inserted by hardware
++ pframe += 8;
++ pattrib->pktlen += 8;
+
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
--
++ // beacon interval: 2 bytes
+
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel=pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_DISCOVERY_REQUEST) != _SUCCESS) {
- }
- rtw_dump_xframe(padapter, pmgntframe);
- DBG_8192C("issue tdls dis req\n");
--
++ _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2);
+
-exit:
--
++ pframe += 2;
++ pattrib->pktlen += 2;
+
- return;
-}
--
++ // capability info: 2 bytes
+
-void issue_tdls_setup_rsp(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct xmit_frame *pmgntframe;
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
- pattrib->pctrl =0;
--
++ _rtw_memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->IEs)), 2);
+
- _rtw_memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
--
++ pframe += 2;
++ pattrib->pktlen += 2;
+
- _rtw_memcpy(pattrib->ra, rx_pkt_pattrib->bssid, ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
--
++ // SSID
++ pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pattrib->pktlen);
+
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel=pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_RESPONSE) != _SUCCESS) {
- goto exit;
- }
- rtw_dump_xframe(padapter, pmgntframe);
--
++ // supported rates...
++ rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pattrib->pktlen);
+
-exit:
--
++ // DS parameter set
++ pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pattrib->pktlen);
+
- return;
--
++ //if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
++ {
++ u8 erpinfo=0;
++ u32 ATIMWindow;
++ // IBSS Parameter Set...
++ //ATIMWindow = cur->Configuration.ATIMWindow;
++ ATIMWindow = 0;
++ pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &pattrib->pktlen);
+
-}
--
++ //ERP IE
++ pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
++ }
+
-void issue_tdls_setup_cfm(_adapter *padapter, union recv_frame *precv_frame)
-{
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct sta_info *ptdls_sta=NULL;
- _irqL irqL;
--
+
- struct rx_pkt_attrib *rx_pkt_pattrib = & precv_frame->u.hdr.attrib;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
-- {
++ // EXTERNDED SUPPORTED RATE
++ if (rate_len > 8)
+ {
- return;
-- }
++ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
+ }
-
- //update attribute
- pattrib = &pmgntframe->attrib;
--
+
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
- pattrib->pctrl =0;
--
+
- _rtw_memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
--
++ //todo:HT for adhoc
+
- _rtw_memcpy(pattrib->ra, rx_pkt_pattrib->bssid, ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
--
++_issue_bcn:
+
- update_tdls_attrib(padapter, pattrib);
- pattrib->qsel=pattrib->priority;
- if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_CONFIRM) != _SUCCESS) {
- rtw_free_xmitframe_ex(pxmitpriv, pmgntframe);
- goto exit;
- }
--
++#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
++ pmlmepriv->update_bcn = _FALSE;
++
++ _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
++#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
+
- rtw_dump_xframe(padapter, pmgntframe);
--
++ if ((pattrib->pktlen + TXDESC_SIZE) > 512)
++ {
++ DBG_871X("beacon frame too large\n");
++ return;
++ }
++
++ pattrib->last_txcmdsz = pattrib->pktlen;
+
-exit:
--
++ //DBG_871X("issue bcn_sz=%d\n", pattrib->last_txcmdsz);
+
- return;
--
--}
--
++ dump_mgntframe(padapter, pmgntframe);
+
+ }
+
-//TDLS Discovery Response frame is a management action frame
-void issue_tdls_dis_rsp(_adapter *padapter, union recv_frame *precv_frame, u8 dialog)
--{
++void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probereq)
+ {
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- unsigned char *pframe;
-- struct rtw_ieee80211_hdr *pwlanhdr;
++ struct xmit_frame *pmgntframe;
++ struct pkt_attrib *pattrib;
++ unsigned char *pframe;
+ struct rtw_ieee80211_hdr *pwlanhdr;
- unsigned short *fctrl;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
--
++ unsigned short *fctrl;
++ unsigned char *mac, *bssid;
++ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
++#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
++ u8 *pwps_ie;
++ uint wps_ielen;
++ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
++#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++ WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
++ unsigned int rate_len;
++#ifdef CONFIG_P2P
++ struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
++#ifdef CONFIG_WFD
++ u32 wfdielen = 0;
++#endif //CONFIG_WFD
++#endif //CONFIG_P2P
+
- struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib;
--
-- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
-- {
-- return;
-- }
--
-- //update attribute
-- pattrib = &pmgntframe->attrib;
++ //DBG_871X("%s\n", __FUNCTION__);
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
++ DBG_871X("%s, alloc mgnt frame fail\n", __FUNCTION__);
+ return;
+ }
+
++
+ //update attribute
+ pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(padapter, pattrib);
-
-- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
++ update_mgntframe_attrib(padapter, pattrib);
++
+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
-- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
++
+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
-- fctrl = &(pwlanhdr->frame_ctl);
-- *(fctrl) = 0;
--
++ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
++
++ mac = myid(&(padapter->eeprompriv));
++ bssid = cur_network->MacAddress;
++
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
++ _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr3, bssid, ETH_ALEN);
+
- // unicast probe request frame
- _rtw_memcpy(pwlanhdr->addr1, rx_pkt_pattrib->src, ETH_ALEN);
- _rtw_memcpy(pattrib->dst, pwlanhdr->addr1, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, rx_pkt_pattrib->bssid, ETH_ALEN);
- _rtw_memcpy(pattrib->ra, pwlanhdr->addr3, ETH_ALEN);
-
-- SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
-- pmlmeext->mgnt_seq++;
+ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
+ pmlmeext->mgnt_seq++;
- SetFrameSubType(pframe, WIFI_ACTION);
-
- pframe += sizeof (struct rtw_ieee80211_hdr_3addr);
- pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr);
--
++ SetFrameSubType(fctrl, WIFI_PROBERSP);
+
- rtw_tdls_dis_rsp_fr(padapter, pmgntframe, pframe, dialog);
-
- pattrib->nr_frags = 1;
-
- return;
-}
--
++ pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr);
++ pattrib->pktlen = pattrib->hdrlen;
++ pframe += pattrib->hdrlen;
+
-void issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *ptdls_sta)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
--
+
- static u8 dialogtoken=0;
--
++ if(cur_network->IELength>MAX_IE_SZ)
++ return;
+
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
-- {
++#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
++ if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
+ {
- return;
- }
--
++ pwps_ie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen);
+
- //update attribute
- pattrib = &pmgntframe->attrib;
-
- goto exit;
- }
- rtw_dump_xframe(padapter, pmgntframe);
--
++ //inerset & update wps_probe_resp_ie
++ if((pmlmepriv->wps_probe_resp_ie!=NULL) && pwps_ie && (wps_ielen>0))
++ {
++ uint wps_offset, remainder_ielen;
++ u8 *premainder_ie;
+
-exit:
--
++ wps_offset = (uint)(pwps_ie - cur_network->IEs);
+
- return;
-}
--
++ premainder_ie = pwps_ie + wps_ielen;
+
-void issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr)
-+void issue_beacon(_adapter *padapter)
- {
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
+-{
+- struct xmit_frame *pmgntframe;
+- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
--
++ remainder_ielen = cur_network->IELength - wps_offset - wps_ielen;
+
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
- return;
-
- //update attribute
- pattrib = &pmgntframe->attrib;
--
++ _rtw_memcpy(pframe, cur_network->IEs, wps_offset);
++ pframe += wps_offset;
++ pattrib->pktlen += wps_offset;
+
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
- pattrib->pctrl =0;
--
++ wps_ielen = (uint)pmlmepriv->wps_probe_resp_ie[1];//to get ie data len
++ if((wps_offset+wps_ielen+2)<=MAX_IE_SZ)
++ {
++ _rtw_memcpy(pframe, pmlmepriv->wps_probe_resp_ie, wps_ielen+2);
++ pframe += wps_ielen+2;
++ pattrib->pktlen += wps_ielen+2;
++ }
+
- _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
--
++ if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ)
++ {
++ _rtw_memcpy(pframe, premainder_ie, remainder_ielen);
++ pframe += remainder_ielen;
++ pattrib->pktlen += remainder_ielen;
++ }
++ }
++ else
++ {
++ _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength);
++ pframe += cur_network->IELength;
++ pattrib->pktlen += cur_network->IELength;
++ }
+
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
--
++ /* retrieve SSID IE from cur_network->Ssid */
++ {
++ u8 *ssid_ie;
++ sint ssid_ielen;
++ sint ssid_ielen_diff;
++ u8 buf[MAX_IE_SZ];
++ u8 *ies = pmgntframe->buf_addr+TXDESC_OFFSET+sizeof(struct rtw_ieee80211_hdr_3addr);
+
- update_tdls_attrib(padapter, pattrib);
--
++ ssid_ie = rtw_get_ie(ies+_FIXED_IE_LENGTH_, _SSID_IE_, &ssid_ielen,
++ (pframe-ies)-_FIXED_IE_LENGTH_);
+
- pattrib->qsel=pattrib->priority;
- if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_CHANNEL_SWITCH_REQUEST) !=_SUCCESS ){
- rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf);
- goto exit;
- }
- rtw_dump_xframe(padapter, pmgntframe);
--
++ ssid_ielen_diff = cur_network->Ssid.SsidLength - ssid_ielen;
+
-exit:
--
++ if (ssid_ie && cur_network->Ssid.SsidLength) {
++ uint remainder_ielen;
++ u8 *remainder_ie;
++ remainder_ie = ssid_ie+2;
++ remainder_ielen = (pframe-remainder_ie);
+
- return;
-}
--
++ LOG_LEVEL(_drv_warning_, FUNC_ADPT_FMT" remainder_ielen > MAX_IE_SZ\n", FUNC_ADPT_ARG(padapter));
++ if (remainder_ielen > MAX_IE_SZ) {
++ remainder_ielen = MAX_IE_SZ;
++ }
+
-void issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr)
-{
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
--
++ _rtw_memcpy(buf, remainder_ie, remainder_ielen);
++ _rtw_memcpy(remainder_ie+ssid_ielen_diff, buf, remainder_ielen);
++ *(ssid_ie+1) = cur_network->Ssid.SsidLength;
++ _rtw_memcpy(ssid_ie+2, cur_network->Ssid.Ssid, cur_network->Ssid.SsidLength);
+
- _irqL irqL;
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
-- {
++ pframe += ssid_ielen_diff;
++ pattrib->pktlen += ssid_ielen_diff;
++ }
++ }
++ }
++ else
++#endif
+ {
- return;
- }
--
+
- //update attribute
- pattrib = &pmgntframe->attrib;
--
++ //timestamp will be inserted by hardware
++ pframe += 8;
++ pattrib->pktlen += 8;
+
- pmgntframe->frame_tag = DATA_FRAMETAG;
- pattrib->ether_type = 0x890d;
- pattrib->pctrl =0;
--
++ // beacon interval: 2 bytes
+
- _rtw_memcpy(pattrib->dst, mac_addr, ETH_ALEN);
- _rtw_memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN);
--
++ _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2);
+
- _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN);
- _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
--
++ pframe += 2;
++ pattrib->pktlen += 2;
+
- update_tdls_attrib(padapter, pattrib);
--
++ // capability info: 2 bytes
+
- pattrib->qsel=pattrib->priority;
-/*
- _enter_critical_bh(&pxmitpriv->lock, &irqL);
- goto exit;
- }
- rtw_dump_xframe(padapter, pmgntframe);
--
++ _rtw_memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->IEs)), 2);
+
-exit:
--
++ pframe += 2;
++ pattrib->pktlen += 2;
+
- return;
-}
--
++ //below for ad-hoc mode
+
-sint On_TDLS_Dis_Rsp(_adapter *adapter, union recv_frame *precv_frame)
-{
- struct sta_info *ptdls_sta = NULL;
- struct rx_pkt_attrib *pattrib = &(precv_frame->u.hdr.attrib);
- struct tdls_info *ptdlsinfo = &(adapter->tdlsinfo);
- u8 empty_addr[ETH_ALEN] = { 0x00 };
--
++ // SSID
++ pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pattrib->pktlen);
+
- psa = get_sa(ptr);
- ptdls_sta = rtw_get_stainfo(&(adapter->stapriv), psa);
--
++ // supported rates...
++ rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pattrib->pktlen);
+
- if(ptdls_sta != NULL)
- {
- ptdls_sta->tdls_sta_state |= TDLS_ALIVE_STATE;
--
++ // DS parameter set
++ pframe =rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pattrib->pktlen);
+
- //Record the tdls sta with lowest signal strength
- if( (ptdlsinfo->sta_maximum == _TRUE) && (ptdls_sta->alive_count >= 1) )
-- {
++ if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
+ {
- printk("%s %d\n", __FUNCTION__, __LINE__);
- if( _rtw_memcmp(ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN) )
- {
- ptdlsinfo->ss_record.signal_strength = pattrib->signal_strength;
- }
- }
-- }
--
++ u8 erpinfo=0;
++ u32 ATIMWindow;
++ // IBSS Parameter Set...
++ //ATIMWindow = cur->Configuration.ATIMWindow;
++ ATIMWindow = 0;
++ pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &pattrib->pktlen);
++
++ //ERP IE
++ pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
+ }
+
- }
- else
-- {
++
++ // EXTERNDED SUPPORTED RATE
++ if (rate_len > 8)
++ {
++ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
++ }
++
++
++ //todo:HT for adhoc
++
++ }
++
++#ifdef CONFIG_P2P
++ if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) /*&& is_valid_p2p_probereq*/)
+ {
- if( ptdlsinfo->sta_maximum == _TRUE)
-- {
++ u32 len;
++#ifdef CONFIG_IOCTL_CFG80211
++ if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 )
+ {
- printk("%s %d\n", __FUNCTION__, __LINE__);
- if( _rtw_memcmp( ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN ) )
- {
- return _FAIL;
- }
- }
-- }
--
-- if( pattrib->signal_strength + TDLS_SIGNAL_THRESH >= precvpriv->signal_strength )
-- {
-- issue_tdls_setup_req(adapter, psa);
-- }
-- }
--
-- return _FAIL;
--}
--
--#endif
--
--int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode)
--{
-- u8 *ssid_ie;
-- sint ssid_len_ori;
-- int len_diff = 0;
--
-- ssid_ie = rtw_get_ie(ies, WLAN_EID_SSID, &ssid_len_ori, ies_len);
--
-- //DBG_871X("%s hidden_ssid_mode:%u, ssid_ie:%p, ssid_len_ori:%d\n", __FUNCTION__, hidden_ssid_mode, ssid_ie, ssid_len_ori);
--
-- if(ssid_ie && ssid_len_ori>0)
-- {
-- switch(hidden_ssid_mode)
-- {
-- case 1:
-- {
-- u8 *next_ie = ssid_ie + 2 + ssid_len_ori;
-- u32 remain_len = 0;
--
-- remain_len = ies_len -(next_ie-ies);
--
-- ssid_ie[1] = 0;
-- _rtw_memcpy(ssid_ie+2, next_ie, remain_len);
-- len_diff -= ssid_len_ori;
--
-- break;
-- }
-- case 2:
-- _rtw_memset(&ssid_ie[2], 0, ssid_len_ori);
-- break;
-- default:
-- break;
-- }
-- }
--
-- return len_diff;
--}
--
--void issue_beacon(_adapter *padapter)
--{
-- _irqL irqL;
-- struct xmit_frame *pmgntframe;
-- struct pkt_attrib *pattrib;
- unsigned char *pframe;
- struct rtw_ieee80211_hdr *pwlanhdr;
- unsigned short *fctrl;
- unsigned int rate_len;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-+#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
-+ _irqL irqL;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-+#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
-@@ -5630,8 +6502,9 @@ void issue_beacon(_adapter *padapter)
- DBG_871X("%s, alloc mgnt frame fail\n", __FUNCTION__);
- return;
- }
--
-- _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
-+#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
-+ _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
-+#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
-
- //update attribute
- pattrib = &pmgntframe->attrib;
-@@ -5670,7 +6543,7 @@ void issue_beacon(_adapter *padapter)
- if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && wpsie && wpsielen>0)
- {
- uint wps_offset, remainder_ielen;
-- u8 *premainder_ie, *pframe_wscie;
-+ u8 *premainder_ie, *pframe_wscie;
-
- wps_offset = (uint)(wpsie - cur_network->IEs);
-
-@@ -5679,24 +6552,22 @@ void issue_beacon(_adapter *padapter)
- remainder_ielen = cur_network->IELength - wps_offset - wpsielen;
-
- #ifdef CONFIG_IOCTL_CFG80211
-- if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled)
-+ if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- if(pmlmepriv->wps_beacon_ie && pmlmepriv->wps_beacon_ie_len>0)
- {
- _rtw_memcpy(pframe, cur_network->IEs, wps_offset);
- pframe += wps_offset;
- pattrib->pktlen += wps_offset;
--
-- _rtw_memcpy(pframe, pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len);
-
-+ _rtw_memcpy(pframe, pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len);
- pframe += pmlmepriv->wps_beacon_ie_len;
-- pattrib->pktlen += pmlmepriv->wps_beacon_ie_len;
-+ pattrib->pktlen += pmlmepriv->wps_beacon_ie_len;
-
- //copy remainder_ie to pframe
- _rtw_memcpy(pframe, premainder_ie, remainder_ielen);
- pframe += remainder_ielen;
-- pattrib->pktlen += remainder_ielen;
--
-+ pattrib->pktlen += remainder_ielen;
- }
- else
- {
-@@ -5708,7 +6579,6 @@ void issue_beacon(_adapter *padapter)
- else
- #endif //CONFIG_IOCTL_CFG80211
- {
--
- pframe_wscie = pframe + wps_offset;
- _rtw_memcpy(pframe, cur_network->IEs, wps_offset+wpsielen);
- pframe += (wps_offset + wpsielen);
-@@ -5726,7 +6596,7 @@ void issue_beacon(_adapter *padapter)
-
- // Value:
- // Category ID
-- *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_CID_RTK_WIDI );
-+ *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_CID_MULIT_MEDIA );
- insert_len += 2;
-
- // OUI
-@@ -5734,7 +6604,7 @@ void issue_beacon(_adapter *padapter)
- insert_len += 4;
-
- // Sub Category ID
-- *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_SCID_RTK_DMP );
-+ *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_SCID_MEDIA_SERVER );
- insert_len += 2;
-
-
-@@ -5762,9 +6632,8 @@ void issue_beacon(_adapter *padapter)
- //copy remainder_ie to pframe
- _rtw_memcpy(pframe, premainder_ie, remainder_ielen);
- pframe += remainder_ielen;
-- pattrib->pktlen += remainder_ielen;
-+ pattrib->pktlen += remainder_ielen;
- }
--
- }
- else
- #endif //CONFIG_P2P
-@@ -5780,12 +6649,27 @@ void issue_beacon(_adapter *padapter)
- pattrib->pktlen += (cur_network->IELength+len_diff);
- }
-
-+ {
-+ u8 *wps_ie;
-+ uint wps_ielen;
-+ u8 sr = 0;
-+ wps_ie = rtw_get_wps_ie(pmgntframe->buf_addr+TXDESC_OFFSET+sizeof (struct rtw_ieee80211_hdr_3addr)+_BEACON_IE_OFFSET_,
-+ pattrib->pktlen-sizeof (struct rtw_ieee80211_hdr_3addr)-_BEACON_IE_OFFSET_, NULL, &wps_ielen);
-+ if (wps_ie && wps_ielen>0) {
-+ rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL);
-+ }
-+ if (sr != 0)
-+ set_fwstate(pmlmepriv, WIFI_UNDER_WPS);
-+ else
-+ _clr_fwstate_(pmlmepriv, WIFI_UNDER_WPS);
++ //if pwdinfo->role == P2P_ROLE_DEVICE will call issue_probersp_p2p()
++ len = pmlmepriv->p2p_go_probe_resp_ie_len;
++ if(pmlmepriv->p2p_go_probe_resp_ie && len>0)
++ _rtw_memcpy(pframe, pmlmepriv->p2p_go_probe_resp_ie, len);
+ }
-+
- #ifdef CONFIG_P2P
- if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
- {
- u32 len;
- #ifdef CONFIG_IOCTL_CFG80211
-- if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled)
-+ if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- len = pmlmepriv->p2p_beacon_ie_len;
- if(pmlmepriv->p2p_beacon_ie && len>0)
-@@ -5797,11 +6681,26 @@ void issue_beacon(_adapter *padapter)
- len = build_beacon_p2p_ie(pwdinfo, pframe);
- }
-
--
- pframe += len;
- pattrib->pktlen += len;
- #ifdef CONFIG_WFD
-- len = build_beacon_wfd_ie( pwdinfo, pframe );
-+#ifdef CONFIG_IOCTL_CFG80211
-+ if(_TRUE == pwdinfo->wfd_info->wfd_enable)
-+#endif //CONFIG_IOCTL_CFG80211
-+ {
-+ len = build_beacon_wfd_ie( pwdinfo, pframe );
-+ }
-+#ifdef CONFIG_IOCTL_CFG80211
-+ else
-+ {
-+ len = 0;
-+ if(pmlmepriv->wfd_beacon_ie && pmlmepriv->wfd_beacon_ie_len>0)
-+ {
-+ len = pmlmepriv->wfd_beacon_ie_len;
-+ _rtw_memcpy(pframe, pmlmepriv->wfd_beacon_ie, len);
-+ }
-+ }
++ else
+#endif //CONFIG_IOCTL_CFG80211
- pframe += len;
- pattrib->pktlen += len;
- #endif //CONFIG_WFD
-@@ -5867,9 +6766,11 @@ void issue_beacon(_adapter *padapter)
-
- _issue_bcn:
-
-+#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
- pmlmepriv->update_bcn = _FALSE;
-
- _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
-+#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
-
- if ((pattrib->pktlen + TXDESC_SIZE) > 512)
- {
-@@ -5887,8 +6788,6 @@ _issue_bcn:
-
- void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probereq)
- {
-- u8 *pwps_ie;
-- uint wps_ielen;
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- unsigned char *pframe;
-@@ -5896,7 +6795,11 @@ void issue_probersp(_adapter *padapter,
- unsigned short *fctrl;
- unsigned char *mac, *bssid;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-+#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
-+ u8 *pwps_ie;
-+ uint wps_ielen;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-+#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
-@@ -5908,8 +6811,6 @@ void issue_probersp(_adapter *padapter,
- #endif //CONFIG_WFD
- #endif //CONFIG_P2P
-
--
--
- //DBG_871X("%s\n", __FUNCTION__);
-
- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
-@@ -5946,7 +6847,7 @@ void issue_probersp(_adapter *padapter,
- pframe += pattrib->hdrlen;
-
-
-- if(cur_network->IELength>MAX_IE_SZ || cur_network->IELength<_FIXED_IE_LENGTH_)
-+ if(cur_network->IELength>MAX_IE_SZ)
- return;
-
- #if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
-@@ -5991,7 +6892,40 @@ void issue_probersp(_adapter *padapter,
- pframe += cur_network->IELength;
- pattrib->pktlen += cur_network->IELength;
- }
--
-+
-+ /* retrieve SSID IE from cur_network->Ssid */
+ {
-+ u8 *ssid_ie;
-+ sint ssid_ielen;
-+ sint ssid_ielen_diff;
-+ u8 buf[MAX_IE_SZ];
-+ u8 *ies = pmgntframe->buf_addr+TXDESC_OFFSET+sizeof(struct rtw_ieee80211_hdr_3addr);
-+
-+ ssid_ie = rtw_get_ie(ies+_FIXED_IE_LENGTH_, _SSID_IE_, &ssid_ielen,
-+ (pframe-ies)-_FIXED_IE_LENGTH_);
-+
-+ ssid_ielen_diff = cur_network->Ssid.SsidLength - ssid_ielen;
-+
-+ if (ssid_ie && cur_network->Ssid.SsidLength) {
-+ uint remainder_ielen;
-+ u8 *remainder_ie;
-+ remainder_ie = ssid_ie+2;
-+ remainder_ielen = (pframe-remainder_ie);
-+
-+ LOG_LEVEL(_drv_warning_, FUNC_ADPT_FMT" remainder_ielen > MAX_IE_SZ\n", FUNC_ADPT_ARG(padapter));
-+ if (remainder_ielen > MAX_IE_SZ) {
-+ remainder_ielen = MAX_IE_SZ;
-+ }
-+
-+ _rtw_memcpy(buf, remainder_ie, remainder_ielen);
-+ _rtw_memcpy(remainder_ie+ssid_ielen_diff, buf, remainder_ielen);
-+ *(ssid_ie+1) = cur_network->Ssid.SsidLength;
-+ _rtw_memcpy(ssid_ie+2, cur_network->Ssid.Ssid, cur_network->Ssid.SsidLength);
-+
-+ pframe += ssid_ielen_diff;
-+ pattrib->pktlen += ssid_ielen_diff;
-+ }
-+ }
- }
- else
- #endif
-@@ -6053,11 +6987,11 @@ void issue_probersp(_adapter *padapter,
- }
-
- #ifdef CONFIG_P2P
-- if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && is_valid_p2p_probereq)
-+ if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) /*&& is_valid_p2p_probereq*/)
- {
- u32 len;
- #ifdef CONFIG_IOCTL_CFG80211
-- if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled)
-+ if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 )
- {
- //if pwdinfo->role == P2P_ROLE_DEVICE will call issue_probersp_p2p()
- len = pmlmepriv->p2p_go_probe_resp_ie_len;
-@@ -6065,7 +6999,7 @@ void issue_probersp(_adapter *padapter,
- _rtw_memcpy(pframe, pmlmepriv->p2p_go_probe_resp_ie, len);
- }
- else
--#endif //CONFIG_IOCTL_CFG80211
-+#endif //CONFIG_IOCTL_CFG80211
- {
- len = build_probe_resp_p2p_ie(pwdinfo, pframe);
++ len = build_probe_resp_p2p_ie(pwdinfo, pframe);
}
-@@ -6074,15 +7008,62 @@ void issue_probersp(_adapter *padapter,
- pattrib->pktlen += len;
-
- #ifdef CONFIG_WFD
-- wfdielen = build_probe_resp_wfd_ie(pwdinfo, pframe);
-- pframe += wfdielen;
-- pattrib->pktlen += wfdielen;
+
+- if( pattrib->signal_strength + TDLS_SIGNAL_THRESH >= precvpriv->signal_strength )
++ pframe += len;
++ pattrib->pktlen += len;
++
++#ifdef CONFIG_WFD
+#ifdef CONFIG_IOCTL_CFG80211
+ if(_TRUE == pwdinfo->wfd_info->wfd_enable)
+#endif //CONFIG_IOCTL_CFG80211
-+ {
+ {
+- issue_tdls_setup_req(adapter, psa);
+ len = build_probe_resp_wfd_ie(pwdinfo, pframe, 0);
+ }
+#ifdef CONFIG_IOCTL_CFG80211
+ len = pmlmepriv->wfd_probe_resp_ie_len;
+ _rtw_memcpy(pframe, pmlmepriv->wfd_probe_resp_ie, len);
+ }
-+ }
+ }
+#endif //CONFIG_IOCTL_CFG80211
+ pframe += len;
+ pattrib->pktlen += len;
- #endif //CONFIG_WFD
-
-- }
-+ }
- #endif //CONFIG_P2P
-
++#endif //CONFIG_WFD
++
+ }
++#endif //CONFIG_P2P
+- return _FAIL;
++
+#ifdef CONFIG_AUTO_AP_MODE
+{
+ struct sta_info *psta;
+
+ pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, sizeof(RC_INFO), RC_INFO, &pattrib->pktlen);
+ }
-+}
+ }
+#endif //CONFIG_AUTO_AP_MODE
-+
-+
- pattrib->last_txcmdsz = pattrib->pktlen;
+
+-#endif
+
+-int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode)
+-{
+- u8 *ssid_ie;
+- sint ssid_len_ori;
+- int len_diff = 0;
++ pattrib->last_txcmdsz = pattrib->pktlen;
+- ssid_ie = rtw_get_ie(ies, WLAN_EID_SSID, &ssid_len_ori, ies_len);
-@@ -6092,8 +7073,9 @@ void issue_probersp(_adapter *padapter,
+- //DBG_871X("%s hidden_ssid_mode:%u, ssid_ie:%p, ssid_len_ori:%d\n", __FUNCTION__, hidden_ssid_mode, ssid_ie, ssid_len_ori);
++ dump_mgntframe(padapter, pmgntframe);
+
+- if(ssid_ie && ssid_len_ori>0)
+- {
+- switch(hidden_ssid_mode)
+- {
+- case 1:
+- {
+- u8 *next_ie = ssid_ie + 2 + ssid_len_ori;
+- u32 remain_len = 0;
+-
+- remain_len = ies_len -(next_ie-ies);
+-
+- ssid_ie[1] = 0;
+- _rtw_memcpy(ssid_ie+2, next_ie, remain_len);
+- len_diff -= ssid_len_ori;
+-
+- break;
+- }
+- case 2:
+- _rtw_memset(&ssid_ie[2], 0, ssid_len_ori);
+- break;
+- default:
+- break;
+- }
+- }
++ return;
+- return len_diff;
}
--void issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, u8 blnbc)
+-void issue_beacon(_adapter *padapter)
+int _issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, u8 *da, int wait_ack)
{
+- _irqL irqL;
+- struct xmit_frame *pmgntframe;
+- struct pkt_attrib *pattrib;
+- unsigned char *pframe;
+- struct rtw_ieee80211_hdr *pwlanhdr;
+- unsigned short *fctrl;
+- unsigned int rate_len;
+- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ int ret = _FAIL;
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- unsigned char *pframe;
-@@ -6108,11 +7090,11 @@ void issue_probereq(_adapter *padapter,
- int bssrate_len = 0;
++ struct xmit_frame *pmgntframe;
++ struct pkt_attrib *pattrib;
++ unsigned char *pframe;
++ struct rtw_ieee80211_hdr *pwlanhdr;
++ unsigned short *fctrl;
++ unsigned char *mac;
++ unsigned char bssrate[NumRates];
++ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
++ int bssrate_len = 0;
u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+-#ifdef CONFIG_P2P
+- struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
+-#endif //CONFIG_P2P
+-
-- RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("+issue_probereq\n"));
+- //DBG_871X("%s\n", __FUNCTION__);
+ RT_TRACE(_module_rtl871x_mlme_c_,_drv_notice_,("+issue_probereq\n"));
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
{
+- DBG_871X("%s, alloc mgnt frame fail\n", __FUNCTION__);
- return;
+ goto exit;
}
+- _enter_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
+-
//update attribute
-@@ -6130,11 +7112,11 @@ void issue_probereq(_adapter *padapter,
+ pattrib = &pmgntframe->attrib;
+ update_mgntframe_attrib(padapter, pattrib);
+- pattrib->qsel = 0x10;
+-
++
++
+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+-
++
+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+-
+-
++ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
++
++ mac = myid(&(padapter->eeprompriv));
++
fctrl = &(pwlanhdr->frame_ctl);
*(fctrl) = 0;
+-
+- _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN);
-- if ( 0 == blnbc )
+- SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
+- //pmlmeext->mgnt_seq++;
+- SetFrameSubType(pframe, WIFI_BEACON);
+-
+- pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
+- pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr);
+-
+- if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
+ if (da)
{
- // unicast probe request frame
-- _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+- //DBG_871X("ie len=%d\n", cur_network->IELength);
+-#ifdef CONFIG_P2P
+- // for P2P : Primary Device Type & Device Name
+- u32 wpsielen=0, insert_len=0;
+- u8 *wpsie=NULL;
+- wpsie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen);
+-
+- if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && wpsie && wpsielen>0)
+- {
+- uint wps_offset, remainder_ielen;
+- u8 *premainder_ie, *pframe_wscie;
+-
+- wps_offset = (uint)(wpsie - cur_network->IEs);
+-
+- premainder_ie = wpsie + wpsielen;
++ // unicast probe request frame
+ _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, da, ETH_ALEN);
- }
- else
- {
-@@ -6191,11 +7173,64 @@ void issue_probereq(_adapter *padapter,
++ }
++ else
++ {
++ // broadcast probe request frame
++ _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN);
++ }
- pattrib->last_txcmdsz = pattrib->pktlen;
+- remainder_ielen = cur_network->IELength - wps_offset - wpsielen;
++ _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
-- RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("issuing probe_req, tx_len=%d\n", pattrib->last_txcmdsz));
+-#ifdef CONFIG_IOCTL_CFG80211
+- if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled)
+- {
+- if(pmlmepriv->wps_beacon_ie && pmlmepriv->wps_beacon_ie_len>0)
+- {
+- _rtw_memcpy(pframe, cur_network->IEs, wps_offset);
+- pframe += wps_offset;
+- pattrib->pktlen += wps_offset;
+-
+- _rtw_memcpy(pframe, pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len);
++ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
++ pmlmeext->mgnt_seq++;
++ SetFrameSubType(pframe, WIFI_PROBEREQ);
+
+- pframe += pmlmepriv->wps_beacon_ie_len;
+- pattrib->pktlen += pmlmepriv->wps_beacon_ie_len;
++ pframe += sizeof (struct rtw_ieee80211_hdr_3addr);
++ pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr);
+
+- //copy remainder_ie to pframe
+- _rtw_memcpy(pframe, premainder_ie, remainder_ielen);
+- pframe += remainder_ielen;
+- pattrib->pktlen += remainder_ielen;
+-
+- }
+- else
+- {
+- _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength);
+- pframe += cur_network->IELength;
+- pattrib->pktlen += cur_network->IELength;
+- }
+- }
+- else
+-#endif //CONFIG_IOCTL_CFG80211
+- {
++ if(pssid)
++ pframe = rtw_set_ie(pframe, _SSID_IE_, pssid->SsidLength, pssid->Ssid, &(pattrib->pktlen));
++ else
++ pframe = rtw_set_ie(pframe, _SSID_IE_, 0, NULL, &(pattrib->pktlen));
+
+- pframe_wscie = pframe + wps_offset;
+- _rtw_memcpy(pframe, cur_network->IEs, wps_offset+wpsielen);
+- pframe += (wps_offset + wpsielen);
+- pattrib->pktlen += (wps_offset + wpsielen);
++ get_rate_set(padapter, bssrate, &bssrate_len);
+
+- //now pframe is end of wsc ie, insert Primary Device Type & Device Name
+- // Primary Device Type
+- // Type:
+- *(u16*) ( pframe + insert_len) = cpu_to_be16( WPS_ATTR_PRIMARY_DEV_TYPE );
+- insert_len += 2;
+-
+- // Length:
+- *(u16*) ( pframe + insert_len ) = cpu_to_be16( 0x0008 );
+- insert_len += 2;
+-
+- // Value:
+- // Category ID
+- *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_CID_RTK_WIDI );
+- insert_len += 2;
++ if (bssrate_len > 8)
++ {
++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
++ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
++ }
++ else
++ {
++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
++ }
+
+- // OUI
+- *(u32*) ( pframe + insert_len ) = cpu_to_be32( WPSOUI );
+- insert_len += 4;
+-
+- // Sub Category ID
+- *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_PDT_SCID_RTK_DMP );
+- insert_len += 2;
+-
+-
+- // Device Name
+- // Type:
+- *(u16*) ( pframe + insert_len ) = cpu_to_be16( WPS_ATTR_DEVICE_NAME );
+- insert_len += 2;
+-
+- // Length:
+- *(u16*) ( pframe + insert_len ) = cpu_to_be16( pwdinfo->device_name_len );
+- insert_len += 2;
+-
+- // Value:
+- _rtw_memcpy( pframe + insert_len, pwdinfo->device_name, pwdinfo->device_name_len );
+- insert_len += pwdinfo->device_name_len;
+-
+-
+- //update wsc ie length
+- *(pframe_wscie+1) = (wpsielen -2) + insert_len;
+-
+- //pframe move to end
+- pframe+=insert_len;
+- pattrib->pktlen += insert_len;
+-
+- //copy remainder_ie to pframe
+- _rtw_memcpy(pframe, premainder_ie, remainder_ielen);
+- pframe += remainder_ielen;
+- pattrib->pktlen += remainder_ielen;
+- }
+-
+- }
+- else
+-#endif //CONFIG_P2P
+- {
+- int len_diff;
+- _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength);
+- len_diff = update_hidden_ssid(
+- pframe+_BEACON_IE_OFFSET_
+- , cur_network->IELength-_BEACON_IE_OFFSET_
+- , pmlmeinfo->hidden_ssid_mode
+- );
+- pframe += (cur_network->IELength+len_diff);
+- pattrib->pktlen += (cur_network->IELength+len_diff);
+- }
+-
+-#ifdef CONFIG_P2P
+- if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
+- {
+- u32 len;
+-#ifdef CONFIG_IOCTL_CFG80211
+- if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled)
+- {
+- len = pmlmepriv->p2p_beacon_ie_len;
+- if(pmlmepriv->p2p_beacon_ie && len>0)
+- _rtw_memcpy(pframe, pmlmepriv->p2p_beacon_ie, len);
+- }
+- else
+-#endif //CONFIG_IOCTL_CFG80211
+- {
+- len = build_beacon_p2p_ie(pwdinfo, pframe);
+- }
++#if 0
++ //add wps_ie for wps2.0
++ if(pmlmepriv->probereq_wpsie_len>0 && pmlmepriv->probereq_wpsie_len<MAX_WPS_IE_LEN)
++ {
++ _rtw_memcpy(pframe, pmlmepriv->probereq_wpsie, pmlmepriv->probereq_wpsie_len);
++ pframe += pmlmepriv->probereq_wpsie_len;
++ pattrib->pktlen += pmlmepriv->probereq_wpsie_len;
++ //pmlmepriv->probereq_wpsie_len = 0 ;//reset to zero
++ }
++#else
++ //add wps_ie for wps2.0
++ if(pmlmepriv->wps_probe_req_ie_len>0 && pmlmepriv->wps_probe_req_ie)
++ {
++ _rtw_memcpy(pframe, pmlmepriv->wps_probe_req_ie, pmlmepriv->wps_probe_req_ie_len);
++ pframe += pmlmepriv->wps_probe_req_ie_len;
++ pattrib->pktlen += pmlmepriv->wps_probe_req_ie_len;
++ //pmlmepriv->wps_probe_req_ie_len = 0 ;//reset to zero
++ }
++#endif
+
+-
+- pframe += len;
+- pattrib->pktlen += len;
+-#ifdef CONFIG_WFD
+- len = build_beacon_wfd_ie( pwdinfo, pframe );
+- pframe += len;
+- pattrib->pktlen += len;
+-#endif //CONFIG_WFD
+- }
+-#endif //CONFIG_P2P
++ pattrib->last_txcmdsz = pattrib->pktlen;
+
+- goto _issue_bcn;
+ RT_TRACE(_module_rtl871x_mlme_c_,_drv_notice_,("issuing probe_req, tx_len=%d\n", pattrib->last_txcmdsz));
-- dump_mgntframe(padapter, pmgntframe);
+ if (wait_ack) {
+ ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
+ } else {
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
-+ }
+ }
-- return;
+- //below for ad-hoc mode
+-
+- //timestamp will be inserted by hardware
+- pframe += 8;
+- pattrib->pktlen += 8;
+-
+- // beacon interval: 2 bytes
+-
+- _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2);
+-
+- pframe += 2;
+- pattrib->pktlen += 2;
+-
+- // capability info: 2 bytes
+-
+- _rtw_memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->IEs)), 2);
+-
+- pframe += 2;
+- pattrib->pktlen += 2;
+-
+- // SSID
+- pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pattrib->pktlen);
+-
+- // supported rates...
+- rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
+- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pattrib->pktlen);
+-
+- // DS parameter set
+- pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pattrib->pktlen);
+-
+- //if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
+- {
+- u8 erpinfo=0;
+- u32 ATIMWindow;
+- // IBSS Parameter Set...
+- //ATIMWindow = cur->Configuration.ATIMWindow;
+- ATIMWindow = 0;
+- pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &pattrib->pktlen);
+exit:
+ return ret;
+}
-+
+
+- //ERP IE
+- pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
+- }
+inline void issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, u8 *da)
+{
+ _issue_probereq(padapter, pssid, da, _FALSE);
+}
-+
+
+int issue_probereq_ex(_adapter *padapter, NDIS_802_11_SSID *pssid, u8 *da,
+ int try_cnt, int wait_ms)
+{
+ int ret;
+ int i = 0;
+ u32 start = rtw_get_current_time();
-+
+
+- // EXTERNDED SUPPORTED RATE
+- if (rate_len > 8)
+ do
-+ {
+ {
+- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
+- }
+ ret = _issue_probereq(padapter, pssid, da, wait_ms>0?_TRUE:_FALSE);
-+
+
+ i++;
-+
+
+- //todo:HT for adhoc
+ if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
+ break;
-+
+
+-_issue_bcn:
+ if(i < try_cnt && wait_ms > 0 && ret==_FAIL)
+ rtw_msleep_os(wait_ms);
-+
+
+- pmlmepriv->update_bcn = _FALSE;
+-
+- _exit_critical_bh(&pmlmepriv->bcn_update_lock, &irqL);
+ }while((i<try_cnt) && ((ret==_FAIL)||(wait_ms==0)));
-+
+
+- if ((pattrib->pktlen + TXDESC_SIZE) > 512)
+- {
+- DBG_871X("beacon frame too large\n");
+- return;
+ if (ret != _FAIL) {
+ ret = _SUCCESS;
+ #ifndef DBG_XMIT_ACK
+ goto exit;
+ #endif
-+ }
-+
+ }
+-
+- pattrib->last_txcmdsz = pattrib->pktlen;
+-
+- //DBG_871X("issue bcn_sz=%d\n", pattrib->last_txcmdsz);
+-
+- dump_mgntframe(padapter, pmgntframe);
+
+ if (try_cnt && wait_ms) {
+ if (da)
+ DBG_871X(FUNC_ADPT_FMT" to "MAC_FMT", ch:%u%s, %d/%d in %u ms\n",
+ return ret;
}
- // if psta == NULL, indiate we are station(client) now...
-@@ -6211,16 +7246,7 @@ void issue_auth(_adapter *padapter, stru
- int use_shared_key = 0;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+-void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probereq)
++// if psta == NULL, indiate we are station(client) now...
++void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status)
+ {
+- u8 *pwps_ie;
+- uint wps_ielen;
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ unsigned char *pframe;
+ struct rtw_ieee80211_hdr *pwlanhdr;
+- unsigned short *fctrl;
+- unsigned char *mac, *bssid;
+- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
++ unsigned short *fctrl;
++ unsigned int val32;
++ unsigned short val16;
++ int use_shared_key = 0;
++ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
+- unsigned int rate_len;
+-#ifdef CONFIG_P2P
+- struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
+-#ifdef CONFIG_WFD
+- u32 wfdielen = 0;
+-#endif //CONFIG_WFD
+-#endif //CONFIG_P2P
-
--/*
-- if( (psta == NULL) && (pmlmeinfo->auth_seq != 3) ) {
-- // Because of AP's not receiving deauth before
-- // AP may: 1)not response auth or 2)deauth us after link is complete
-- // issue deauth before issuing auth to deal with the situation
-- issue_deauth(padapter, (&(pmlmeinfo->network))->MacAddress, WLAN_REASON_DEAUTH_LEAVING);
-- }
--*/
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+-
+-
+- //DBG_871X("%s\n", __FUNCTION__);
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
{
-@@ -6298,12 +7324,12 @@ void issue_auth(_adapter *padapter, stru
- val16 = cpu_to_le16(val16);
- use_shared_key = 1;
- }
-- //DBG_8192C("%s auth_algo= %s auth_seq=%d\n",__FUNCTION__,(pmlmeinfo->auth_algo==0)?"OPEN":"SHARED",pmlmeinfo->auth_seq);
-+ //DBG_871X("%s auth_algo= %s auth_seq=%d\n",__FUNCTION__,(pmlmeinfo->auth_algo==0)?"OPEN":"SHARED",pmlmeinfo->auth_seq);
-
- //setting IV for auth seq #3
- if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1))
- {
-- //DBG_8192C("==> iv(%d),key_index(%d)\n",pmlmeinfo->iv,pmlmeinfo->key_index);
-+ //DBG_871X("==> iv(%d),key_index(%d)\n",pmlmeinfo->iv,pmlmeinfo->key_index);
- val32 = ((pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30));
- val32 = cpu_to_le32(val32);
- pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&val32, &(pattrib->pktlen));
-@@ -6373,7 +7399,6 @@ void issue_asocrsp(_adapter *padapter, u
- #ifdef CONFIG_WFD
- u32 wfdielen = 0;
- #endif //CONFIG_WFD
--
- #endif //CONFIG_P2P
+- DBG_871X("%s, alloc mgnt frame fail\n", __FUNCTION__);
+ return;
+ }
- DBG_871X("%s\n", __FUNCTION__);
-@@ -6503,21 +7528,30 @@ void issue_asocrsp(_adapter *padapter, u
+-
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+- update_mgntframe_attrib(padapter, pattrib);
+-
++ update_mgntframe_attrib(padapter, pattrib);
++
+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+-
++
+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+-
+- mac = myid(&(padapter->eeprompriv));
+- bssid = cur_network->MacAddress;
+-
++ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
++
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+- _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr3, bssid, ETH_ALEN);
+
+ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
+ pmlmeext->mgnt_seq++;
+- SetFrameSubType(fctrl, WIFI_PROBERSP);
+-
+- pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+- pattrib->pktlen = pattrib->hdrlen;
+- pframe += pattrib->hdrlen;
++ SetFrameSubType(pframe, WIFI_AUTH);
+
++ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
++ pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+
+- if(cur_network->IELength>MAX_IE_SZ || cur_network->IELength<_FIXED_IE_LENGTH_)
+- return;
+-
+-#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
+- if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
++
++ if(psta)// for AP mode
+ {
+- pwps_ie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen);
+-
+- //inerset & update wps_probe_resp_ie
+- if((pmlmepriv->wps_probe_resp_ie!=NULL) && pwps_ie && (wps_ielen>0))
+- {
+- uint wps_offset, remainder_ielen;
+- u8 *premainder_ie;
++#ifdef CONFIG_NATIVEAP_MLME
++
++ _rtw_memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
++
+
+- wps_offset = (uint)(pwps_ie - cur_network->IEs);
++ // setting auth algo number
++ val16 = (u16)psta->authalg;
+
+- premainder_ie = pwps_ie + wps_ielen;
++ if(status != _STATS_SUCCESSFUL_)
++ val16 = 0;
+
+- remainder_ielen = cur_network->IELength - wps_offset - wps_ielen;
++ if (val16) {
++ val16 = cpu_to_le16(val16);
++ use_shared_key = 1;
++ }
+
+- _rtw_memcpy(pframe, cur_network->IEs, wps_offset);
+- pframe += wps_offset;
+- pattrib->pktlen += wps_offset;
++ pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
+
+- wps_ielen = (uint)pmlmepriv->wps_probe_resp_ie[1];//to get ie data len
+- if((wps_offset+wps_ielen+2)<=MAX_IE_SZ)
+- {
+- _rtw_memcpy(pframe, pmlmepriv->wps_probe_resp_ie, wps_ielen+2);
+- pframe += wps_ielen+2;
+- pattrib->pktlen += wps_ielen+2;
+- }
++ // setting auth seq number
++ val16 =(u16)psta->auth_seq;
++ val16 = cpu_to_le16(val16);
++ pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
+
+- if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ)
+- {
+- _rtw_memcpy(pframe, premainder_ie, remainder_ielen);
+- pframe += remainder_ielen;
+- pattrib->pktlen += remainder_ielen;
+- }
+- }
+- else
++ // setting status code...
++ val16 = status;
++ val16 = cpu_to_le16(val16);
++ pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen));
++
++ // added challenging text...
++ if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1))
+ {
+- _rtw_memcpy(pframe, cur_network->IEs, cur_network->IELength);
+- pframe += cur_network->IELength;
+- pattrib->pktlen += cur_network->IELength;
++ pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, psta->chg_txt, &(pattrib->pktlen));
+ }
+-
+- }
+- else
+-#endif
+- {
++#endif
++ }
++ else
++ {
++ _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&pmlmeinfo->network), ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
++ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&pmlmeinfo->network), ETH_ALEN);
+
+- //timestamp will be inserted by hardware
+- pframe += 8;
+- pattrib->pktlen += 8;
+-
+- // beacon interval: 2 bytes
+-
+- _rtw_memcpy(pframe, (unsigned char *)(rtw_get_beacon_interval_from_ie(cur_network->IEs)), 2);
+-
+- pframe += 2;
+- pattrib->pktlen += 2;
+-
+- // capability info: 2 bytes
+-
+- _rtw_memcpy(pframe, (unsigned char *)(rtw_get_capability_from_ie(cur_network->IEs)), 2);
+-
+- pframe += 2;
+- pattrib->pktlen += 2;
+-
+- //below for ad-hoc mode
+-
+- // SSID
+- pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pattrib->pktlen);
+-
+- // supported rates...
+- rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
+- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pattrib->pktlen);
+-
+- // DS parameter set
+- pframe =rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pattrib->pktlen);
+-
+- if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
++ // setting auth algo number
++ val16 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared)? 1: 0;// 0:OPEN System, 1:Shared key
++ if (val16) {
++ val16 = cpu_to_le16(val16);
++ use_shared_key = 1;
++ }
++ //DBG_871X("%s auth_algo= %s auth_seq=%d\n",__FUNCTION__,(pmlmeinfo->auth_algo==0)?"OPEN":"SHARED",pmlmeinfo->auth_seq);
++
++ //setting IV for auth seq #3
++ if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1))
+ {
+- u8 erpinfo=0;
+- u32 ATIMWindow;
+- // IBSS Parameter Set...
+- //ATIMWindow = cur->Configuration.ATIMWindow;
+- ATIMWindow = 0;
+- pframe = rtw_set_ie(pframe, _IBSS_PARA_IE_, 2, (unsigned char *)(&ATIMWindow), &pattrib->pktlen);
++ //DBG_871X("==> iv(%d),key_index(%d)\n",pmlmeinfo->iv,pmlmeinfo->key_index);
++ val32 = ((pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30));
++ val32 = cpu_to_le32(val32);
++ pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&val32, &(pattrib->pktlen));
+
+- //ERP IE
+- pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
++ pattrib->iv_len = 4;
+ }
+
++ pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
+
+- // EXTERNDED SUPPORTED RATE
+- if (rate_len > 8)
+- {
+- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
+- }
++ // setting auth seq number
++ val16 = pmlmeinfo->auth_seq;
++ val16 = cpu_to_le16(val16);
++ pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
+
++
++ // setting status code...
++ val16 = status;
++ val16 = cpu_to_le16(val16);
++ pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen));
+
+- //todo:HT for adhoc
++ // then checking to see if sending challenging text...
++ if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1))
++ {
++ pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, pmlmeinfo->chg_txt, &(pattrib->pktlen));
+
+- }
++ SetPrivacy(fctrl);
++
++ pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr);
++
++ pattrib->encrypt = _WEP40_;
+
+-#ifdef CONFIG_P2P
+- if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && is_valid_p2p_probereq)
+- {
+- u32 len;
+-#ifdef CONFIG_IOCTL_CFG80211
+- if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled)
+- {
+- //if pwdinfo->role == P2P_ROLE_DEVICE will call issue_probersp_p2p()
+- len = pmlmepriv->p2p_go_probe_resp_ie_len;
+- if(pmlmepriv->p2p_go_probe_resp_ie && len>0)
+- _rtw_memcpy(pframe, pmlmepriv->p2p_go_probe_resp_ie, len);
+- }
+- else
+-#endif //CONFIG_IOCTL_CFG80211
+- {
+- len = build_probe_resp_p2p_ie(pwdinfo, pframe);
++ pattrib->icv_len = 4;
++
++ pattrib->pktlen += pattrib->icv_len;
++
+ }
+-
+- pframe += len;
+- pattrib->pktlen += len;
+
+-#ifdef CONFIG_WFD
+- wfdielen = build_probe_resp_wfd_ie(pwdinfo, pframe);
+- pframe += wfdielen;
+- pattrib->pktlen += wfdielen;
+-#endif //CONFIG_WFD
+-
+- }
+-#endif //CONFIG_P2P
+-
++ }
+
+ pattrib->last_txcmdsz = pattrib->pktlen;
+-
++
++ rtw_wep_encrypt(padapter, (u8 *)pmgntframe);
+
+ dump_mgntframe(padapter, pmgntframe);
+-
+- return;
+
++ return;
+ }
+
+-void issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, u8 blnbc)
++
++void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *pstat, int pkt_type)
+ {
+- struct xmit_frame *pmgntframe;
+- struct pkt_attrib *pattrib;
+- unsigned char *pframe;
++#ifdef CONFIG_AP_MODE
++ struct xmit_frame *pmgntframe;
+ struct rtw_ieee80211_hdr *pwlanhdr;
+- unsigned short *fctrl;
+- unsigned char *mac;
+- unsigned char bssrate[NumRates];
+- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
++ struct pkt_attrib *pattrib;
++ unsigned char *pbuf, *pframe;
++ unsigned short val;
++ unsigned short *fctrl;
++ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- int bssrate_len = 0;
+- u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
++ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++ WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network);
++ u8 *ie = pnetwork->IEs;
++#ifdef CONFIG_P2P
++ struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
++#ifdef CONFIG_WFD
++ u32 wfdielen = 0;
++#endif //CONFIG_WFD
++#endif //CONFIG_P2P
+
+- RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("+issue_probereq\n"));
++ DBG_871X("%s\n", __FUNCTION__);
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
+@@ -6125,313 +7418,45 @@ void issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, u8 blnbc)
+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+
+- mac = myid(&(padapter->eeprompriv));
+-
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+
+- if ( 0 == blnbc )
+- {
+- // unicast probe request frame
+- _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+- }
+- else
+- {
+- // broadcast probe request frame
+- _rtw_memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN);
+- }
++ _rtw_memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
++ _rtw_memcpy((void *)GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
++ _rtw_memcpy((void *)GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+
+- _rtw_memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
+
+ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
+ pmlmeext->mgnt_seq++;
+- SetFrameSubType(pframe, WIFI_PROBEREQ);
++ if ((pkt_type == WIFI_ASSOCRSP) || (pkt_type == WIFI_REASSOCRSP))
++ SetFrameSubType(pwlanhdr, pkt_type);
++ else
++ return;
+
+- pframe += sizeof (struct rtw_ieee80211_hdr_3addr);
+- pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr);
++ pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr);
++ pattrib->pktlen += pattrib->hdrlen;
++ pframe += pattrib->hdrlen;
+
+- if(pssid)
+- pframe = rtw_set_ie(pframe, _SSID_IE_, pssid->SsidLength, pssid->Ssid, &(pattrib->pktlen));
+- else
+- pframe = rtw_set_ie(pframe, _SSID_IE_, 0, NULL, &(pattrib->pktlen));
++ //capability
++ val = *(unsigned short *)rtw_get_capability_from_ie(ie);
+
+- get_rate_set(padapter, bssrate, &bssrate_len);
++ pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_ , (unsigned char *)&val, &(pattrib->pktlen));
+
+- if (bssrate_len > 8)
+- {
+- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen));
+- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
+- }
+- else
+- {
+- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen));
+- }
++ status = cpu_to_le16(status);
++ pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char *)&status, &(pattrib->pktlen));
++
++ val = cpu_to_le16(pstat->aid | BIT(14) | BIT(15));
++ pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&val, &(pattrib->pktlen));
+
+-#if 0
+- //add wps_ie for wps2.0
+- if(pmlmepriv->probereq_wpsie_len>0 && pmlmepriv->probereq_wpsie_len<MAX_WPS_IE_LEN)
++ if (pstat->bssratelen <= 8)
+ {
+- _rtw_memcpy(pframe, pmlmepriv->probereq_wpsie, pmlmepriv->probereq_wpsie_len);
+- pframe += pmlmepriv->probereq_wpsie_len;
+- pattrib->pktlen += pmlmepriv->probereq_wpsie_len;
+- //pmlmepriv->probereq_wpsie_len = 0 ;//reset to zero
++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen));
+ }
+-#else
+- //add wps_ie for wps2.0
+- if(pmlmepriv->wps_probe_req_ie_len>0 && pmlmepriv->wps_probe_req_ie)
++ else
+ {
+- _rtw_memcpy(pframe, pmlmepriv->wps_probe_req_ie, pmlmepriv->wps_probe_req_ie_len);
+- pframe += pmlmepriv->wps_probe_req_ie_len;
+- pattrib->pktlen += pmlmepriv->wps_probe_req_ie_len;
+- //pmlmepriv->wps_probe_req_ie_len = 0 ;//reset to zero
+- }
+-#endif
+-
+- pattrib->last_txcmdsz = pattrib->pktlen;
+-
+- RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("issuing probe_req, tx_len=%d\n", pattrib->last_txcmdsz));
+-
+- dump_mgntframe(padapter, pmgntframe);
+-
+- return;
+-}
+-
+-// if psta == NULL, indiate we are station(client) now...
+-void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status)
+-{
+- struct xmit_frame *pmgntframe;
+- struct pkt_attrib *pattrib;
+- unsigned char *pframe;
+- struct rtw_ieee80211_hdr *pwlanhdr;
+- unsigned short *fctrl;
+- unsigned int val32;
+- unsigned short val16;
+- int use_shared_key = 0;
+- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+-
+-/*
+- if( (psta == NULL) && (pmlmeinfo->auth_seq != 3) ) {
+- // Because of AP's not receiving deauth before
+- // AP may: 1)not response auth or 2)deauth us after link is complete
+- // issue deauth before issuing auth to deal with the situation
+- issue_deauth(padapter, (&(pmlmeinfo->network))->MacAddress, WLAN_REASON_DEAUTH_LEAVING);
+- }
+-*/
+-
+- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+- {
+- return;
+- }
+-
+- //update attribute
+- pattrib = &pmgntframe->attrib;
+- update_mgntframe_attrib(padapter, pattrib);
+-
+- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+-
+- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+-
+- fctrl = &(pwlanhdr->frame_ctl);
+- *(fctrl) = 0;
+-
+- SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
+- pmlmeext->mgnt_seq++;
+- SetFrameSubType(pframe, WIFI_AUTH);
+-
+- pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
+- pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+-
+-
+- if(psta)// for AP mode
+- {
+-#ifdef CONFIG_NATIVEAP_MLME
+-
+- _rtw_memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
+-
+-
+- // setting auth algo number
+- val16 = (u16)psta->authalg;
+-
+- if(status != _STATS_SUCCESSFUL_)
+- val16 = 0;
+-
+- if (val16) {
+- val16 = cpu_to_le16(val16);
+- use_shared_key = 1;
+- }
+-
+- pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
+-
+- // setting auth seq number
+- val16 =(u16)psta->auth_seq;
+- val16 = cpu_to_le16(val16);
+- pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
+-
+- // setting status code...
+- val16 = status;
+- val16 = cpu_to_le16(val16);
+- pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen));
+-
+- // added challenging text...
+- if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1))
+- {
+- pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, psta->chg_txt, &(pattrib->pktlen));
+- }
+-#endif
+- }
+- else
+- {
+- _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&pmlmeinfo->network), ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&pmlmeinfo->network), ETH_ALEN);
+-
+- // setting auth algo number
+- val16 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared)? 1: 0;// 0:OPEN System, 1:Shared key
+- if (val16) {
+- val16 = cpu_to_le16(val16);
+- use_shared_key = 1;
+- }
+- //DBG_8192C("%s auth_algo= %s auth_seq=%d\n",__FUNCTION__,(pmlmeinfo->auth_algo==0)?"OPEN":"SHARED",pmlmeinfo->auth_seq);
+-
+- //setting IV for auth seq #3
+- if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1))
+- {
+- //DBG_8192C("==> iv(%d),key_index(%d)\n",pmlmeinfo->iv,pmlmeinfo->key_index);
+- val32 = ((pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30));
+- val32 = cpu_to_le32(val32);
+- pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&val32, &(pattrib->pktlen));
+-
+- pattrib->iv_len = 4;
+- }
+-
+- pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
+-
+- // setting auth seq number
+- val16 = pmlmeinfo->auth_seq;
+- val16 = cpu_to_le16(val16);
+- pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen));
+-
+-
+- // setting status code...
+- val16 = status;
+- val16 = cpu_to_le16(val16);
+- pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen));
+-
+- // then checking to see if sending challenging text...
+- if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1))
+- {
+- pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, pmlmeinfo->chg_txt, &(pattrib->pktlen));
+-
+- SetPrivacy(fctrl);
+-
+- pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+-
+- pattrib->encrypt = _WEP40_;
+-
+- pattrib->icv_len = 4;
+-
+- pattrib->pktlen += pattrib->icv_len;
+-
+- }
+-
+- }
+-
+- pattrib->last_txcmdsz = pattrib->pktlen;
+-
+- rtw_wep_encrypt(padapter, (u8 *)pmgntframe);
+-
+- dump_mgntframe(padapter, pmgntframe);
+-
+- return;
+-}
+-
+-
+-void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *pstat, int pkt_type)
+-{
+-#ifdef CONFIG_AP_MODE
+- struct xmit_frame *pmgntframe;
+- struct rtw_ieee80211_hdr *pwlanhdr;
+- struct pkt_attrib *pattrib;
+- unsigned char *pbuf, *pframe;
+- unsigned short val;
+- unsigned short *fctrl;
+- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network);
+- u8 *ie = pnetwork->IEs;
+-#ifdef CONFIG_P2P
+- struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
+-#ifdef CONFIG_WFD
+- u32 wfdielen = 0;
+-#endif //CONFIG_WFD
+-
+-#endif //CONFIG_P2P
+-
+- DBG_871X("%s\n", __FUNCTION__);
+-
+- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+- {
+- return;
+- }
+-
+- //update attribute
+- pattrib = &pmgntframe->attrib;
+- update_mgntframe_attrib(padapter, pattrib);
+-
+-
+- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
+-
+- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
+-
+- fctrl = &(pwlanhdr->frame_ctl);
+- *(fctrl) = 0;
+-
+- _rtw_memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
+- _rtw_memcpy((void *)GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
+- _rtw_memcpy((void *)GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+-
+-
+- SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
+- pmlmeext->mgnt_seq++;
+- if ((pkt_type == WIFI_ASSOCRSP) || (pkt_type == WIFI_REASSOCRSP))
+- SetFrameSubType(pwlanhdr, pkt_type);
+- else
+- return;
+-
+- pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+- pattrib->pktlen += pattrib->hdrlen;
+- pframe += pattrib->hdrlen;
+-
+- //capability
+- val = *(unsigned short *)rtw_get_capability_from_ie(ie);
+-
+- pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_ , (unsigned char *)&val, &(pattrib->pktlen));
+-
+- status = cpu_to_le16(status);
+- pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char *)&status, &(pattrib->pktlen));
+-
+- val = cpu_to_le16(pstat->aid | BIT(14) | BIT(15));
+- pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&val, &(pattrib->pktlen));
+-
+- if (pstat->bssratelen <= 8)
+- {
+- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen));
+- }
+- else
+- {
+- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, pstat->bssrateset, &(pattrib->pktlen));
+- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (pstat->bssratelen-8), pstat->bssrateset+8, &(pattrib->pktlen));
+- }
++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, pstat->bssrateset, &(pattrib->pktlen));
++ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (pstat->bssratelen-8), pstat->bssrateset+8, &(pattrib->pktlen));
++ }
+
+ #ifdef CONFIG_80211N_HT
+ if ((pstat->flags & WLAN_STA_HT) && (pmlmepriv->htpriv.ht_option))
+@@ -6503,21 +7528,30 @@ void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *p
}
#ifdef CONFIG_P2P
#endif //CONFIG_P2P
pattrib->last_txcmdsz = pattrib->pktlen;
-@@ -6529,6 +7563,7 @@ void issue_asocrsp(_adapter *padapter, u
+@@ -6529,6 +7563,7 @@ void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *p
void issue_assocreq(_adapter *padapter)
{
}
//update attribute
-@@ -6997,7 +8130,7 @@ void issue_nulldata(_adapter *padapter,
+@@ -6997,7 +8130,7 @@ void issue_nulldata(_adapter *padapter, unsigned int power_mode)
SetPwrMgt(fctrl);
}
_rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-@@ -7009,14 +8142,75 @@ void issue_nulldata(_adapter *padapter,
+@@ -7009,14 +8142,75 @@ void issue_nulldata(_adapter *padapter, unsigned int power_mode)
pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
pattrib->last_txcmdsz = pattrib->pktlen;
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
-@@ -7030,7 +8224,7 @@ void issue_qos_nulldata(_adapter *padapt
+@@ -7030,7 +8224,7 @@ void issue_qos_nulldata(_adapter *padapter, unsigned char *da, u16 tid)
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
{
}
//update attribute
-@@ -7083,230 +8277,104 @@ void issue_qos_nulldata(_adapter *padapt
+@@ -7083,11 +8277,71 @@ void issue_qos_nulldata(_adapter *padapter, unsigned char *da, u16 tid)
pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos);
pattrib->last_txcmdsz = pattrib->pktlen;
- dump_mgntframe(padapter, pmgntframe);
--
--}
--
--void issue_deauth(_adapter *padapter, unsigned char *da, unsigned short reason)
--{
-- struct xmit_frame *pmgntframe;
-- struct pkt_attrib *pattrib;
-- unsigned char *pframe;
-- struct rtw_ieee80211_hdr *pwlanhdr;
-- unsigned short *fctrl;
-- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
--
-- DBG_871X("%s to "MAC_FMT"\n", __func__, MAC_ARG(da));
-- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
-- {
-- return;
-- }
--
-- //update attribute
-- pattrib = &pmgntframe->attrib;
-- update_mgntframe_attrib(padapter, pattrib);
-- pattrib->retry_ctrl = _FALSE;
--
-- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
--
-- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
--
-- fctrl = &(pwlanhdr->frame_ctl);
-- *(fctrl) = 0;
--
-- _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
-- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
-- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
--
-- SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
-- pmlmeext->mgnt_seq++;
-- SetFrameSubType(pframe, WIFI_DEAUTH);
--
-- pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
-- pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
--
-- reason = cpu_to_le16(reason);
-- pframe = rtw_set_fixed_ie(pframe, _RSON_CODE_ , (unsigned char *)&reason, &(pattrib->pktlen));
--
-- pattrib->last_txcmdsz = pattrib->pktlen;
--
-- dump_mgntframe(padapter, pmgntframe);
--}
--
--void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short status)
--{
-- u8 category = RTW_WLAN_CATEGORY_BACK;
-- u16 start_seq;
-- u16 BA_para_set;
-- u16 reason_code;
-- u16 BA_timeout_value;
-- u16 BA_starting_seqctrl;
-- struct xmit_frame *pmgntframe;
-- struct pkt_attrib *pattrib;
-- u8 *pframe;
-- struct rtw_ieee80211_hdr *pwlanhdr;
-- u16 *fctrl;
-- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- struct sta_info *psta;
-- struct sta_priv *pstapriv = &padapter->stapriv;
-- struct registry_priv *pregpriv = &padapter->registrypriv;
--
--
-- DBG_871X("%s, category=%d, action=%d, status=%d\n", __FUNCTION__, category, action, status);
--
-- if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ if(wait_ack)
- {
-- return;
++ {
+ ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
+ }
+ else
+ {
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
- }
-
-- //update attribute
-- pattrib = &pmgntframe->attrib;
-- update_mgntframe_attrib(padapter, pattrib);
--
-- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
--
-- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
--
-- fctrl = &(pwlanhdr->frame_ctl);
-- *(fctrl) = 0;
--
-- //_rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-- _rtw_memcpy(pwlanhdr->addr1, raddr, ETH_ALEN);
-- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
-- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
--
-- SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
-- pmlmeext->mgnt_seq++;
-- SetFrameSubType(pframe, WIFI_ACTION);
--
-- pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
-- pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
--
-- pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
-- pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
--
-- status = cpu_to_le16(status);
--
--
-- if (category == 3)
-- {
-- switch (action)
-- {
-- case 0: //ADDBA req
-- do {
-- pmlmeinfo->dialogToken++;
-- } while (pmlmeinfo->dialogToken == 0);
-- pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->dialogToken), &(pattrib->pktlen));
--
-- BA_para_set = (0x1002 | ((status & 0xf) << 2)); //immediate ack & 64 buffer size
-- //sys_mib.BA_para_set = 0x0802; //immediate ack & 32 buffer size
-- BA_para_set = cpu_to_le16(BA_para_set);
-- pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen));
--
-- //BA_timeout_value = 0xffff;//max: 65535 TUs(~ 65 ms)
-- BA_timeout_value = 5000;//~ 5ms
-- BA_timeout_value = cpu_to_le16(BA_timeout_value);
-- pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_timeout_value)), &(pattrib->pktlen));
++ }
++
+exit:
+ return ret;
+}
-
-- //if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL)
-- if ((psta = rtw_get_stainfo(pstapriv, raddr)) != NULL)
-- {
-- start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07]&0xfff) + 1;
++
+//when wait_ms >0 , this function shoule be called at process context
+//da == NULL for station mode
+int issue_qos_nulldata(_adapter *padapter, unsigned char *da, u16 tid, int try_cnt, int wait_ms)
+ u32 start = rtw_get_current_time();
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
-- DBG_871X("BA_starting_seqctrl = %d for TID=%d\n", start_seq, status & 0x07);
--
-- psta->BA_starting_seqctrl[status & 0x07] = start_seq;
--
-- BA_starting_seqctrl = start_seq << 4;
-- }
--
-- BA_starting_seqctrl = cpu_to_le16(BA_starting_seqctrl);
-- pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_starting_seqctrl)), &(pattrib->pktlen));
-- break;
++
+ /* da == NULL, assum it's null data for sta to ap*/
+ if (da == NULL)
+ da = get_my_bssid(&(pmlmeinfo->network));
+ do
+ {
+ ret = _issue_qos_nulldata(padapter, da, tid, wait_ms>0?_TRUE:_FALSE);
-
-- case 1: //ADDBA rsp
-- pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen));
-- pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen));
++
+ i++;
-
-- //BA_para_set = cpu_to_le16((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size
-- BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size
++
+ if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
+ break;
-
-- if(pregpriv->ampdu_amsdu==0)//disabled
-- BA_para_set = cpu_to_le16(BA_para_set & ~BIT(0));
-- else if(pregpriv->ampdu_amsdu==1)//enabled
-- BA_para_set = cpu_to_le16(BA_para_set | BIT(0));
-- else //auto
-- BA_para_set = cpu_to_le16(BA_para_set);
--
-- pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen));
-- pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(pmlmeinfo->ADDBA_req.BA_timeout_value)), &(pattrib->pktlen));
-- break;
-- case 2://DELBA
-- BA_para_set = (status & 0x1F) << 3;
-- BA_para_set = cpu_to_le16(BA_para_set);
-- pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen));
++
+ if(i < try_cnt && wait_ms > 0 && ret==_FAIL)
+ rtw_msleep_os(wait_ms);
-
-- reason_code = 37;//Requested from peer STA as it does not want to use the mechanism
-- reason_code = cpu_to_le16(reason_code);
-- pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(reason_code)), &(pattrib->pktlen));
-- break;
-- default:
-- break;
-- }
-- }
++
+ }while((i<try_cnt) && ((ret==_FAIL)||(wait_ms==0)));
-
-- pattrib->last_txcmdsz = pattrib->pktlen;
++
+ if (ret != _FAIL) {
+ ret = _SUCCESS;
+ #ifndef DBG_XMIT_ACK
+ goto exit;
+ #endif
+ }
-
-- dump_mgntframe(padapter, pmgntframe);
++
+ if (try_cnt && wait_ms) {
+ if (da)
+ DBG_871X(FUNC_ADPT_FMT" to "MAC_FMT", ch:%u%s, %d/%d in %u ms\n",
+ return ret;
}
--static void issue_action_BSSCoexistPacket(_adapter *padapter)
--{
-- _irqL irqL;
-- _list *plist, *phead;
-- unsigned char category, action;
+-void issue_deauth(_adapter *padapter, unsigned char *da, unsigned short reason)
+static int _issue_deauth(_adapter *padapter, unsigned char *da, unsigned short reason, u8 wait_ack)
-+{
+ {
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
-- unsigned char *pframe;
-+ unsigned char *pframe;
- struct rtw_ieee80211_hdr *pwlanhdr;
-- unsigned short *fctrl;
-- struct wlan_network *pnetwork = NULL;
-+ unsigned short *fctrl;
+@@ -7097,12 +8351,24 @@ void issue_deauth(_adapter *padapter, unsigned char *da, unsigned short reason)
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- _queue *queue = &(pmlmepriv->scanned_queue);
-- u8 InfoContent[16] = {0};
-- u8 ICS[8][15];
--
-- if((pmlmepriv->num_FortyMHzIntolerant==0) || (pmlmepriv->num_sta_no_ht==0))
-- return;
-
-- if(_TRUE == pmlmeinfo->bwmode_updated)
-- return;
+- DBG_871X("%s to "MAC_FMT"\n", __func__, MAC_ARG(da));
+ int ret = _FAIL;
+#ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
+#endif //CONFIG_P2P
+ //DBG_871X("%s to "MAC_FMT"\n", __func__, MAC_ARG(da));
-
-- DBG_871X("%s\n", __FUNCTION__);
--
--
-- category = RTW_WLAN_CATEGORY_PUBLIC;
-- action = ACT_PUBLIC_BSSCOEXIST;
++
+#ifdef CONFIG_P2P
+ if ( !( rtw_p2p_chk_state( pwdinfo, P2P_STATE_NONE ) ) && ( pwdinfo->rx_invitereq_info.scan_op_ch_only ) )
+ {
+ _set_timer( &pwdinfo->reset_ch_sitesurvey, 10 );
+ }
+#endif //CONFIG_P2P
-
++
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
{
- return;
}
//update attribute
- pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(padapter, pattrib);
-+ pattrib->retry_ctrl = _FALSE;
-
- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
-@@ -7316,4715 +8384,4970 @@ static void issue_action_BSSCoexistPacke
- fctrl = &(pwlanhdr->frame_ctl);
- *(fctrl) = 0;
-
-- _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-+ _rtw_memcpy(pwlanhdr->addr1, da, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-
- SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
- pmlmeext->mgnt_seq++;
-- SetFrameSubType(pframe, WIFI_ACTION);
-+ SetFrameSubType(pframe, WIFI_DEAUTH);
-
- pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
- pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+@@ -7134,17 +8400,138 @@ void issue_deauth(_adapter *padapter, unsigned char *da, unsigned short reason)
-- pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
-- pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
-+ reason = cpu_to_le16(reason);
-+ pframe = rtw_set_fixed_ie(pframe, _RSON_CODE_ , (unsigned char *)&reason, &(pattrib->pktlen));
-
-+ pattrib->last_txcmdsz = pattrib->pktlen;
-
-- //
-- if(pmlmepriv->num_FortyMHzIntolerant>0)
-- {
-- u8 iedata=0;
--
-- iedata |= BIT(2);//20 MHz BSS Width Request
+ pattrib->last_txcmdsz = pattrib->pktlen;
-- pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
--
++
+ if(wait_ack)
+ {
+ ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe);
+ {
+ dump_mgntframe(padapter, pmgntframe);
+ ret = _SUCCESS;
- }
--
--
-- //
-- _rtw_memset(ICS, 0, sizeof(ICS));
-- if(pmlmepriv->num_sta_no_ht>0)
-- {
-- int i;
--
-- _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-
-- phead = get_list_head(queue);
-- plist = get_next(phead);
--
-- while(1)
-- {
-- int len;
-- u8 *p;
-- WLAN_BSSID_EX *pbss_network;
--
-- if (rtw_end_of_queue_search(phead,plist)== _TRUE)
-- break;
++ }
++
+exit:
+ return ret;
+}
-
-- pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
--
-- plist = get_next(plist);
++
+int issue_deauth(_adapter *padapter, unsigned char *da, unsigned short reason)
+{
+ DBG_871X("%s to "MAC_FMT"\n", __func__, MAC_ARG(da));
+ return _issue_deauth(padapter, da, reason, _FALSE);
+}
-
-- pbss_network = (WLAN_BSSID_EX *)&pnetwork->network;
++
+int issue_deauth_ex(_adapter *padapter, u8 *da, unsigned short reason, int try_cnt,
+ int wait_ms)
+{
+ int ret;
+ int i = 0;
+ u32 start = rtw_get_current_time();
-
-- p = rtw_get_ie(pbss_network->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pbss_network->IELength - _FIXED_IE_LENGTH_);
-- if((p==NULL) || (len==0))//non-HT
-- {
-- if((pbss_network->Configuration.DSConfig<=0) || (pbss_network->Configuration.DSConfig>14))
-- continue;
--
-- ICS[0][pbss_network->Configuration.DSConfig]=1;
--
-- if(ICS[0][0] == 0)
-- ICS[0][0] = 1;
-- }
--
-- }
++
+ do
+ {
+ ret = _issue_deauth(padapter, da, reason, wait_ms>0?_TRUE:_FALSE);
-
-- _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
++
+ i++;
-
++
+ if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
+ break;
-
-- for(i= 0;i<8;i++)
-- {
-- if(ICS[i][0] == 1)
-- {
-- int j, k = 0;
--
-- InfoContent[k] = i;
-- //SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent,i);
-- k++;
--
-- for(j=1;j<=14;j++)
-- {
-- if(ICS[i][j]==1)
-- {
-- if(k<16)
-- {
-- InfoContent[k] = j; //channel number
-- //SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j);
-- k++;
-- }
-- }
-- }
++
+ if(i < try_cnt && wait_ms > 0 && ret==_FAIL)
+ rtw_msleep_os(wait_ms);
-
-- pframe = rtw_set_ie(pframe, EID_BSSIntolerantChlReport, k, InfoContent, &(pattrib->pktlen));
--
-- }
--
-- }
--
++
+ }while((i<try_cnt) && ((ret==_FAIL)||(wait_ms==0)));
-
++
+ if (ret != _FAIL) {
+ ret = _SUCCESS;
+ #ifndef DBG_XMIT_ACK
+ goto exit;
+ #endif
- }
--
--
-- pattrib->last_txcmdsz = pattrib->pktlen;
--
-- dump_mgntframe(padapter, pmgntframe);
--
--}
--
--unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr)
--{
-- struct sta_priv *pstapriv = &padapter->stapriv;
-- struct sta_info *psta = NULL;
-- //struct recv_reorder_ctrl *preorder_ctrl;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- u16 tid;
--
-- if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
-- if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS))
-- return _SUCCESS;
--
-- psta = rtw_get_stainfo(pstapriv, addr);
-- if(psta==NULL)
-- return _SUCCESS;
-
-- //DBG_8192C("%s:%s\n", __FUNCTION__, (initiator==0)?"RX_DIR":"TX_DIR");
--
-- if(initiator==0) // recipient
-- {
-- for(tid = 0;tid<MAXTID;tid++)
-- {
-- if(psta->recvreorder_ctrl[tid].enable == _TRUE)
-- {
-- DBG_8192C("rx agg disable tid(%d)\n",tid);
-- issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid <<1) |initiator)&0x1F));
-- psta->recvreorder_ctrl[tid].enable = _FALSE;
-- psta->recvreorder_ctrl[tid].indicate_seq = 0xffff;
-- #ifdef DBG_RX_SEQ
-- DBG_871X("DBG_RX_SEQ %s:%d indicate_seq:%u \n", __FUNCTION__, __LINE__,
-- psta->recvreorder_ctrl[tid].indicate_seq);
-- #endif
-- }
-- }
-- }
-- else if(initiator == 1)// originator
-- {
-- //DBG_8192C("tx agg_enable_bitmap(0x%08x)\n", psta->htpriv.agg_enable_bitmap);
-- for(tid = 0;tid<MAXTID;tid++)
-- {
-- if(psta->htpriv.agg_enable_bitmap & BIT(tid))
-- {
-- DBG_8192C("tx agg disable tid(%d)\n",tid);
-- issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid <<1) |initiator)&0x1F) );
-- psta->htpriv.agg_enable_bitmap &= ~BIT(tid);
-- psta->htpriv.candidate_tid_bitmap &= ~BIT(tid);
--
-- }
-- }
-- }
--
-- return _SUCCESS;
--
++ }
++
+ if (try_cnt && wait_ms) {
+ if (da)
+ DBG_871X(FUNC_ADPT_FMT" to "MAC_FMT", ch:%u%s, %d/%d in %u ms\n",
+ }
+exit:
+ return ret;
- }
-
--unsigned int send_beacon(_adapter *padapter)
--{
-- u8 bxmitok = _FALSE;
-- int retry=0;
++}
++
+void issue_action_spct_ch_switch(_adapter *padapter, u8 *ra, u8 new_ch, u8 ch_offset)
+{
+ _irqL irqL;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
-- //DBG_871X("%s\n", __FUNCTION__);
-
--#ifdef CONFIG_PCI_HCI
++
++
+ DBG_871X(FUNC_NDEV_FMT" ra="MAC_FMT", ch:%u, offset:%u\n",
+ FUNC_NDEV_ARG(padapter->pnetdev), MAC_ARG(ra), new_ch, ch_offset);
-
-- issue_beacon(padapter);
++
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ return;
-
-- return _SUCCESS;
++
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ update_mgntframe_attrib(padapter, pattrib);
-
--#endif
++
+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
--#ifdef CONFIG_USB_HCI
-- do{
++
+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
-- issue_beacon(padapter);
++
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
-
-- padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_TX_BCN_DONE, (u8 *)(&bxmitok));
++
+ _rtw_memcpy(pwlanhdr->addr1, ra, ETH_ALEN); /* RA */
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); /* TA */
+ _rtw_memcpy(pwlanhdr->addr3, ra, ETH_ALEN); /* DA = RA */
-
-- }while((_FALSE == bxmitok) &&((retry++)<100 ));
++
+ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
+ pmlmeext->mgnt_seq++;
+ SetFrameSubType(pframe, WIFI_ACTION);
-
-- if(retry == 100)
-- {
-- DBG_871X("send_beacon, fail!\n");
-- return _FAIL;
-- }
-- else
++
+ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
+ pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
+
+ /* category, action */
- {
-- return _SUCCESS;
++ {
+ u8 category, action;
+ category = RTW_WLAN_CATEGORY_SPECTRUM_MGMT;
+ action = RTW_WLAN_ACTION_SPCT_CHL_SWITCH;
+
+ pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
- }
--#endif
--
--}
-
--/****************************************************************************
++ }
++
+ pframe = rtw_set_ie_ch_switch(pframe, &(pattrib->pktlen), 0, new_ch, 0);
+ pframe = rtw_set_ie_secondary_ch_offset(pframe, &(pattrib->pktlen),
+ hal_ch_offset_to_secondary_ch_offset(ch_offset));
-
--Following are some utitity fuctions for WiFi MLME
++
+ pattrib->last_txcmdsz = pattrib->pktlen;
-
--*****************************************************************************/
-+ dump_mgntframe(padapter, pmgntframe);
-
--BOOLEAN IsLegal5GChannel(
-- IN PADAPTER Adapter,
-- IN u8 channel)
--{
--
-- int i=0;
-- u8 Channel_5G[45] = {36,38,40,42,44,46,48,50,52,54,56,58,
-- 60,62,64,100,102,104,106,108,110,112,114,116,118,120,122,
-- 124,126,128,130,132,134,136,138,140,149,151,153,155,157,159,
-- 161,163,165};
-- for(i=0;i<sizeof(Channel_5G);i++)
-- if(channel == Channel_5G[i])
-- return _TRUE;
-- return _FALSE;
++
+ dump_mgntframe(padapter, pmgntframe);
++
}
--void site_survey(_adapter *padapter)
+-void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short status)
+#ifdef CONFIG_IEEE80211W
+void issue_action_SA_Query(_adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short tid)
{
-- unsigned char survey_channel = 0, val8;
-- RT_SCAN_TYPE ScanType = SCAN_PASSIVE;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- u8 category = RTW_WLAN_CATEGORY_BACK;
+- u16 start_seq;
+- u16 BA_para_set;
+ u8 category = RTW_WLAN_CATEGORY_SA_QUERY;
-+ u16 reason_code;
-+ struct xmit_frame *pmgntframe;
-+ struct pkt_attrib *pattrib;
-+ u8 *pframe;
-+ struct rtw_ieee80211_hdr *pwlanhdr;
-+ u16 *fctrl;
-+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- u32 initialgain = 0;
--
--#ifdef CONFIG_P2P
-- struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
-- static unsigned char prev_survey_channel = 0;
-- static unsigned int p2p_scan_count = 0;
--
-- if(rtw_p2p_findphase_ex_is_social(pwdinfo))
-+ struct sta_info *psta;
-+ struct sta_priv *pstapriv = &padapter->stapriv;
-+ struct registry_priv *pregpriv = &padapter->registrypriv;
-+
-+
+ u16 reason_code;
+- u16 BA_timeout_value;
+- u16 BA_starting_seqctrl;
+ struct xmit_frame *pmgntframe;
+ struct pkt_attrib *pattrib;
+ u8 *pframe;
+@@ -7158,10 +8545,11 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act
+ struct registry_priv *pregpriv = &padapter->registrypriv;
+
+
+- DBG_871X("%s, category=%d, action=%d, status=%d\n", __FUNCTION__, category, action, status);
+ DBG_871X("%s\n", __FUNCTION__);
-+
-+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
{
-- // Commented by Albert 2011/06/03
-- // The driver is in the find phase, it should go through the social channel.
-- survey_channel = pwdinfo->social_chan[pmlmeext->sitesurvey_res.channel_idx];
+ DBG_871X("%s: alloc_mgtxmitframe fail\n", __FUNCTION__);
-+ return;
+ return;
}
-+
-+ //update attribute
-+ pattrib = &pmgntframe->attrib;
-+ update_mgntframe_attrib(padapter, pattrib);
-+
-+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-+
-+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-+
-+ fctrl = &(pwlanhdr->frame_ctl);
-+ *(fctrl) = 0;
-+
+
+@@ -7177,8 +8565,10 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+
+- //_rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+- _rtw_memcpy(pwlanhdr->addr1, raddr, ETH_ALEN);
+ if(raddr)
+ _rtw_memcpy(pwlanhdr->addr1, raddr, ETH_ALEN);
- else
--#endif //CONFIG_P2P
-- {
-- survey_channel = pmlmeext->channel_set[pmlmeext->sitesurvey_res.channel_idx].ChannelNum;
-- }
++ else
+ _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
-+ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-- ScanType = pmlmeext->channel_set[pmlmeext->sitesurvey_res.channel_idx].ScanType;
--
-- //DBG_871X("switching to ch:%d (cnt:%u,idx:%d) at %dms, %c%c%c\n"
-- // , survey_channel
-- // , pwdinfo->find_phase_state_exchange_cnt, pmlmeext->sitesurvey_res.channel_idx
-- // , rtw_get_passing_time_ms(padapter->mlmepriv.scan_start_time)
-- // , ScanType?'A':'P', pmlmeext->sitesurvey_res.scan_mode?'A':'P'
-- // , pmlmeext->sitesurvey_res.ssid[0].SsidLength?'S':' '
-- //);
-+ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
-+ pmlmeext->mgnt_seq++;
-+ SetFrameSubType(pframe, WIFI_ACTION);
+@@ -7189,11 +8579,89 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act
+ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
+ pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
-- if(survey_channel != 0)
-+ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
-+ pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
-+
+- pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
+- pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
+-
+- status = cpu_to_le16(status);
+-
+ pframe = rtw_set_fixed_ie(pframe, 1, &category, &pattrib->pktlen);
+ pframe = rtw_set_fixed_ie(pframe, 1, &action, &pattrib->pktlen);
+
+ switch (action)
- {
-- //PAUSE 4-AC Queue when site_survey
-- //padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
-- //val8 |= 0x0f;
-- //padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
++ {
+ case 0: //SA Query req
+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)&pmlmeext->sa_query_seq, &pattrib->pktlen);
+ pmlmeext->sa_query_seq++;
+ //send sa query request to AP, AP should reply sa query response in 1 second
+ set_sa_query_timer(pmlmeext, 1000);
+ break;
-
-- if(pmlmeext->sitesurvey_res.channel_idx == 0)
-- {
-- set_channel_bwmode(padapter, survey_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
-- }
-- else
-- {
-- SelectChannel(padapter, survey_channel);
-- }
++
+ case 1: //SA Query rsp
+ tid = cpu_to_le16(tid);
+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)&tid, &pattrib->pktlen);
+ default:
+ break;
+ }
-
++
+ pattrib->last_txcmdsz = pattrib->pktlen;
-
-- if(ScanType == SCAN_ACTIVE) //obey the channel plan setting...
-- {
-- #ifdef CONFIG_P2P
-- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) ||
-- rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)
-- )
-- {
-- issue_probereq_p2p(padapter);
-- issue_probereq_p2p(padapter);
-- issue_probereq_p2p(padapter);
-- }
-- else
-- #endif //CONFIG_P2P
-- {
-- int i;
-- for(i=0;i<RTW_SSID_SCAN_AMOUNT;i++){
-- if(pmlmeext->sitesurvey_res.ssid[i].SsidLength) {
-- //todo: to issue two probe req???
-- issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]),1);
-- //rtw_msleep_os(SURVEY_TO>>1);
-- issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]),1);
-- } else {
-- break;
-- }
-- }
++
+ dump_mgntframe(padapter, pmgntframe);
+}
+#endif //CONFIG_IEEE80211W
-
-- if(pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) {
-- //todo: to issue two probe req???
-- issue_probereq(padapter, NULL, 1);
-- //rtw_msleep_os(SURVEY_TO>>1);
-- issue_probereq(padapter, NULL, 1);
-- }
-- }
-- }
++
+void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short status)
+{
+ u8 category = RTW_WLAN_CATEGORY_BACK;
+ struct sta_info *psta;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct registry_priv *pregpriv = &padapter->registrypriv;
-
-- set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
-
-- }
-- else
++
++
+ DBG_871X("%s, category=%d, action=%d, status=%d\n", __FUNCTION__, category, action, status);
+
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
++ {
+ return;
+ }
-
-- // channel number is 0 or this channel is not valid.
--#ifdef CONFIG_P2P
-- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH))
-- {
-- #ifdef CONFIG_DBG_P2P
-- DBG_8192C( "[%s] find phase exchange cnt = %d\n", __FUNCTION__, pwdinfo->find_phase_state_exchange_cnt );
-- #endif
-- }
--
-- if(rtw_p2p_findphase_ex_is_needed(pwdinfo))
-- {
-- // Set the P2P State to the listen state of find phase and set the current channel to the listen channel
-- set_channel_bwmode(padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
-- rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_LISTEN);
--
-- pmlmeext->sitesurvey_res.state = SCAN_DISABLE;
++
+ //update attribute
+ pattrib = &pmgntframe->attrib;
+ update_mgntframe_attrib(padapter, pattrib);
-
-- _set_timer( &pwdinfo->find_phase_timer, ( u32 ) ( ( u32 ) ( pwdinfo->listen_dwell ) * 100 ) );
-- }
-- else
--#endif //CONFIG_P2P
-- {
++
+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
--#ifdef CONFIG_ANTENNA_DIVERSITY
-- // 20100721:Interrupt scan operation here.
-- // For SW antenna diversity before link, it needs to switch to another antenna and scan again.
-- // It compares the scan result and select beter one to do connection.
-- if(padapter->HalFunc.SwAntDivBeforeLinkHandler(padapter))
-- {
-- pmlmeext->sitesurvey_res.bss_cnt = 0;
-- pmlmeext->sitesurvey_res.channel_idx = -1;
-- pmlmeext->chan_scan_time = SURVEY_TO /2;
-- set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
-- return;
-- }
--#endif
++
+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
--#ifdef CONFIG_P2P
-- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH))
-- {
-- rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN);
-- }
-- rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE);
--#endif //CONFIG_P2P
--
-- pmlmeext->sitesurvey_res.state = SCAN_COMPLETE;
++
+ fctrl = &(pwlanhdr->frame_ctl);
+ *(fctrl) = 0;
+
+
+ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
+ pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
-
-- //switch back to the original channel
-- //SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset);
++
+ pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
+ pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
-
--#ifdef CONFIG_P2P
-- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_OK)
-- && pwdinfo->peer_operating_ch != 0
-- )
-- {
-- DBG_8192C( "[%s] In P2P WPS mode, stay in the peer operating channel = %d\n", __FUNCTION__, pwdinfo->peer_operating_ch );
-- set_channel_bwmode(padapter, pwdinfo->peer_operating_ch, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-- }
-- else
--#endif //CONFIG_P2P
-- {
-- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-- }
++
+ status = cpu_to_le16(status);
+
-- //flush 4-AC Queue after site_survey
-- //val8 = 0;
-- //padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
-+ if (category == 3)
-+ {
-+ switch (action)
-+ {
-+ case 0: //ADDBA req
-+ do {
-+ pmlmeinfo->dialogToken++;
-+ } while (pmlmeinfo->dialogToken == 0);
-+ pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->dialogToken), &(pattrib->pktlen));
-
-- val8 = 0;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
-+ BA_para_set = (0x1002 | ((status & 0xf) << 2)); //immediate ack & 64 buffer size
-+ //sys_mib.BA_para_set = 0x0802; //immediate ack & 32 buffer size
-+ BA_para_set = cpu_to_le16(BA_para_set);
-+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen));
-
-- //config MSR
-- Set_NETYPE0_MSR(padapter, (pmlmeinfo->state & 0x3));
-+ //BA_timeout_value = 0xffff;//max: 65535 TUs(~ 65 ms)
-+ BA_timeout_value = 5000;//~ 5ms
-+ BA_timeout_value = cpu_to_le16(BA_timeout_value);
-+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_timeout_value)), &(pattrib->pktlen));
-
-- initialgain = 0xff; //restore RX GAIN
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
-- //turn on dynamic functions
-- Restore_DM_Func_Flag(padapter);
-- //Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE);
-+ //if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL)
-+ if ((psta = rtw_get_stainfo(pstapriv, raddr)) != NULL)
-+ {
-+ start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07]&0xfff) + 1;
-
-- if (is_client_associated_to_ap(padapter) == _TRUE)
-- {
-- //issue null data
-- issue_nulldata(padapter, 0);
-- }
-+ DBG_871X("BA_starting_seqctrl = %d for TID=%d\n", start_seq, status & 0x07);
-+
-+ psta->BA_starting_seqctrl[status & 0x07] = start_seq;
-+
-+ BA_starting_seqctrl = start_seq << 4;
-+ }
-+
-+ BA_starting_seqctrl = cpu_to_le16(BA_starting_seqctrl);
-+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_starting_seqctrl)), &(pattrib->pktlen));
-+ break;
-
-- report_surveydone_event(padapter);
-+ case 1: //ADDBA rsp
-+ pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen));
-+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen));
-
-- pmlmeext->chan_scan_time = SURVEY_TO;
-- pmlmeext->sitesurvey_res.state = SCAN_DISABLE;
-+ //BA_para_set = cpu_to_le16((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size
-+ BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size
-
-- issue_action_BSSCoexistPacket(padapter);
-- issue_action_BSSCoexistPacket(padapter);
-- issue_action_BSSCoexistPacket(padapter);
-+ if(pregpriv->ampdu_amsdu==0)//disabled
-+ BA_para_set = cpu_to_le16(BA_para_set & ~BIT(0));
-+ else if(pregpriv->ampdu_amsdu==1)//enabled
-+ BA_para_set = cpu_to_le16(BA_para_set | BIT(0));
-+ else //auto
-+ BA_para_set = cpu_to_le16(BA_para_set);
-+
-+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen));
-+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(pmlmeinfo->ADDBA_req.BA_timeout_value)), &(pattrib->pktlen));
-+ break;
-+ case 2://DELBA
-+ BA_para_set = (status & 0x1F) << 3;
-+ BA_para_set = cpu_to_le16(BA_para_set);
-+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen));
-
-+ reason_code = 37;//Requested from peer STA as it does not want to use the mechanism
-+ reason_code = cpu_to_le16(reason_code);
-+ pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(reason_code)), &(pattrib->pktlen));
-+ break;
-+ default:
-+ break;
- }
--
- }
-
-- return;
-+ pattrib->last_txcmdsz = pattrib->pktlen;
-
-+ dump_mgntframe(padapter, pmgntframe);
- }
-
--//collect bss info from Beacon and Probe response frames.
--u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSID_EX *bssid)
--{
-- int i;
-- u32 len;
-- u8 *p;
-- u16 val16, subtype;
-- u8 *pframe = precv_frame->u.hdr.rx_data;
-- u32 packet_len = precv_frame->u.hdr.len;
-- struct registry_priv *pregistrypriv = &padapter->registrypriv;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+static void issue_action_BSSCoexistPacket(_adapter *padapter)
-+{
-+ _irqL irqL;
-+ _list *plist, *phead;
-+ unsigned char category, action;
-+ struct xmit_frame *pmgntframe;
-+ struct pkt_attrib *pattrib;
-+ unsigned char *pframe;
-+ struct rtw_ieee80211_hdr *pwlanhdr;
-+ unsigned short *fctrl;
-+ struct wlan_network *pnetwork = NULL;
-+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ _queue *queue = &(pmlmepriv->scanned_queue);
-+ u8 InfoContent[16] = {0};
-+ u8 ICS[8][15];
-+
-+ if((pmlmepriv->num_FortyMHzIntolerant==0) || (pmlmepriv->num_sta_no_ht==0))
-+ return;
-
-- len = packet_len - sizeof(struct rtw_ieee80211_hdr_3addr);
-+ if(_TRUE == pmlmeinfo->bwmode_updated)
-+ return;
-+
-
-- if (len > MAX_IE_SZ)
-+ DBG_871X("%s\n", __FUNCTION__);
-+
-+
-+ category = RTW_WLAN_CATEGORY_PUBLIC;
-+ action = ACT_PUBLIC_BSSCOEXIST;
-+
-+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
- {
-- //DBG_8192C("IE too long for survey event\n");
-- return _FAIL;
-+ return;
- }
-
-- _rtw_memset(bssid, 0, sizeof(WLAN_BSSID_EX));
-+ //update attribute
-+ pattrib = &pmgntframe->attrib;
-+ update_mgntframe_attrib(padapter, pattrib);
-
-- subtype = GetFrameSubType(pframe);
-+ _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
-- if(subtype==WIFI_BEACON)
-- bssid->Reserved[0] = 1;
-- else
-- bssid->Reserved[0] = 0;
--
-- bssid->Length = sizeof(WLAN_BSSID_EX) - MAX_IE_SZ + len;
-+ pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-+ pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
-- //below is to copy the information element
-- bssid->IELength = len;
-- _rtw_memcpy(bssid->IEs, (pframe + sizeof(struct rtw_ieee80211_hdr_3addr)), bssid->IELength);
-+ fctrl = &(pwlanhdr->frame_ctl);
-+ *(fctrl) = 0;
-
-- //get the signal strength
-- bssid->PhyInfo.SignalQuality = precv_frame->u.hdr.attrib.signal_qual;//in percentage
-- bssid->PhyInfo.SignalStrength = precv_frame->u.hdr.attrib.signal_strength;//in percentage
-- bssid->Rssi = precv_frame->u.hdr.attrib.RecvSignalPower; // in dBM.raw data
--
--#ifdef CONFIG_ANTENNA_DIVERSITY
-- //padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_CURRENT_ANTENNA, (u8 *)(&bssid->PhyInfo.Optimum_antenna));
-- padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_CURRENT_ANTENNA, &bssid->PhyInfo.Optimum_antenna);
--#endif
-+ _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-+ _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
-+ _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-
-- // checking SSID
-- if ((p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_)) == NULL)
-- {
-- DBG_871X("marc: cannot find SSID for survey event\n");
-- return _FAIL;
-- }
-+ SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
-+ pmlmeext->mgnt_seq++;
-+ SetFrameSubType(pframe, WIFI_ACTION);
-
-- if (*(p + 1))
-- {
-- _rtw_memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
-- bssid->Ssid.SsidLength = *(p + 1);
-- }
-- else
-- {
-- bssid->Ssid.SsidLength = 0;
-- }
-+ pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
-+ pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
-
-- _rtw_memset(bssid->SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
-+ pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
-+ pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
-
-- //checking rate info...
-- i = 0;
-- p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SUPPORTEDRATES_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-- if (p != NULL)
-- {
-- _rtw_memcpy(bssid->SupportedRates, (p + 2), len);
-- i = len;
-- }
-
-- p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _EXT_SUPPORTEDRATES_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-- if (p != NULL)
-+ //
-+ if(pmlmepriv->num_FortyMHzIntolerant>0)
+ if (category == 3)
{
-- _rtw_memcpy(bssid->SupportedRates + i, (p + 2), len);
-- }
-+ u8 iedata=0;
-+
-+ iedata |= BIT(2);//20 MHz BSS Width Request
-
-- //todo:
--#if 0
-- if (judge_network_type(bssid->SupportedRates, (len + i)) == WIRELESS_11B)
-- {
-- bssid->NetworkTypeInUse = Ndis802_11DS;
-- }
-- else
--#endif
-- {
-- bssid->NetworkTypeInUse = Ndis802_11OFDM24;
-+ pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
-+
- }
-+
-
-- // Checking for DSConfig
-- p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _DSSET_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
--
-- bssid->Configuration.DSConfig = 0;
-- bssid->Configuration.Length = 0;
-+ //
-+ _rtw_memset(ICS, 0, sizeof(ICS));
-+ if(pmlmepriv->num_sta_no_ht>0)
-+ {
-+ int i;
-+
-+ _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-
-- if (p)
-- {
-- bssid->Configuration.DSConfig = *(p + 2);
-- }
-- else
-- {// In 5G, some ap do not have DSSET IE
-- // checking HT info for channel
-- p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-- if(p)
-+ phead = get_list_head(queue);
-+ plist = get_next(phead);
-+
-+ while(1)
- {
-- struct HT_info_element *HT_info = (struct HT_info_element *)(p + 2);
-- bssid->Configuration.DSConfig = HT_info->primary_channel;
-- }
-- else
-- { // use current channel
-- if (padapter->mlmeextpriv.sitesurvey_res.state == SCAN_PROCESS)
-- bssid->Configuration.DSConfig = padapter->mlmeextpriv.channel_set[padapter->mlmeextpriv.sitesurvey_res.channel_idx].ChannelNum;
-- else
-- bssid->Configuration.DSConfig = padapter->mlmeextpriv.cur_channel;
-- }
-- }
--
-- _rtw_memcpy(&bssid->Configuration.BeaconPeriod, rtw_get_beacon_interval_from_ie(bssid->IEs), 2);
--
-+ int len;
-+ u8 *p;
-+ WLAN_BSSID_EX *pbss_network;
-+
-+ if (rtw_end_of_queue_search(phead,plist)== _TRUE)
-+ break;
-
-- bssid->Configuration.BeaconPeriod = le32_to_cpu(bssid->Configuration.BeaconPeriod);
-+ pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
-+
-+ plist = get_next(plist);
-
-- val16 = rtw_get_capability((WLAN_BSSID_EX *)bssid);
-+ pbss_network = (WLAN_BSSID_EX *)&pnetwork->network;
-
-- if (val16 & BIT(0))
-- {
-- bssid->InfrastructureMode = Ndis802_11Infrastructure;
-- _rtw_memcpy(bssid->MacAddress, GetAddr2Ptr(pframe), ETH_ALEN);
-- }
-- else
-- {
-- bssid->InfrastructureMode = Ndis802_11IBSS;
-- _rtw_memcpy(bssid->MacAddress, GetAddr3Ptr(pframe), ETH_ALEN);
-- }
-+ p = rtw_get_ie(pbss_network->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pbss_network->IELength - _FIXED_IE_LENGTH_);
-+ if((p==NULL) || (len==0))//non-HT
-+ {
-+ if((pbss_network->Configuration.DSConfig<=0) || (pbss_network->Configuration.DSConfig>14))
-+ continue;
-+
-+ ICS[0][pbss_network->Configuration.DSConfig]=1;
-+
-+ if(ICS[0][0] == 0)
-+ ICS[0][0] = 1;
-+ }
-+
-+ }
-
-- if (val16 & BIT(4))
-- bssid->Privacy = 1;
-- else
-- bssid->Privacy = 0;
-+ _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-
-- bssid->Configuration.ATIMWindow = 0;
-
-- //20/40 BSS Coexistence check
-- if((pregistrypriv->wifi_spec==1) && (_FALSE == pmlmeinfo->bwmode_updated))
-- {
-- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
--
-- p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-- if(p && len>0)
-+ for(i= 0;i<8;i++)
- {
-- struct HT_caps_element *pHT_caps;
-- pHT_caps = (struct HT_caps_element *)(p + 2);
--
-- if(pHT_caps->HT_cap_element.HT_caps_info&BIT(14))
-- {
-- pmlmepriv->num_FortyMHzIntolerant++;
-+ if(ICS[i][0] == 1)
-+ {
-+ int j, k = 0;
-+
-+ InfoContent[k] = i;
-+ //SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent,i);
-+ k++;
-+
-+ for(j=1;j<=14;j++)
-+ {
-+ if(ICS[i][j]==1)
-+ {
-+ if(k<16)
-+ {
-+ InfoContent[k] = j; //channel number
-+ //SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j);
-+ k++;
-+ }
-+ }
-+ }
-+
-+ pframe = rtw_set_ie(pframe, EID_BSSIntolerantChlReport, k, InfoContent, &(pattrib->pktlen));
-+
- }
-- }
-- else
-- {
-- pmlmepriv->num_sta_no_ht++;
-+
- }
-
-- }
-
--
-- #if defined(DBG_RX_SIGNAL_DISPLAY_PROCESSING) & 1
-- if(strcmp(bssid->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) {
-- DBG_871X("Receiving %s("MAC_FMT", DSConfig:%u) from ch%u with ss:%3u, sq:%3u, RawRSSI:%3ld\n"
-- , bssid->Ssid.Ssid, MAC_ARG(bssid->MacAddress), bssid->Configuration.DSConfig
-- , padapter->mlmeextpriv.channel_set[padapter->mlmeextpriv.sitesurvey_res.channel_idx].ChannelNum
-- , bssid->PhyInfo.SignalStrength, bssid->PhyInfo.SignalQuality, bssid->Rssi
-- );
- }
-- #endif
-
-- // mark bss info receving from nearby channel as SignalQuality 101
-- if(bssid->Configuration.DSConfig != padapter->mlmeextpriv.channel_set[padapter->mlmeextpriv.sitesurvey_res.channel_idx].ChannelNum)
-- {
-- bssid->PhyInfo.SignalQuality= 101;
-- }
-
-- return _SUCCESS;
-+ pattrib->last_txcmdsz = pattrib->pktlen;
-+
-+ dump_mgntframe(padapter, pmgntframe);
-
- }
-
--void start_create_ibss(_adapter* padapter)
-+unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr)
- {
-- unsigned short caps;
-- u32 val32;
-- u8 val8;
-- u8 join_type;
-+ struct sta_priv *pstapriv = &padapter->stapriv;
-+ struct sta_info *psta = NULL;
-+ //struct recv_reorder_ctrl *preorder_ctrl;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
-- pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
-- pmlmeinfo->bcn_interval = get_beacon_interval(pnetwork);
-+ u16 tid;
-
-- //update wireless mode
-- update_wireless_mode(padapter);
-+ if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
-+ if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS))
-+ return _SUCCESS;
-+
-+ psta = rtw_get_stainfo(pstapriv, addr);
-+ if(psta==NULL)
-+ return _SUCCESS;
+@@ -7442,7 +8910,7 @@ unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr)
+ if(psta==NULL)
+ return _SUCCESS;
-- //udpate capability
-- caps = rtw_get_capability((WLAN_BSSID_EX *)pnetwork);
-- update_capinfo(padapter, caps);
-- if(caps&cap_IBSS)//adhoc master
+- //DBG_8192C("%s:%s\n", __FUNCTION__, (initiator==0)?"RX_DIR":"TX_DIR");
+ //DBG_871X("%s:%s\n", __FUNCTION__, (initiator==0)?"RX_DIR":"TX_DIR");
-+
-+ if(initiator==0) // recipient
+
+ if(initiator==0) // recipient
{
-- //set_opmode_cmd(padapter, adhoc);//removed
--
-- val8 = 0xcf;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
--
-- //switch channel
-- //SelectChannel(padapter, pmlmeext->cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE);
-- set_channel_bwmode(padapter, pmlmeext->cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
--
-- beacon_timing_control(padapter);
--
-- //set msr to WIFI_FW_ADHOC_STATE
-- pmlmeinfo->state = WIFI_FW_ADHOC_STATE;
-- Set_NETYPE0_MSR(padapter, (pmlmeinfo->state & 0x3));
--
-- //issue beacon
-- if(send_beacon(padapter)==_FAIL)
-+ for(tid = 0;tid<MAXTID;tid++)
+@@ -7450,7 +8918,7 @@ unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr)
{
-- RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("issuing beacon frame fail....\n"));
--
-- report_join_res(padapter, -1);
-- pmlmeinfo->state = WIFI_FW_NULL_STATE;
-- }
-- else
-- {
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, padapter->registrypriv.dev_network.MacAddress);
-- join_type = 0;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
--
-- report_join_res(padapter, 1);
-- pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
-+ if(psta->recvreorder_ctrl[tid].enable == _TRUE)
-+ {
+ if(psta->recvreorder_ctrl[tid].enable == _TRUE)
+ {
+- DBG_8192C("rx agg disable tid(%d)\n",tid);
+ DBG_871X("rx agg disable tid(%d)\n",tid);
-+ issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid <<1) |initiator)&0x1F));
-+ psta->recvreorder_ctrl[tid].enable = _FALSE;
-+ psta->recvreorder_ctrl[tid].indicate_seq = 0xffff;
-+ #ifdef DBG_RX_SEQ
-+ DBG_871X("DBG_RX_SEQ %s:%d indicate_seq:%u \n", __FUNCTION__, __LINE__,
-+ psta->recvreorder_ctrl[tid].indicate_seq);
-+ #endif
-+ }
- }
+ issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid <<1) |initiator)&0x1F));
+ psta->recvreorder_ctrl[tid].enable = _FALSE;
+ psta->recvreorder_ctrl[tid].indicate_seq = 0xffff;
+@@ -7463,12 +8931,12 @@ unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr)
}
-- else
-+ else if(initiator == 1)// originator
+ else if(initiator == 1)// originator
{
-- DBG_871X("start_create_ibss, invalid cap:%x\n", caps);
-- return;
+- //DBG_8192C("tx agg_enable_bitmap(0x%08x)\n", psta->htpriv.agg_enable_bitmap);
+ //DBG_871X("tx agg_enable_bitmap(0x%08x)\n", psta->htpriv.agg_enable_bitmap);
-+ for(tid = 0;tid<MAXTID;tid++)
-+ {
-+ if(psta->htpriv.agg_enable_bitmap & BIT(tid))
-+ {
+ for(tid = 0;tid<MAXTID;tid++)
+ {
+ if(psta->htpriv.agg_enable_bitmap & BIT(tid))
+ {
+- DBG_8192C("tx agg disable tid(%d)\n",tid);
+ DBG_871X("tx agg disable tid(%d)\n",tid);
-+ issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid <<1) |initiator)&0x1F) );
-+ psta->htpriv.agg_enable_bitmap &= ~BIT(tid);
-+ psta->htpriv.candidate_tid_bitmap &= ~BIT(tid);
-+
-+ }
-+ }
- }
--
-+
-+ return _SUCCESS;
-+
- }
-
--void start_clnt_join(_adapter* padapter)
-+unsigned int send_beacon(_adapter *padapter)
+ issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, (((tid <<1) |initiator)&0x1F) );
+ psta->htpriv.agg_enable_bitmap &= ~BIT(tid);
+ psta->htpriv.candidate_tid_bitmap &= ~BIT(tid);
+@@ -7484,38 +8952,63 @@ unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr)
+ unsigned int send_beacon(_adapter *padapter)
{
-- unsigned short caps;
-- u8 val8;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
-+ u8 bxmitok = _FALSE;
+ u8 bxmitok = _FALSE;
+- int retry=0;
+-
+- //DBG_871X("%s\n", __FUNCTION__);
+ int issue=0;
+ int poll = 0;
+//#ifdef CONFIG_CONCURRENT_MODE
+ //struct mlme_priv *pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv);
+//#endif
-+#ifdef CONFIG_PCI_HCI
+ #ifdef CONFIG_PCI_HCI
-- pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
-- pmlmeinfo->bcn_interval = get_beacon_interval(pnetwork);
+ //DBG_871X("%s\n", __FUNCTION__);
++
+ issue_beacon(padapter);
-- //update wireless mode
-- update_wireless_mode(padapter);
-+ issue_beacon(padapter);
-
-- //udpate capability
-- caps = rtw_get_capability((WLAN_BSSID_EX *)pnetwork);
-- update_capinfo(padapter, caps);
-- if (caps&cap_ESS)
-- {
-- Set_NETYPE0_MSR(padapter, WIFI_FW_STATION_STATE);
-+ return _SUCCESS;
+ return _SUCCESS;
-- val8 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
-+#endif
+ #endif
-- //switch channel
-- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+-#ifdef CONFIG_USB_HCI
+- do{
+#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
+ u32 start = rtw_get_current_time();
-- //here wait for receiving the beacon to start auth
-- //and enable a timer
-- set_link_timer(pmlmeext, decide_wait_for_beacon_timeout(pmlmeinfo->bcn_interval));
+ rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL);
+ do{
-+ issue_beacon(padapter);
+ issue_beacon(padapter);
+ issue++;
+ do {
+ rtw_yield_os();
+ poll++;
+ }while((poll%10)!=0 && _FALSE == bxmitok && !padapter->bSurpriseRemoved && !padapter->bDriverStopped);
-- pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE;
+- padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_TX_BCN_DONE, (u8 *)(&bxmitok));
+-
+- }while((_FALSE == bxmitok) &&((retry++)<100 ));
+ }while(_FALSE == bxmitok && issue<100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped);
-+
+
+- if(retry == 100)
+ if(padapter->bSurpriseRemoved || padapter->bDriverStopped)
+ {
+ return _FAIL;
- }
-- else if (caps&cap_IBSS) //adhoc client
++ }
+ if(_FALSE == bxmitok)
{
-- Set_NETYPE0_MSR(padapter, WIFI_FW_ADHOC_STATE);
--
-- val8 = 0xcf;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
--
-- //switch channel
-- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
--
-- beacon_timing_control(padapter);
--
-- pmlmeinfo->state = WIFI_FW_ADHOC_STATE;
--
-- report_join_res(padapter, 1);
+- DBG_871X("send_beacon, fail!\n");
+ DBG_871X("%s fail! %u ms\n", __FUNCTION__, rtw_get_passing_time_ms(start));
-+ return _FAIL;
+ return _FAIL;
}
else
{
-- //DBG_8192C("marc: invalid cap:%x\n", caps);
-- return;
-- }
--
--}
--
--void start_clnt_auth(_adapter* padapter)
--{
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
--
-- _cancel_timer_ex(&pmlmeext->link_timer);
+ u32 passing_time = rtw_get_passing_time_ms(start);
-
-- pmlmeinfo->state &= (~WIFI_FW_AUTH_NULL);
-- pmlmeinfo->state |= WIFI_FW_AUTH_STATE;
++
+ if(passing_time > 100 || issue > 3)
+ DBG_871X("%s success, issue:%d, poll:%d, %u ms\n", __FUNCTION__, issue, poll, rtw_get_passing_time_ms(start));
+ //else
+ // DBG_871X("%s success, issue:%d, poll:%d, %u ms\n", __FUNCTION__, issue, poll, rtw_get_passing_time_ms(start));
+
-+ return _SUCCESS;
-+ }
-
-- pmlmeinfo->auth_seq = 1;
-- pmlmeinfo->reauth_count = 0;
-- pmlmeinfo->reassoc_count = 0;
-- pmlmeinfo->link_count = 0;
+ return _SUCCESS;
+ }
+-#endif
+-
++
+#endif
-
-+}
-
-- // Because of AP's not receiving deauth before
-- // AP may: 1)not response auth or 2)deauth us after link is complete
-- // issue deauth before issuing auth to deal with the situation
-- issue_deauth(padapter, (&(pmlmeinfo->network))->MacAddress, WLAN_REASON_DEAUTH_LEAVING);
-+/****************************************************************************
-
-- issue_auth(padapter, NULL, 0);
-+Following are some utitity fuctions for WiFi MLME
-
-- set_link_timer(pmlmeext, REAUTH_TO);
-+*****************************************************************************/
-
-+BOOLEAN IsLegal5GChannel(
-+ IN PADAPTER Adapter,
-+ IN u8 channel)
-+{
-+
-+ int i=0;
-+ u8 Channel_5G[45] = {36,38,40,42,44,46,48,50,52,54,56,58,
-+ 60,62,64,100,102,104,106,108,110,112,114,116,118,120,122,
-+ 124,126,128,130,132,134,136,138,140,149,151,153,155,157,159,
-+ 161,163,165};
-+ for(i=0;i<sizeof(Channel_5G);i++)
-+ if(channel == Channel_5G[i])
-+ return _TRUE;
-+ return _FALSE;
++
}
--
--void start_clnt_assoc(_adapter* padapter)
-+void site_survey(_adapter *padapter)
- {
-+ unsigned char survey_channel = 0, val8;
-+ RT_SCAN_TYPE ScanType = SCAN_PASSIVE;
+ /****************************************************************************
+@@ -7547,41 +9040,96 @@ void site_survey(_adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ u32 initialgain = 0;
+ u32 initialgain = 0;
+-
+ u8 restore_initial_gain = 1;
-
-- _cancel_timer_ex(&pmlmeext->link_timer);
--
-- pmlmeinfo->state &= (~(WIFI_FW_AUTH_NULL | WIFI_FW_AUTH_STATE));
-- pmlmeinfo->state |= (WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE);
-+#ifdef CONFIG_P2P
-
-- issue_assocreq(padapter);
++
+ #ifdef CONFIG_P2P
++
+#ifdef CONFIG_CONCURRENT_MODE
-
-- set_link_timer(pmlmeext, REASSOC_TO);
--}
++
+#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
+ u8 stay_buddy_ch = 0;
+#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
-
--unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsigned short reason)
--{
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
-
-- //check A3
-- if (!(_rtw_memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
-- return _SUCCESS;
++
+#endif //CONFIG_CONCURRENT_MODE
-+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
-+ static unsigned char prev_survey_channel = 0;
-+ static unsigned int p2p_scan_count = 0;
-
-- DBG_871X("%s\n", __FUNCTION__);
-
-- if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
+ static unsigned char prev_survey_channel = 0;
+ static unsigned int p2p_scan_count = 0;
+-
+- if(rtw_p2p_findphase_ex_is_social(pwdinfo))
++
++
+ if ( ( pwdinfo->rx_invitereq_info.scan_op_ch_only ) || ( pwdinfo->p2p_info.scan_op_ch_only ) )
- {
-- if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)
++ {
+ if ( pwdinfo->rx_invitereq_info.scan_op_ch_only )
- {
-- pmlmeinfo->state = WIFI_FW_NULL_STATE;
-- report_del_sta_event(padapter, MacAddr, reason);
++ {
+ survey_channel = pwdinfo->rx_invitereq_info.operation_ch[pmlmeext->sitesurvey_res.channel_idx];
- }
-- else if (pmlmeinfo->state & WIFI_FW_LINKING_STATE)
++ }
+ else
- {
-- pmlmeinfo->state = WIFI_FW_NULL_STATE;
-- report_join_res(padapter, -2);
++ {
+ survey_channel = pwdinfo->p2p_info.operation_ch[pmlmeext->sitesurvey_res.channel_idx];
+ }
+ ScanType = SCAN_ACTIVE;
+ }
+ else if(rtw_p2p_findphase_ex_is_social(pwdinfo))
-+ {
-+ // Commented by Albert 2011/06/03
-+ // The driver is in the find phase, it should go through the social channel.
+ {
+ // Commented by Albert 2011/06/03
+ // The driver is in the find phase, it should go through the social channel.
+ int ch_set_idx;
-+ survey_channel = pwdinfo->social_chan[pmlmeext->sitesurvey_res.channel_idx];
+ survey_channel = pwdinfo->social_chan[pmlmeext->sitesurvey_res.channel_idx];
+ ch_set_idx = rtw_ch_set_search_ch(pmlmeext->channel_set, survey_channel);
+ if (ch_set_idx >= 0)
+ ScanType = pmlmeext->channel_set[ch_set_idx].ScanType;
+ else
+ ScanType = SCAN_ACTIVE;
-+ }
-+ else
-+#endif //CONFIG_P2P
-+ {
+ }
+ else
+ #endif //CONFIG_P2P
+ {
+- survey_channel = pmlmeext->channel_set[pmlmeext->sitesurvey_res.channel_idx].ChannelNum;
+ struct rtw_ieee80211_channel *ch;
+ if (pmlmeext->sitesurvey_res.channel_idx < pmlmeext->sitesurvey_res.ch_num) {
+ ch = &pmlmeext->sitesurvey_res.ch[pmlmeext->sitesurvey_res.channel_idx];
+ survey_channel = ch->hw_value;
+ ScanType = (ch->flags & RTW_IEEE80211_CHAN_PASSIVE_SCAN) ? SCAN_PASSIVE : SCAN_ACTIVE;
- }
++ }
}
-- return _SUCCESS;
--}
+- ScanType = pmlmeext->channel_set[pmlmeext->sitesurvey_res.channel_idx].ScanType;
+-
+- //DBG_871X("switching to ch:%d (cnt:%u,idx:%d) at %dms, %c%c%c\n"
+- // , survey_channel
+- // , pwdinfo->find_phase_state_exchange_cnt, pmlmeext->sitesurvey_res.channel_idx
+- // , rtw_get_passing_time_ms(padapter->mlmepriv.scan_start_time)
+- // , ScanType?'A':'P', pmlmeext->sitesurvey_res.scan_mode?'A':'P'
+- // , pmlmeext->sitesurvey_res.ssid[0].SsidLength?'S':' '
+- //);
+ if (0)
+ DBG_871X(FUNC_ADPT_FMT" ch:%u(cnt:%u,idx:%d) at %dms, %c%c%c\n"
+ , FUNC_ADPT_ARG(padapter)
+ , pmlmeext->sitesurvey_res.ssid[0].SsidLength?'S':' '
+ );
--/****************************************************************************
-+ if(survey_channel != 0)
-+ {
-+ //PAUSE 4-AC Queue when site_survey
+ if(survey_channel != 0)
+ {
+ //PAUSE 4-AC Queue when site_survey
+- //padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
+ //rtw_hal_get_hwreg(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
-+ //val8 |= 0x0f;
+ //val8 |= 0x0f;
+- //padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
+-
+ //rtw_hal_set_hwreg(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
+#ifdef CONFIG_CONCURRENT_MODE
+#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
+ }
+#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
+#endif //CONFIG_CONCURRENT_MODE
-+ if(pmlmeext->sitesurvey_res.channel_idx == 0)
-+ {
-+ set_channel_bwmode(padapter, survey_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
-+ }
-+ else
-+ {
-+ SelectChannel(padapter, survey_channel);
-+ }
+ if(pmlmeext->sitesurvey_res.channel_idx == 0)
+ {
+ set_channel_bwmode(padapter, survey_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
+@@ -7591,17 +9139,35 @@ void site_survey(_adapter *padapter)
+ SelectChannel(padapter, survey_channel);
+ }
--Following are the functions to report events
+#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
+ if( stay_buddy_ch == 1 )
+ {
+ val8 = 0; //survey done
+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
-
--*****************************************************************************/
++
+ if(check_buddy_mlmeinfo_state(padapter, WIFI_FW_AP_STATE) &&
+ check_buddy_fwstate(padapter, _FW_LINKED))
+ {
+ }
+#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
--void report_survey_event(_adapter *padapter, union recv_frame *precv_frame)
--{
-- struct cmd_obj *pcmd_obj;
-- u8 *pevtcmd;
-- u32 cmdsz;
-- struct survey_event *psurvey_evt;
-- struct C2HEvent_Header *pc2h_evt_hdr;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-- //u8 *pframe = precv_frame->u.hdr.rx_data;
-- //uint len = precv_frame->u.hdr.len;
-+ if(ScanType == SCAN_ACTIVE) //obey the channel plan setting...
+ if(ScanType == SCAN_ACTIVE) //obey the channel plan setting...
+- {
+ {
-+ #ifdef CONFIG_P2P
-+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) ||
-+ rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)
-+ )
-+ {
+ #ifdef CONFIG_P2P
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) ||
+ rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)
+ )
+ {
+- issue_probereq_p2p(padapter);
+- issue_probereq_p2p(padapter);
+- issue_probereq_p2p(padapter);
+ issue_probereq_p2p(padapter, NULL);
+ issue_probereq_p2p(padapter, NULL);
+ issue_probereq_p2p(padapter, NULL);
-+ }
-+ else
-+ #endif //CONFIG_P2P
-+ {
-+ int i;
-+ for(i=0;i<RTW_SSID_SCAN_AMOUNT;i++){
-+ if(pmlmeext->sitesurvey_res.ssid[i].SsidLength) {
-+ //todo: to issue two probe req???
+ }
+ else
+ #endif //CONFIG_P2P
+@@ -7610,9 +9176,9 @@ void site_survey(_adapter *padapter)
+ for(i=0;i<RTW_SSID_SCAN_AMOUNT;i++){
+ if(pmlmeext->sitesurvey_res.ssid[i].SsidLength) {
+ //todo: to issue two probe req???
+- issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]),1);
+ issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL);
-+ //rtw_msleep_os(SURVEY_TO>>1);
+ //rtw_msleep_os(SURVEY_TO>>1);
+- issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]),1);
+ issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL);
-+ } else {
-+ break;
-+ }
-+ }
+ } else {
+ break;
+ }
+@@ -7620,47 +9186,98 @@ void site_survey(_adapter *padapter)
-- if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
-- {
-- return;
-- }
-+ if(pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) {
-+ //todo: to issue two probe req???
+ if(pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) {
+ //todo: to issue two probe req???
+- issue_probereq(padapter, NULL, 1);
+ issue_probereq(padapter, NULL, NULL);
-+ //rtw_msleep_os(SURVEY_TO>>1);
+ //rtw_msleep_os(SURVEY_TO>>1);
+- issue_probereq(padapter, NULL, 1);
+ issue_probereq(padapter, NULL, NULL);
-+ }
-+ }
-+ }
-+
+ }
+ }
+ }
+
+- set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
+#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
+ if( stay_buddy_ch == 1 )
+ set_survey_timer(pmlmeext, pmlmeext->chan_scan_time * RTW_STAY_AP_CH_MILLISECOND );
+#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
+ set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
-- cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header));
-- if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
-- {
-- rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-- return;
}
-+ else
-+ {
-
-- _rtw_init_listhead(&pcmd_obj->list);
-+ // channel number is 0 or this channel is not valid.
+ else
+ {
-- pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-- pcmd_obj->cmdsz = cmdsz;
-- pcmd_obj->parmbuf = pevtcmd;
+ // channel number is 0 or this channel is not valid.
++
+#ifdef CONFIG_CONCURRENT_MODE
+ u8 cur_channel;
+ u8 cur_bwmode;
+ cur_ch_offset = pmlmeext->cur_ch_offset;
+ }
+#endif
-
-- pcmd_obj->rsp = NULL;
-- pcmd_obj->rspsz = 0;
++
+
-+#ifdef CONFIG_P2P
-+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH))
-+ {
+ #ifdef CONFIG_P2P
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH))
+ {
+ if( ( pwdinfo->rx_invitereq_info.scan_op_ch_only ) || ( pwdinfo->p2p_info.scan_op_ch_only ) )
+ {
+ // Set the find_phase_state_exchange_cnt to P2P_FINDPHASE_EX_CNT.
+ // This will let the following flow to run the scanning end.
+ rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_MAX);
+ }
-+ #ifdef CONFIG_DBG_P2P
+ #ifdef CONFIG_DBG_P2P
+- DBG_8192C( "[%s] find phase exchange cnt = %d\n", __FUNCTION__, pwdinfo->find_phase_state_exchange_cnt );
+ DBG_871X( "[%s] find phase exchange cnt = %d\n", __FUNCTION__, pwdinfo->find_phase_state_exchange_cnt );
-+ #endif
-+ }
-
-- pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-- pc2h_evt_hdr->len = sizeof(struct survey_event);
-- pc2h_evt_hdr->ID = GEN_EVT_CODE(_Survey);
-- pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
-+ if(rtw_p2p_findphase_ex_is_needed(pwdinfo))
-+ {
-+ // Set the P2P State to the listen state of find phase and set the current channel to the listen channel
-+ set_channel_bwmode(padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
-+ rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_LISTEN);
-+ pmlmeext->sitesurvey_res.state = SCAN_DISABLE;
+ #endif
+ }
+-
++
+ if(rtw_p2p_findphase_ex_is_needed(pwdinfo))
+ {
+ // Set the P2P State to the listen state of find phase and set the current channel to the listen channel
+ set_channel_bwmode(padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
+ rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_LISTEN);
+-
+ pmlmeext->sitesurvey_res.state = SCAN_DISABLE;
-- psurvey_evt = (struct survey_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
+ //turn on dynamic functions
+ Restore_DM_Func_Flag(padapter);
+ //Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE);
+
-+ _set_timer( &pwdinfo->find_phase_timer, ( u32 ) ( ( u32 ) ( pwdinfo->listen_dwell ) * 100 ) );
-+ }
-+ else
-+#endif //CONFIG_P2P
-+ {
+ _set_timer( &pwdinfo->find_phase_timer, ( u32 ) ( ( u32 ) ( pwdinfo->listen_dwell ) * 100 ) );
+ }
+ else
+ #endif //CONFIG_P2P
+ {
-- if (collect_bss_info(padapter, precv_frame, (WLAN_BSSID_EX *)&psurvey_evt->bss) == _FAIL)
-- {
-- rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-- rtw_mfree((u8 *)pevtcmd, cmdsz);
-- return;
-- }
+#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
+ pmlmeinfo->scan_cnt = 0;
+#endif //CONFIG_DMP_STA_NODE_SCAN_UNDER_AP_MODE
-
-- rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-+#ifdef CONFIG_ANTENNA_DIVERSITY
-+ // 20100721:Interrupt scan operation here.
-+ // For SW antenna diversity before link, it needs to switch to another antenna and scan again.
-+ // It compares the scan result and select beter one to do connection.
++
+ #ifdef CONFIG_ANTENNA_DIVERSITY
+ // 20100721:Interrupt scan operation here.
+ // For SW antenna diversity before link, it needs to switch to another antenna and scan again.
+ // It compares the scan result and select beter one to do connection.
+- if(padapter->HalFunc.SwAntDivBeforeLinkHandler(padapter))
+ if(rtw_hal_antdiv_before_linked(padapter))
-+ {
-+ pmlmeext->sitesurvey_res.bss_cnt = 0;
-+ pmlmeext->sitesurvey_res.channel_idx = -1;
-+ pmlmeext->chan_scan_time = SURVEY_TO /2;
-+ set_survey_timer(pmlmeext, pmlmeext->chan_scan_time);
-+ return;
-+ }
-+#endif
-
-- pmlmeext->sitesurvey_res.bss_cnt++;
-+#ifdef CONFIG_P2P
-+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH))
-+ {
+ {
+ pmlmeext->sitesurvey_res.bss_cnt = 0;
+ pmlmeext->sitesurvey_res.channel_idx = -1;
+@@ -7673,7 +9290,18 @@ void site_survey(_adapter *padapter)
+ #ifdef CONFIG_P2P
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH))
+ {
+- rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN);
+ #ifdef CONFIG_CONCURRENT_MODE
+ if( pwdinfo->driver_interface == DRIVER_WEXT )
+ {
+ #else
+ rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));
+ #endif
-+ }
-+ rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE);
-+#endif //CONFIG_P2P
-+
-+ pmlmeext->sitesurvey_res.state = SCAN_COMPLETE;
-
-- return;
-+ //switch back to the original channel
-+ //SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset);
+ }
+ rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE);
+ #endif //CONFIG_P2P
+@@ -7683,41 +9311,77 @@ void site_survey(_adapter *padapter)
+ //switch back to the original channel
+ //SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset);
--}
-+ {
+-#ifdef CONFIG_P2P
+- if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_OK)
+- && pwdinfo->peer_operating_ch != 0
+- )
+- {
+- DBG_8192C( "[%s] In P2P WPS mode, stay in the peer operating channel = %d\n", __FUNCTION__, pwdinfo->peer_operating_ch );
+- set_channel_bwmode(padapter, pwdinfo->peer_operating_ch, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+- }
+- else
+-#endif //CONFIG_P2P
+ {
+- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+#ifdef CONFIG_CONCURRENT_MODE
+ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
+#else
+ }
+#endif //CONFIG_DUALMAC_CONCURRENT
+#endif //CONFIG_CONCURRENT_MODE
-+ }
+ }
--void report_surveydone_event(_adapter *padapter)
--{
-- struct cmd_obj *pcmd_obj;
-- u8 *pevtcmd;
-- u32 cmdsz;
-- struct surveydone_event *psurveydone_evt;
-- struct C2HEvent_Header *pc2h_evt_hdr;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-+ //flush 4-AC Queue after site_survey
-+ //val8 = 0;
+ //flush 4-AC Queue after site_survey
+ //val8 = 0;
+- //padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
+ //rtw_hal_set_hwreg(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8));
-+
+
+- val8 = 0;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
+ val8 = 0; //survey done
+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
-+
-+ //config MSR
+
+ //config MSR
+- Set_NETYPE0_MSR(padapter, (pmlmeinfo->state & 0x3));
+ Set_MSR(padapter, (pmlmeinfo->state & 0x3));
+
+
+ initialgain = 0xff; //restore RX GAIN
+ rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
+ }
-+
-+ //turn on dynamic functions
-+ Restore_DM_Func_Flag(padapter);
-+ //Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE);
-- if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
-- {
-- return;
-- }
-+ if (is_client_associated_to_ap(padapter) == _TRUE)
-+ {
+- initialgain = 0xff; //restore RX GAIN
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
+ //turn on dynamic functions
+ Restore_DM_Func_Flag(padapter);
+ //Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE);
+
+ if (is_client_associated_to_ap(padapter) == _TRUE)
+ {
+- //issue null data
+- issue_nulldata(padapter, 0);
+ issue_nulldata(padapter, NULL, 0, 3, 500);
+
+#ifdef CONFIG_CONCURRENT_MODE
+ else if(is_client_associated_to_ap(padapter->pbuddy_adapter) == _TRUE)
+ {
+ issue_nulldata(padapter->pbuddy_adapter, NULL, 0, 3, 500);
-+ }
+ }
+#endif
-- cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header));
-- if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
-- {
-- rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-- return;
-- }
-+ report_surveydone_event(padapter);
+ report_surveydone_event(padapter);
-- _rtw_init_listhead(&pcmd_obj->list);
-+ pmlmeext->chan_scan_time = SURVEY_TO;
-+ pmlmeext->sitesurvey_res.state = SCAN_DISABLE;
+@@ -7730,6 +9394,19 @@ void site_survey(_adapter *padapter)
-- pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-- pcmd_obj->cmdsz = cmdsz;
-- pcmd_obj->parmbuf = pevtcmd;
-+ issue_action_BSSCoexistPacket(padapter);
-+ issue_action_BSSCoexistPacket(padapter);
-+ issue_action_BSSCoexistPacket(padapter);
-
-- pcmd_obj->rsp = NULL;
-- pcmd_obj->rspsz = 0;
-+ }
+ }
-- pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-- pc2h_evt_hdr->len = sizeof(struct surveydone_event);
-- pc2h_evt_hdr->ID = GEN_EVT_CODE(_SurveyDone);
-- pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
+#ifdef CONFIG_CONCURRENT_MODE
+ if(check_buddy_mlmeinfo_state(padapter, WIFI_FW_AP_STATE) &&
+ check_buddy_fwstate(padapter, _FW_LINKED))
+ {
-
-- psurveydone_evt = (struct surveydone_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-- psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt;
++
+ DBG_871X("survey done, current CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset);
-
-- DBG_871X("survey done event(%x)\n", psurveydone_evt->bss_cnt);
++
+ DBG_871X("restart pbuddy_adapter's beacon\n");
+
+ update_beacon(padapter->pbuddy_adapter, 0, NULL, _TRUE);
+ }
+#endif
-
-- rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-+ }
++
+ }
return;
+@@ -7753,7 +9430,7 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
- }
-
--void report_join_res(_adapter *padapter, int res)
-+//collect bss info from Beacon and Probe response frames.
-+u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSID_EX *bssid)
- {
-- struct cmd_obj *pcmd_obj;
-- u8 *pevtcmd;
-- u32 cmdsz;
-- struct joinbss_event *pjoinbss_evt;
-- struct C2HEvent_Header *pc2h_evt_hdr;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ int i;
-+ u32 len;
-+ u8 *p;
-+ u16 val16, subtype;
-+ u8 *pframe = precv_frame->u.hdr.rx_data;
-+ u32 packet_len = precv_frame->u.hdr.len;
-+ struct registry_priv *pregistrypriv = &padapter->registrypriv;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-
-- if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
-- {
-- return;
-- }
-+ len = packet_len - sizeof(struct rtw_ieee80211_hdr_3addr);
-
-- cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header));
-- if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
-+ if (len > MAX_IE_SZ)
+ if (len > MAX_IE_SZ)
{
-- rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-- return;
+- //DBG_8192C("IE too long for survey event\n");
+ //DBG_871X("IE too long for survey event\n");
-+ return _FAIL;
+ return _FAIL;
}
-- _rtw_init_listhead(&pcmd_obj->list);
--
-- pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-- pcmd_obj->cmdsz = cmdsz;
-- pcmd_obj->parmbuf = pevtcmd;
--
-- pcmd_obj->rsp = NULL;
-- pcmd_obj->rspsz = 0;
-+ _rtw_memset(bssid, 0, sizeof(WLAN_BSSID_EX));
-
-- pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-- pc2h_evt_hdr->len = sizeof(struct joinbss_event);
-- pc2h_evt_hdr->ID = GEN_EVT_CODE(_JoinBss);
-- pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
-+ subtype = GetFrameSubType(pframe);
-
-- pjoinbss_evt = (struct joinbss_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-- _rtw_memcpy((unsigned char *)(&(pjoinbss_evt->network.network)), &(pmlmeinfo->network), sizeof(WLAN_BSSID_EX));
-- pjoinbss_evt->network.join_res = pjoinbss_evt->network.aid = res;
-+ if(subtype==WIFI_BEACON)
-+ bssid->Reserved[0] = 1;
-+ else
-+ bssid->Reserved[0] = 0;
-+
-+ bssid->Length = sizeof(WLAN_BSSID_EX) - MAX_IE_SZ + len;
-
-- DBG_871X("report_join_res(%d)\n", res);
-+ //below is to copy the information element
-+ bssid->IELength = len;
-+ _rtw_memcpy(bssid->IEs, (pframe + sizeof(struct rtw_ieee80211_hdr_3addr)), bssid->IELength);
-
-+ //get the signal strength
-+ bssid->PhyInfo.SignalQuality = precv_frame->u.hdr.attrib.signal_qual;//in percentage
-+ bssid->PhyInfo.SignalStrength = precv_frame->u.hdr.attrib.signal_strength;//in percentage
-+ bssid->Rssi = precv_frame->u.hdr.attrib.RecvSignalPower; // in dBM.raw data
+@@ -7778,8 +9455,8 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
+ bssid->Rssi = precv_frame->u.hdr.attrib.RecvSignalPower; // in dBM.raw data
-- rtw_joinbss_event_prehandle(padapter, (u8 *)&pjoinbss_evt->network);
--
-+#ifdef CONFIG_ANTENNA_DIVERSITY
+ #ifdef CONFIG_ANTENNA_DIVERSITY
+- //padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_CURRENT_ANTENNA, (u8 *)(&bssid->PhyInfo.Optimum_antenna));
+- padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_CURRENT_ANTENNA, &bssid->PhyInfo.Optimum_antenna);
+ //rtw_hal_get_hwreg(padapter, HW_VAR_CURRENT_ANTENNA, (u8 *)(&bssid->PhyInfo.Optimum_antenna));
+ rtw_hal_get_def_var(padapter, HAL_DEF_CURRENT_ANTENNA, &bssid->PhyInfo.Optimum_antenna);
-+#endif
+ #endif
-- rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-+ // checking SSID
-+ if ((p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_)) == NULL)
-+ {
-+ DBG_871X("marc: cannot find SSID for survey event\n");
-+ return _FAIL;
-+ }
+ // checking SSID
+@@ -7791,6 +9468,11 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
-- return;
-+ if (*(p + 1))
-+ {
+ if (*(p + 1))
+ {
+ if (len > NDIS_802_11_LENGTH_SSID)
+ {
+ DBG_871X("%s()-%d: IE too long (%d) for survey event\n", __FUNCTION__, __LINE__, len);
+ return _FAIL;
+ }
-+ _rtw_memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
-+ bssid->Ssid.SsidLength = *(p + 1);
-+ }
-+ else
-+ {
-+ bssid->Ssid.SsidLength = 0;
-+ }
-
--}
-+ _rtw_memset(bssid->SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
-
--void report_del_sta_event(_adapter *padapter, unsigned char* MacAddr, unsigned short reason)
--{
-- struct cmd_obj *pcmd_obj;
-- u8 *pevtcmd;
-- u32 cmdsz;
-- struct stadel_event *pdel_sta_evt;
-- struct C2HEvent_Header *pc2h_evt_hdr;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-+ //checking rate info...
-+ i = 0;
-+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SUPPORTEDRATES_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-+ if (p != NULL)
-+ {
+ _rtw_memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
+ bssid->Ssid.SsidLength = *(p + 1);
+ }
+@@ -7806,6 +9488,11 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SUPPORTEDRATES_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
+ if (p != NULL)
+ {
+ if (len > NDIS_802_11_LENGTH_RATES_EX)
+ {
+ DBG_871X("%s()-%d: IE too long (%d) for survey event\n", __FUNCTION__, __LINE__, len);
+ return _FAIL;
+ }
-+ _rtw_memcpy(bssid->SupportedRates, (p + 2), len);
-+ i = len;
-+ }
-
-- if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
-+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _EXT_SUPPORTEDRATES_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-+ if (p != NULL)
+ _rtw_memcpy(bssid->SupportedRates, (p + 2), len);
+ i = len;
+ }
+@@ -7813,6 +9500,11 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _EXT_SUPPORTEDRATES_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
+ if (p != NULL)
{
-- return;
+ if (len > (NDIS_802_11_LENGTH_RATES_EX-i))
+ {
+ DBG_871X("%s()-%d: IE too long (%d) for survey event\n", __FUNCTION__, __LINE__, len);
+ return _FAIL;
+ }
-+ _rtw_memcpy(bssid->SupportedRates + i, (p + 2), len);
+ _rtw_memcpy(bssid->SupportedRates + i, (p + 2), len);
}
-- cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header));
-- if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
-+ //todo:
-+#if 0
-+ if (judge_network_type(bssid->SupportedRates, (len + i)) == WIRELESS_11B)
- {
-- rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-- return;
-+ bssid->NetworkTypeInUse = Ndis802_11DS;
-+ }
-+ else
-+#endif
-+ {
-+ bssid->NetworkTypeInUse = Ndis802_11OFDM24;
+@@ -7828,6 +9520,9 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
+ bssid->NetworkTypeInUse = Ndis802_11OFDM24;
}
-- _rtw_init_listhead(&pcmd_obj->list);
+ if (bssid->IELength < 12)
+ return _FAIL;
++
+ // Checking for DSConfig
+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _DSSET_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-- pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-- pcmd_obj->cmdsz = cmdsz;
-- pcmd_obj->parmbuf = pevtcmd;
-+ // Checking for DSConfig
-+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _DSSET_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-
-- pcmd_obj->rsp = NULL;
-- pcmd_obj->rspsz = 0;
-+ bssid->Configuration.DSConfig = 0;
-+ bssid->Configuration.Length = 0;
-
-- pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-- pc2h_evt_hdr->len = sizeof(struct stadel_event);
-- pc2h_evt_hdr->ID = GEN_EVT_CODE(_DelSTA);
-- pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
-+ if (p)
-+ {
-+ bssid->Configuration.DSConfig = *(p + 2);
-+ }
-+ else
-+ {// In 5G, some ap do not have DSSET IE
-+ // checking HT info for channel
-+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-+ if(p)
-+ {
-+ struct HT_info_element *HT_info = (struct HT_info_element *)(p + 2);
-+ bssid->Configuration.DSConfig = HT_info->primary_channel;
-+ }
-+ else
-+ { // use current channel
+@@ -7849,16 +9544,11 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
+ }
+ else
+ { // use current channel
+- if (padapter->mlmeextpriv.sitesurvey_res.state == SCAN_PROCESS)
+- bssid->Configuration.DSConfig = padapter->mlmeextpriv.channel_set[padapter->mlmeextpriv.sitesurvey_res.channel_idx].ChannelNum;
+- else
+- bssid->Configuration.DSConfig = padapter->mlmeextpriv.cur_channel;
+ bssid->Configuration.DSConfig = rtw_get_oper_ch(padapter);
-+ }
-+ }
-
-- pdel_sta_evt = (struct stadel_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-- _rtw_memcpy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr, ETH_ALEN);
-- _rtw_memcpy((unsigned char *)(pdel_sta_evt->rsvd),(unsigned char *)(&reason),2);
-+ _rtw_memcpy(&bssid->Configuration.BeaconPeriod, rtw_get_beacon_interval_from_ie(bssid->IEs), 2);
-+ bssid->Configuration.BeaconPeriod = le32_to_cpu(bssid->Configuration.BeaconPeriod);
-
-- DBG_871X("report_del_sta_event: delete STA\n");
-+ val16 = rtw_get_capability((WLAN_BSSID_EX *)bssid);
-
-- rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-+ if (val16 & BIT(0))
-+ {
-+ bssid->InfrastructureMode = Ndis802_11Infrastructure;
-+ _rtw_memcpy(bssid->MacAddress, GetAddr2Ptr(pframe), ETH_ALEN);
-+ }
-+ else
-+ {
-+ bssid->InfrastructureMode = Ndis802_11IBSS;
-+ _rtw_memcpy(bssid->MacAddress, GetAddr3Ptr(pframe), ETH_ALEN);
-+ }
-
-- return;
--}
-+ if (val16 & BIT(4))
-+ bssid->Privacy = 1;
-+ else
-+ bssid->Privacy = 0;
+ }
+ }
--void report_add_sta_event(_adapter *padapter, unsigned char* MacAddr, int cam_idx)
--{
-- struct cmd_obj *pcmd_obj;
-- u8 *pevtcmd;
-- u32 cmdsz;
-- struct stassoc_event *padd_sta_evt;
-- struct C2HEvent_Header *pc2h_evt_hdr;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-+ bssid->Configuration.ATIMWindow = 0;
+ _rtw_memcpy(&bssid->Configuration.BeaconPeriod, rtw_get_beacon_interval_from_ie(bssid->IEs), 2);
+-
+-
+ bssid->Configuration.BeaconPeriod = le32_to_cpu(bssid->Configuration.BeaconPeriod);
-- if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
-- {
-- return;
-+ //20/40 BSS Coexistence check
-+ if((pregistrypriv->wifi_spec==1) && (_FALSE == pmlmeinfo->bwmode_updated))
-+ {
-+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-+
-+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
-+ if(p && len>0)
-+ {
-+ struct HT_caps_element *pHT_caps;
-+ pHT_caps = (struct HT_caps_element *)(p + 2);
-+
+ val16 = rtw_get_capability((WLAN_BSSID_EX *)bssid);
+@@ -7892,7 +9582,7 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
+ struct HT_caps_element *pHT_caps;
+ pHT_caps = (struct HT_caps_element *)(p + 2);
+
+- if(pHT_caps->HT_cap_element.HT_caps_info&BIT(14))
+ if(pHT_caps->u.HT_cap_element.HT_caps_info&BIT(14))
-+ {
-+ pmlmepriv->num_FortyMHzIntolerant++;
-+ }
-+ }
-+ else
-+ {
-+ pmlmepriv->num_sta_no_ht++;
-+ }
-+
+ {
+ pmlmepriv->num_FortyMHzIntolerant++;
+ }
+@@ -7904,31 +9594,36 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI
+
}
-- cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header));
-- if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
+#ifdef CONFIG_INTEL_WIDI
+ //process_intel_widi_query_or_tigger(padapter, bssid);
+ if(process_intel_widi_query_or_tigger(padapter, bssid))
- {
-- rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-- return;
++ {
+ return _FAIL;
- }
++ }
+#endif // CONFIG_INTEL_WIDI
-- _rtw_init_listhead(&pcmd_obj->list);
--
-- pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-- pcmd_obj->cmdsz = cmdsz;
-- pcmd_obj->parmbuf = pevtcmd;
--
-- pcmd_obj->rsp = NULL;
-- pcmd_obj->rspsz = 0;
--
-- pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-- pc2h_evt_hdr->len = sizeof(struct stassoc_event);
-- pc2h_evt_hdr->ID = GEN_EVT_CODE(_AddSTA);
-- pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
--
-- padd_sta_evt = (struct stassoc_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-- _rtw_memcpy((unsigned char *)(&(padd_sta_evt->macaddr)), MacAddr, ETH_ALEN);
-- padd_sta_evt->cam_id = cam_idx;
--
-- DBG_871X("report_add_sta_event: add STA\n");
+- #if defined(DBG_RX_SIGNAL_DISPLAY_PROCESSING) & 1
+ #if defined(DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) & 1
-+ if(strcmp(bssid->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) {
-+ DBG_871X("Receiving %s("MAC_FMT", DSConfig:%u) from ch%u with ss:%3u, sq:%3u, RawRSSI:%3ld\n"
-+ , bssid->Ssid.Ssid, MAC_ARG(bssid->MacAddress), bssid->Configuration.DSConfig
+ if(strcmp(bssid->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) {
+ DBG_871X("Receiving %s("MAC_FMT", DSConfig:%u) from ch%u with ss:%3u, sq:%3u, RawRSSI:%3ld\n"
+ , bssid->Ssid.Ssid, MAC_ARG(bssid->MacAddress), bssid->Configuration.DSConfig
+- , padapter->mlmeextpriv.channel_set[padapter->mlmeextpriv.sitesurvey_res.channel_idx].ChannelNum
+ , rtw_get_oper_ch(padapter)
-+ , bssid->PhyInfo.SignalStrength, bssid->PhyInfo.SignalQuality, bssid->Rssi
-+ );
-+ }
-+ #endif
-
-- rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-+ // mark bss info receving from nearby channel as SignalQuality 101
+ , bssid->PhyInfo.SignalStrength, bssid->PhyInfo.SignalQuality, bssid->Rssi
+ );
+ }
+ #endif
+-
++
+ // mark bss info receving from nearby channel as SignalQuality 101
+- if(bssid->Configuration.DSConfig != padapter->mlmeextpriv.channel_set[padapter->mlmeextpriv.sitesurvey_res.channel_idx].ChannelNum)
+ if(bssid->Configuration.DSConfig != rtw_get_oper_ch(padapter))
-+ {
-+ bssid->PhyInfo.SignalQuality= 101;
-+ }
+ {
+ bssid->PhyInfo.SignalQuality= 101;
+ }
-- return;
-+ return _SUCCESS;
+ return _SUCCESS;
+-
}
--
--/****************************************************************************
--
--Following are the event callback functions
--
--*****************************************************************************/
--
--//for sta/adhoc mode
--void update_sta_info(_adapter *padapter, struct sta_info *psta)
-+void start_create_ibss(_adapter* padapter)
+ void start_create_ibss(_adapter* padapter)
{
-- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-+ unsigned short caps;
-+ u8 val8;
-+ u8 join_type;
+ unsigned short caps;
+- u32 val32;
+ u8 val8;
+ u8 join_type;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
-+ pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
-+ pmlmeinfo->bcn_interval = get_beacon_interval(pnetwork);
+@@ -7948,7 +9643,7 @@ void start_create_ibss(_adapter* padapter)
+ //set_opmode_cmd(padapter, adhoc);//removed
-- //ERP
-- VCS_update(padapter, psta);
--
-+ //update wireless mode
-+ update_wireless_mode(padapter);
-
-- //HT
-- if(pmlmepriv->htpriv.ht_option)
-+ //udpate capability
-+ caps = rtw_get_capability((WLAN_BSSID_EX *)pnetwork);
-+ update_capinfo(padapter, caps);
-+ if(caps&cap_IBSS)//adhoc master
- {
-- psta->htpriv.ht_option = _TRUE;
--
-- psta->htpriv.ampdu_enable = pmlmepriv->htpriv.ampdu_enable;
-+ //set_opmode_cmd(padapter, adhoc);//removed
-
-- if (support_short_GI(padapter, &(pmlmeinfo->HT_caps)))
-- psta->htpriv.sgi = _TRUE;
-+ val8 = 0xcf;
+ val8 = 0xcf;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
+ rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
-- psta->qos_option = _TRUE;
--
-- }
-- else
-- {
-- psta->htpriv.ht_option = _FALSE;
-+ //switch channel
-+ //SelectChannel(padapter, pmlmeext->cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE);
-+ set_channel_bwmode(padapter, pmlmeext->cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
-
-- psta->htpriv.ampdu_enable = _FALSE;
--
-- psta->htpriv.sgi = _FALSE;
-+ beacon_timing_control(padapter);
+ //switch channel
+ //SelectChannel(padapter, pmlmeext->cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE);
+@@ -7958,7 +9653,7 @@ void start_create_ibss(_adapter* padapter)
-- psta->qos_option = _FALSE;
-+ //set msr to WIFI_FW_ADHOC_STATE
-+ pmlmeinfo->state = WIFI_FW_ADHOC_STATE;
+ //set msr to WIFI_FW_ADHOC_STATE
+ pmlmeinfo->state = WIFI_FW_ADHOC_STATE;
+- Set_NETYPE0_MSR(padapter, (pmlmeinfo->state & 0x3));
+ Set_MSR(padapter, (pmlmeinfo->state & 0x3));
-- }
--
-- psta->htpriv.bwmode = pmlmeext->cur_bwmode;
-- psta->htpriv.ch_offset = pmlmeext->cur_ch_offset;
--
-- psta->htpriv.agg_enable_bitmap = 0x0;//reset
-- psta->htpriv.candidate_tid_bitmap = 0x0;//reset
--
-+ //issue beacon
-+ if(send_beacon(padapter)==_FAIL)
-+ {
-+ RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("issuing beacon frame fail....\n"));
-
-- //QoS
-- if(pmlmepriv->qospriv.qos_option)
-- psta->qos_option = _TRUE;
--
-+ report_join_res(padapter, -1);
-+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
-+ }
-+ else
+ //issue beacon
+ if(send_beacon(padapter)==_FAIL)
+@@ -7969,11 +9664,11 @@ void start_create_ibss(_adapter* padapter)
+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
+ }
+ else
+- {
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, padapter->registrypriv.dev_network.MacAddress);
+ {
+ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, padapter->registrypriv.dev_network.MacAddress);
-+ join_type = 0;
+ join_type = 0;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
+-
+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
-
-- psta->state = _FW_LINKED;
-+ report_join_res(padapter, 1);
-+ pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
-+ }
-+ }
-+ else
-+ {
-+ DBG_871X("start_create_ibss, invalid cap:%x\n", caps);
-+ return;
-+ }
-
- }
-
--u8 null_addr[ETH_ALEN]= {0,0,0,0,0,0};
--
--void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res)
-+void start_clnt_join(_adapter* padapter)
- {
-- struct sta_info *psta, *psta_bmc;
-+ unsigned short caps;
-+ u8 val8;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
++
+ report_join_res(padapter, 1);
+ pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
+ }
+@@ -7994,10 +9689,6 @@ void start_clnt_join(_adapter* padapter)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
-- struct sta_priv *pstapriv = &padapter->stapriv;
-- u8 join_type, init_rts_rate;
-+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
-
-- if(join_res < 0)
-- {
-- join_type = 1;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, null_addr);
-- return;
-- }
-+ //update wireless mode
-+ update_wireless_mode(padapter);
+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
-- if((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
-+ //udpate capability
-+ caps = rtw_get_capability((WLAN_BSSID_EX *)pnetwork);
-+ update_capinfo(padapter, caps);
-+ if (caps&cap_ESS)
- {
-- //for bc/mc
-- psta_bmc = rtw_get_bcmc_stainfo(padapter);
-- if(psta_bmc)
-- {
-- pmlmeinfo->FW_sta_info[psta_bmc->mac_id].psta = psta_bmc;
-- update_bmc_sta_support_rate(padapter, psta_bmc->mac_id);
-- Update_RA_Entry(padapter, psta_bmc->mac_id);
-- }
-- }
-
+- pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
+- pmlmeinfo->bcn_interval = get_beacon_interval(pnetwork);
-
-- //turn on dynamic functions
-- Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE);
+ //update wireless mode
+ update_wireless_mode(padapter);
+
+@@ -8006,13 +9697,53 @@ void start_clnt_join(_adapter* padapter)
+ update_capinfo(padapter, caps);
+ if (caps&cap_ESS)
+ {
+- Set_NETYPE0_MSR(padapter, WIFI_FW_STATION_STATE);
+ Set_MSR(padapter, WIFI_FW_STATION_STATE);
-- // update IOT-releated issue
-- update_IOT_info(padapter);
-+ val8 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf;
+ val8 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
+ rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BASIC_RATE, cur_network->SupportedRates);
+- //switch channel
+- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+ #ifdef CONFIG_DEAUTH_BEFORE_CONNECT
+ // Because of AP's not receiving deauth before
+ // AP may: 1)not response auth or 2)deauth us after link is complete
+ // issue deauth before issuing auth to deal with the situation
-
-- //BCN interval
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&pmlmeinfo->bcn_interval));
++
+ // Commented by Albert 2012/07/21
+ // For the Win8 P2P connection, it will be hard to have a successful connection if this Wi-Fi doesn't connect to it.
+ {
+ }
+
+ _exit_critical_bh(&(padapter->mlmepriv.scanned_queue.lock), &irqL);
-
-- //udpate capability
-- update_capinfo(padapter, pmlmeinfo->capability);
++
+ if (scanned == NULL || rtw_end_of_queue_search(head, pos) || has_p2p_ie == _FALSE)
+ #endif /* CONFIG_P2P */
+ issue_deauth_ex(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVING, 5, 100);
+ }
+ #endif /* CONFIG_DEAUTH_BEFORE_CONNECT */
-- //WMM, Update EDCA param
-- WMMOnAssocRsp(padapter);
-+ //here wait for receiving the beacon to start auth
-+ //and enable a timer
-+ set_link_timer(pmlmeext, decide_wait_for_beacon_timeout(pmlmeinfo->bcn_interval));
-
-- //HT
-- HTOnAssocRsp(padapter);
-+ pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE;
-+ }
-+ else if (caps&cap_IBSS) //adhoc client
-+ {
+ //here wait for receiving the beacon to start auth
+ //and enable a timer
+@@ -8022,10 +9753,10 @@ void start_clnt_join(_adapter* padapter)
+ }
+ else if (caps&cap_IBSS) //adhoc client
+ {
+- Set_NETYPE0_MSR(padapter, WIFI_FW_ADHOC_STATE);
+ Set_MSR(padapter, WIFI_FW_ADHOC_STATE);
-+ val8 = 0xcf;
+ val8 = 0xcf;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
+ rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
-- //Set cur_channel&cur_bwmode&cur_ch_offset
-- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-+ //switch channel
-+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-
-+ beacon_timing_control(padapter);
-
-- psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress);
-- if (psta) //only for infra. mode
-- {
-- pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
-+ pmlmeinfo->state = WIFI_FW_ADHOC_STATE;
-
-- //DBG_871X("set_sta_rate\n");
--
-- //set per sta rate after updating HT cap.
-- set_sta_rate(padapter, psta);
-+ report_join_res(padapter, 1);
+ //switch channel
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+@@ -8038,7 +9769,7 @@ void start_clnt_join(_adapter* padapter)
}
--
-- join_type = 2;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
--
-- if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
-+ else
+ else
{
-- // correcting TSF
-- correct_TSF(padapter, pmlmeext);
--
-- //set_link_timer(pmlmeext, DISCONNECT_TO);
+- //DBG_8192C("marc: invalid cap:%x\n", caps);
+ //DBG_871X("marc: invalid cap:%x\n", caps);
-+ return;
+ return;
}
--#ifdef CONFIG_LPS
-- rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_CONNECT, 0);
--#endif
--
-- DBG_871X("=>%s\n", __FUNCTION__);
--
- }
-
--void mlmeext_sta_add_event_callback(_adapter *padapter, struct sta_info *psta)
-+void start_clnt_auth(_adapter* padapter)
- {
-- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- u8 join_type;
-
-- DBG_871X("%s\n", __FUNCTION__);
-+ _cancel_timer_ex(&pmlmeext->link_timer);
-
-- if((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
-- {
-- if(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)//adhoc master or sta_count>1
-- {
-- //nothing to do
-- }
-- else//adhoc client
-- {
-- //update TSF Value
-- //update_TSF(pmlmeext, pframe, len);
-+ pmlmeinfo->state &= (~WIFI_FW_AUTH_NULL);
-+ pmlmeinfo->state |= WIFI_FW_AUTH_STATE;
-
-- // correcting TSF
-- correct_TSF(padapter, pmlmeext);
-+ pmlmeinfo->auth_seq = 1;
-+ pmlmeinfo->reauth_count = 0;
-+ pmlmeinfo->reassoc_count = 0;
-+ pmlmeinfo->link_count = 0;
+@@ -8058,13 +9789,9 @@ void start_clnt_auth(_adapter* padapter)
+ pmlmeinfo->reauth_count = 0;
+ pmlmeinfo->reassoc_count = 0;
+ pmlmeinfo->link_count = 0;
+ pmlmeext->retry = 0;
-- //start beacon
-- if(send_beacon(padapter)==_FAIL)
-- {
-- pmlmeinfo->FW_sta_info[psta->mac_id].status = 0;
-
-- pmlmeinfo->state ^= WIFI_FW_ADHOC_STATE;
-+ issue_auth(padapter, NULL, 0);
-+
-+ set_link_timer(pmlmeext, REAUTH_TO);
-
-- return;
-- }
-+}
-
-- pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
--
-- }
-
-- join_type = 2;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
-- }
-+void start_clnt_assoc(_adapter* padapter)
-+{
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
-- pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
-+ _cancel_timer_ex(&pmlmeext->link_timer);
-
-- //rate radaptive
-- Update_RA_Entry(padapter, psta->mac_id);
-+ pmlmeinfo->state &= (~(WIFI_FW_AUTH_NULL | WIFI_FW_AUTH_STATE));
-+ pmlmeinfo->state |= (WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE);
-
-- //update adhoc sta_info
-- update_sta_info(padapter, psta);
-+ issue_assocreq(padapter);
-
-+ set_link_timer(pmlmeext, REASSOC_TO);
- }
-
--void mlmeext_sta_del_event_callback(_adapter *padapter)
-+unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsigned short reason)
- {
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- if (is_client_associated_to_ap(padapter) || is_IBSS_empty(padapter))
-+ //check A3
-+ if (!(_rtw_memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
-+ return _SUCCESS;
-+
-+ DBG_871X("%s\n", __FUNCTION__);
-+
-+ if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
- {
-- //set_opmode_cmd(padapter, infra_client_with_mlme);
-+ if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)
-+ {
-+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
-+ report_del_sta_event(padapter, MacAddr, reason);
-
-- //switch to the 20M Hz mode after disconnect
-- pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
-- pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-+ }
-+ else if (pmlmeinfo->state & WIFI_FW_LINKING_STATE)
-+ {
-+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
-+ report_join_res(padapter, -2);
-+ }
-+ }
+- // Because of AP's not receiving deauth before
+- // AP may: 1)not response auth or 2)deauth us after link is complete
+- // issue deauth before issuing auth to deal with the situation
+- issue_deauth(padapter, (&(pmlmeinfo->network))->MacAddress, WLAN_REASON_DEAUTH_LEAVING);
+-
+ issue_auth(padapter, NULL, 0);
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_DISCONNECT, 0);
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, null_addr);
-+ return _SUCCESS;
-+}
+ set_link_timer(pmlmeext, REAUTH_TO);
+@@ -8104,6 +9831,7 @@ unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsi
+ {
+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
+ report_del_sta_event(padapter, MacAddr, reason);
++
+ }
+ else if (pmlmeinfo->state & WIFI_FW_LINKING_STATE)
+ {
+@@ -8115,24 +9843,321 @@ unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsi
+ return _SUCCESS;
+ }
-- //SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset);
-- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-- flush_all_cam_entry(padapter);
+-/****************************************************************************
+#ifdef CONFIG_80211D
+static void process_80211d(PADAPTER padapter, WLAN_BSSID_EX *bssid)
+{
+ u8 channel;
+ u8 i;
-- pmlmeinfo->state = WIFI_FW_NULL_STATE;
+-Following are the functions to report events
-- //set MSR to no link state
-- Set_NETYPE0_MSR(padapter, _HW_STATE_NOLINK_);
+-*****************************************************************************/
+ pregistrypriv = &padapter->registrypriv;
+ pmlmeext = &padapter->mlmeextpriv;
-- _cancel_timer_ex(&pmlmeext->link_timer);
+-void report_survey_event(_adapter *padapter, union recv_frame *precv_frame)
+-{
+- struct cmd_obj *pcmd_obj;
+- u8 *pevtcmd;
+- u32 cmdsz;
+- struct survey_event *psurvey_evt;
+ // Adjust channel plan by AP Country IE
+ if (pregistrypriv->enable80211d &&
+ (!pmlmeext->update_channel_plan_by_ap_done))
+ u8 fcn; // first channel number
+ u8 noc; // number of channel
+ u8 j, k;
-
-- }
++
+ ie = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _COUNTRY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
+ if (!ie) return;
+ if (len < 6) return;
-
--}
++
+ ie += 2;
+ p = ie;
+ ie += len;
-
--/****************************************************************************
++
+ _rtw_memset(country, 0, 4);
+ _rtw_memcpy(country, p, 3);
+ p += 3;
+ RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_,
+ ("%s: 802.11d country=%s\n", __FUNCTION__, country));
-
--Following are the functions for the timer handlers
++
+ i = 0;
+ while ((ie - p) >= 3)
+ {
+ fcn = *(p++);
+ noc = *(p++);
+ p++;
-
--*****************************************************************************/
++
+ for (j = 0; j < noc; j++)
+ {
+ if (fcn <= 14) channel = fcn + j; // 2.4 GHz
+ else channel = fcn + j*4; // 5 GHz
-
--void _linked_rx_signal_strehgth_display(_adapter *padapter)
--{
-- int UndecoratedSmoothedPWDB;
-- DBG_8192C("============ linked status check ===================\n");
-- DBG_8192C("pathA Rx SNRdb:%d, pathB Rx SNRdb:%d\n",padapter->recvpriv.RxSNRdB[0],padapter->recvpriv.RxSNRdB[1]);
-- DBG_8192C("pathA Rx RSSI:%d,pathB Rx RSSI:%d\n",padapter->recvpriv.RxRssi[0],padapter->recvpriv.RxRssi[1]);
--
-- DBG_8192C("pathA Rx PWDB:%d\n",padapter->recvpriv.rxpwdb);
-- padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
-- DBG_8192C("UndecoratedSmoothedPWDB:%d\n",UndecoratedSmoothedPWDB);
-- DBG_8192C("Rx RSSI:%d\n",padapter->recvpriv.rssi);
-- DBG_8192C("Rx Signal_strength:%d\n",padapter->recvpriv.signal_strength);
-- DBG_8192C("Rx Signal_qual:%d \n",padapter->recvpriv.signal_qual);
-- DBG_8192C("============ linked status check ===================\n");
-- DBG_8192C(" DIG PATH-A(0x%02x), PATH-B(0x%02x)\n",rtw_read8(padapter,0xc50),rtw_read8(padapter,0xc58));
-- DBG_8192C(" OFDM -Alarm DA2(0x%04x),DA4(0x%04x),DA6(0x%04x),DA8(0x%04x)\n",
-- rtw_read16(padapter,0xDA2),rtw_read16(padapter,0xDA4),rtw_read16(padapter,0xDA6),rtw_read16(padapter,0xDA8));
++
+ chplan_ap.Channel[i++] = channel;
+ }
+ }
+ chplan_ap.Len = i;
-
-- DBG_8192C(" CCK -Alarm A5B(0x%02x),A5C(0x%02x)\n",rtw_read8(padapter,0xA5B),rtw_read8(padapter,0xA5C));
-- DBG_8192C(" FalseAlmCnt_all(%d)\n",padapter->recvpriv.FalseAlmCnt_all);
--}
++
+#ifdef CONFIG_DEBUG_RTL871X
+#ifdef PLATFORM_LINUX
+ i = 0;
+ printk("}\n");
+#endif
+#endif
-
--void linked_status_chk(_adapter *padapter)
--{
-- u32 i;
-- struct sta_info *psta;
-- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-- struct recv_priv *precvpriv = &(padapter->recvpriv);
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-- struct sta_priv *pstapriv = &padapter->stapriv;
-- struct registry_priv *pregistrypriv = &padapter->registrypriv;
++
+ _rtw_memcpy(chplan_sta, pmlmeext->channel_set, sizeof(chplan_sta));
+#ifdef CONFIG_DEBUG_RTL871X
+#ifdef PLATFORM_LINUX
+ printk("}\n");
+#endif
+#endif
-
-- if(padapter->bRxRSSIDisplay)
-- _linked_rx_signal_strehgth_display(padapter);
++
+ _rtw_memset(pmlmeext->channel_set, 0, sizeof(pmlmeext->channel_set));
+ chplan_new = pmlmeext->channel_set;
-
-- if (is_client_associated_to_ap(padapter))
-- {
-- //linked infrastructure client mode
-- if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL)
++
+ i = j = k = 0;
+ if (pregistrypriv->wireless_mode & WIRELESS_11G)
- {
-- #ifdef DBG_EXPIRATION_CHK
-- DBG_871X("%s rx:"STA_PKTS_FMT", BI:%u, retry:%u\n"
-- , __FUNCTION__
-- , STA_RX_PKTS_ARG(psta)
-- , pmlmeinfo->bcn_interval
-- , pmlmeext->retry
-- );
-- #endif
++ {
+ do {
+ if ((i == MAX_CHANNEL_NUM) ||
+ (chplan_sta[i].ChannelNum == 0) ||
+ (chplan_sta[i].ChannelNum > 14))
+ break;
-
-- /*to monitor whether the AP is alive or not*/
-- if (sta_last_rx_pkts(psta) == sta_rx_pkts(psta))
-- {
-- // Commented by Albert 2010/07/21
-- // In this case, there is no any rx packet received by driver.
++
+ if ((j == chplan_ap.Len) || (chplan_ap.Channel[j] > 14))
+ break;
-
-- #ifdef DBG_ROAMING_TEST
-- if(pmlmeext->retry<1)
-- #else
-- if(pmlmeext->retry<8)// Alter the retry limit to 8
-- #endif
++
+ if (chplan_sta[i].ChannelNum == chplan_ap.Channel[j])
- {
-- if(pmlmeext->retry==0)
-- {
-- #ifdef DBG_CONFIG_ERROR_DETECT
-- if(padapter->HalFunc.sreset_linked_status_check)
-- padapter->HalFunc.sreset_linked_status_check(padapter);
-- #endif
--
-- // In order to know the AP's current state, try to send the probe request
-- // to trigger the AP to send the probe response.
-- #ifdef CONFIG_P2P
-- if(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE)) {
-- #ifdef DBG_EXPIRATION_CHK
-- DBG_871X("issue_probereq_p2p to trigger probersp, retry=%d\n", pmlmeext->retry);
-- #endif
-- issue_probereq_p2p(padapter);
-- } else
-- #endif
-- {
-- #ifdef DBG_EXPIRATION_CHK
-- DBG_871X("issue_probereq to trigger probersp, retry=%d\n", pmlmeext->retry);
-- #endif
-- issue_probereq(padapter, &(pmlmeinfo->network.Ssid), 0);
-- issue_probereq(padapter, &(pmlmeinfo->network.Ssid), 0);
-- issue_probereq(padapter, &(pmlmeinfo->network.Ssid), 0);
-- }
-- }
--
-- pmlmeext->retry++;
++ {
+ chplan_new[k].ChannelNum = chplan_ap.Channel[j];
+ chplan_new[k].ScanType = SCAN_ACTIVE;
+ i++;
+ j++;
+ k++;
- }
-- else
++ }
+ else if (chplan_sta[i].ChannelNum < chplan_ap.Channel[j])
- {
-- pmlmeext->retry = 0;
-- DBG_871X("no beacon to call receive_disconnect()\n");
-- receive_disconnect(padapter, pmlmeinfo->network.MacAddress
-- , 65535// indicate disconnect caused by no rx
-- );
-- pmlmeinfo->link_count = 0;
-- return;
++ {
+ chplan_new[k].ChannelNum = chplan_sta[i].ChannelNum;
+// chplan_new[k].ScanType = chplan_sta[i].ScanType;
+ chplan_new[k].ScanType = SCAN_PASSIVE;
+ i++;
+ k++;
- }
++ }
+ else if (chplan_sta[i].ChannelNum > chplan_ap.Channel[j])
+ {
+ chplan_new[k].ChannelNum = chplan_ap.Channel[j];
+ chplan_new[k].ScanType = SCAN_PASSIVE;
+ i++;
+ k++;
- }
-- else
-- {
-- pmlmeext->retry = 0;
-- sta_update_last_rx_pkts(psta);
-- //set_link_timer(pmlmeext, DISCONNECT_TO);
-- }
--
-- #ifdef DBG_EXPIRATION_CHK
-- DBG_871X("%s tx_pkts:%llu, link_count:%u\n", __FUNCTION__
-- , pxmitpriv->tx_pkts
-- , pmlmeinfo->link_count
-- );
-- #endif
-
-- /*to send the AP a nulldata if no frame is xmitted in order to keep alive*/
-- if(pxmitpriv->last_tx_pkts == pxmitpriv->tx_pkts)
++ }
++
+ // add channel AP supported
+ while ((j < chplan_ap.Len) && (chplan_ap.Channel[j] <= 14))
- {
-- if(pmlmeinfo->link_count++ == 0xf)
-- {
-- //DBG_871X("(Interface %d)issue nulldata to keep alive\n",padapter->dvobjpriv.InterfaceNumber);
-- #ifdef DBG_EXPIRATION_CHK
-- DBG_871X("%s issue_nulldata 0\n", __FUNCTION__);
-- #endif
-- issue_nulldata(padapter, 0);
-- pmlmeinfo->link_count = 0;
-- }
++ {
+ chplan_new[k].ChannelNum = chplan_ap.Channel[j];
+ chplan_new[k].ScanType = SCAN_ACTIVE;
+ j++;
+ k++;
- }
-- else
++ }
+ }
+ else
+ {
+
+ // skip AP 2.4G channel plan
+ while ((j < chplan_ap.Len) && (chplan_ap.Channel[j] <= 14))
- {
-- pxmitpriv->last_tx_pkts = pxmitpriv->tx_pkts;
-- pmlmeinfo->link_count = 0;
++ {
+ j++;
- }
++ }
+ }
-
-- } //end of if ((psta = rtw_get_stainfo(pstapriv, passoc_res->network.MacAddress)) != NULL)
-- }
-- else if (is_client_associated_to_ibss(padapter))
-- {
-- //linked IBSS mode
-- //for each assoc list entry to check the rx pkt counter
-- for (i = IBSS_START_MAC_ID; i < NUM_STA; i++)
++
+ if (pregistrypriv->wireless_mode & WIRELESS_11A)
- {
-- if (pmlmeinfo->FW_sta_info[i].status == 1)
-- {
-- psta = pmlmeinfo->FW_sta_info[i].psta;
++ {
+ do {
+ if ((i == MAX_CHANNEL_NUM) ||
+ (chplan_sta[i].ChannelNum == 0))
+ break;
-
-- if(NULL==psta) continue;
++
+ if ((j == chplan_ap.Len) || (chplan_ap.Channel[j] == 0))
+ break;
-
-- if (pmlmeinfo->FW_sta_info[i].rx_pkt == sta_rx_pkts(psta))
++
+ if (chplan_sta[i].ChannelNum == chplan_ap.Channel[j])
- {
--
-- if(pmlmeinfo->FW_sta_info[i].retry<3)
-- {
-- pmlmeinfo->FW_sta_info[i].retry++;
-- }
-- else
-- {
-- pmlmeinfo->FW_sta_info[i].retry = 0;
-- pmlmeinfo->FW_sta_info[i].status = 0;
-- report_del_sta_event(padapter, psta->hwaddr
-- , 65535// indicate disconnect caused by no rx
-- );
-- }
++ {
+ chplan_new[k].ChannelNum = chplan_ap.Channel[j];
+ chplan_new[k].ScanType = SCAN_ACTIVE;
+ i++;
+ j++;
+ k++;
- }
-- else
++ }
+ else if (chplan_sta[i].ChannelNum < chplan_ap.Channel[j])
- {
-- pmlmeinfo->FW_sta_info[i].retry = 0;
-- pmlmeinfo->FW_sta_info[i].rx_pkt = (u32)sta_rx_pkts(psta);
++ {
+ chplan_new[k].ChannelNum = chplan_sta[i].ChannelNum;
+// chplan_new[k].ScanType = chplan_sta[i].ScanType;
+ chplan_new[k].ScanType = SCAN_PASSIVE;
+ i++;
+ k++;
- }
++ }
+ else if (chplan_sta[i].ChannelNum > chplan_ap.Channel[j])
+ {
+ chplan_new[k].ChannelNum = chplan_ap.Channel[j];
+ chplan_new[k].ScanType = chplan_sta[i].ScanType;
+ i++;
+ k++;
- }
- }
-
-- //set_link_timer(pmlmeext, DISCONNECT_TO);
++ }
++ }
++
+ pmlmeext->update_channel_plan_by_ap_done = 1;
+
+#ifdef CONFIG_DEBUG_RTL871X
+ printk("}\n");
+#endif
+#endif
-
++
+#if 0
+ // recover the right channel index
+ channel = chplan_sta[pmlmeext->sitesurvey_res.channel_idx].ChannelNum;
+ k++;
+ }
+#endif
- }
-
++ }
++
+ // If channel is used by AP, set channel scan type to active
+ channel = bssid->Configuration.DSConfig;
+ chplan_new = pmlmeext->channel_set;
+ }
+ i++;
+ }
- }
++}
+#endif
-
--void survey_timer_hdl(_adapter *padapter)
++
+/****************************************************************************
+
+Following are the functions to report events
+*****************************************************************************/
+
+void report_survey_event(_adapter *padapter, union recv_frame *precv_frame)
- {
-- struct cmd_obj *ph2c;
-- struct sitesurvey_parm *psurveyPara;
-- struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
-- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
--#ifdef CONFIG_P2P
-- struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
--#endif
++{
+ struct cmd_obj *pcmd_obj;
+ u8 *pevtcmd;
+ u32 cmdsz;
+ struct survey_event *psurvey_evt;
-+ struct C2HEvent_Header *pc2h_evt_hdr;
+ struct C2HEvent_Header *pc2h_evt_hdr;
+- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
+ struct mlme_ext_priv *pmlmeext;
+ struct cmd_priv *pcmdpriv;
-+ //u8 *pframe = precv_frame->u.hdr.rx_data;
-+ //uint len = precv_frame->u.hdr.len;
+ //u8 *pframe = precv_frame->u.hdr.rx_data;
+ //uint len = precv_frame->u.hdr.len;
-- //DBG_8192C("marc: survey timer\n");
+ if(!padapter)
+ return;
-
-- //issue rtw_sitesurvey_cmd
-- if (pmlmeext->sitesurvey_res.state > SCAN_START)
++
+ pmlmeext = &padapter->mlmeextpriv;
+ pcmdpriv = &padapter->cmdpriv;
+
+
-+ if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
+ if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
{
-- if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS)
-- pmlmeext->sitesurvey_res.channel_idx++;
-+ return;
+ return;
+@@ -8168,6 +10193,10 @@ void report_survey_event(_adapter *padapter, union recv_frame *precv_frame)
+ return;
+ }
+
++#ifdef CONFIG_80211D
++ process_80211d(padapter, &psurvey_evt->bss);
++#endif
++
+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
+
+ pmlmeext->sitesurvey_res.bss_cnt++;
+@@ -8215,7 +10244,7 @@ void report_surveydone_event(_adapter *padapter)
+ psurveydone_evt = (struct surveydone_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
+ psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt;
+
+- DBG_871X("survey done event(%x)\n", psurveydone_evt->bss_cnt);
++ DBG_871X("survey done event(%x) band:%d for "ADPT_FMT"\n", psurveydone_evt->bss_cnt, padapter->setband, ADPT_ARG(padapter));
+
+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
+
+@@ -8265,11 +10294,11 @@ void report_join_res(_adapter *padapter, int res)
+ pjoinbss_evt->network.join_res = pjoinbss_evt->network.aid = res;
+
+ DBG_871X("report_join_res(%d)\n", res);
+-
++
+
+ rtw_joinbss_event_prehandle(padapter, (u8 *)&pjoinbss_evt->network);
+
+-
++
+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
+
+ return;
+@@ -8281,10 +10310,11 @@ void report_del_sta_event(_adapter *padapter, unsigned char* MacAddr, unsigned s
+ struct cmd_obj *pcmd_obj;
+ u8 *pevtcmd;
+ u32 cmdsz;
++ struct sta_info *psta;
++ int mac_id;
+ struct stadel_event *pdel_sta_evt;
+ struct C2HEvent_Header *pc2h_evt_hdr;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
+
+ if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
+@@ -8317,7 +10347,16 @@ void report_del_sta_event(_adapter *padapter, unsigned char* MacAddr, unsigned s
+ _rtw_memcpy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr, ETH_ALEN);
+ _rtw_memcpy((unsigned char *)(pdel_sta_evt->rsvd),(unsigned char *)(&reason),2);
+
+- DBG_871X("report_del_sta_event: delete STA\n");
++
++ psta = rtw_get_stainfo(&padapter->stapriv, MacAddr);
++ if(psta)
++ mac_id = (int)psta->mac_id;
++ else
++ mac_id = (-1);
++
++ pdel_sta_evt->mac_id = mac_id;
++
++ DBG_871X("report_del_sta_event: delete STA, mac_id=%d\n", mac_id);
+
+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
+
+@@ -8332,7 +10371,6 @@ void report_add_sta_event(_adapter *padapter, unsigned char* MacAddr, int cam_id
+ struct stassoc_event *padd_sta_evt;
+ struct C2HEvent_Header *pc2h_evt_hdr;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
+
+ if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
+@@ -8431,8 +10469,6 @@ void update_sta_info(_adapter *padapter, struct sta_info *psta)
+
+ }
+
+-u8 null_addr[ETH_ALEN]= {0,0,0,0,0,0};
+-
+ void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res)
+ {
+ struct sta_info *psta, *psta_bmc;
+@@ -8440,14 +10476,25 @@ void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res)
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+- u8 join_type, init_rts_rate;
++ u8 join_type;
+
+ if(join_res < 0)
+ {
+ join_type = 1;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, null_addr);
+- return;
++ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
++ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr);
++
++ //restore to initial setting.
++ update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode);
++#if 0 //temply remove
++#ifdef CONFIG_INTEL_WIDI
++#ifdef DBG_CONFIG_ERROR_DETECT
++ DBG_871X("%s(): do silentreset\n",__FUNCTION__);
++ rtw_hal_sreset_reset(padapter);
++#endif
++#endif
++#endif
++ goto exit_mlmeext_joinbss_event_callback;
+ }
+
+ if((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
+@@ -8469,10 +10516,10 @@ void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res)
+ // update IOT-releated issue
+ update_IOT_info(padapter);
+
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BASIC_RATE, cur_network->SupportedRates);
++ rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, cur_network->SupportedRates);
+
+ //BCN interval
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&pmlmeinfo->bcn_interval));
++ rtw_hal_set_hwreg(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&pmlmeinfo->bcn_interval));
+
+ //udpate capability
+ update_capinfo(padapter, pmlmeinfo->capability);
+@@ -8483,10 +10530,11 @@ void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res)
+ //HT
+ HTOnAssocRsp(padapter);
+
+-
++#ifndef CONFIG_CONCURRENT_MODE
++ // Call set_channel_bwmode when the CONFIG_CONCURRENT_MODE doesn't be defined.
+ //Set cur_channel&cur_bwmode&cur_ch_offset
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+-
++#endif
+
+ psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress);
+ if (psta) //only for infra. mode
+@@ -8496,11 +10544,11 @@ void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res)
+ //DBG_871X("set_sta_rate\n");
+
+ //set per sta rate after updating HT cap.
+- set_sta_rate(padapter, psta);
++ set_sta_rate(padapter, psta);
+ }
+
+ join_type = 2;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
++ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
+
+ if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
+ {
+@@ -8513,7 +10561,16 @@ void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res)
+ #ifdef CONFIG_LPS
+ rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_CONNECT, 0);
+ #endif
+-
++
++exit_mlmeext_joinbss_event_callback:
++
++#ifdef CONFIG_DUALMAC_CONCURRENT
++ dc_handle_join_done(padapter, join_res);
++#endif
++#ifdef CONFIG_CONCURRENT_MODE
++ concurrent_chk_joinbss_done(padapter, join_res);
++#endif
++
+ DBG_871X("=>%s\n", __FUNCTION__);
+
+ }
+@@ -8555,7 +10612,7 @@ void mlmeext_sta_add_event_callback(_adapter *padapter, struct sta_info *psta)
+ }
+
+ join_type = 2;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
++ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
+ }
+
+ pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
+@@ -8577,21 +10634,38 @@ void mlmeext_sta_del_event_callback(_adapter *padapter)
+ {
+ //set_opmode_cmd(padapter, infra_client_with_mlme);
+
++ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0);
++ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr);
++
++ //restore to initial setting.
++ update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode);
++
++#ifdef CONFIG_DUALMAC_CONCURRENT
++ dc_set_channel_bwmode_disconnect(padapter);
++#else
++#ifdef CONFIG_CONCURRENT_MODE
++ if((check_buddy_fwstate(padapter, _FW_LINKED)) != _TRUE)
++ {
++#endif //CONFIG_CONCURRENT_MODE
++
+ //switch to the 20M Hz mode after disconnect
+ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
+ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_DISCONNECT, 0);
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, null_addr);
+-
+ //SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset);
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
++
++#ifdef CONFIG_CONCURRENT_MODE
++ }
++#endif //CONFIG_CONCURRENT_MODE
++#endif //CONFIG_DUALMAC_CONCURRENT
++
+ flush_all_cam_entry(padapter);
+
+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
+
+- //set MSR to no link state
+- Set_NETYPE0_MSR(padapter, _HW_STATE_NOLINK_);
++ //set MSR to no link state -> infra. mode
++ Set_MSR(padapter, _HW_STATE_STATION_);
+
+ _cancel_timer_ex(&pmlmeext->link_timer);
+
+@@ -8604,27 +10678,94 @@ void mlmeext_sta_del_event_callback(_adapter *padapter)
+ Following are the functions for the timer handlers
+
+ *****************************************************************************/
+-
++void _linked_rx_signal_strehgth_display(_adapter *padapter);
+ void _linked_rx_signal_strehgth_display(_adapter *padapter)
+ {
+ int UndecoratedSmoothedPWDB;
+- DBG_8192C("============ linked status check ===================\n");
+- DBG_8192C("pathA Rx SNRdb:%d, pathB Rx SNRdb:%d\n",padapter->recvpriv.RxSNRdB[0],padapter->recvpriv.RxSNRdB[1]);
+- DBG_8192C("pathA Rx RSSI:%d,pathB Rx RSSI:%d\n",padapter->recvpriv.RxRssi[0],padapter->recvpriv.RxRssi[1]);
+-
+- DBG_8192C("pathA Rx PWDB:%d\n",padapter->recvpriv.rxpwdb);
+- padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
+- DBG_8192C("UndecoratedSmoothedPWDB:%d\n",UndecoratedSmoothedPWDB);
+- DBG_8192C("Rx RSSI:%d\n",padapter->recvpriv.rssi);
+- DBG_8192C("Rx Signal_strength:%d\n",padapter->recvpriv.signal_strength);
+- DBG_8192C("Rx Signal_qual:%d \n",padapter->recvpriv.signal_qual);
+- DBG_8192C("============ linked status check ===================\n");
+- DBG_8192C(" DIG PATH-A(0x%02x), PATH-B(0x%02x)\n",rtw_read8(padapter,0xc50),rtw_read8(padapter,0xc58));
+- DBG_8192C(" OFDM -Alarm DA2(0x%04x),DA4(0x%04x),DA6(0x%04x),DA8(0x%04x)\n",
++
++#ifdef CONFIG_CONCURRENT_MODE
++ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
++ DBG_871X("============ pbuddy_adapter linked status check ===================\n");
++ DBG_871X("buddy_adapter_type=%d\n", pbuddy_adapter->adapter_type);
++ DBG_871X("pbuddy_adapter pathA Rx SNRdb:%d\n",pbuddy_adapter->recvpriv.RxSNRdB[0]);
++ DBG_871X("pbuddy_adapter pathA Rx PWDB:%d\n",pbuddy_adapter->recvpriv.rxpwdb);
++ DBG_871X("pbuddy_adapter pathA Rx RSSI:%d,pathB Rx RSSI:%d\n"
++ ,pbuddy_adapter->recvpriv.RxRssi[0],pbuddy_adapter->recvpriv.RxRssi[1]);
++ rtw_hal_get_def_var(pbuddy_adapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
++ DBG_871X("pbuddy_adapter UndecoratedSmoothedPWDB:%d\n",UndecoratedSmoothedPWDB);
++ DBG_871X("Rx RSSI:%d\n",pbuddy_adapter->recvpriv.rssi);
++ DBG_871X("Rx Signal_strength:%d\n",pbuddy_adapter->recvpriv.signal_strength);
++ DBG_871X("Rx Signal_qual:%d \n",pbuddy_adapter->recvpriv.signal_qual);
++ DBG_871X("============ linked status check ===================\n");
++ DBG_871X("adapter_type=%d\n", padapter->adapter_type);
++#else //CONFIG_CONCURRENT_MODE
++ DBG_871X("============ linked status check ===================\n");
++#endif //CONFIG_CONCURRENT_MODE
++ DBG_871X("pathA Rx SNRdb:%d, pathB Rx SNRdb:%d\n",padapter->recvpriv.RxSNRdB[0], padapter->recvpriv.RxSNRdB[1]);
++ DBG_871X("pathA Rx PWDB:%d\n",padapter->recvpriv.rxpwdb);
++ DBG_871X("pathA Rx RSSI:%d,pathB Rx RSSI:%d\n",padapter->recvpriv.RxRssi[0],padapter->recvpriv.RxRssi[1]);
++ rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
++ DBG_871X("UndecoratedSmoothedPWDB:%d\n",UndecoratedSmoothedPWDB);
++ DBG_871X("Rx RSSI:%d\n",padapter->recvpriv.rssi);
++ DBG_871X("Rx Signal_strength:%d\n",padapter->recvpriv.signal_strength);
++ DBG_871X("Rx Signal_qual:%d \n",padapter->recvpriv.signal_qual);
++ if ( check_fwstate( &padapter->mlmepriv, _FW_LINKED ))
++ {
++ DBG_871X("bw mode: %d, channel: %d\n", padapter->mlmeextpriv.cur_bwmode, padapter->mlmeextpriv.cur_channel );
++ DBG_871X("received bytes = %d\n", (u32) (padapter->recvpriv.rx_bytes - padapter->recvpriv.last_rx_bytes ) );
+ }
++ DBG_871X("============ linked status check ===================\n");
++ DBG_871X(" DIG PATH-A(0x%02x), PATH-B(0x%02x)\n",rtw_read8(padapter,0xc50),rtw_read8(padapter,0xc58));
++ DBG_871X(" OFDM -Alarm DA2(0x%04x),DA4(0x%04x),DA6(0x%04x),DA8(0x%04x)\n",
+ rtw_read16(padapter,0xDA2),rtw_read16(padapter,0xDA4),rtw_read16(padapter,0xDA6),rtw_read16(padapter,0xDA8));
-- if(pmlmeext->scan_abort == _TRUE)
-- {
-- #ifdef CONFIG_P2P
-- if(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE))
+- DBG_8192C(" CCK -Alarm A5B(0x%02x),A5C(0x%02x)\n",rtw_read8(padapter,0xA5B),rtw_read8(padapter,0xA5C));
+- DBG_8192C(" FalseAlmCnt_all(%d)\n",padapter->recvpriv.FalseAlmCnt_all);
++ DBG_871X(" CCK -Alarm A5B(0x%02x),A5C(0x%02x)\n",rtw_read8(padapter,0xA5B),rtw_read8(padapter,0xA5C));
++ DBG_871X(" FalseAlmCnt_all(%d)\n",padapter->recvpriv.FalseAlmCnt_all);
++
++}
++
++u8 chk_ap_is_alive(_adapter *padapter, struct sta_info *psta)
++{
++ u8 ret = _FALSE;
++ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++
++ #ifdef DBG_EXPIRATION_CHK
++ DBG_871X(FUNC_ADPT_FMT" rx:"STA_PKTS_FMT", beacon:%llu, probersp_to_self:%llu"
++ /*", probersp_bm:%llu, probersp_uo:%llu, probereq:%llu, BI:%u"*/
++ ", retry:%u\n"
++ , FUNC_ADPT_ARG(padapter)
++ , STA_RX_PKTS_DIFF_ARG(psta)
++ , psta->sta_stats.rx_beacon_pkts - psta->sta_stats.last_rx_beacon_pkts
++ , psta->sta_stats.rx_probersp_pkts - psta->sta_stats.last_rx_probersp_pkts
++ /*, psta->sta_stats.rx_probersp_bm_pkts - psta->sta_stats.last_rx_probersp_bm_pkts
++ , psta->sta_stats.rx_probersp_uo_pkts - psta->sta_stats.last_rx_probersp_uo_pkts
++ , psta->sta_stats.rx_probereq_pkts - psta->sta_stats.last_rx_probereq_pkts
++ , pmlmeinfo->bcn_interval*/
++ , pmlmeext->retry
++ );
++
++ DBG_871X(FUNC_ADPT_FMT" tx_pkts:%llu, link_count:%u\n", FUNC_ADPT_ARG(padapter)
++ , padapter->xmitpriv.tx_pkts
++ , pmlmeinfo->link_count
++ );
++ #endif
++
++ if((sta_rx_data_pkts(psta) == sta_last_rx_data_pkts(psta))
++ && sta_rx_beacon_pkts(psta) == sta_last_rx_beacon_pkts(psta)
++ && sta_rx_probersp_pkts(psta) == sta_last_rx_probersp_pkts(psta)
++ )
++ {
++ ret = _FALSE;
++ }
++ else
++ {
++ ret = _TRUE;
++ }
++
++ sta_update_last_rx_pkts(psta);
++
++ return ret;
+ }
+
+ void linked_status_chk(_adapter *padapter)
+@@ -8632,110 +10773,116 @@ void linked_status_chk(_adapter *padapter)
+ u32 i;
+ struct sta_info *psta;
+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
+- struct recv_priv *precvpriv = &(padapter->recvpriv);
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ struct sta_priv *pstapriv = &padapter->stapriv;
+- struct registry_priv *pregistrypriv = &padapter->registrypriv;
+
+ if(padapter->bRxRSSIDisplay)
+- _linked_rx_signal_strehgth_display(padapter);
++ _linked_rx_signal_strehgth_display(padapter);
++
++ #ifdef DBG_CONFIG_ERROR_DETECT
++ rtw_hal_sreset_linked_status_check(padapter);
++ #endif
+
+ if (is_client_associated_to_ap(padapter))
+ {
+ //linked infrastructure client mode
++
++ int tx_chk = _SUCCESS, rx_chk = _SUCCESS;
++ int rx_chk_limit;
++
++ #if defined(DBG_ROAMING_TEST)
++ rx_chk_limit = 1;
++ #elif defined(CONFIG_ACTIVE_KEEP_ALIVE_CHECK)
++ rx_chk_limit = 4;
++ #else
++ rx_chk_limit = 8;
++ #endif
++
++ // Marked by Kurt 20130715
++ // For WiDi 3.5 and later on, they don't ask WiDi sink to do roaming, so we could not check rx limit that strictly.
++ // todo: To check why rx_chk would be _FALSE under miracast session.
++ //#ifdef CONFIG_INTEL_WIDI
++ //if (padapter->mlmepriv.widi_state != INTEL_WIDI_STATE_NONE)
++ // rx_chk_limit = 1;
++ //#endif
++
+ if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL)
+ {
+- #ifdef DBG_EXPIRATION_CHK
+- DBG_871X("%s rx:"STA_PKTS_FMT", BI:%u, retry:%u\n"
+- , __FUNCTION__
+- , STA_RX_PKTS_ARG(psta)
+- , pmlmeinfo->bcn_interval
+- , pmlmeext->retry
+- );
++ bool is_p2p_enable = _FALSE;
++ #ifdef CONFIG_P2P
++ is_p2p_enable = !rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE);
+ #endif
++
++ if (chk_ap_is_alive(padapter, psta) == _FALSE)
++ rx_chk = _FAIL;
+
+- /*to monitor whether the AP is alive or not*/
+- if (sta_last_rx_pkts(psta) == sta_rx_pkts(psta))
- {
-- rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_MAX);
-- pmlmeext->sitesurvey_res.channel_idx = 3;
-- DBG_871X("%s idx:%d, cnt:%u\n", __FUNCTION__
-- , pmlmeext->sitesurvey_res.channel_idx
-- , pwdinfo->find_phase_state_exchange_cnt
-- );
+- // Commented by Albert 2010/07/21
+- // In this case, there is no any rx packet received by driver.
++ if (pxmitpriv->last_tx_pkts == pxmitpriv->tx_pkts)
++ tx_chk = _FAIL;
+
+- #ifdef DBG_ROAMING_TEST
+- if(pmlmeext->retry<1)
+- #else
+- if(pmlmeext->retry<8)// Alter the retry limit to 8
+- #endif
+- {
+- if(pmlmeext->retry==0)
+- {
+- #ifdef DBG_CONFIG_ERROR_DETECT
+- if(padapter->HalFunc.sreset_linked_status_check)
+- padapter->HalFunc.sreset_linked_status_check(padapter);
+- #endif
++ #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
++ if (pmlmeext->active_keep_alive_check && (rx_chk == _FAIL || tx_chk == _FAIL)) {
++ u8 backup_oper_channel=0;
+
+- // In order to know the AP's current state, try to send the probe request
+- // to trigger the AP to send the probe response.
+- #ifdef CONFIG_P2P
+- if(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE)) {
+- #ifdef DBG_EXPIRATION_CHK
+- DBG_871X("issue_probereq_p2p to trigger probersp, retry=%d\n", pmlmeext->retry);
+- #endif
+- issue_probereq_p2p(padapter);
+- } else
+- #endif
+- {
+- #ifdef DBG_EXPIRATION_CHK
+- DBG_871X("issue_probereq to trigger probersp, retry=%d\n", pmlmeext->retry);
+- #endif
+- issue_probereq(padapter, &(pmlmeinfo->network.Ssid), 0);
+- issue_probereq(padapter, &(pmlmeinfo->network.Ssid), 0);
+- issue_probereq(padapter, &(pmlmeinfo->network.Ssid), 0);
+- }
+- }
+-
+- pmlmeext->retry++;
++ /* switch to correct channel of current network before issue keep-alive frames */
++ if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
++ backup_oper_channel = rtw_get_oper_ch(padapter);
++ SelectChannel(padapter, pmlmeext->cur_channel);
+ }
+- else
+- {
+- pmlmeext->retry = 0;
+- DBG_871X("no beacon to call receive_disconnect()\n");
+- receive_disconnect(padapter, pmlmeinfo->network.MacAddress
+- , 65535// indicate disconnect caused by no rx
+- );
+- pmlmeinfo->link_count = 0;
+- return;
++
++ if (rx_chk != _SUCCESS)
++ issue_probereq_ex(padapter, &pmlmeinfo->network.Ssid, psta->hwaddr, 3, 1);
++
++ if ((tx_chk != _SUCCESS && pmlmeinfo->link_count++ == 0xf) || rx_chk != _SUCCESS) {
++ tx_chk = issue_nulldata(padapter, psta->hwaddr, 0, 3, 1);
++ /* if tx acked and p2p disabled, set rx_chk _SUCCESS to reset retry count */
++ if (tx_chk == _SUCCESS && !is_p2p_enable)
++ rx_chk = _SUCCESS;
+ }
++
++ /* back to the original operation channel */
++ if(backup_oper_channel>0)
++ SelectChannel(padapter, backup_oper_channel);
++
+ }
+ else
++ #endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
+ {
+- pmlmeext->retry = 0;
+- sta_update_last_rx_pkts(psta);
+- //set_link_timer(pmlmeext, DISCONNECT_TO);
- }
-- else
+-
+- #ifdef DBG_EXPIRATION_CHK
+- DBG_871X("%s tx_pkts:%llu, link_count:%u\n", __FUNCTION__
+- , pxmitpriv->tx_pkts
+- , pmlmeinfo->link_count
+- );
- #endif
++ if (rx_chk != _SUCCESS) {
++ if (pmlmeext->retry == 0) {
++ #ifdef DBG_EXPIRATION_CHK
++ DBG_871X("issue_probereq to trigger probersp, retry=%d\n", pmlmeext->retry);
++ #endif
++ issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress);
++ issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress);
++ issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress);
++ }
++ }
+
+- /*to send the AP a nulldata if no frame is xmitted in order to keep alive*/
+- if(pxmitpriv->last_tx_pkts == pxmitpriv->tx_pkts)
- {
-- pmlmeext->sitesurvey_res.channel_idx = pmlmeext->max_chan_nums;
-- DBG_871X("%s idx:%d\n", __FUNCTION__
-- , pmlmeext->sitesurvey_res.channel_idx
-- );
-- }
-+ cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header));
-+ if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
-+ {
-+ rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-+ return;
-+ }
+- if(pmlmeinfo->link_count++ == 0xf)
+- {
+- //DBG_871X("(Interface %d)issue nulldata to keep alive\n",padapter->dvobjpriv.InterfaceNumber);
++ if (tx_chk != _SUCCESS && pmlmeinfo->link_count++ == 0xf) {
+ #ifdef DBG_EXPIRATION_CHK
+ DBG_871X("%s issue_nulldata 0\n", __FUNCTION__);
+ #endif
+- issue_nulldata(padapter, 0);
+- pmlmeinfo->link_count = 0;
++ tx_chk = issue_nulldata(padapter, NULL, 0, 1, 0);
+ }
+ }
+- else
+- {
++
++ if (rx_chk == _FAIL) {
++ pmlmeext->retry++;
++ if (pmlmeext->retry > rx_chk_limit) {
++ DBG_871X(FUNC_ADPT_FMT" disconnect or roaming\n",
++ FUNC_ADPT_ARG(padapter));
++ receive_disconnect(padapter, pmlmeinfo->network.MacAddress
++ , WLAN_REASON_EXPIRATION_CHK);
++ return;
++ }
++ } else {
++ pmlmeext->retry = 0;
++ }
++
++ if (tx_chk == _FAIL) {
++ pmlmeinfo->link_count &= 0xf;
++ } else {
+ pxmitpriv->last_tx_pkts = pxmitpriv->tx_pkts;
+ pmlmeinfo->link_count = 0;
+ }
+@@ -8789,19 +10936,41 @@ void survey_timer_hdl(_adapter *padapter)
+ struct cmd_obj *ph2c;
+ struct sitesurvey_parm *psurveyPara;
+ struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
+- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ #ifdef CONFIG_P2P
+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
+ #endif
-- pmlmeext->scan_abort = _FALSE;//reset
-- }
-+ _rtw_init_listhead(&pcmd_obj->list);
+- //DBG_8192C("marc: survey timer\n");
++ //DBG_871X("marc: survey timer\n");
++#ifdef PLATFORM_FREEBSD
++ rtw_mtx_lock(NULL);
++ if (callout_pending(&padapter->mlmeextpriv.survey_timer.callout)) {
++ /* callout was reset */
++ //mtx_unlock(&sc->sc_mtx);
++ rtw_mtx_unlock(NULL);
++ return;
++ }
++ if (!callout_active(&padapter->mlmeextpriv.survey_timer.callout)) {
++ /* callout was stopped */
++ //mtx_unlock(&sc->sc_mtx);
++ rtw_mtx_unlock(NULL);
++ return;
++ }
++ callout_deactivate(&padapter->mlmeextpriv.survey_timer.callout);
++
++
++#endif
+
+ //issue rtw_sitesurvey_cmd
+ if (pmlmeext->sitesurvey_res.state > SCAN_START)
+ {
+ if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS)
+- pmlmeext->sitesurvey_res.channel_idx++;
++ {
++#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
++ if( padapter->mlmeextpriv.mlmext_info.scan_cnt != RTW_SCAN_NUM_OF_CH )
++#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
++ pmlmeext->sitesurvey_res.channel_idx++;
++ }
+
+ if(pmlmeext->scan_abort == _TRUE)
+ {
+@@ -8818,7 +10987,7 @@ void survey_timer_hdl(_adapter *padapter)
+ else
+ #endif
+ {
+- pmlmeext->sitesurvey_res.channel_idx = pmlmeext->max_chan_nums;
++ pmlmeext->sitesurvey_res.channel_idx = pmlmeext->sitesurvey_res.ch_num;
+ DBG_871X("%s idx:%d\n", __FUNCTION__
+ , pmlmeext->sitesurvey_res.channel_idx
+ );
+@@ -8827,3204 +10996,2358 @@ void survey_timer_hdl(_adapter *padapter)
+ pmlmeext->scan_abort = _FALSE;//reset
+ }
- if ((ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
- {
- goto exit_survey_timer_hdl;
- }
-+ pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-+ pcmd_obj->cmdsz = cmdsz;
-+ pcmd_obj->parmbuf = pevtcmd;
-
+-
- if ((psurveyPara = (struct sitesurvey_parm*)rtw_zmalloc(sizeof(struct sitesurvey_parm))) == NULL)
- {
- rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
- goto exit_survey_timer_hdl;
- }
-+ pcmd_obj->rsp = NULL;
-+ pcmd_obj->rspsz = 0;
-
+-
- init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey));
- rtw_enqueue_cmd(pcmdpriv, ph2c);
-+ pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-+ pc2h_evt_hdr->len = sizeof(struct survey_event);
-+ pc2h_evt_hdr->ID = GEN_EVT_CODE(_Survey);
-+ pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
-+
-+ psurvey_evt = (struct survey_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-+
-+ if (collect_bss_info(padapter, precv_frame, (WLAN_BSSID_EX *)&psurvey_evt->bss) == _FAIL)
-+ {
-+ rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-+ rtw_mfree((u8 *)pevtcmd, cmdsz);
-+ return;
- }
-
-+#ifdef CONFIG_80211D
-+ process_80211d(padapter, &psurvey_evt->bss);
-+#endif
-+
-+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-
+- }
+-
+-
-exit_survey_timer_hdl:
-+ pmlmeext->sitesurvey_res.bss_cnt++;
-
- return;
-+
- }
-
+-
+- return;
+-}
+-
-void link_timer_hdl(_adapter *padapter)
-+void report_surveydone_event(_adapter *padapter)
- {
+-{
- static unsigned int rx_pkt = 0;
- static u64 tx_cnt = 0;
- struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct sta_priv *pstapriv = &padapter->stapriv;
-+ struct cmd_obj *pcmd_obj;
-+ u8 *pevtcmd;
-+ u32 cmdsz;
-+ struct surveydone_event *psurveydone_evt;
-+ struct C2HEvent_Header *pc2h_evt_hdr;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-
+-
- if (pmlmeinfo->state & WIFI_FW_AUTH_NULL)
-+ if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
- {
+- {
- DBG_871X("link_timer_hdl:no beacon while connecting\n");
- pmlmeinfo->state = WIFI_FW_NULL_STATE;
- report_join_res(padapter, -3);
-+ return;
- }
+- }
- else if (pmlmeinfo->state & WIFI_FW_AUTH_STATE)
-+
-+ cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header));
-+ if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
- {
+- {
- //re-auth timer
- if (++pmlmeinfo->reauth_count > REAUTH_LIMIT)
- {
- pmlmeinfo->auth_seq = 1;
- issue_auth(padapter, NULL, 0);
- set_link_timer(pmlmeext, REAUTH_TO);
-+ rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-+ return;
- }
+- }
- else if (pmlmeinfo->state & WIFI_FW_ASSOC_STATE)
- {
- //re-assoc timer
- report_join_res(padapter, -2);
- return;
- }
-
+-
- DBG_871X("link_timer_hdl: assoc timeout and try again\n");
- issue_assocreq(padapter);
- set_link_timer(pmlmeext, REASSOC_TO);
- rx_pkt = psta->sta_stats.rx_pkts;
- set_link_timer(pmlmeext, DISCONNECT_TO);
- }
-+ _rtw_init_listhead(&pcmd_obj->list);
-
+-
- //update the EDCA paramter according to the Tx/RX mode
- update_EDCA_param(padapter);
-+ pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-+ pcmd_obj->cmdsz = cmdsz;
-+ pcmd_obj->parmbuf = pevtcmd;
-
+-
- /*to send the AP a nulldata if no frame is xmitted in order to keep alive*/
- if (pmlmeinfo->link_count++ == 0)
- {
- {
- issue_nulldata(padapter, 0);
- }
-+ pcmd_obj->rsp = NULL;
-+ pcmd_obj->rspsz = 0;
-
+-
- tx_cnt = pxmitpriv->tx_pkts;
- }
- } //end of if ((psta = rtw_get_stainfo(pstapriv, passoc_res->network.MacAddress)) != NULL)
- if (pmlmeinfo->FW_sta_info[i].status == 1)
- {
- psta = pmlmeinfo->FW_sta_info[i].psta;
-+ pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-+ pc2h_evt_hdr->len = sizeof(struct surveydone_event);
-+ pc2h_evt_hdr->ID = GEN_EVT_CODE(_SurveyDone);
-+ pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
-
+-
- if (pmlmeinfo->FW_sta_info[i].rx_pkt == psta->sta_stats.rx_pkts)
- {
- pmlmeinfo->FW_sta_info[i].status = 0;
- }
- }
- }
-+ psurveydone_evt = (struct surveydone_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-+ psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt;
-
+-
- set_link_timer(pmlmeext, DISCONNECT_TO);
- }
-#endif
-+ DBG_871X("survey done event(%x) band:%d for "ADPT_FMT"\n", psurveydone_evt->bss_cnt, padapter->setband, ADPT_ARG(padapter));
-+
-+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-
- return;
-+
- }
-
+-
+- return;
+-}
+-
-void addba_timer_hdl(struct sta_info *psta)
-+void report_join_res(_adapter *padapter, int res)
- {
+-{
- u8 bitmap;
- u16 tid;
- struct ht_priv *phtpriv;
-+ struct cmd_obj *pcmd_obj;
-+ u8 *pevtcmd;
-+ u32 cmdsz;
-+ struct joinbss_event *pjoinbss_evt;
-+ struct C2HEvent_Header *pc2h_evt_hdr;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-
+-
- if(!psta)
-+ if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
-+ {
- return;
+- return;
-
- phtpriv = &psta->htpriv;
-+ }
-
+-
- if((phtpriv->ht_option==_TRUE) && (phtpriv->ampdu_enable==_TRUE))
-+ cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header));
-+ if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
- {
+- {
- if(phtpriv->candidate_tid_bitmap)
- phtpriv->candidate_tid_bitmap=0x0;
-
-+ rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-+ return;
- }
-+
-+ _rtw_init_listhead(&pcmd_obj->list);
-+
-+ pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-+ pcmd_obj->cmdsz = cmdsz;
-+ pcmd_obj->parmbuf = pevtcmd;
-+
-+ pcmd_obj->rsp = NULL;
-+ pcmd_obj->rspsz = 0;
-+
-+ pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-+ pc2h_evt_hdr->len = sizeof(struct joinbss_event);
-+ pc2h_evt_hdr->ID = GEN_EVT_CODE(_JoinBss);
-+ pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
-+
-+ pjoinbss_evt = (struct joinbss_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-+ _rtw_memcpy((unsigned char *)(&(pjoinbss_evt->network.network)), &(pmlmeinfo->network), sizeof(WLAN_BSSID_EX));
-+ pjoinbss_evt->network.join_res = pjoinbss_evt->network.aid = res;
-+
-+ DBG_871X("report_join_res(%d)\n", res);
-
+- }
+-
-}
-+
-+ rtw_joinbss_event_prehandle(padapter, (u8 *)&pjoinbss_evt->network);
-+
-+
-+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-+
-+ return;
-
+-
-u8 NULL_hdl(_adapter *padapter, u8 *pbuf)
-{
- return H2C_SUCCESS;
- }
-
+-}
+-
-u8 setopmode_hdl(_adapter *padapter, u8 *pbuf)
-+void report_del_sta_event(_adapter *padapter, unsigned char* MacAddr, unsigned short reason)
- {
+-{
- u8 type;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf;
-+ struct cmd_obj *pcmd_obj;
-+ u8 *pevtcmd;
-+ u32 cmdsz;
-+ struct sta_info *psta;
-+ int mac_id;
-+ struct stadel_event *pdel_sta_evt;
-+ struct C2HEvent_Header *pc2h_evt_hdr;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-
+-
- if(psetop->mode == Ndis802_11APMode)
- {
- pmlmeinfo->state = WIFI_FW_AP_STATE;
-#endif
- }
- else if(psetop->mode == Ndis802_11Infrastructure)
-+ if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
- {
+- {
- type = _HW_STATE_STATION_;
-+ return;
- }
+- }
- else if(psetop->mode == Ndis802_11IBSS)
-+
-+ cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header));
-+ if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
- {
+- {
- type = _HW_STATE_ADHOC_;
-+ rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-+ return;
- }
-+
-+ _rtw_init_listhead(&pcmd_obj->list);
-+
-+ pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-+ pcmd_obj->cmdsz = cmdsz;
-+ pcmd_obj->parmbuf = pevtcmd;
-+
-+ pcmd_obj->rsp = NULL;
-+ pcmd_obj->rspsz = 0;
-+
-+ pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-+ pc2h_evt_hdr->len = sizeof(struct stadel_event);
-+ pc2h_evt_hdr->ID = GEN_EVT_CODE(_DelSTA);
-+ pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
-+
-+ pdel_sta_evt = (struct stadel_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-+ _rtw_memcpy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr, ETH_ALEN);
-+ _rtw_memcpy((unsigned char *)(pdel_sta_evt->rsvd),(unsigned char *)(&reason),2);
-+
-+
-+ psta = rtw_get_stainfo(&padapter->stapriv, MacAddr);
-+ if(psta)
-+ mac_id = (int)psta->mac_id;
- else
+- }
+- else
- {
- type = _HW_STATE_NOLINK_;
- }
-+ mac_id = (-1);
-
+-
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SET_OPMODE, (u8 *)(&type));
- //Set_NETYPE0_MSR(padapter, type);
-+ pdel_sta_evt->mac_id = mac_id;
-
+-
- return H2C_SUCCESS;
-
-+ DBG_871X("report_del_sta_event: delete STA, mac_id=%d\n", mac_id);
-+
-+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-+
-+ return;
- }
-
+-}
+-
-u8 createbss_hdl(_adapter *padapter, u8 *pbuf)
-+void report_add_sta_event(_adapter *padapter, unsigned char* MacAddr, int cam_idx)
- {
+-{
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
- struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf;
- u32 initialgain;
-+ struct cmd_obj *pcmd_obj;
-+ u8 *pevtcmd;
-+ u32 cmdsz;
-+ struct stassoc_event *padd_sta_evt;
-+ struct C2HEvent_Header *pc2h_evt_hdr;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
-
+-
-
- if(pparm->network.InfrastructureMode == Ndis802_11APMode)
-+ if ((pcmd_obj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
- {
+- {
-#ifdef CONFIG_AP_MODE
-
- if(pmlmeinfo->state == WIFI_FW_AP_STATE)
- return H2C_SUCCESS;
- }
-#endif
-+ return;
- }
-
+- }
+-
- //below is for ad-hoc master
- if(pparm->network.InfrastructureMode == Ndis802_11IBSS)
-+ cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header));
-+ if ((pevtcmd = (u8*)rtw_zmalloc(cmdsz)) == NULL)
- {
+- {
- rtw_joinbss_reset(padapter);
-
- pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
- pmlmeinfo->HT_info_enable = 0;
- pmlmeinfo->agg_enable_bitmap = 0;
- pmlmeinfo->candidate_tid_bitmap = 0;
-+ rtw_mfree((u8 *)pcmd_obj, sizeof(struct cmd_obj));
-+ return;
-+ }
-
+-
- //disable dynamic functions, such as high power, DIG
- Save_DM_Func_Flag(padapter);
- Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-+ _rtw_init_listhead(&pcmd_obj->list);
-
+-
- //config the initial gain under linking, need to write the BB registers
- initialgain = 0x1E;
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
-+ pcmd_obj->cmdcode = GEN_CMD_CODE(_Set_MLME_EVT);
-+ pcmd_obj->cmdsz = cmdsz;
-+ pcmd_obj->parmbuf = pevtcmd;
-
+-
- //cancel link timer
- _cancel_timer_ex(&pmlmeext->link_timer);
-+ pcmd_obj->rsp = NULL;
-+ pcmd_obj->rspsz = 0;
-
+-
- //clear CAM
- flush_all_cam_entry(padapter);
-+ pc2h_evt_hdr = (struct C2HEvent_Header*)(pevtcmd);
-+ pc2h_evt_hdr->len = sizeof(struct stassoc_event);
-+ pc2h_evt_hdr->ID = GEN_EVT_CODE(_AddSTA);
-+ pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
-
+-
- _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength));
- pnetwork->IELength = ((WLAN_BSSID_EX *)pbuf)->IELength;
-+ padd_sta_evt = (struct stassoc_event*)(pevtcmd + sizeof(struct C2HEvent_Header));
-+ _rtw_memcpy((unsigned char *)(&(padd_sta_evt->macaddr)), MacAddr, ETH_ALEN);
-+ padd_sta_evt->cam_id = cam_idx;
-
+-
- if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength
- return H2C_PARAMETERS_ERROR;
-+ DBG_871X("report_add_sta_event: add STA\n");
-
+-
- _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength);
-
- start_create_ibss(padapter);
-+ rtw_enqueue_cmd(pcmdpriv, pcmd_obj);
-
+-
- }
-+ return;
-+}
-
+-
- return H2C_SUCCESS;
-
+-
-}
-+/****************************************************************************
-
+-
-u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf)
-+Following are the event callback functions
-+
-+*****************************************************************************/
-+
-+//for sta/adhoc mode
-+void update_sta_info(_adapter *padapter, struct sta_info *psta)
- {
+-{
- u8 join_type;
- PNDIS_802_11_VARIABLE_IEs pIE;
- struct registry_priv *pregpriv = &padapter->registrypriv;
-+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
- struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf;
- u32 acparm, initialgain, i;
-
+-
- //check already connecting to AP or not
- if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)
- {
- {
- issue_deauth(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVING);
- }
-+ //ERP
-+ VCS_update(padapter, psta);
-
+-
- pmlmeinfo->state = WIFI_FW_NULL_STATE;
-
- //clear CAM
-
- //set MSR to nolink
- Set_NETYPE0_MSR(padapter, _HW_STATE_NOLINK_);
-
+-
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_DISCONNECT, 0);
- }
-+ //HT
-+ if(pmlmepriv->htpriv.ht_option)
-+ {
-+ psta->htpriv.ht_option = _TRUE;
-
+-
-#ifdef CONFIG_ANTENNA_DIVERSITY
- rtw_antenna_select_cmd(padapter, pparm->network.PhyInfo.Optimum_antenna, _FALSE);
-#endif
-+ psta->htpriv.ampdu_enable = pmlmepriv->htpriv.ampdu_enable;
-
+-
- rtw_joinbss_reset(padapter);
-
- pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
- pmlmeinfo->candidate_tid_bitmap = 0;
- pmlmeinfo->bwmode_updated = _FALSE;
- //pmlmeinfo->assoc_AP_vendor = maxAP;
-+ if (support_short_GI(padapter, &(pmlmeinfo->HT_caps)))
-+ psta->htpriv.sgi = _TRUE;
-
+-
- _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength));
- pnetwork->IELength = ((WLAN_BSSID_EX *)pbuf)->IELength;
-
- if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength
- return H2C_PARAMETERS_ERROR;
-+ psta->qos_option = _TRUE;
-
+-
- _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength);
-
- //Check AP vendor to move rtw_joinbss_cmd()
- //pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->IEs, pnetwork->IELength);
-
- for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;)
-+ }
-+ else
- {
+- {
- pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
-
- switch (pIE->ElementID)
- default:
- break;
- }
-+ psta->htpriv.ht_option = _FALSE;
-
+-
- i += (pIE->Length + 2);
- }
-#if 0
-#endif
- //disable dynamic functions, such as high power, DIG
- //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-+ psta->htpriv.ampdu_enable = _FALSE;
-+
-+ psta->htpriv.sgi = _FALSE;
-
+-
- //config the initial gain under linking, need to write the BB registers
- #ifndef CONFIG_BEFORE_LINKED_DIG
- initialgain = 0x1E;
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
- join_type = 0;
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
-+ psta->qos_option = _FALSE;
-
+-
- //cancel link timer
- _cancel_timer_ex(&pmlmeext->link_timer);
-+ }
-
+-
- start_clnt_join(padapter);
-+ psta->htpriv.bwmode = pmlmeext->cur_bwmode;
-+ psta->htpriv.ch_offset = pmlmeext->cur_ch_offset;
-
+-
- return H2C_SUCCESS;
-+ psta->htpriv.agg_enable_bitmap = 0x0;//reset
-+ psta->htpriv.candidate_tid_bitmap = 0x0;//reset
-
-+
-+ //QoS
-+ if(pmlmepriv->qospriv.qos_option)
-+ psta->qos_option = _TRUE;
-+
-+
-+ psta->state = _FW_LINKED;
-+
- }
-
+-
+-}
+-
-u8 disconnect_hdl(_adapter *padapter, unsigned char *pbuf)
-+void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res)
- {
+-{
- struct disconnect_parm *pparm = (struct disconnect_parm *)pbuf;
-+ struct sta_info *psta, *psta_bmc;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
- u8 val8;
-
- {
- issue_deauth(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVING);
- }
-+ WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
-+ struct sta_priv *pstapriv = &padapter->stapriv;
-+ u8 join_type;
-
+-
- //set_opmode_cmd(padapter, infra_client_with_mlme);
-+ if(join_res < 0)
-+ {
-+ join_type = 1;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
-+ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr);
-
+-
- pmlmeinfo->state = WIFI_FW_NULL_STATE;
-
- //switch to the 20M Hz mode after disconnect
-
- //set MSR to no link state
- Set_NETYPE0_MSR(padapter, _HW_STATE_NOLINK_);
-+ //restore to initial setting.
-+ update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode);
-+#if 0 //temply remove
-+#ifdef CONFIG_INTEL_WIDI
-+#ifdef DBG_CONFIG_ERROR_DETECT
-+ DBG_871X("%s(): do silentreset\n",__FUNCTION__);
-+ rtw_hal_sreset_reset(padapter);
-+#endif
-+#endif
-+#endif
-+ goto exit_mlmeext_joinbss_event_callback;
-+ }
-
+-
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_DISCONNECT, 0);
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, null_addr);
-
- if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
-+ if((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
- {
-- //Stop BCN
-- val8 = 0;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BCN_FUNC, (u8 *)(&val8));
-+ //for bc/mc
-+ psta_bmc = rtw_get_bcmc_stainfo(padapter);
-+ if(psta_bmc)
-+ {
-+ pmlmeinfo->FW_sta_info[psta_bmc->mac_id].psta = psta_bmc;
-+ update_bmc_sta_support_rate(padapter, psta_bmc->mac_id);
-+ Update_RA_Entry(padapter, psta_bmc->mac_id);
-+ }
- }
-
+- {
+- //Stop BCN
+- val8 = 0;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BCN_FUNC, (u8 *)(&val8));
+- }
+-
- pmlmeinfo->state = WIFI_FW_NULL_STATE;
-
- set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
- u8 val8;
- u32 initialgain;
- u32 i;
-
+-
-#ifdef CONFIG_P2P
- struct wifidirect_info* pwdinfo = &padapter->wdinfo;
-#endif
-+ //turn on dynamic functions
-+ Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE);
-
+-
- if (pmlmeext->sitesurvey_res.state == SCAN_DISABLE)
- {
- //for first time sitesurvey_cmd
- pmlmeext->sitesurvey_res.state = SCAN_START;
- pmlmeext->sitesurvey_res.bss_cnt = 0;
- pmlmeext->sitesurvey_res.channel_idx = 0;
-+ // update IOT-releated issue
-+ update_IOT_info(padapter);
-
+-
- for(i=0;i<RTW_SSID_SCAN_AMOUNT;i++){
- if(pparm->ssid[i].SsidLength) {
- _rtw_memcpy(pmlmeext->sitesurvey_res.ssid[i].Ssid, pparm->ssid[i].Ssid, IW_ESSID_MAX_SIZE);
- pmlmeext->sitesurvey_res.ssid[i].SsidLength= 0;
- }
- }
-+ rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, cur_network->SupportedRates);
-
+-
- pmlmeext->sitesurvey_res.scan_mode = pparm->scan_mode;
-+ //BCN interval
-+ rtw_hal_set_hwreg(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&pmlmeinfo->bcn_interval));
-
+-
- //issue null data if associating to the AP
- if (is_client_associated_to_ap(padapter) == _TRUE)
- {
- pmlmeext->sitesurvey_res.state = SCAN_TXNULL;
-+ //udpate capability
-+ update_capinfo(padapter, pmlmeinfo->capability);
-
+-
- issue_nulldata(padapter, 1);
- issue_nulldata(padapter, 1);
-+ //WMM, Update EDCA param
-+ WMMOnAssocRsp(padapter);
-
+-
- //delay 50ms to protect nulldata(1).
- set_survey_timer(pmlmeext, 50);
-+ //HT
-+ HTOnAssocRsp(padapter);
-
+-
- return H2C_SUCCESS;
- }
- }
-+#ifndef CONFIG_CONCURRENT_MODE
-+ // Call set_channel_bwmode when the CONFIG_CONCURRENT_MODE doesn't be defined.
-+ //Set cur_channel&cur_bwmode&cur_ch_offset
-+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-+#endif
-
+-
- if ((pmlmeext->sitesurvey_res.state == SCAN_START) || (pmlmeext->sitesurvey_res.state == SCAN_TXNULL))
-+ psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress);
-+ if (psta) //only for infra. mode
- {
+- {
-#ifdef CONFIG_FIND_BEST_CHANNEL
-#if 0
- for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) {
- }
-#endif
-#endif /* CONFIG_FIND_BEST_CHANNEL */
-+ pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
-
+-
- //disable dynamic functions, such as high power, DIG
- Save_DM_Func_Flag(padapter);
- Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-+ //DBG_871X("set_sta_rate\n");
-+
-+ //set per sta rate after updating HT cap.
-+ set_sta_rate(padapter, psta);
-+ }
-
+-
- //config the initial gain under scaning, need to write the BB registers
-#ifdef CONFIG_IOCTL_CFG80211
- if((wdev_to_priv(padapter->rtw_wdev))->p2p_enabled == _TRUE)
- else
-#endif
- initialgain = 0x17;
-+ join_type = 2;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
-
+-
-#ifdef CONFIG_P2P
- if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE))
- initialgain = 0x27;
-#endif //CONFIG_P2P
-+ if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
-+ {
-+ // correcting TSF
-+ correct_TSF(padapter, pmlmeext);
-+
-+ //set_link_timer(pmlmeext, DISCONNECT_TO);
-+ }
-
+-
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
-
- //set MSR to no link state
- Set_NETYPE0_MSR(padapter, _HW_STATE_NOLINK_);
-+#ifdef CONFIG_LPS
-+ rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_CONNECT, 0);
-+#endif
-
+-
- val8 = 1; //before site survey
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
-+exit_mlmeext_joinbss_event_callback:
-
+-
- // Commented by Albert 2011/08/05
- // The pre_tx_scan_timer_process will issue the scan H2C command.
- // However, the driver should NOT enter the scanning mode at that time.
- pmlmeext->sitesurvey_res.state = SCAN_PROCESS;
- }
-+#ifdef CONFIG_DUALMAC_CONCURRENT
-+ dc_handle_join_done(padapter, join_res);
-+#endif
-+#ifdef CONFIG_CONCURRENT_MODE
-+ concurrent_chk_joinbss_done(padapter, join_res);
-+#endif
-
+-
- site_survey(padapter);
-+ DBG_871X("=>%s\n", __FUNCTION__);
-
+-
- return H2C_SUCCESS;
-
- }
-
+-}
+-
-u8 setauth_hdl(_adapter *padapter, unsigned char *pbuf)
-+void mlmeext_sta_add_event_callback(_adapter *padapter, struct sta_info *psta)
- {
+-{
- struct setauth_parm *pparm = (struct setauth_parm *)pbuf;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- if (pparm->mode < 4)
-+ u8 join_type;
-+
-+ DBG_871X("%s\n", __FUNCTION__);
-+
-+ if((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)
- {
+- {
- pmlmeinfo->auth_algo = pparm->mode;
-+ if(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)//adhoc master or sta_count>1
-+ {
-+ //nothing to do
-+ }
-+ else//adhoc client
-+ {
-+ //update TSF Value
-+ //update_TSF(pmlmeext, pframe, len);
-+
-+ // correcting TSF
-+ correct_TSF(padapter, pmlmeext);
-+
-+ //start beacon
-+ if(send_beacon(padapter)==_FAIL)
-+ {
-+ pmlmeinfo->FW_sta_info[psta->mac_id].status = 0;
-+
-+ pmlmeinfo->state ^= WIFI_FW_ADHOC_STATE;
-+
-+ return;
-+ }
-+
-+ pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
-+
-+ }
-+
-+ join_type = 2;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
- }
-
+- }
+-
- return H2C_SUCCESS;
-}
-+ pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
-
+-
-u8 setkey_hdl(_adapter *padapter, u8 *pbuf)
-{
- unsigned short ctrl;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-+ //rate radaptive
-+ Update_RA_Entry(padapter, psta->mac_id);
-
+-
- //main tx key for wep.
- if(pparm->set_tx)
- pmlmeinfo->key_index = pparm->keyid;
-
- //write cam
- ctrl = BIT(15) | ((pparm->algorithm) << 2) | pparm->keyid;
-+ //update adhoc sta_info
-+ update_sta_info(padapter, psta);
-
+-
- write_cam(padapter, pparm->keyid, ctrl, null_sta, pparm->key);
-
- return H2C_SUCCESS;
- }
-
+-}
+-
-u8 set_stakey_hdl(_adapter *padapter, u8 *pbuf)
-+void mlmeext_sta_del_event_callback(_adapter *padapter)
- {
+-{
- unsigned short ctrl=0;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct set_stakey_parm *pparm = (struct set_stakey_parm *)pbuf;
-#ifdef CONFIG_TDLS
- struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
- if(psta)
- {
- ctrl = (BIT(15) | ((pparm->algorithm) << 2));
-
+-
- DBG_8192C("r871x_set_stakey_hdl(): enc_algorithm=%d\n", pparm->algorithm);
-
- if((psta->mac_id<1) || (psta->mac_id>(NUM_STA-4)))
- }
-
- cam_id = (psta->mac_id + 3);//0~3 for default key, cmd_id=macid + 3, macid=aid+1;
-+ if (is_client_associated_to_ap(padapter) || is_IBSS_empty(padapter))
-+ {
-+ //set_opmode_cmd(padapter, infra_client_with_mlme);
-
+-
- DBG_8192C("Write CAM, mac_addr=%x:%x:%x:%x:%x:%x, cam_entry=%d\n", pparm->addr[0],
- pparm->addr[1], pparm->addr[2], pparm->addr[3], pparm->addr[4],
- pparm->addr[5], cam_id);
-+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0);
-+ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr);
-
+-
- write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key);
-
- return H2C_SUCCESS_RSP;
-
- }
- else
-+ //restore to initial setting.
-+ update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode);
-+
-+#ifdef CONFIG_DUALMAC_CONCURRENT
-+ dc_set_channel_bwmode_disconnect(padapter);
-+#else
-+#ifdef CONFIG_CONCURRENT_MODE
-+ if((check_buddy_fwstate(padapter, _FW_LINKED)) != _TRUE)
- {
+- {
- DBG_8192C("r871x_set_stakey_hdl(): sta has been free\n");
- return H2C_REJECTED;
- }
-
- }
-+#endif //CONFIG_CONCURRENT_MODE
-
+-
- //below for sta mode
-
- ctrl = BIT(15) | ((pparm->algorithm) << 2);
-+ //switch to the 20M Hz mode after disconnect
-+ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
-+ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-+
-+ //SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset);
-+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-
+-
-#ifdef CONFIG_TDLS
- if(ptdlsinfo->cam_entry_to_clear!=0){
- clear_cam_entry(padapter, ptdlsinfo->cam_entry_to_clear);
- ptdlsinfo->cam_entry_to_clear=0;
-+#ifdef CONFIG_CONCURRENT_MODE
-+ }
-+#endif //CONFIG_CONCURRENT_MODE
-+#endif //CONFIG_DUALMAC_CONCURRENT
-
+-
- return H2C_SUCCESS;
- }
-+ flush_all_cam_entry(padapter);
-+
-+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
-+
-+ //set MSR to no link state -> infra. mode
-+ Set_MSR(padapter, _HW_STATE_STATION_);
-+
-+ _cancel_timer_ex(&pmlmeext->link_timer);
-
+-
- psta = rtw_get_stainfo(pstapriv, pparm->addr);//Get TDLS Peer STA
- if( psta->tdls_sta_state&TDLS_LINKED_STATE ){
- write_cam(padapter, psta->cam_entry, ctrl, pparm->addr, pparm->key);
- }
+- }
- else
-#endif
- write_cam(padapter, 5, ctrl, pparm->addr, pparm->key);
-
+-
- pmlmeinfo->enc_algo = pparm->algorithm;
-
- return H2C_SUCCESS;
- }
-
+-}
+-
-u8 add_ba_hdl(_adapter *padapter, unsigned char *pbuf)
-{
- struct addBaReq_parm *pparm = (struct addBaReq_parm *)pbuf;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+/****************************************************************************
-
+-
- struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, pparm->addr);
-+Following are the functions for the timer handlers
-+
-+*****************************************************************************/
-+void _linked_rx_signal_strehgth_display(_adapter *padapter);
-+void _linked_rx_signal_strehgth_display(_adapter *padapter)
-+{
-+ int UndecoratedSmoothedPWDB;
-
+-
- if(!psta)
- return H2C_SUCCESS;
-
-+#ifdef CONFIG_CONCURRENT_MODE
-+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
-+ DBG_871X("============ pbuddy_adapter linked status check ===================\n");
-+ DBG_871X("buddy_adapter_type=%d\n", pbuddy_adapter->adapter_type);
-+ DBG_871X("pbuddy_adapter pathA Rx SNRdb:%d\n",pbuddy_adapter->recvpriv.RxSNRdB[0]);
-+ DBG_871X("pbuddy_adapter pathA Rx PWDB:%d\n",pbuddy_adapter->recvpriv.rxpwdb);
-+ DBG_871X("pbuddy_adapter pathA Rx RSSI:%d,pathB Rx RSSI:%d\n"
-+ ,pbuddy_adapter->recvpriv.RxRssi[0],pbuddy_adapter->recvpriv.RxRssi[1]);
-+ rtw_hal_get_def_var(pbuddy_adapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
-+ DBG_871X("pbuddy_adapter UndecoratedSmoothedPWDB:%d\n",UndecoratedSmoothedPWDB);
-+ DBG_871X("Rx RSSI:%d\n",pbuddy_adapter->recvpriv.rssi);
-+ DBG_871X("Rx Signal_strength:%d\n",pbuddy_adapter->recvpriv.signal_strength);
-+ DBG_871X("Rx Signal_qual:%d \n",pbuddy_adapter->recvpriv.signal_qual);
-+ DBG_871X("============ linked status check ===================\n");
-+ DBG_871X("adapter_type=%d\n", padapter->adapter_type);
-+#else //CONFIG_CONCURRENT_MODE
-+ DBG_871X("============ linked status check ===================\n");
-+#endif //CONFIG_CONCURRENT_MODE
-+ DBG_871X("pathA Rx SNRdb:%d, pathB Rx SNRdb:%d\n",padapter->recvpriv.RxSNRdB[0], padapter->recvpriv.RxSNRdB[1]);
-+ DBG_871X("pathA Rx PWDB:%d\n",padapter->recvpriv.rxpwdb);
-+ DBG_871X("pathA Rx RSSI:%d,pathB Rx RSSI:%d\n",padapter->recvpriv.RxRssi[0],padapter->recvpriv.RxRssi[1]);
-+ rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB);
-+ DBG_871X("UndecoratedSmoothedPWDB:%d\n",UndecoratedSmoothedPWDB);
-+ DBG_871X("Rx RSSI:%d\n",padapter->recvpriv.rssi);
-+ DBG_871X("Rx Signal_strength:%d\n",padapter->recvpriv.signal_strength);
-+ DBG_871X("Rx Signal_qual:%d \n",padapter->recvpriv.signal_qual);
-+ if ( check_fwstate( &padapter->mlmepriv, _FW_LINKED ))
-+ {
-+ DBG_871X("bw mode: %d, channel: %d\n", padapter->mlmeextpriv.cur_bwmode, padapter->mlmeextpriv.cur_channel );
-+ DBG_871X("received bytes = %d\n", (u32) (padapter->recvpriv.rx_bytes - padapter->recvpriv.last_rx_bytes ) );
-+ }
-+ DBG_871X("============ linked status check ===================\n");
-+ DBG_871X(" DIG PATH-A(0x%02x), PATH-B(0x%02x)\n",rtw_read8(padapter,0xc50),rtw_read8(padapter,0xc58));
-+ DBG_871X(" OFDM -Alarm DA2(0x%04x),DA4(0x%04x),DA6(0x%04x),DA8(0x%04x)\n",
-+ rtw_read16(padapter,0xDA2),rtw_read16(padapter,0xDA4),rtw_read16(padapter,0xDA6),rtw_read16(padapter,0xDA8));
-
+-
- if (((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && (pmlmeinfo->HT_enable)) ||
- ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
- {
- {
- psta->htpriv.candidate_tid_bitmap &= ~BIT(pparm->tid);
- }
-+ DBG_871X(" CCK -Alarm A5B(0x%02x),A5C(0x%02x)\n",rtw_read8(padapter,0xA5B),rtw_read8(padapter,0xA5C));
-+ DBG_871X(" FalseAlmCnt_all(%d)\n",padapter->recvpriv.FalseAlmCnt_all);
-
+-
- return H2C_SUCCESS;
- }
-
+-}
+-
-u8 set_tx_beacon_cmd(_adapter* padapter)
-+u8 chk_ap_is_alive(_adapter *padapter, struct sta_info *psta)
- {
+-{
- struct cmd_obj *ph2c;
- struct Tx_Beacon_param *ptxBeacon_parm;
- struct cmd_priv *pcmdpriv = &(padapter->cmdpriv);
-+ u8 ret = _FALSE;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- u8 res = _SUCCESS;
- int len_diff = 0;
-
-_func_enter_;
-
- if ((ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
-+
-+ #ifdef DBG_EXPIRATION_CHK
-+ DBG_871X(FUNC_ADPT_FMT" rx:"STA_PKTS_FMT", beacon:%llu, probersp_to_self:%llu"
-+ /*", probersp_bm:%llu, probersp_uo:%llu, probereq:%llu, BI:%u"*/
-+ ", retry:%u\n"
-+ , FUNC_ADPT_ARG(padapter)
-+ , STA_RX_PKTS_DIFF_ARG(psta)
-+ , psta->sta_stats.rx_beacon_pkts - psta->sta_stats.last_rx_beacon_pkts
-+ , psta->sta_stats.rx_probersp_pkts - psta->sta_stats.last_rx_probersp_pkts
-+ /*, psta->sta_stats.rx_probersp_bm_pkts - psta->sta_stats.last_rx_probersp_bm_pkts
-+ , psta->sta_stats.rx_probersp_uo_pkts - psta->sta_stats.last_rx_probersp_uo_pkts
-+ , psta->sta_stats.rx_probereq_pkts - psta->sta_stats.last_rx_probereq_pkts
-+ , pmlmeinfo->bcn_interval*/
-+ , pmlmeext->retry
-+ );
-+
-+ DBG_871X(FUNC_ADPT_FMT" tx_pkts:%llu, link_count:%u\n", FUNC_ADPT_ARG(padapter)
-+ , padapter->xmitpriv.tx_pkts
-+ , pmlmeinfo->link_count
-+ );
-+ #endif
-+
-+ if((sta_rx_data_pkts(psta) == sta_last_rx_data_pkts(psta))
-+ && sta_rx_beacon_pkts(psta) == sta_last_rx_beacon_pkts(psta)
-+ && sta_rx_probersp_pkts(psta) == sta_last_rx_probersp_pkts(psta)
-+ )
- {
+- {
- res= _FAIL;
- goto exit;
-+ ret = _FALSE;
- }
+- }
-
- if ((ptxBeacon_parm = (struct Tx_Beacon_param *)rtw_zmalloc(sizeof(struct Tx_Beacon_param))) == NULL)
-+ else
- {
+- {
- rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
- res= _FAIL;
- goto exit;
-+ ret = _TRUE;
- }
-
+- }
+-
- _rtw_memcpy(&(ptxBeacon_parm->network), &(pmlmeinfo->network), sizeof(WLAN_BSSID_EX));
-
- len_diff = update_hidden_ssid(
-exit:
-
-_func_exit_;
-+ sta_update_last_rx_pkts(psta);
-
+-
- return res;
-+ return ret;
- }
-
+-}
+-
-
-u8 mlme_evt_hdl(_adapter *padapter, unsigned char *pbuf)
-+void linked_status_chk(_adapter *padapter)
- {
+-{
- u8 evt_code, evt_seq;
- u16 evt_sz;
- uint *peventbuf;
- void (*event_callback)(_adapter *dev, u8 *pbuf);
- struct evt_priv *pevt_priv = &(padapter->evtpriv);
-+ u32 i;
-+ struct sta_info *psta;
-+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ struct sta_priv *pstapriv = &padapter->stapriv;
-
+-
- peventbuf = (uint*)pbuf;
- evt_sz = (u16)(*peventbuf&0xffff);
- evt_seq = (u8)((*peventbuf>>24)&0x7f);
- RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("Evetn Seq Error! %d vs %d\n", (evt_seq & 0x7f), (ATOMIC_READ(&pevt_priv->event_seq) & 0x7f)));
-
- pevt_priv->event_seq = (evt_seq+1)&0x7f;
-+ if(padapter->bRxRSSIDisplay)
-+ _linked_rx_signal_strehgth_display(padapter);
-
+-
- goto _abort_event_;
- }
-+ #ifdef DBG_CONFIG_ERROR_DETECT
-+ rtw_hal_sreset_linked_status_check(padapter);
- #endif
-
+- #endif
+-
- // checking if event code is valid
- if (evt_code >= MAX_C2HEVT)
-+ if (is_client_associated_to_ap(padapter))
- {
+- {
- RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nEvent Code(%d) mismatch!\n", evt_code));
- goto _abort_event_;
- }
-+ //linked infrastructure client mode
-
+-
- // checking if event size match the event parm size
- if ((wlanevents[evt_code].parmsize != 0) &&
- (wlanevents[evt_code].parmsize != evt_sz))
- goto _abort_event_;
-
- }
-+ int tx_chk = _SUCCESS, rx_chk = _SUCCESS;
-+ int rx_chk_limit;
-
+-
- ATOMIC_INC(&pevt_priv->event_seq);
-+ #if defined(DBG_ROAMING_TEST)
-+ rx_chk_limit = 1;
-+ #elif defined(CONFIG_ACTIVE_KEEP_ALIVE_CHECK)
-+ rx_chk_limit = 4;
-+ #else
-+ rx_chk_limit = 8;
-+ #endif
++ if ((ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
++ {
++ goto exit_survey_timer_hdl;
++ }
- peventbuf += 2;
-
- {
- event_callback = wlanevents[evt_code].event_callback;
- event_callback(padapter, (u8*)peventbuf);
-+ // Marked by Kurt 20130715
-+ // For WiDi 3.5 and later on, they don't ask WiDi sink to do roaming, so we could not check rx limit that strictly.
-+ // todo: To check why rx_chk would be _FALSE under miracast session.
-+ //#ifdef CONFIG_INTEL_WIDI
-+ //if (padapter->mlmepriv.widi_state != INTEL_WIDI_STATE_NONE)
-+ // rx_chk_limit = 1;
-+ //#endif
-+
-+ if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL)
++ if ((psurveyPara = (struct sitesurvey_parm*)rtw_zmalloc(sizeof(struct sitesurvey_parm))) == NULL)
+ {
-+ bool is_p2p_enable = _FALSE;
-+ #ifdef CONFIG_P2P
-+ is_p2p_enable = !rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE);
-+ #endif
-+
-+ if (chk_ap_is_alive(padapter, psta) == _FALSE)
-+ rx_chk = _FAIL;
++ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
++ goto exit_survey_timer_hdl;
++ }
- pevt_priv->evt_done_cnt++;
-- }
-+ if (pxmitpriv->last_tx_pkts == pxmitpriv->tx_pkts)
-+ tx_chk = _FAIL;
++ init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey));
++ rtw_enqueue_cmd(pcmdpriv, ph2c);
+ }
-+ #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
-+ if (pmlmeext->active_keep_alive_check && (rx_chk == _FAIL || tx_chk == _FAIL)) {
-+ u8 backup_oper_channel=0;
-_abort_event_:
-+ /* switch to correct channel of current network before issue keep-alive frames */
-+ if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
-+ backup_oper_channel = rtw_get_oper_ch(padapter);
-+ SelectChannel(padapter, pmlmeext->cur_channel);
-+ }
-
-+ if (rx_chk != _SUCCESS)
-+ issue_probereq_ex(padapter, &pmlmeinfo->network.Ssid, psta->hwaddr, 3, 1);
+-
++exit_survey_timer_hdl:
++#ifdef PLATFORM_FREEBSD
++ rtw_mtx_unlock(NULL);
++#endif
- return H2C_SUCCESS;
-
--}
-+ if ((tx_chk != _SUCCESS && pmlmeinfo->link_count++ == 0xf) || rx_chk != _SUCCESS) {
-+ tx_chk = issue_nulldata(padapter, psta->hwaddr, 0, 3, 1);
-+ /* if tx acked and p2p disabled, set rx_chk _SUCCESS to reset retry count */
-+ if (tx_chk == _SUCCESS && !is_p2p_enable)
-+ rx_chk = _SUCCESS;
-+ }
++ return;
+ }
-u8 h2c_msg_hdl(_adapter *padapter, unsigned char *pbuf)
--{
++void link_timer_hdl(_adapter *padapter)
+ {
- if(!pbuf)
- return H2C_PARAMETERS_ERROR;
-+ /* back to the original operation channel */
-+ if(backup_oper_channel>0)
-+ SelectChannel(padapter, backup_oper_channel);
-
+-
- return H2C_SUCCESS;
-}
-+ }
-+ else
-+ #endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
-+ {
-+ if (rx_chk != _SUCCESS) {
-+ if (pmlmeext->retry == 0) {
-+ #ifdef DBG_EXPIRATION_CHK
-+ DBG_871X("issue_probereq to trigger probersp, retry=%d\n", pmlmeext->retry);
-+ #endif
-+ issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress);
-+ issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress);
-+ issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress);
-+ }
-+ }
++ //static unsigned int rx_pkt = 0;
++ //static u64 tx_cnt = 0;
++ //struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
++ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++ //struct sta_priv *pstapriv = &padapter->stapriv;
++
++#ifdef PLATFORM_FREEBSD
++ rtw_mtx_lock(NULL);
++ if (callout_pending(&padapter->mlmeextpriv.survey_timer.callout)) {
++ /* callout was reset */
++ //mtx_unlock(&sc->sc_mtx);
++ rtw_mtx_unlock(NULL);
++ return;
++ }
++ if (!callout_active(&padapter->mlmeextpriv.survey_timer.callout)) {
++ /* callout was stopped */
++ //mtx_unlock(&sc->sc_mtx);
++ rtw_mtx_unlock(NULL);
++ return;
++ }
++ callout_deactivate(&padapter->mlmeextpriv.survey_timer.callout);
-+ if (tx_chk != _SUCCESS && pmlmeinfo->link_count++ == 0xf) {
-+ #ifdef DBG_EXPIRATION_CHK
-+ DBG_871X("%s issue_nulldata 0\n", __FUNCTION__);
-+ #endif
-+ tx_chk = issue_nulldata(padapter, NULL, 0, 1, 0);
-+ }
-+ }
++
++#endif
-u8 tx_beacon_hdl(_adapter *padapter, unsigned char *pbuf)
-{
- if(send_beacon(padapter)==_FAIL)
-- {
++ if (pmlmeinfo->state & WIFI_FW_AUTH_NULL)
+ {
- DBG_871X("issue_beacon, fail!\n");
- return H2C_PARAMETERS_ERROR;
-- }
++ DBG_871X("link_timer_hdl:no beacon while connecting\n");
++ pmlmeinfo->state = WIFI_FW_NULL_STATE;
++ report_join_res(padapter, -3);
+ }
-#ifdef CONFIG_AP_MODE
- else //tx bc/mc frames after update TIM
- {
- _list *xmitframe_plist, *xmitframe_phead;
- struct xmit_frame *pxmitframe=NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
--
++ else if (pmlmeinfo->state & WIFI_FW_AUTH_STATE)
++ {
++ //re-auth timer
++ if (++pmlmeinfo->reauth_count > REAUTH_LIMIT)
++ {
++ //if (pmlmeinfo->auth_algo != dot11AuthAlgrthm_Auto)
++ //{
++ pmlmeinfo->state = 0;
++ report_join_res(padapter, -1);
++ return;
++ //}
++ //else
++ //{
++ // pmlmeinfo->auth_algo = dot11AuthAlgrthm_Shared;
++ // pmlmeinfo->reauth_count = 0;
++ //}
++ }
+
- //for BC/MC Frames
- psta_bmc = rtw_get_bcmc_stainfo(padapter);
- if(!psta_bmc)
- rtw_msleep_os(10);// 10ms, ATIM(HIQ) Windows
-#endif
- _enter_critical_bh(&psta_bmc->sleep_q.lock, &irqL);
-+ if (rx_chk == _FAIL) {
-+ pmlmeext->retry++;
-+ if (pmlmeext->retry > rx_chk_limit) {
-+ DBG_871X(FUNC_ADPT_FMT" disconnect or roaming\n",
-+ FUNC_ADPT_ARG(padapter));
-+ receive_disconnect(padapter, pmlmeinfo->network.MacAddress
-+ , WLAN_REASON_EXPIRATION_CHK);
-+ return;
-+ }
-+ } else {
-+ pmlmeext->retry = 0;
-+ }
++ DBG_871X("link_timer_hdl: auth timeout and try again\n");
++ pmlmeinfo->auth_seq = 1;
++ issue_auth(padapter, NULL, 0);
++ set_link_timer(pmlmeext, REAUTH_TO);
++ }
++ else if (pmlmeinfo->state & WIFI_FW_ASSOC_STATE)
++ {
++ //re-assoc timer
++ if (++pmlmeinfo->reassoc_count > REASSOC_LIMIT)
++ {
++ pmlmeinfo->state = WIFI_FW_NULL_STATE;
++ report_join_res(padapter, -2);
++ return;
++ }
- xmitframe_phead = get_list_head(&psta_bmc->sleep_q);
- xmitframe_plist = get_next(xmitframe_phead);
-+ if (tx_chk == _FAIL) {
-+ pmlmeinfo->link_count &= 0xf;
-+ } else {
-+ pxmitpriv->last_tx_pkts = pxmitpriv->tx_pkts;
-+ pmlmeinfo->link_count = 0;
++ DBG_871X("link_timer_hdl: assoc timeout and try again\n");
++ issue_assocreq(padapter);
++ set_link_timer(pmlmeext, REASSOC_TO);
++ }
++#if 0
++ else if (is_client_associated_to_ap(padapter))
++ {
++ //linked infrastructure client mode
++ if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL)
++ {
++ /*to monitor whether the AP is alive or not*/
++ if (rx_pkt == psta->sta_stats.rx_pkts)
++ {
++ receive_disconnect(padapter, pmlmeinfo->network.MacAddress);
++ return;
++ }
++ else
++ {
++ rx_pkt = psta->sta_stats.rx_pkts;
++ set_link_timer(pmlmeext, DISCONNECT_TO);
+ }
- while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == _FALSE)
- {
- pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list);
++ //update the EDCA paramter according to the Tx/RX mode
++ update_EDCA_param(padapter);
+
+- xmitframe_plist = get_next(xmitframe_plist);
++ /*to send the AP a nulldata if no frame is xmitted in order to keep alive*/
++ if (pmlmeinfo->link_count++ == 0)
++ {
++ tx_cnt = pxmitpriv->tx_pkts;
++ }
++ else if ((pmlmeinfo->link_count & 0xf) == 0)
++ {
++ if (tx_cnt == pxmitpriv->tx_pkts)
++ {
++ issue_nulldata(padapter, NULL, 0, 0, 0);
++ }
+
+- rtw_list_delete(&pxmitframe->list);
++ tx_cnt = pxmitpriv->tx_pkts;
++ }
+ } //end of if ((psta = rtw_get_stainfo(pstapriv, passoc_res->network.MacAddress)) != NULL)
+ }
+ else if (is_client_associated_to_ibss(padapter))
+ {
+ psta = pmlmeinfo->FW_sta_info[i].psta;
-- xmitframe_plist = get_next(xmitframe_plist);
-+ if(NULL==psta) continue;
-
-- rtw_list_delete(&pxmitframe->list);
-+ if (pmlmeinfo->FW_sta_info[i].rx_pkt == sta_rx_pkts(psta))
-+ {
-
- psta_bmc->sleepq_len--;
- if(psta_bmc->sleepq_len>0)
- pxmitframe->attrib.mdata = 1;
-+ if(pmlmeinfo->FW_sta_info[i].retry<3)
-+ {
-+ pmlmeinfo->FW_sta_info[i].retry++;
-+ }
-+ else
-+ {
-+ pmlmeinfo->FW_sta_info[i].retry = 0;
-+ pmlmeinfo->FW_sta_info[i].status = 0;
-+ report_del_sta_event(padapter, psta->hwaddr
-+ , 65535// indicate disconnect caused by no rx
-+ );
-+ }
++ if (pmlmeinfo->FW_sta_info[i].rx_pkt == psta->sta_stats.rx_pkts)
++ {
++ pmlmeinfo->FW_sta_info[i].status = 0;
++ report_del_sta_event(padapter, psta->hwaddr);
+ }
else
- pxmitframe->attrib.mdata = 0;
- {
- rtw_os_xmit_complete(padapter, pxmitframe);
+ {
-+ pmlmeinfo->FW_sta_info[i].retry = 0;
-+ pmlmeinfo->FW_sta_info[i].rx_pkt = (u32)sta_rx_pkts(psta);
++ pmlmeinfo->FW_sta_info[i].rx_pkt = psta->sta_stats.rx_pkts;
}
-
- //pstapriv->tim_bitmap &= ~BIT(0);
+ }
}
-+ //set_link_timer(pmlmeext, DISCONNECT_TO);
-+
++ set_link_timer(pmlmeext, DISCONNECT_TO);
}
--#endif
+ #endif
- return H2C_SUCCESS;
-
- }
+-}
++#ifdef PLATFORM_FREEBSD
++ rtw_mtx_unlock(NULL);
++#endif
-#ifdef CONFIG_AP_MODE
--
++ return;
++}
+
-void init_mlme_ap_info(_adapter *padapter)
-+void survey_timer_hdl(_adapter *padapter)
++void addba_timer_hdl(struct sta_info *psta)
{
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-+ struct cmd_obj *ph2c;
-+ struct sitesurvey_parm *psurveyPara;
-+ struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+#ifdef CONFIG_P2P
-+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
-+#endif
-
+-
- _rtw_spinlock_init(&pmlmepriv->bcn_update_lock);
-+ //DBG_871X("marc: survey timer\n");
-+#ifdef PLATFORM_FREEBSD
-+ rtw_mtx_lock(NULL);
-+ if (callout_pending(&padapter->mlmeextpriv.survey_timer.callout)) {
-+ /* callout was reset */
-+ //mtx_unlock(&sc->sc_mtx);
-+ rtw_mtx_unlock(NULL);
-+ return;
-+ }
-+ if (!callout_active(&padapter->mlmeextpriv.survey_timer.callout)) {
-+ /* callout was stopped */
-+ //mtx_unlock(&sc->sc_mtx);
-+ rtw_mtx_unlock(NULL);
-+ return;
-+ }
-+ callout_deactivate(&padapter->mlmeextpriv.survey_timer.callout);
++ struct ht_priv *phtpriv;
- //pmlmeext->bstart_bss = _FALSE;
++ if(!psta)
++ return;
++
++ phtpriv = &psta->htpriv;
- start_ap_mode(padapter);
--}
-+#endif
++ if((phtpriv->ht_option==_TRUE) && (phtpriv->ampdu_enable==_TRUE))
++ {
++ if(phtpriv->candidate_tid_bitmap)
++ phtpriv->candidate_tid_bitmap=0x0;
++
++ }
+ }
-void free_mlme_ap_info(_adapter *padapter)
--{
-- _irqL irqL;
++#ifdef CONFIG_IEEE80211W
++void sa_query_timer_hdl(_adapter *padapter)
+ {
++ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
++ struct mlme_priv * pmlmepriv = &padapter->mlmepriv;
+ _irqL irqL;
- struct sta_info *psta=NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ //issue rtw_sitesurvey_cmd
-+ if (pmlmeext->sitesurvey_res.state > SCAN_START)
-+ {
-+ if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS)
-+ {
-+#ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
-+ if( padapter->mlmeextpriv.mlmext_info.scan_cnt != RTW_SCAN_NUM_OF_CH )
-+#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
-+ pmlmeext->sitesurvey_res.channel_idx++;
-+ }
++ //disconnect
++ _enter_critical_bh(&pmlmepriv->lock, &irqL);
- //stop_ap_mode(padapter);
-+ if(pmlmeext->scan_abort == _TRUE)
-+ {
-+ #ifdef CONFIG_P2P
-+ if(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE))
-+ {
-+ rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_MAX);
-+ pmlmeext->sitesurvey_res.channel_idx = 3;
-+ DBG_871X("%s idx:%d, cnt:%u\n", __FUNCTION__
-+ , pmlmeext->sitesurvey_res.channel_idx
-+ , pwdinfo->find_phase_state_exchange_cnt
-+ );
-+ }
-+ else
-+ #endif
-+ {
-+ pmlmeext->sitesurvey_res.channel_idx = pmlmeext->sitesurvey_res.ch_num;
-+ DBG_871X("%s idx:%d\n", __FUNCTION__
-+ , pmlmeext->sitesurvey_res.channel_idx
-+ );
-+ }
++ if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
++ {
++ rtw_disassoc_cmd(padapter, 0, _TRUE);
++ rtw_indicate_disconnect(padapter);
++ rtw_free_assoc_resources(padapter, 1);
++ }
- pmlmepriv->update_bcn = _FALSE;
- pmlmeext->bstart_bss = _FALSE;
-
- rtw_sta_flush(padapter);
-+ pmlmeext->scan_abort = _FALSE;//reset
-+ }
++ _exit_critical_bh(&pmlmepriv->lock, &irqL);
++ DBG_871X("SA query timeout disconnect\n");
++}
++#endif //CONFIG_IEEE80211W
- pmlmeinfo->state = _HW_STATE_NOLINK_;
-+ if ((ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj))) == NULL)
-+ {
-+ goto exit_survey_timer_hdl;
-+ }
++u8 NULL_hdl(_adapter *padapter, u8 *pbuf)
++{
++ return H2C_SUCCESS;
++}
- //free_assoc_sta_resources
- rtw_free_all_stainfo(padapter);
-+ if ((psurveyPara = (struct sitesurvey_parm*)rtw_zmalloc(sizeof(struct sitesurvey_parm))) == NULL)
-+ {
-+ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj));
-+ goto exit_survey_timer_hdl;
-+ }
++#ifdef CONFIG_AUTO_AP_MODE
++void rtw_start_auto_ap(_adapter *adapter)
++{
++ DBG_871X("%s\n", __FUNCTION__);
- //free bc/mc sta_info
- psta = rtw_get_bcmc_stainfo(padapter);
- rtw_free_stainfo(padapter, psta);
- _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
-
-+ init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey));
-+ rtw_enqueue_cmd(pcmdpriv, ph2c);
-+ }
++ rtw_set_802_11_infrastructure_mode(adapter, Ndis802_11APMode);
- _rtw_spinlock_free(&pmlmepriv->bcn_update_lock);
-
-+
-+exit_survey_timer_hdl:
-+#ifdef PLATFORM_FREEBSD
-+ rtw_mtx_unlock(NULL);
-+#endif
-+
-+ return;
++ rtw_setopmode_cmd(adapter, Ndis802_11APMode);
}
-static void update_BCNTIM(_adapter *padapter)
-+void link_timer_hdl(_adapter *padapter)
++static int rtw_auto_ap_start_beacon(_adapter *adapter)
{
- struct sta_priv *pstapriv = &padapter->stapriv;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- u8 *p, ie_len;
- u16 tim_bitmap_le;
- u32 tmp_len, head_len=0;
-+ //static unsigned int rx_pkt = 0;
-+ //static u64 tx_cnt = 0;
-+ //struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ //struct sta_priv *pstapriv = &padapter->stapriv;
-+
-+#ifdef PLATFORM_FREEBSD
-+ rtw_mtx_lock(NULL);
-+ if (callout_pending(&padapter->mlmeextpriv.survey_timer.callout)) {
-+ /* callout was reset */
-+ //mtx_unlock(&sc->sc_mtx);
-+ rtw_mtx_unlock(NULL);
-+ return;
-+ }
-+ if (!callout_active(&padapter->mlmeextpriv.survey_timer.callout)) {
-+ /* callout was stopped */
-+ //mtx_unlock(&sc->sc_mtx);
-+ rtw_mtx_unlock(NULL);
-+ return;
-+ }
-+ callout_deactivate(&padapter->mlmeextpriv.survey_timer.callout);
++ int ret=0;
++ u8 *pbuf = NULL;
++ uint len;
++ u8 supportRate[16];
++ int sz = 0, rateLen;
++ u8 * ie;
++ u8 wireless_mode, oper_channel;
++ u8 ssid[3] = {0}; //hidden ssid
++ u32 ssid_len = sizeof(ssid);
++ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);
-
+-
- //calucate head_len
- head_len = _FIXED_IE_LENGTH_;
- head_len += pnetwork->Ssid.SsidLength + 2;
-+#endif
- // get supported rates len
- p = rtw_get_ie(src_ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
- if (p != NULL)
- {
- head_len += tmp_len+2;
-+ if (pmlmeinfo->state & WIFI_FW_AUTH_NULL)
-+ {
-+ DBG_871X("link_timer_hdl:no beacon while connecting\n");
-+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
-+ report_join_res(padapter, -3);
-+ }
-+ else if (pmlmeinfo->state & WIFI_FW_AUTH_STATE)
-+ {
-+ //re-auth timer
-+ if (++pmlmeinfo->reauth_count > REAUTH_LIMIT)
-+ {
-+ //if (pmlmeinfo->auth_algo != dot11AuthAlgrthm_Auto)
-+ //{
-+ pmlmeinfo->state = 0;
-+ report_join_res(padapter, -1);
-+ return;
-+ //}
-+ //else
-+ //{
-+ // pmlmeinfo->auth_algo = dot11AuthAlgrthm_Shared;
-+ // pmlmeinfo->reauth_count = 0;
-+ //}
- }
--
+- }
++ if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
++ return -EINVAL;
+
- //DS Parameter Set IE, len=3
- head_len += 3;
--
+
- //copy head offset
- _rtw_memcpy(dst_ie, src_ie, head_len);
-
-+ DBG_871X("link_timer_hdl: auth timeout and try again\n");
-+ pmlmeinfo->auth_seq = 1;
-+ issue_auth(padapter, NULL, 0);
-+ set_link_timer(pmlmeext, REAUTH_TO);
-+ }
-+ else if (pmlmeinfo->state & WIFI_FW_ASSOC_STATE)
-+ {
-+ //re-assoc timer
-+ if (++pmlmeinfo->reassoc_count > REASSOC_LIMIT)
-+ {
-+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
-+ report_join_res(padapter, -2);
-+ return;
-+ }
+-
++ len = 128;
++ pbuf = rtw_zmalloc(len);
++ if(!pbuf)
++ return -ENOMEM;
- //append TIM IE from head_len offset
- dst_ie+=head_len;
--
+
- *dst_ie++=_TIM_IE_;
--
++ //generate beacon
++ ie = pbuf;
+
- if((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc))
- ie_len = 5;
- else
- ie_len = 4;
-+ DBG_871X("link_timer_hdl: assoc timeout and try again\n");
-+ issue_assocreq(padapter);
-+ set_link_timer(pmlmeext, REASSOC_TO);
-+ }
-+#if 0
-+ else if (is_client_associated_to_ap(padapter))
-+ {
-+ //linked infrastructure client mode
-+ if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL)
-+ {
-+ /*to monitor whether the AP is alive or not*/
-+ if (rx_pkt == psta->sta_stats.rx_pkts)
-+ {
-+ receive_disconnect(padapter, pmlmeinfo->network.MacAddress);
-+ return;
-+ }
-+ else
-+ {
-+ rx_pkt = psta->sta_stats.rx_pkts;
-+ set_link_timer(pmlmeext, DISCONNECT_TO);
-+ }
++ //timestamp will be inserted by hardware
++ sz += 8;
++ ie += sz;
++
++ //beacon interval : 2bytes
++ *(u16*)ie = cpu_to_le16((u16)100);//BCN_INTERVAL=100;
++ sz += 2;
++ ie += 2;
++
++ //capability info
++ *(u16*)ie = 0;
++ *(u16*)ie |= cpu_to_le16(cap_ESS);
++ *(u16*)ie |= cpu_to_le16(cap_ShortPremble);
++ //*(u16*)ie |= cpu_to_le16(cap_Privacy);
++ sz += 2;
++ ie += 2;
- *dst_ie++= ie_len;
-
- *dst_ie++ = BIT(0);//bitmap ctrl
- else
- *dst_ie++ = 0;
-+ //update the EDCA paramter according to the Tx/RX mode
-+ update_EDCA_param(padapter);
++ //SSID
++ ie = rtw_set_ie(ie, _SSID_IE_, ssid_len, ssid, &sz);
- if(ie_len==4)
- {
-
- //copy remainder IE
- _rtw_memcpy(dst_ie, src_ie+head_len, src_ielen-head_len);
-+ /*to send the AP a nulldata if no frame is xmitted in order to keep alive*/
-+ if (pmlmeinfo->link_count++ == 0)
-+ {
-+ tx_cnt = pxmitpriv->tx_pkts;
-+ }
-+ else if ((pmlmeinfo->link_count & 0xf) == 0)
-+ {
-+ if (tx_cnt == pxmitpriv->tx_pkts)
-+ {
-+ issue_nulldata(padapter, NULL, 0, 0, 0);
-+ }
++ //supported rates
++ wireless_mode = WIRELESS_11BG_24N;
++ rtw_set_supported_rate(supportRate, wireless_mode) ;
++ rateLen = rtw_get_rateset_len(supportRate);
++ if (rateLen > 8)
++ {
++ ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, 8, supportRate, &sz);
++ }
++ else
++ {
++ ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, rateLen, supportRate, &sz);
++ }
++
++
++ //DS parameter set
++ if(check_buddy_fwstate(adapter, _FW_LINKED) &&
++ check_buddy_fwstate(adapter, WIFI_STATION_STATE))
++ {
++ PADAPTER pbuddy_adapter = adapter->pbuddy_adapter;
++ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
++
++ oper_channel = pbuddy_mlmeext->cur_channel;
++ }
++ else
++ {
++ oper_channel = adapter_to_dvobj(adapter)->oper_channel;
++ }
++ ie = rtw_set_ie(ie, _DSSET_IE_, 1, &oper_channel, &sz);
++
++ //ext supported rates
++ if (rateLen > 8)
++ {
++ ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (supportRate + 8), &sz);
++ }
++
++ DBG_871X("%s, start auto ap beacon sz=%d\n", __FUNCTION__, sz);
++
++ //lunch ap mode & start to issue beacon
++ if(rtw_check_beacon_data(adapter, pbuf, sz) == _SUCCESS)
++ {
- //pnetwork_mlmeext->Length += ie_len+2;
- //pnetwork_mlmeext->IELength += ie_len+2;
- pnetwork_mlmeext->Length = pnetwork->Length+ie_len+2;
- pnetwork_mlmeext->IELength = src_ielen+ie_len+2;
-
-+ tx_cnt = pxmitpriv->tx_pkts;
-+ }
-+ } //end of if ((psta = rtw_get_stainfo(pstapriv, passoc_res->network.MacAddress)) != NULL)
}
-- else
-+ else if (is_client_associated_to_ibss(padapter))
+ else
{
- _rtw_memcpy(dst_ie, src_ie, src_ielen);
- pnetwork_mlmeext->Length = pnetwork->Length;
- pnetwork_mlmeext->IELength = src_ielen;
-+ //linked IBSS mode
-+ //for each assoc list entry to check the rx pkt counter
-+ for (i = IBSS_START_MAC_ID; i < NUM_STA; i++)
-+ {
-+ if (pmlmeinfo->FW_sta_info[i].status == 1)
-+ {
-+ psta = pmlmeinfo->FW_sta_info[i].psta;
-+
-+ if (pmlmeinfo->FW_sta_info[i].rx_pkt == psta->sta_stats.rx_pkts)
-+ {
-+ pmlmeinfo->FW_sta_info[i].status = 0;
-+ report_del_sta_event(padapter, psta->hwaddr);
-+ }
-+ else
-+ {
-+ pmlmeinfo->FW_sta_info[i].rx_pkt = psta->sta_stats.rx_pkts;
-+ }
-+ }
-+ }
-+
-+ set_link_timer(pmlmeext, DISCONNECT_TO);
++ ret = -EINVAL;
}
-+#endif
-#ifdef CONFIG_USB_HCI
- set_tx_beacon_cmd(padapter);
-+#ifdef PLATFORM_FREEBSD
-+ rtw_mtx_unlock(NULL);
- #endif
+-#endif
-+ return;
-+}
++ rtw_mfree(pbuf, len);
-/*
- if(send_beacon(padapter)==_FAIL)
-+void addba_timer_hdl(struct sta_info *psta)
-+{
-+ struct ht_priv *phtpriv;
-+
-+ if(!psta)
-+ return;
-+
-+ phtpriv = &psta->htpriv;
-+
-+ if((phtpriv->ht_option==_TRUE) && (phtpriv->ampdu_enable==_TRUE))
- {
+- {
- DBG_871X("issue_beacon, fail!\n");
-+ if(phtpriv->candidate_tid_bitmap)
-+ phtpriv->candidate_tid_bitmap=0x0;
-+
- }
+- }
-*/
--
++ return ret;
+
}
++#endif//CONFIG_AUTO_AP_MODE
-u8 chk_sta_is_alive(struct sta_info *psta)
-+#ifdef CONFIG_IEEE80211W
-+void sa_query_timer_hdl(_adapter *padapter)
++u8 setopmode_hdl(_adapter *padapter, u8 *pbuf)
{
- u8 ret = _FALSE;
- #ifdef DBG_EXPIRATION_CHK
- , psta->state&WIFI_SLEEP_STATE?"SLEEP":""
- );
- #endif
++ u8 type;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_priv * pmlmepriv = &padapter->mlmepriv;
-+ _irqL irqL;
-+ //disconnect
-+ _enter_critical_bh(&pmlmepriv->lock, &irqL);
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++ struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf;
- //if(sta_last_rx_pkts(psta) == sta_rx_pkts(psta))
- if(psta->sta_stats.last_rx_data_pkts == psta->sta_stats.rx_data_pkts)
-- {
++ if(psetop->mode == Ndis802_11APMode)
+ {
- #if 0
- if(psta->state&WIFI_SLEEP_STATE)
- ret = _TRUE;
- #endif
-- }
-- else
-+ if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
++ pmlmeinfo->state = WIFI_FW_AP_STATE;
++ type = _HW_STATE_AP_;
++#ifdef CONFIG_NATIVEAP_MLME
++ //start_ap_mode(padapter);
++#endif
++ }
++ else if(psetop->mode == Ndis802_11Infrastructure)
++ {
++ pmlmeinfo->state &= ~(BIT(0)|BIT(1));// clear state
++ pmlmeinfo->state |= WIFI_FW_STATION_STATE;//set to STATION_STATE
++ type = _HW_STATE_STATION_;
++ }
++ else if(psetop->mode == Ndis802_11IBSS)
++ {
++ type = _HW_STATE_ADHOC_;
+ }
+ else
{
- ret = _TRUE;
-+ rtw_disassoc_cmd(padapter, 0, _TRUE);
-+ rtw_indicate_disconnect(padapter);
-+ rtw_free_assoc_resources(padapter, 1);
++ type = _HW_STATE_NOLINK_;
}
-
- sta_update_last_rx_pkts(psta);
-
+-
- return ret;
-+ _exit_critical_bh(&pmlmepriv->lock, &irqL);
-+ DBG_871X("SA query timeout disconnect\n");
- }
-+#endif //CONFIG_IEEE80211W
-
+-}
+-
-void expire_timeout_chk(_adapter *padapter)
-+u8 NULL_hdl(_adapter *padapter, u8 *pbuf)
- {
+-{
- _irqL irqL;
- _list *phead, *plist;
- struct sta_info *psta=NULL;
- struct sta_priv *pstapriv = &padapter->stapriv;
-+ return H2C_SUCCESS;
-+}
-+#ifdef CONFIG_AUTO_AP_MODE
-+void rtw_start_auto_ap(_adapter *adapter)
-+{
-+ DBG_871X("%s\n", __FUNCTION__);
++ rtw_hal_set_hwreg(padapter, HW_VAR_SET_OPMODE, (u8 *)(&type));
++ //Set_NETYPE0_MSR(padapter, type);
- _enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
-
- phead = &pstapriv->auth_list;
- plist = get_next(phead);
-+ rtw_set_802_11_infrastructure_mode(adapter, Ndis802_11APMode);
++#ifdef CONFIG_AUTO_AP_MODE
++ if(psetop->mode == Ndis802_11APMode)
++ rtw_auto_ap_start_beacon(padapter);
++#endif
- //check auth_queue
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
- psta = LIST_CONTAINOR(plist, struct sta_info, auth_list);
-
- plist = get_next(plist);
--
++ return H2C_SUCCESS;
+
- if(psta->expire_to>0)
- {
- psta->expire_to--;
- }
-
- }
-+ rtw_setopmode_cmd(adapter, Ndis802_11APMode);
-+}
-
+-
- _exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
-+static int rtw_auto_ap_start_beacon(_adapter *adapter)
-+{
-+ int ret=0;
-+ u8 *pbuf = NULL;
-+ uint len;
-+ u8 supportRate[16];
-+ int sz = 0, rateLen;
-+ u8 * ie;
-+ u8 wireless_mode, oper_channel;
-+ u8 ssid[3] = {0}; //hidden ssid
-+ u32 ssid_len = sizeof(ssid);
-+ struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
++}
- psta = NULL;
-
++u8 createbss_hdl(_adapter *padapter, u8 *pbuf)
++{
++ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
++ struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf;
++ u32 initialgain;
- _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
--
+
- phead = &pstapriv->asoc_list;
- plist = get_next(phead);
-+ if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
-+ return -EINVAL;
-
+-
- //check asoc_queue
- while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
-- {
++ if(pparm->network.InfrastructureMode == Ndis802_11APMode)
+ {
- psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
-
- plist = get_next(plist);
--
++#ifdef CONFIG_AP_MODE
+
- if(chk_sta_is_alive(psta))
- {
- psta->expire_to = pstapriv->expire_to;
-#ifdef CONFIG_TX_MCAST2UNI
- psta->under_exist_checking = 0;
-#endif // CONFIG_TX_MCAST2UNI
-- }
++ if(pmlmeinfo->state == WIFI_FW_AP_STATE)
++ {
++ //todo:
++ return H2C_SUCCESS;
+ }
-
- if(psta->expire_to>0)
- {
- psta->expire_to--;
-
+-
-#ifdef CONFIG_TX_MCAST2UNI
- if ( (psta->flags & WLAN_STA_HT) && (psta->htpriv.agg_enable_bitmap || psta->under_exist_checking) ) {
- // check sta by delba(addba) for 11n STA
- }
- }
-#endif // CONFIG_TX_MCAST2UNI
-+ len = 128;
-+ pbuf = rtw_zmalloc(len);
-+ if(!pbuf)
-+ return -ENOMEM;
++#endif
++ }
- if (psta->expire_to == 0)
- {
-#if 0
- //tear down Rx AMPDU
- send_delba(padapter, 0, psta->hwaddr);// recipient
--
++ //below is for ad-hoc master
++ if(pparm->network.InfrastructureMode == Ndis802_11IBSS)
++ {
++ rtw_joinbss_reset(padapter);
+
- //tear down TX AMPDU
- send_delba(padapter, 1, psta->hwaddr);// // originator
- psta->htpriv.agg_enable_bitmap = 0x0;//reset
- psta->htpriv.candidate_tid_bitmap = 0x0;//reset
--
++ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
++ pmlmeext->cur_ch_offset= HAL_PRIME_CHNL_OFFSET_DONT_CARE;
++ pmlmeinfo->ERP_enable = 0;
++ pmlmeinfo->WMM_enable = 0;
++ pmlmeinfo->HT_enable = 0;
++ pmlmeinfo->HT_caps_enable = 0;
++ pmlmeinfo->HT_info_enable = 0;
++ pmlmeinfo->agg_enable_bitmap = 0;
++ pmlmeinfo->candidate_tid_bitmap = 0;
+
- issue_deauth(padapter, psta->hwaddr, WLAN_REASON_DEAUTH_LEAVING);
--
++ //disable dynamic functions, such as high power, DIG
++ Save_DM_Func_Flag(padapter);
++ Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
+
- _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- rtw_free_stainfo(padapter, psta);
- _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
- }
-
- }
++ //config the initial gain under linking, need to write the BB registers
++ initialgain = 0x1E;
++ rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-+ //generate beacon
-+ ie = pbuf;
++ //cancel link timer
++ _cancel_timer_ex(&pmlmeext->link_timer);
-}
-+ //timestamp will be inserted by hardware
-+ sz += 8;
-+ ie += sz;
++ //clear CAM
++ flush_all_cam_entry(padapter);
-+ //beacon interval : 2bytes
-+ *(u16*)ie = cpu_to_le16((u16)100);//BCN_INTERVAL=100;
-+ sz += 2;
-+ ie += 2;
-+
-+ //capability info
-+ *(u16*)ie = 0;
-+ *(u16*)ie |= cpu_to_le16(cap_ESS);
-+ *(u16*)ie |= cpu_to_le16(cap_ShortPremble);
-+ //*(u16*)ie |= cpu_to_le16(cap_Privacy);
-+ sz += 2;
-+ ie += 2;
++ _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength));
++ pnetwork->IELength = ((WLAN_BSSID_EX *)pbuf)->IELength;
-static void add_RATid(_adapter *padapter, struct sta_info *psta)
-{
- struct ht_priv *psta_ht = NULL;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
-+ //SSID
-+ ie = rtw_set_ie(ie, _SSID_IE_, ssid_len, ssid, &sz);
++ if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength
++ return H2C_PARAMETERS_ERROR;
--
++ _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength);
+
- if(psta)
- psta_ht = &psta->htpriv;
-+ //supported rates
-+ wireless_mode = WIRELESS_11BG_24N;
-+ rtw_set_supported_rate(supportRate, wireless_mode) ;
-+ rateLen = rtw_get_rateset_len(supportRate);
-+ if (rateLen > 8)
-+ {
-+ ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, 8, supportRate, &sz);
-+ }
- else
+- else
- return;
-
- //b/g mode ra_bitmap
- for (i=0; i<sizeof(psta->bssrateset); i++)
- {
+- {
- if (psta->bssrateset[i])
- tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f);
-+ ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, rateLen, supportRate, &sz);
- }
+- }
++ start_create_ibss(padapter);
- //n mode ra_bitmap
- if(psta_ht->ht_option)
-+
-+ //DS parameter set
-+ if(check_buddy_fwstate(adapter, _FW_LINKED) &&
-+ check_buddy_fwstate(adapter, WIFI_STATION_STATE))
- {
+- {
- padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
- if(rf_type == RF_2T2R)
- limit=16;// 2R
- else
- limit=8;// 1R
-+ PADAPTER pbuddy_adapter = adapter->pbuddy_adapter;
-+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
++ }
- for (i=0; i<limit; i++) {
- if (psta_ht->ht_cap.supp_mcs_set[i/8] & BIT(i%8))
- tx_ra_bitmap |= BIT(i+12);
- }
-+ oper_channel = pbuddy_mlmeext->cur_channel;
-+ }
-+ else
-+ {
-+ oper_channel = adapter_to_dvobj(adapter)->oper_channel;
-+ }
-+ ie = rtw_set_ie(ie, _DSSET_IE_, 1, &oper_channel, &sz);
++ return H2C_SUCCESS;
- //max short GI rate
- shortGIrate = psta_ht->sgi;
-+ //ext supported rates
-+ if (rateLen > 8)
-+ {
-+ ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (supportRate + 8), &sz);
- }
+- }
++}
-+ DBG_871X("%s, start auto ap beacon sz=%d\n", __FUNCTION__, sz);
++u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf)
++{
++ u8 join_type;
++ PNDIS_802_11_VARIABLE_IEs pIE;
++ struct registry_priv *pregpriv = &padapter->registrypriv;
++ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
++ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
++#ifdef CONFIG_ANTENNA_DIVERSITY
++ struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf;
++#endif //CONFIG_ANTENNA_DIVERSITY
++ u32 initialgain, i;
++ u8 cbw40_enable=0;
++ //u32 acparm;
-#if 0//gtest
- if(get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R)
-+ //lunch ap mode & start to issue beacon
-+ if(rtw_check_beacon_data(adapter, pbuf, sz) == _SUCCESS)
++ //check already connecting to AP or not
++ if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)
{
- //is this a 2r STA?
- if((pstat->tx_ra_bitmap & 0x0ff00000) != 0 && !(priv->pshare->has_2r_sta & BIT(pstat->aid)))
-- {
++ if (pmlmeinfo->state & WIFI_FW_STATION_STATE)
+ {
- priv->pshare->has_2r_sta |= BIT(pstat->aid);
- if(rtw_read16(padapter, 0x102501f6) != 0xffff)
- {
- Switch_1SS_Antenna(priv, 2);
- }
- }
-- }
--
-- }
++ issue_deauth_ex(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVING, 5, 100);
+ }
++
++ pmlmeinfo->state = WIFI_FW_NULL_STATE;
++
++ //clear CAM
++ flush_all_cam_entry(padapter);
++
++ _cancel_timer_ex(&pmlmeext->link_timer);
++
++ //set MSR to nolink -> infra. mode
++ //Set_MSR(padapter, _HW_STATE_NOLINK_);
++ Set_MSR(padapter, _HW_STATE_STATION_);
+
++
++ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0);
+ }
- if ((pstat->rssi_level < 1) || (pstat->rssi_level > 3))
-+ }
-+ else
++#ifdef CONFIG_ANTENNA_DIVERSITY
++ rtw_antenna_select_cmd(padapter, pparm->network.PhyInfo.Optimum_antenna, _FALSE);
++#endif
++
++ rtw_joinbss_reset(padapter);
++
++ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
++ pmlmeext->cur_ch_offset= HAL_PRIME_CHNL_OFFSET_DONT_CARE;
++ pmlmeinfo->ERP_enable = 0;
++ pmlmeinfo->WMM_enable = 0;
++ pmlmeinfo->HT_enable = 0;
++ pmlmeinfo->HT_caps_enable = 0;
++ pmlmeinfo->HT_info_enable = 0;
++ pmlmeinfo->agg_enable_bitmap = 0;
++ pmlmeinfo->candidate_tid_bitmap = 0;
++ pmlmeinfo->bwmode_updated = _FALSE;
++ //pmlmeinfo->assoc_AP_vendor = maxAP;
++
++ _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength));
++ pnetwork->IELength = ((WLAN_BSSID_EX *)pbuf)->IELength;
++
++ if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength
++ return H2C_PARAMETERS_ERROR;
++
++ _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength);
++
++ pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
++ pmlmeinfo->bcn_interval = get_beacon_interval(pnetwork);
++
++ //Check AP vendor to move rtw_joinbss_cmd()
++ //pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->IEs, pnetwork->IELength);
++
++ for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;)
{
- if (pstat->rssi >= priv->pshare->rf_ft_var.raGoDownUpper)
- pstat->rssi_level = 1;
- pstat->rssi_level = 2;
- else
- pstat->rssi_level = 3;
-+ ret = -EINVAL;
- }
+- }
++ pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
++
++ switch (pIE->ElementID)
++ {
++ case _VENDOR_SPECIFIC_IE_://Get WMM IE.
++ if ( _rtw_memcmp(pIE->data, WMM_OUI, 4) )
++ {
++ pmlmeinfo->WMM_enable = 1;
++ }
++ break;
++
++ case _HT_CAPABILITY_IE_: //Get HT Cap IE.
++ pmlmeinfo->HT_caps_enable = 1;
++ break;
++
++ case _HT_EXTRA_INFO_IE_: //Get HT Info IE.
++ pmlmeinfo->HT_info_enable = 1;
++
++ //spec case only for cisco's ap because cisco's ap issue assoc rsp using mcs rate @40MHz or @20MHz
++//#if !defined(CONFIG_CONCURRENT_MODE) && !defined(CONFIG_DUALMAC_CONCURRENT)
++// if(pmlmeinfo->assoc_AP_vendor == ciscoAP)
++//#endif
++ {
++ struct HT_info_element *pht_info = (struct HT_info_element *)(pIE->data);
++
++ if( pnetwork->Configuration.DSConfig > 14 )
++ {
++ if( pregpriv->cbw40_enable & BIT(1) )
++ cbw40_enable = 1;
++ }
++ else
++ if( pregpriv->cbw40_enable & BIT(0) )
++ cbw40_enable = 1;
++
++ if ((cbw40_enable) && (pht_info->infos[0] & BIT(2)))
++ {
++ //switch to the 40M Hz mode according to the AP
++ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40;
++ switch (pht_info->infos[0] & 0x3)
++ {
++ case 1:
++ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
++ break;
++
++ case 3:
++ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
++ break;
++
++ default:
++ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
++ break;
++ }
- // rate adaptive by rssi
- if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N) && pstat->ht_cap_len)
- pstat->tx_ra_bitmap &= 0x100ff005;
- else
- pstat->tx_ra_bitmap &= 0x100ff001;
++ DBG_871X("set ch/bw before connected\n");
++ }
++ }
++ break;
- break;
- }
-- }
++ default:
++ break;
+ }
- else
- {
- switch (pstat->rssi_level) {
- pstat->tx_ra_bitmap &= 0x000ff005;
- else
- pstat->tx_ra_bitmap &= 0x000ff001;
-+ rtw_mfree(pbuf, len);
-
+-
- break;
- }
-+ return ret;
- // Don't need to mask high rates due to new rate adaptive parameters
- //if (pstat->is_broadcom_sta) // use MCS12 as the highest rate vs. Broadcom sta
- // pstat->tx_ra_bitmap &= 0x81ffffff;
-+}
-+#endif//CONFIG_AUTO_AP_MODE
-
+-
- // NIC driver will report not supporting MCS15 and MCS14 in asoc req
- //if (pstat->is_rtl8190_sta && !pstat->is_2t_mimo_sta)
- // pstat->tx_ra_bitmap &= 0x83ffffff; // if Realtek 1x2 sta, don't use MCS15 and MCS14
- }
-+u8 setopmode_hdl(_adapter *padapter, u8 *pbuf)
-+{
-+ u8 type;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf;
-+
-+ if(psetop->mode == Ndis802_11APMode)
-+ {
-+ pmlmeinfo->state = WIFI_FW_AP_STATE;
-+ type = _HW_STATE_AP_;
-+#ifdef CONFIG_NATIVEAP_MLME
-+ //start_ap_mode(padapter);
-+#endif
++ i += (pIE->Length + 2);
}
- else if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11G) && isErpSta(pstat))
-+ else if(psetop->mode == Ndis802_11Infrastructure)
- {
+- {
- switch (pstat->rssi_level) {
- case 1:
- pstat->tx_ra_bitmap &= 0x00000f00;
- case 3:
- pstat->tx_ra_bitmap &= 0x00000ff5;
- break;
-- }
-+ pmlmeinfo->state &= ~(BIT(0)|BIT(1));// clear state
-+ pmlmeinfo->state |= WIFI_FW_STATION_STATE;//set to STATION_STATE
-+ type = _HW_STATE_STATION_;
++#if 0
++ if (padapter->registrypriv.wifi_spec) {
++ // for WiFi test, follow WMM test plan spec
++ acparm = 0x002F431C; // VO
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm));
++ acparm = 0x005E541C; // VI
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm));
++ acparm = 0x0000A525; // BE
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
++ acparm = 0x0000A549; // BK
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm));
++
++ // for WiFi test, mixed mode with intel STA under bg mode throughput issue
++ if (padapter->mlmepriv.htpriv.ht_option == _FALSE){
++ acparm = 0x00004320;
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
+ }
}
- else
-+ else if(psetop->mode == Ndis802_11IBSS)
- {
+- {
- pstat->tx_ra_bitmap &= 0x0000000d;
-+ type = _HW_STATE_ADHOC_;
++ else {
++ acparm = 0x002F3217; // VO
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm));
++ acparm = 0x005E4317; // VI
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm));
++ acparm = 0x00105320; // BE
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
++ acparm = 0x0000A444; // BK
++ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm));
}
--
++#endif
+
- // disable tx short GI when station cannot rx MCS15(AP is 2T2R)
- // disable tx short GI when station cannot rx MCS7 (AP is 1T2R or 1T1R)
- // if there is only 1r STA and we are 2T2R, DO NOT mask SGI rate
- if ((!(pstat->tx_ra_bitmap & 0x8000000) && (priv->pshare->has_2r_sta > 0) && (get_rf_mimo_mode(padapter) == RTL8712_RF_2T2R)) ||
- (!(pstat->tx_ra_bitmap & 0x80000) && (get_rf_mimo_mode(padapter) != RTL8712_RF_2T2R)))
-+ else
- {
+- {
- pstat->tx_ra_bitmap &= ~BIT(28);
-+ type = _HW_STATE_NOLINK_;
++ /* check channel, bandwidth, offset and switch */
++#ifdef CONFIG_DUALMAC_CONCURRENT
++ if(dc_handle_join_request(padapter) == _FAIL) {
++ DBG_871X("dc_handle_join_request fail !!!\n");
++ return H2C_SUCCESS;
++ }
++ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
++#else //NON CONFIG_DUALMAC_CONCURRENT
++ if(rtw_chk_start_clnt_join(padapter) == _FAIL) {
++ report_join_res(padapter, (-4));
++ return H2C_SUCCESS;
}
--#endif
+ #endif
- if ( pcur_network->Configuration.DSConfig > 14 ) {
- // 5G band
- else
- sta_band |= WIRELESS_11B;
- }
--
++ //disable dynamic functions, such as high power, DIG
++ //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
+
- raid = networktype_to_raid(sta_band);
- init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fffffff)&0x3f;
--
++ //config the initial gain under linking, need to write the BB registers
++
++ initialgain = 0x1E;
++ rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
+
- if (psta->aid < NUM_STA)
- {
- u8 arg = 0;
- //printk("%s psta->mac_id=%d arg=0x%x\n",__FUNCTION__,psta->mac_id,arg);
- }
- tx_ra_bitmap |= ((raid<<28)&0xf0000000);
-+ rtw_hal_set_hwreg(padapter, HW_VAR_SET_OPMODE, (u8 *)(&type));
-+ //Set_NETYPE0_MSR(padapter, type);
-
+-
- DBG_871X("update raid entry, bitmap=0x%x, arg=0x%x\n", tx_ra_bitmap, arg);
-+#ifdef CONFIG_AUTO_AP_MODE
-+ if(psetop->mode == Ndis802_11APMode)
-+ rtw_auto_ap_start_beacon(padapter);
-+#endif
-
+-
- //bitmap[0:27] = tx_rate_bitmap
- //bitmap[28:31]= Rate Adaptive id
- //arg[0:4] = macid
- //arg[5] = Short GI
- padapter->HalFunc.Add_RateATid(padapter, tx_ra_bitmap, arg,psta->mac_id);
-+ return H2C_SUCCESS;
-+
-+}
- if (shortGIrate==_TRUE)
- init_rate |= BIT(6);
-
- }
- else
-+u8 createbss_hdl(_adapter *padapter, u8 *pbuf)
-+{
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
-+ struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf;
-+ u32 initialgain;
-+
-+
-+ if(pparm->network.InfrastructureMode == Ndis802_11APMode)
- {
+- {
- DBG_871X("station aid %d exceed the max number\n", psta->aid);
-+#ifdef CONFIG_AP_MODE
-+
-+ if(pmlmeinfo->state == WIFI_FW_AP_STATE)
-+ {
-+ //todo:
-+ return H2C_SUCCESS;
-+ }
-+#endif
- }
+- }
++ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
++ join_type = 0;
++ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
-+ //below is for ad-hoc master
-+ if(pparm->network.InfrastructureMode == Ndis802_11IBSS)
-+ {
-+ rtw_joinbss_reset(padapter);
++ //cancel link timer
++ _cancel_timer_ex(&pmlmeext->link_timer);
+
-+ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
-+ pmlmeext->cur_ch_offset= HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-+ pmlmeinfo->ERP_enable = 0;
-+ pmlmeinfo->WMM_enable = 0;
-+ pmlmeinfo->HT_enable = 0;
-+ pmlmeinfo->HT_caps_enable = 0;
-+ pmlmeinfo->HT_info_enable = 0;
-+ pmlmeinfo->agg_enable_bitmap = 0;
-+ pmlmeinfo->candidate_tid_bitmap = 0;
-+
-+ //disable dynamic functions, such as high power, DIG
-+ Save_DM_Func_Flag(padapter);
-+ Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-+
-+ //config the initial gain under linking, need to write the BB registers
-+ initialgain = 0x1E;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
-+
-+ //cancel link timer
-+ _cancel_timer_ex(&pmlmeext->link_timer);
-+
-+ //clear CAM
-+ flush_all_cam_entry(padapter);
-+
-+ _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength));
-+ pnetwork->IELength = ((WLAN_BSSID_EX *)pbuf)->IELength;
-+
-+ if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength
-+ return H2C_PARAMETERS_ERROR;
-+
-+ _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength);
++ start_clnt_join(padapter);
+
-+ start_create_ibss(padapter);
-+
-+ }
-+
+ return H2C_SUCCESS;
-+
++
}
-static void update_bmc_sta(_adapter *padapter)
-+u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf)
++u8 disconnect_hdl(_adapter *padapter, unsigned char *pbuf)
{
- _irqL irqL;
- u32 init_rate=0;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
- struct sta_info *psta = rtw_get_bcmc_stainfo(padapter);
-+ u8 join_type;
-+ PNDIS_802_11_VARIABLE_IEs pIE;
-+ struct registry_priv *pregpriv = &padapter->registrypriv;
++ struct disconnect_parm *param = (struct disconnect_parm *)pbuf;
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
-+#ifdef CONFIG_ANTENNA_DIVERSITY
-+ struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf;
-+#endif //CONFIG_ANTENNA_DIVERSITY
-+ u32 initialgain, i;
-+ u8 cbw40_enable=0;
-+ //u32 acparm;
++ u8 val8;
- if(psta)
-+ //check already connecting to AP or not
-+ if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)
++ if (is_client_associated_to_ap(padapter))
{
- psta->aid = 0;//default set to 0
- //psta->mac_id = psta->aid+4;
- psta->htpriv.ht_option = _FALSE;
-
- psta->ieee8021x_blocked = 0;
-+ if (pmlmeinfo->state & WIFI_FW_STATION_STATE)
-+ {
-+ issue_deauth_ex(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVING, 5, 100);
-+ }
-
+-
- _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
-+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
-+
-+ //clear CAM
-+ flush_all_cam_entry(padapter);
-+
-+ _cancel_timer_ex(&pmlmeext->link_timer);
-+
-+ //set MSR to nolink -> infra. mode
-+ //Set_MSR(padapter, _HW_STATE_NOLINK_);
-+ Set_MSR(padapter, _HW_STATE_STATION_);
-+
-
+-
- //psta->dot118021XPrivacy = _NO_PRIVACY_;//!!! remove it, because it has been set before this.
-+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0);
++ issue_deauth_ex(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVING, param->deauth_timeout_ms/100, 100);
+ }
-+#ifdef CONFIG_ANTENNA_DIVERSITY
-+ rtw_antenna_select_cmd(padapter, pparm->network.PhyInfo.Optimum_antenna, _FALSE);
-+#endif
++ //set_opmode_cmd(padapter, infra_client_with_mlme);
-+ rtw_joinbss_reset(padapter);
++ //pmlmeinfo->state = WIFI_FW_NULL_STATE;
+
-+ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
-+ pmlmeext->cur_ch_offset= HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-+ pmlmeinfo->ERP_enable = 0;
-+ pmlmeinfo->WMM_enable = 0;
-+ pmlmeinfo->HT_enable = 0;
-+ pmlmeinfo->HT_caps_enable = 0;
-+ pmlmeinfo->HT_info_enable = 0;
-+ pmlmeinfo->agg_enable_bitmap = 0;
-+ pmlmeinfo->candidate_tid_bitmap = 0;
-+ pmlmeinfo->bwmode_updated = _FALSE;
-+ //pmlmeinfo->assoc_AP_vendor = maxAP;
- //prepare for add_RATid
- supportRateNum = rtw_get_rateset_len((u8*)&pcur_network->SupportedRates);
- network_type = rtw_check_network_type((u8*)&pcur_network->SupportedRates, supportRateNum, 1);
-+ _rtw_memcpy(pnetwork, pbuf, FIELD_OFFSET(WLAN_BSSID_EX, IELength));
-+ pnetwork->IELength = ((WLAN_BSSID_EX *)pbuf)->IELength;
-+
-+ if(pnetwork->IELength>MAX_IE_SZ)//Check pbuf->IELength
-+ return H2C_PARAMETERS_ERROR;
-
+-
- _rtw_memcpy(psta->bssrateset, &pcur_network->SupportedRates, supportRateNum);
- psta->bssratelen = supportRateNum;
--
++ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0);
++ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr);
+
- //b/g mode ra_bitmap
- for (i=0; i<supportRateNum; i++)
- {
- if (psta->bssrateset[i])
- tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f);
- }
-+ _rtw_memcpy(pnetwork->IEs, ((WLAN_BSSID_EX *)pbuf)->IEs, pnetwork->IELength);
++ //restore to initial setting.
++ update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode);
- if ( pcur_network->Configuration.DSConfig > 14 ) {
- //force to A mode. 5G doesn't support CCK rates
- network_type = WIRELESS_11B;
- tx_ra_bitmap = 0xf;
- }
-+ pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
-+ pmlmeinfo->bcn_interval = get_beacon_interval(pnetwork);
++ if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
++ {
++ //Stop BCN
++ val8 = 0;
++ rtw_hal_set_hwreg(padapter, HW_VAR_BCN_FUNC, (u8 *)(&val8));
++ }
- //tx_ra_bitmap = update_basic_rate(pcur_network->SupportedRates, supportRateNum);
-+ //Check AP vendor to move rtw_joinbss_cmd()
-+ //pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->IEs, pnetwork->IELength);
- raid = networktype_to_raid(network_type);
- init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fffffff)&0x3f;
-
- //DBG_871X("Add id %d val %08x to ratr for bmc sta\n", psta->aid, tx_ra_bitmap);
-+ for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;)
-+ {
-+ pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
++ //set MSR to no link state -> infra. mode
++ Set_MSR(padapter, _HW_STATE_STATION_);
- //if(pHalData->fw_ractrl == _TRUE)
-+ switch (pIE->ElementID)
- {
+- {
- u8 arg = 0;
-+ case _VENDOR_SPECIFIC_IE_://Get WMM IE.
-+ if ( _rtw_memcmp(pIE->data, WMM_OUI, 4) )
-+ {
-+ pmlmeinfo->WMM_enable = 1;
-+ }
-+ break;
++ pmlmeinfo->state = WIFI_FW_NULL_STATE;
- arg = psta->mac_id&0x1f;
-
-
- //if (shortGIrate==_TRUE)
- // arg |= BIT(5);
-+ case _HT_CAPABILITY_IE_: //Get HT Cap IE.
-+ pmlmeinfo->HT_caps_enable = 1;
-+ break;
-+
-+ case _HT_EXTRA_INFO_IE_: //Get HT Info IE.
-+ pmlmeinfo->HT_info_enable = 1;
-+
-+ //spec case only for cisco's ap because cisco's ap issue assoc rsp using mcs rate @40MHz or @20MHz
-+//#if !defined(CONFIG_CONCURRENT_MODE) && !defined(CONFIG_DUALMAC_CONCURRENT)
-+// if(pmlmeinfo->assoc_AP_vendor == ciscoAP)
-+//#endif
-+ {
-+ struct HT_info_element *pht_info = (struct HT_info_element *)(pIE->data);
-+
-+ if( pnetwork->Configuration.DSConfig > 14 )
-+ {
-+ if( pregpriv->cbw40_enable & BIT(1) )
-+ cbw40_enable = 1;
-+ }
-+ else
-+ if( pregpriv->cbw40_enable & BIT(0) )
-+ cbw40_enable = 1;
-+
-+ if ((cbw40_enable) && (pht_info->infos[0] & BIT(2)))
-+ {
-+ //switch to the 40M Hz mode according to the AP
-+ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40;
-+ switch (pht_info->infos[0] & 0x3)
-+ {
-+ case 1:
-+ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
-+ break;
-
+-
- tx_ra_bitmap |= ((raid<<28)&0xf0000000);
-+ case 3:
-+ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
-+ break;
-+
-+ default:
-+ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-+ break;
-+ }
++#ifdef CONFIG_DUALMAC_CONCURRENT
++ dc_set_channel_bwmode_disconnect(padapter);
++#else
++#ifdef CONFIG_CONCURRENT_MODE
++ if((check_buddy_fwstate(padapter, _FW_LINKED)) != _TRUE)
++ {
++#endif //CONFIG_CONCURRENT_MODE
++ //switch to the 20M Hz mode after disconnect
++ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
++ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
- DBG_871X("update_bmc_sta, mask=0x%x, arg=0x%x\n", tx_ra_bitmap, arg);
-+ DBG_871X("set ch/bw before connected\n");
-+ }
-+ }
-+ break;
++ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
++#ifdef CONFIG_CONCURRENT_MODE
++ }
++#endif //CONFIG_CONCURRENT_MODE
++#endif //CONFIG_DUALMAC_CONCURRENT
- //bitmap[0:27] = tx_rate_bitmap
- //bitmap[28:31]= Rate Adaptive id
- //arg[0:4] = macid
- //arg[5] = Short GI
- padapter->HalFunc.Add_RateATid(padapter, tx_ra_bitmap, arg,psta->mac_id );
--
-+ default:
-+ break;
- }
-
++ flush_all_cam_entry(padapter);
+
+- }
+-
- //set ra_id, init_rate
- psta->raid = raid;
- psta->init_rate = init_rate;
- _enter_critical_bh(&psta->lock, &irqL);
- psta->state = _FW_LINKED;
- _exit_critical_bh(&psta->lock, &irqL);
-+ i += (pIE->Length + 2);
-+ }
-+#if 0
-+ if (padapter->registrypriv.wifi_spec) {
-+ // for WiFi test, follow WMM test plan spec
-+ acparm = 0x002F431C; // VO
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm));
-+ acparm = 0x005E541C; // VI
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm));
-+ acparm = 0x0000A525; // BE
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
-+ acparm = 0x0000A549; // BK
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm));
-+
-+ // for WiFi test, mixed mode with intel STA under bg mode throughput issue
-+ if (padapter->mlmepriv.htpriv.ht_option == _FALSE){
-+ acparm = 0x00004320;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
-+ }
-+ }
-+ else {
-+ acparm = 0x002F3217; // VO
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm));
-+ acparm = 0x005E4317; // VI
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm));
-+ acparm = 0x00105320; // BE
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
-+ acparm = 0x0000A444; // BK
-+ rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm));
-+ }
-+#endif
++ _cancel_timer_ex(&pmlmeext->link_timer);
-+ /* check channel, bandwidth, offset and switch */
-+#ifdef CONFIG_DUALMAC_CONCURRENT
-+ if(dc_handle_join_request(padapter) == _FAIL) {
-+ DBG_871X("dc_handle_join_request fail !!!\n");
-+ return H2C_SUCCESS;
- }
+- }
- else
- {
- DBG_871X("add_RATid_bmc_sta error!\n");
-+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-+#else //NON CONFIG_DUALMAC_CONCURRENT
-+ if(rtw_chk_start_clnt_join(padapter) == _FAIL) {
-+ report_join_res(padapter, (-4));
-+ return H2C_SUCCESS;
- }
+- }
-
--}
-+#endif
++ rtw_free_uc_swdec_pending_queue(padapter);
++
++ return H2C_SUCCESS;
+ }
-//notes:
-//AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode
-//MAC_ID = 1 for bc/mc for sta/ap/adhoc
-//MAC_ID = 0 for bssid for sta/ap/adhoc
-//CAM_ID = //0~3 for default key, cmd_id=macid + 3, macid=aid+1;
-+ //disable dynamic functions, such as high power, DIG
-+ //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-
+-
-void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
-{
- _irqL irqL;
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
- struct ht_priv *phtpriv_sta = &psta->htpriv;
-+ //config the initial gain under linking, need to write the BB registers
-+
-+ initialgain = 0x1E;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
-+
++int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out,
++ u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num)
++{
++ int i, j;
++ int scan_ch_num = 0;
++ int set_idx;
++ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- //set intf_tag to if1
- //psta->intf_tag = 0;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
-+ join_type = 0;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
++ /* clear first */
++ _rtw_memset(out, 0, sizeof(struct rtw_ieee80211_channel)*out_num);
- //psta->mac_id = psta->aid+4;
- psta->mac_id = psta->aid+1;
-+ //cancel link timer
-+ _cancel_timer_ex(&pmlmeext->link_timer);
-
+-
- if(psecuritypriv->dot11AuthAlgrthm==dot11AuthAlgrthm_8021X)
- psta->ieee8021x_blocked = _TRUE;
- else
- psta->ieee8021x_blocked = _FALSE;
-+ start_clnt_join(padapter);
-
--
+-
++ /* acquire channels from in */
++ j = 0;
++ for (i=0;i<in_num;i++) {
+
- //update sta's cap
-+ return H2C_SUCCESS;
-
+-
- //ERP
- VCS_update(padapter, psta);
-
- //HT related cap
- if(phtpriv_sta->ht_option)
-+}
-+
-+u8 disconnect_hdl(_adapter *padapter, unsigned char *pbuf)
-+{
-+ struct disconnect_parm *param = (struct disconnect_parm *)pbuf;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+ WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network));
-+ u8 val8;
-+
-+ if (is_client_associated_to_ap(padapter))
- {
+- {
- //check if sta supports rx ampdu
- phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable;
-+ issue_deauth_ex(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVING, param->deauth_timeout_ms/100, 100);
-+ }
++ if (0)
++ DBG_871X(FUNC_ADPT_FMT" "CHAN_FMT"\n", FUNC_ADPT_ARG(padapter), CHAN_ARG(&in[i]));
- //check if sta support s Short GI
- if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40))
-- {
++ if(in[i].hw_value && !(in[i].flags & RTW_IEEE80211_CHAN_DISABLED)
++ && (set_idx=rtw_ch_set_search_ch(pmlmeext->channel_set, in[i].hw_value)) >=0
++ && rtw_mlme_band_check(padapter, in[i].hw_value) == _TRUE
++ )
+ {
- phtpriv_sta->sgi = _TRUE;
- }
-+ //set_opmode_cmd(padapter, infra_client_with_mlme);
++ if (j >= out_num) {
++ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" out_num:%u not enough\n",
++ FUNC_ADPT_ARG(padapter), out_num);
++ break;
++ }
- // bwmode
- if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH))
- //phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_40;
- phtpriv_sta->bwmode = pmlmeext->cur_bwmode;
- phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
--
++ _rtw_memcpy(&out[j], &in[i], sizeof(struct rtw_ieee80211_channel));
+
- }
-+ //pmlmeinfo->state = WIFI_FW_NULL_STATE;
-+
-
+-
- psta->qos_option = _TRUE;
-
- }
- else
-+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0);
-+ rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr);
-+
-+ //restore to initial setting.
-+ update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode);
-+
-+ if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
- {
+- {
- phtpriv_sta->ampdu_enable = _FALSE;
-
- phtpriv_sta->sgi = _FALSE;
- phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20;
- phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-+ //Stop BCN
-+ val8 = 0;
-+ rtw_hal_set_hwreg(padapter, HW_VAR_BCN_FUNC, (u8 *)(&val8));
++ if(pmlmeext->channel_set[set_idx].ScanType == SCAN_PASSIVE)
++ out[j].flags &= RTW_IEEE80211_CHAN_PASSIVE_SCAN;
++
++ j++;
++ }
++ if(j>=out_num)
++ break;
}
-
+-
- //Rx AMPDU
- send_delba(padapter, 0, psta->hwaddr);// recipient
-
- send_delba(padapter, 1, psta->hwaddr);// // originator
- phtpriv_sta->agg_enable_bitmap = 0x0;//reset
- phtpriv_sta->candidate_tid_bitmap = 0x0;//reset
--
+
++ /* if out is empty, use channel_set as default */
++ if(j == 0) {
++ for (i=0;i<pmlmeext->max_chan_nums;i++) {
- //todo: init other variables
-
- _rtw_memset((void*)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
-+ //set MSR to no link state -> infra. mode
-+ Set_MSR(padapter, _HW_STATE_STATION_);
-+
-+ pmlmeinfo->state = WIFI_FW_NULL_STATE;
++ if (0)
++ DBG_871X(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter), pmlmeext->channel_set[i].ChannelNum);
-+#ifdef CONFIG_DUALMAC_CONCURRENT
-+ dc_set_channel_bwmode_disconnect(padapter);
-+#else
-+#ifdef CONFIG_CONCURRENT_MODE
-+ if((check_buddy_fwstate(padapter, _FW_LINKED)) != _TRUE)
-+ {
-+#endif //CONFIG_CONCURRENT_MODE
-+ //switch to the 20M Hz mode after disconnect
-+ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
-+ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
++ if (rtw_mlme_band_check(padapter, pmlmeext->channel_set[i].ChannelNum) == _TRUE) {
- //add ratid
- //add_RATid(padapter, psta);//move to ap_sta_info_defer_update()
-+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
-+#ifdef CONFIG_CONCURRENT_MODE
-+ }
-+#endif //CONFIG_CONCURRENT_MODE
-+#endif //CONFIG_DUALMAC_CONCURRENT
++ if (j >= out_num) {
++ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" out_num:%u not enough\n",
++ FUNC_ADPT_ARG(padapter), out_num);
++ break;
++ }
-+ flush_all_cam_entry(padapter);
-+
-+ _cancel_timer_ex(&pmlmeext->link_timer);
++ out[j].hw_value = pmlmeext->channel_set[i].ChannelNum;
++
++ if(pmlmeext->channel_set[i].ScanType == SCAN_PASSIVE)
++ out[j].flags &= RTW_IEEE80211_CHAN_PASSIVE_SCAN;
- _enter_critical_bh(&psta->lock, &irqL);
- psta->state |= _FW_LINKED;
- _exit_critical_bh(&psta->lock, &irqL);
-+ rtw_free_uc_swdec_pending_queue(padapter);
-
--
-+ return H2C_SUCCESS;
+-
++ j++;
++ }
++ }
++ }
+
++ return j;
}
-static void update_hw_ht_param(_adapter *padapter)
-+int rtw_scan_ch_decision(_adapter *padapter, struct rtw_ieee80211_channel *out,
-+ u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num)
++u8 sitesurvey_cmd_hdl(_adapter *padapter, u8 *pbuf)
{
- unsigned char max_AMPDU_len;
- unsigned char min_MPDU_spacing;
- struct registry_priv *pregpriv = &padapter->registrypriv;
-+ int i, j;
-+ int scan_ch_num = 0;
-+ int set_idx;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-
- DBG_871X("%s\n", __FUNCTION__);
-
-
+-
- //handle A-MPDU parameter field
- /*
- AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
- min_MPDU_spacing = (pmlmeinfo->HT_caps.HT_cap_element.AMPDU_para & 0x1c) >> 2;
-
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing));
-+ /* clear first */
-+ _rtw_memset(out, 0, sizeof(struct rtw_ieee80211_channel)*out_num);
++ struct sitesurvey_parm *pparm = (struct sitesurvey_parm *)pbuf;
++ u8 bdelayscan = _FALSE;
++ u8 val8;
++ u32 initialgain;
++ u32 i;
++ u8 write_initial_gain = 1;
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len));
-+ /* acquire channels from in */
-+ j = 0;
-+ for (i=0;i<in_num;i++) {
-+
-+ if (0)
-+ DBG_871X(FUNC_ADPT_FMT" "CHAN_FMT"\n", FUNC_ADPT_ARG(padapter), CHAN_ARG(&in[i]));
-+
-+ if(in[i].hw_value && !(in[i].flags & RTW_IEEE80211_CHAN_DISABLED)
-+ && (set_idx=rtw_ch_set_search_ch(pmlmeext->channel_set, in[i].hw_value)) >=0
-+ && rtw_mlme_band_check(padapter, in[i].hw_value) == _TRUE
-+ )
-+ {
-+ if (j >= out_num) {
-+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" out_num:%u not enough\n",
-+ FUNC_ADPT_ARG(padapter), out_num);
-+ break;
-+ }
++#ifdef CONFIG_P2P
++ struct wifidirect_info* pwdinfo = &padapter->wdinfo;
++#endif
- //
- // Config SM Power Save setting
- //
- pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.HT_cap_element.HT_caps_info & 0x0C) >> 2;
- if(pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
-- {
++ if (pmlmeext->sitesurvey_res.state == SCAN_DISABLE)
+ {
- /*u8 i;
- //update the MCS rates
- for (i = 0; i < 16; i++)
- pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
- }*/
- DBG_8192C("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__FUNCTION__);
-+ _rtw_memcpy(&out[j], &in[i], sizeof(struct rtw_ieee80211_channel));
-+
-+ if(pmlmeext->channel_set[set_idx].ScanType == SCAN_PASSIVE)
-+ out[j].flags &= RTW_IEEE80211_CHAN_PASSIVE_SCAN;
-+
-+ j++;
-+ }
-+ if(j>=out_num)
-+ break;
- }
-+
-+ /* if out is empty, use channel_set as default */
-+ if(j == 0) {
-+ for (i=0;i<pmlmeext->max_chan_nums;i++) {
-+
-+ if (0)
-+ DBG_871X(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter), pmlmeext->channel_set[i].ChannelNum);
-+
-+ if (rtw_mlme_band_check(padapter, pmlmeext->channel_set[i].ChannelNum) == _TRUE) {
-+
-+ if (j >= out_num) {
-+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" out_num:%u not enough\n",
-+ FUNC_ADPT_ARG(padapter), out_num);
-+ break;
-+ }
-
+- }
+-
- //
- // Config current HT Protection mode.
- //
- //pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3;
-+ out[j].hw_value = pmlmeext->channel_set[i].ChannelNum;
-+
-+ if(pmlmeext->channel_set[i].ScanType == SCAN_PASSIVE)
-+ out[j].flags &= RTW_IEEE80211_CHAN_PASSIVE_SCAN;
-+
-+ j++;
-+ }
-+ }
-+ }
-
-+ return j;
- }
-
+-
+-}
+-
-static void start_bss_network(_adapter *padapter, u8 *pbuf)
-+u8 sitesurvey_cmd_hdl(_adapter *padapter, u8 *pbuf)
- {
+-{
- u8 *p;
- u8 val8, cur_channel, cur_bwmode, cur_ch_offset;
- u16 bcn_interval;
-
-
- //DBG_8192C("%s\n", __FUNCTION__);
--
++#ifdef CONFIG_CONCURRENT_MODE
++ //for first time sitesurvey_cmd
++ rtw_hal_set_hwreg(padapter, HW_VAR_CHECK_TXBUF, 0);
++#endif //CONFIG_CONCURRENT_MODE
++
++ pmlmeext->sitesurvey_res.state = SCAN_START;
++ pmlmeext->sitesurvey_res.bss_cnt = 0;
++ pmlmeext->sitesurvey_res.channel_idx = 0;
+
- bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod;
- cur_channel = pnetwork->Configuration.DSConfig;
- cur_bwmode = HT_CHANNEL_WIDTH_20;;
- cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct sitesurvey_parm *pparm = (struct sitesurvey_parm *)pbuf;
-+ u8 bdelayscan = _FALSE;
-+ u8 val8;
-+ u32 initialgain;
-+ u32 i;
-+ u8 write_initial_gain = 1;
++ for(i=0;i<RTW_SSID_SCAN_AMOUNT;i++){
++ if(pparm->ssid[i].SsidLength) {
++ _rtw_memcpy(pmlmeext->sitesurvey_res.ssid[i].Ssid, pparm->ssid[i].Ssid, IW_ESSID_MAX_SIZE);
++ pmlmeext->sitesurvey_res.ssid[i].SsidLength= pparm->ssid[i].SsidLength;
++ } else {
++ pmlmeext->sitesurvey_res.ssid[i].SsidLength= 0;
++ }
++ }
- //check if there is wps ie,
- //if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd,
- //pmlmeinfo->HT_enable;
- if(pmlmepriv->qospriv.qos_option)
- pmlmeinfo->WMM_enable = _TRUE;
-+#ifdef CONFIG_P2P
-+ struct wifidirect_info* pwdinfo = &padapter->wdinfo;
-+#endif
++ pmlmeext->sitesurvey_res.ch_num = rtw_scan_ch_decision(padapter
++ , pmlmeext->sitesurvey_res.ch, RTW_CHANNEL_SCAN_AMOUNT
++ , pparm->ch, pparm->ch_num
++ );
- if(pmlmepriv->htpriv.ht_option)
-+ if (pmlmeext->sitesurvey_res.state == SCAN_DISABLE)
- {
+- {
- pmlmeinfo->WMM_enable = _TRUE;
- pmlmeinfo->HT_enable = _TRUE;
- //pmlmeinfo->HT_info_enable = _TRUE;
- //pmlmeinfo->HT_caps_enable = _TRUE;
-+#ifdef CONFIG_CONCURRENT_MODE
-+ //for first time sitesurvey_cmd
-+ rtw_hal_set_hwreg(padapter, HW_VAR_CHECK_TXBUF, 0);
-+#endif //CONFIG_CONCURRENT_MODE
-+
-+ pmlmeext->sitesurvey_res.state = SCAN_START;
-+ pmlmeext->sitesurvey_res.bss_cnt = 0;
-+ pmlmeext->sitesurvey_res.channel_idx = 0;
++ pmlmeext->sitesurvey_res.scan_mode = pparm->scan_mode;
- update_hw_ht_param(padapter);
- }
-
-+ for(i=0;i<RTW_SSID_SCAN_AMOUNT;i++){
-+ if(pparm->ssid[i].SsidLength) {
-+ _rtw_memcpy(pmlmeext->sitesurvey_res.ssid[i].Ssid, pparm->ssid[i].Ssid, IW_ESSID_MAX_SIZE);
-+ pmlmeext->sitesurvey_res.ssid[i].SsidLength= pparm->ssid[i].SsidLength;
-+ } else {
-+ pmlmeext->sitesurvey_res.ssid[i].SsidLength= 0;
-+ }
-+ }
++#ifdef CONFIG_DUALMAC_CONCURRENT
++ bdelayscan = dc_handle_site_survey(padapter);
++#endif
- if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time
- {
- flush_all_cam_entry(padapter); //clear CAM
- }
-+ pmlmeext->sitesurvey_res.ch_num = rtw_scan_ch_decision(padapter
-+ , pmlmeext->sitesurvey_res.ch, RTW_CHANNEL_SCAN_AMOUNT
-+ , pparm->ch, pparm->ch_num
-+ );
++ //issue null data if associating to the AP
++ if (is_client_associated_to_ap(padapter) == _TRUE)
++ {
++ pmlmeext->sitesurvey_res.state = SCAN_TXNULL;
- //set MSR to AP_Mode
- Set_NETYPE0_MSR(padapter, _HW_STATE_AP_);
-
- //Set BSSID REG
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BSSID, pnetwork->MacAddress);
-+ pmlmeext->sitesurvey_res.scan_mode = pparm->scan_mode;
++ issue_nulldata(padapter, NULL, 1, 3, 500);
- //Set EDCA param reg
- acparm = 0x002F3217; // VO
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm));
- acparm = 0x0000A444; // BK
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm));
--
-- //Set Security
-- val8 = (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf;
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
-+#ifdef CONFIG_DUALMAC_CONCURRENT
-+ bdelayscan = dc_handle_site_survey(padapter);
-+#endif
-
-- //Beacon Control related register
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&bcn_interval));
-+ //issue null data if associating to the AP
-+ if (is_client_associated_to_ap(padapter) == _TRUE)
-+ {
-+ pmlmeext->sitesurvey_res.state = SCAN_TXNULL;
-
--
-- UpdateBrateTbl(padapter, pnetwork->SupportedRates);
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates);
-+ issue_nulldata(padapter, NULL, 1, 3, 500);
-
-- if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time
-- {
-- u32 initialgain;
+#ifdef CONFIG_CONCURRENT_MODE
+ if(is_client_associated_to_ap(padapter->pbuddy_adapter) == _TRUE)
+ {
+ }
+ #endif //CONFIG_TDLS
-- //disable dynamic functions, such as high power, DIG
+- //Set Security
+- val8 = (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf;
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
++ pmlmeext->sitesurvey_res.state = SCAN_TXNULL;
+
+- //Beacon Control related register
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&bcn_interval));
++ issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500);
+
+-
+- UpdateBrateTbl(padapter, pnetwork->SupportedRates);
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates);
++ bdelayscan = _TRUE;
++ }
++#endif
++ if(bdelayscan)
++ {
++ //delay 50ms to protect nulldata(1).
++ set_survey_timer(pmlmeext, 50);
++ return H2C_SUCCESS;
++ }
++ }
+
+- if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at first time
++ if ((pmlmeext->sitesurvey_res.state == SCAN_START) || (pmlmeext->sitesurvey_res.state == SCAN_TXNULL))
+ {
+- u32 initialgain;
++#ifdef CONFIG_FIND_BEST_CHANNEL
++#if 0
++ for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) {
++ pmlmeext->channel_set[i].rx_count = 0;
++ }
++#endif
++#endif /* CONFIG_FIND_BEST_CHANNEL */
+
+ //disable dynamic functions, such as high power, DIG
- //Save_DM_Func_Flag(padapter);
- //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
-
- //turn on dynamic functions
- Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE);
-+ pmlmeext->sitesurvey_res.state = SCAN_TXNULL;
++ Save_DM_Func_Flag(padapter);
++ Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
- initialgain = 0x30;
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
-
- }
-+ issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500);
++ //config the initial gain under scaning, need to write the BB registers
- //set channel, bwmode
- p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
- struct HT_info_element *pht_info = (struct HT_info_element *)(p+2);
-
- if ((pregpriv->cbw40_enable) && (pht_info->infos[0] & BIT(2)))
-+ bdelayscan = _TRUE;
-+ }
-+#endif
-+ if(bdelayscan)
++#ifdef CONFIG_P2P
++#ifdef CONFIG_IOCTL_CFG80211
++ if((wdev_to_priv(padapter->rtw_wdev))->p2p_enabled == _TRUE && pwdinfo->driver_interface == DRIVER_CFG80211 )
{
- //switch to the 40M Hz mode
- //pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40;
- break;
- }
-
-+ //delay 50ms to protect nulldata(1).
-+ set_survey_timer(pmlmeext, 50);
-+ return H2C_SUCCESS;
++ write_initial_gain = 0;
}
-
- }
-
+- }
+-
- //TODO: need to judge the phy parameters on concurrent mode for single phy
- //set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
- set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
-
- DBG_871X("CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset);
-+ if ((pmlmeext->sitesurvey_res.state == SCAN_START) || (pmlmeext->sitesurvey_res.state == SCAN_TXNULL))
-+ {
-+#ifdef CONFIG_FIND_BEST_CHANNEL
-+#if 0
-+ for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) {
-+ pmlmeext->channel_set[i].rx_count = 0;
-+ }
-+#endif
-+#endif /* CONFIG_FIND_BEST_CHANNEL */
-
+-
- //
- pmlmeext->cur_channel = cur_channel;
- pmlmeext->cur_bwmode = cur_bwmode;
- pmlmeext->cur_ch_offset = cur_ch_offset;
- pmlmeext->cur_wireless_mode = pmlmepriv->cur_network.network_type;
-+ //disable dynamic functions, such as high power, DIG
-+ Save_DM_Func_Flag(padapter);
-+ Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);
++ else
++#endif //CONFIG_IOCTL_CFG80211
++ if ( !rtw_p2p_chk_state( pwdinfo, P2P_STATE_NONE ) )
++ initialgain = 0x28;
++ else
++#endif //CONFIG_P2P
++ initialgain = 0x17;
- //update cur_wireless_mode
- update_wireless_mode(padapter);
-
- //let pnetwork_mlmeext == pnetwork_mlme.
- _rtw_memcpy(pnetwork_mlmeext, pnetwork, pnetwork->Length);
-+ //config the initial gain under scaning, need to write the BB registers
++ if(write_initial_gain == 1)
++ rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
- #ifdef CONFIG_P2P
+-#ifdef CONFIG_P2P
- _rtw_memcpy(pwdinfo->p2p_group_ssid, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength);
- pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength;
-+#ifdef CONFIG_IOCTL_CFG80211
-+ if((wdev_to_priv(padapter->rtw_wdev))->p2p_enabled == _TRUE && pwdinfo->driver_interface == DRIVER_CFG80211 )
-+ {
-+ write_initial_gain = 0;
-+ }
-+ else
-+#endif //CONFIG_IOCTL_CFG80211
-+ if ( !rtw_p2p_chk_state( pwdinfo, P2P_STATE_NONE ) )
-+ initialgain = 0x28;
-+ else
- #endif //CONFIG_P2P
-+ initialgain = 0x17;
+-#endif //CONFIG_P2P
++ //set MSR to no link state
++ Set_MSR(padapter, _HW_STATE_NOLINK_);
-
- if(_TRUE == pmlmeext->bstart_bss)
- {
- update_beacon(padapter, _TIM_IE_, NULL, _FALSE);
-+ if(write_initial_gain == 1)
-+ rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
++ val8 = 1; //under site survey
++ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
- //issue beacon frame
- if(send_beacon(padapter)==_FAIL)
- {
- DBG_871X("issue_beacon, fail!\n");
- }
-+ //set MSR to no link state
-+ Set_MSR(padapter, _HW_STATE_NOLINK_);
-+
-+ val8 = 1; //under site survey
-+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
-+
+ pmlmeext->sitesurvey_res.state = SCAN_PROCESS;
}
+#endif //CONFIG_TDLS
- _rtw_memcpy(pbss_network->MacAddress, myid(&(padapter->eeprompriv)), ETH_ALEN);
-+ //cam_entry:
-+ //0~3 for default key
-
+-
- //beacon interval
- p = rtw_get_beacon_interval_from_ie(ie);//ie + 8; // 8: TimeStamp, 2: Beacon Interval 2:Capability
- //pbss_network->Configuration.BeaconPeriod = le16_to_cpu(*(unsigned short*)p);
- pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p);
--
++ //cam_entry:
++ //0~3 for default key
+
- //capability
- //cap = *(unsigned short *)rtw_get_capability_from_ie(ie);
- //cap = le16_to_cpu(cap);
+ //default key is disable, using sw encrypt/decrypt
+ //cam_entry = 4 //for sta mode (macid=0)
+ //cam_entry(macid+3) = 5 ~ N//for ap mode (aid=1~N, macid=2 ~N)
-+
-+ //for concurrent mode (sta+sta):
-+ //default key is disable, using sw encrypt/decrypt
-+ //cam_entry = 4 //mapping to macid=0
-+ //cam_entry = 5 //mapping to macid=2
- //SSID
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength -_BEACON_IE_OFFSET_));
- if(p && ie_len>0)
++ //for concurrent mode (sta+sta):
++ //default key is disable, using sw encrypt/decrypt
++ //cam_entry = 4 //mapping to macid=0
++ //cam_entry = 5 //mapping to macid=2
++
+#ifdef CONFIG_CONCURRENT_MODE
+ if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
{
- _rtw_memset(&pbss_network->Ssid, 0, sizeof(NDIS_802_11_SSID));
- _rtw_memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len);
- pbss_network->Ssid.SsidLength = ie_len;
+- }
+ struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_info *psta;
+
+ psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress);
-+
+
+- //chnnel
+- channel = 0;
+- pbss_network->Configuration.Length = 0;
+- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _DSSET_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
+- if(p && ie_len>0)
+- channel = *(p + 2);
+ if(psta && psta->mac_id==2)
+ {
+ cam_id = 5;
+ cam_id = 4;
+ }
+*/
- }
++ }
+#else
+ cam_id = 4;
+#endif
-- //chnnel
-- channel = 0;
-- pbss_network->Configuration.Length = 0;
-- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _DSSET_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
-- if(p && ie_len>0)
-- channel = *(p + 2);
--
- pbss_network->Configuration.DSConfig = channel;
--
+
-
- _rtw_memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
- // get supported rates
- //get ext_supported rates
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_);
- if (p != NULL)
-+
+ if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
{
- _rtw_memcpy(supportRate+supportRateNum, p+2, ie_len);
- }
-
- network_type = rtw_check_network_type(supportRate, supportRateNum, channel);
--
-- rtw_set_supported_rate(pbss_network->SupportedRates, network_type);
+ struct sta_info *psta;
+ struct sta_priv *pstapriv = &padapter->stapriv;
+- rtw_set_supported_rate(pbss_network->SupportedRates, network_type);
+ if(pparm->algorithm == _NO_PRIVACY_) // clear cam entry
+ {
+ clear_cam_entry(padapter, pparm->id);
+ {
+ ctrl = (BIT(15) | ((pparm->algorithm) << 2));
++ DBG_871X("r871x_set_stakey_hdl(): enc_algorithm=%d\n", pparm->algorithm);
+
- //parsing ERP_IE
- p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
- if(p && ie_len>0)
- {
- DBG_8192C("%s id=0x%x len=%d rem=%d next p %p\n",__FUNCTION__,*p,p[1],rem,p + (p[1]+2));
- if ((p) && (_rtw_memcmp(p+2, OUI1, 4)))
-- {
++ if((psta->mac_id<1) || (psta->mac_id>(NUM_STA-4)))
+ {
- //remove wpa ie
- u32 remain=0;
- u8 *ptr;
- }
- }
-#else //SUPPORT_64_STA
-+ DBG_871X("r871x_set_stakey_hdl(): enc_algorithm=%d\n", pparm->algorithm);
-
+-
- //update privacy/security
- if (cap & BIT(4))
- pbss_network->Privacy = 1;
- else
- pbss_network->Privacy = 0;
-+ if((psta->mac_id<1) || (psta->mac_id>(NUM_STA-4)))
-+ {
+ DBG_871X("r871x_set_stakey_hdl():set_stakey failed, mac_id(aid)=%d\n", psta->mac_id);
+ return H2C_REJECTED;
+ }
- psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X;
-
- psecuritypriv->dot8021xalg = 1;//psk, todo:802.1x
--
-- psecuritypriv->wpa_psk |= BIT(0);
+ clear_cam_entry(padapter, pparm->id);
+ return H2C_SUCCESS;
+ }
+ clear_cam_entry(padapter, ptdlsinfo->clear_cam);
+ ptdlsinfo->clear_cam=0;
+- psecuritypriv->wpa_psk |= BIT(0);
++ return H2C_SUCCESS;
++ }
+
- psecuritypriv->wpa_group_cipher = group_cipher;
- psecuritypriv->wpa_pairwise_cipher = pairwise_cipher;
-+ return H2C_SUCCESS;
++ psta = rtw_get_stainfo(pstapriv, pparm->addr);//Get TDLS Peer STA
++ if( psta->tdls_sta_state&TDLS_LINKED_STATE ){
++ write_cam(padapter, psta->mac_id, ctrl, pparm->addr, pparm->key);
+ }
++ else
++#endif //CONFIG_TDLS
++ write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key);
-#if 0
- switch(group_cipher)
- psecuritypriv->wpa_group_cipher = _WEP104_;
- break;
- }
-+ psta = rtw_get_stainfo(pstapriv, pparm->addr);//Get TDLS Peer STA
-+ if( psta->tdls_sta_state&TDLS_LINKED_STATE ){
-+ write_cam(padapter, psta->mac_id, ctrl, pparm->addr, pparm->key);
-+ }
-+ else
-+#endif //CONFIG_TDLS
-+ write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key);
++ pmlmeinfo->enc_algo = pparm->algorithm;
++
++ return H2C_SUCCESS;
++}
- switch(pairwise_cipher)
- {
- }
-#endif
- }
-+ pmlmeinfo->enc_algo = pparm->algorithm;
-+
-+ return H2C_SUCCESS;
-+}
++u8 add_ba_hdl(_adapter *padapter, unsigned char *pbuf)
++{
++ struct addBaReq_parm *pparm = (struct addBaReq_parm *)pbuf;
++ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
++ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- break;
-
- {
- break;
- }
-+u8 add_ba_hdl(_adapter *padapter, unsigned char *pbuf)
-+{
-+ struct addBaReq_parm *pparm = (struct addBaReq_parm *)pbuf;
-+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-+
+ struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, pparm->addr);
+
+ if(!psta)
- WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network);
- unsigned char *ie = pnetwork->IEs;
- u32 ielen = pnetwork->IELength;
--
--
-- DBG_871X("%s\n", __FUNCTION__);
+ u8 network_type,rate_len, total_rate_len,remainder_rate_len;
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+ u8 erpinfo=0x4;
-- pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen);
--
-- if(pwps_ie==NULL || wps_ielen==0)
-- return;
+ //DBG_871X("%s\n", __FUNCTION__);
-- wps_offset = (uint)(pwps_ie-ie);
+- DBG_871X("%s\n", __FUNCTION__);
+ if(pmlmeext->cur_channel >= 36)
+ {
+ network_type = WIRELESS_11A;
+ rtw_add_bcn_ie(padapter, pnetwork, _ERPINFO_IE_, &erpinfo, 1);
+ }
-- premainder_ie = pwps_ie + wps_ielen;
+- pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen);
+-
+- if(pwps_ie==NULL || wps_ielen==0)
+- return;
+ rtw_set_supported_rate(pnetwork->SupportedRates, network_type);
-
-- remainder_ielen = ielen - wps_offset - wps_ielen;
++
+ UpdateBrateTbl(padapter, pnetwork->SupportedRates);
+ rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates);
-
-- if(remainder_ielen>0)
++
+ if(total_rate_len > 8)
- {
-- pbackup_remainder_ie = rtw_malloc(remainder_ielen);
-- if(pbackup_remainder_ie)
-- _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
++ {
+ rate_len = 8;
+ remainder_rate_len = total_rate_len - 8;
+ }
+ {
+ rate_len = total_rate_len;
+ remainder_rate_len = 0;
- }
-
--
-- pwps_ie_src = pmlmepriv->wps_beacon_ie;
-- if(pwps_ie_src == NULL)
-- return;
--
++ }
++
+ rtw_add_bcn_ie(padapter, pnetwork, _SUPPORTEDRATES_IE_, pnetwork->SupportedRates, rate_len);
-- wps_ielen = (uint)pwps_ie_src[1];//to get ie data len
-- if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ)
+- wps_offset = (uint)(pwps_ie-ie);
+ if(remainder_rate_len)
- {
-- _rtw_memcpy(pwps_ie, pwps_ie_src, wps_ielen+2);
-- pwps_ie += (wps_ielen+2);
++ {
+ rtw_add_bcn_ie(padapter, pnetwork, _EXT_SUPPORTEDRATES_IE_, (pnetwork->SupportedRates+8), remainder_rate_len);
+ }
+ else
+ }
+}
-- if(pbackup_remainder_ie)
-- _rtw_memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
+- premainder_ie = pwps_ie + wps_ielen;
-- //update IELength
-- pnetwork->IELength = wps_offset + (wps_ielen+2) + remainder_ielen;
-- }
+- remainder_ielen = ielen - wps_offset - wps_ielen;
+#ifdef CONFIG_DUALMAC_CONCURRENT
+void dc_SelectChannel(_adapter *padapter, unsigned char channel)
+{
+ PADAPTER ptarget_adapter;
-- if(pbackup_remainder_ie)
-- rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+- if(remainder_ielen>0)
+ if( (padapter->pbuddy_adapter != NULL) &&
+ (padapter->DualMacConcurrent == _TRUE) &&
+ (padapter->adapter_type == SECONDARY_ADAPTER))
+ ptarget_adapter = padapter->pbuddy_adapter;
+ }
+ else
-+ {
+ {
+- pbackup_remainder_ie = rtw_malloc(remainder_ielen);
+- if(pbackup_remainder_ie)
+- _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
+ ptarget_adapter = padapter;
-+ }
+ }
--}
+-
+- pwps_ie_src = pmlmepriv->wps_beacon_ie;
+- if(pwps_ie_src == NULL)
+- return;
+ _enter_critical_mutex(&(adapter_to_dvobj(ptarget_adapter)->setch_mutex), NULL);
--static void update_bcn_p2p_ie(_adapter *padapter)
--{
+ rtw_hal_set_chan(ptarget_adapter, channel);
+- wps_ielen = (uint)pwps_ie_src[1];//to get ie data len
+- if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ)
+- {
+- _rtw_memcpy(pwps_ie, pwps_ie_src, wps_ielen+2);
+- pwps_ie += (wps_ielen+2);
+ _exit_critical_mutex(&(adapter_to_dvobj(ptarget_adapter)->setch_mutex), NULL);
- }
++}
--static void update_bcn_vendor_spec_ie(_adapter *padapter, u8*oui)
+- if(pbackup_remainder_ie)
+- _rtw_memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
+void dc_SetBWMode(_adapter *padapter, unsigned short bwmode, unsigned char channel_offset)
- {
-- DBG_871X("%s\n", __FUNCTION__);
++{
+ PADAPTER ptarget_adapter;
-- if(_rtw_memcmp(WPA_OUI, oui, 4))
+- //update IELength
+- pnetwork->IELength = wps_offset + (wps_ielen+2) + remainder_ielen;
+ if( (padapter->pbuddy_adapter != NULL) &&
+ (padapter->DualMacConcurrent == _TRUE) &&
+ (padapter->adapter_type == SECONDARY_ADAPTER))
- {
-- update_bcn_wpa_ie(padapter);
++ {
+ // only mac0 could control BB&RF
+ ptarget_adapter = padapter->pbuddy_adapter;
- }
-- else if(_rtw_memcmp(WMM_OUI, oui, 4))
++ }
+ else
- {
-- update_bcn_wmm_ie(padapter);
++ {
+ ptarget_adapter = padapter;
}
-- else if(_rtw_memcmp(WPS_OUI, oui, 4))
-+
+
+- if(pbackup_remainder_ie)
+- rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+-
+-}
+ _enter_critical_mutex(&(adapter_to_dvobj(ptarget_adapter)->setbw_mutex), NULL);
-+
+
+-static void update_bcn_p2p_ie(_adapter *padapter)
+-{
+ rtw_hal_set_bwmode(ptarget_adapter, (HT_CHANNEL_WIDTH)bwmode, channel_offset);
-+
+
+ _exit_critical_mutex(&(adapter_to_dvobj(ptarget_adapter)->setbw_mutex), NULL);
-+}
-+
+ }
+
+-static void update_bcn_vendor_spec_ie(_adapter *padapter, u8*oui)
+void dc_set_channel_bwmode_disconnect(_adapter *padapter)
-+{
+ {
+- DBG_871X("%s\n", __FUNCTION__);
+ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
+ struct mlme_priv *pbuddy_mlmepriv = NULL;
-+
+
+- if(_rtw_memcmp(WPA_OUI, oui, 4))
+- {
+- update_bcn_wpa_ie(padapter);
+- }
+- else if(_rtw_memcmp(WMM_OUI, oui, 4))
+ if(pbuddy_adapter != NULL &&
+ padapter->DualMacConcurrent == _TRUE)
{
-- update_bcn_wps_ie(padapter);
+- update_bcn_wmm_ie(padapter);
+ pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv);
+ if((check_fwstate(pbuddy_mlmepriv, _FW_LINKED)) != _TRUE)
+ {
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+ }
}
-- else if(_rtw_memcmp(P2P_OUI, oui, 4))
+- else if(_rtw_memcmp(WPS_OUI, oui, 4))
+ else
{
-- update_bcn_p2p_ie(padapter);
+- update_bcn_wps_ie(padapter);
+ //switch to the 20M Hz mode after disconnect
+ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
+ pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
}
-- else
+- else if(_rtw_memcmp(P2P_OUI, oui, 4))
+}
+
+u8 dc_handle_join_request(_adapter *padapter)
+ if(pbuddy_adapter != NULL &&
+ padapter->DualMacConcurrent == _TRUE)
{
-- DBG_871X("unknown OUI type!\n");
-- }
--
--
+- update_bcn_p2p_ie(padapter);
+ pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
+ pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv);
+
+ {
+ issue_nulldata(pbuddy_adapter, NULL, 1, 0, 0);
+ }
-+ }
+ }
+- else
+- {
+- DBG_871X("unknown OUI type!\n");
+- }
+-
+-
+
+ return ret;
}
- int op_mode_changes = 0;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
-+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
-+ struct mlme_priv *pbuddy_mlmepriv = NULL;
-
+-
- if(pmlmepriv->htpriv.ht_option == _TRUE)
- return 0;
-
- //if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed)
- // return 0;
-+ if(padapter->pbuddy_adapter != NULL &&
-+ padapter->DualMacConcurrent == _TRUE)
-
+-
- DBG_871X("%s current operation mode=0x%X\n",
- __FUNCTION__, pmlmepriv->ht_op_mode);
-
- new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS;
- else
- new_op_mode = OP_MODE_PURE;
--
++ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
++ struct mlme_priv *pbuddy_mlmepriv = NULL;
+
- cur_op_mode = pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_OP_MODE_MASK;
- if (cur_op_mode != new_op_mode) {
- pmlmepriv->ht_op_mode &= ~HT_INFO_OPERATION_MODE_OP_MODE_MASK;
- pmlmepriv->ht_op_mode |= new_op_mode;
- op_mode_changes++;
- }
++ if(padapter->pbuddy_adapter != NULL &&
++ padapter->DualMacConcurrent == _TRUE)
++
+ {
+ pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv);
}
-#endif
+}
-
-- if(!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT))
-- {
-- if(!psta->no_short_slot_time_set)
-- {
-- psta->no_short_slot_time_set = 1;
--
-- pmlmepriv->num_sta_no_short_slot_time++;
--
-- if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
-- (pmlmepriv->num_sta_no_short_slot_time == 1))
-- update_beacon(padapter, 0xFF, NULL, _TRUE);
--
++
+void dc_set_channel_bwmode_survey_done(_adapter *padapter)
+{
+ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ u8 cur_channel;
+ u8 cur_bwmode;
+ u8 cur_ch_offset;
-+
+
+- if(!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT))
+ if(pbuddy_adapter != NULL &&
+ padapter->DualMacConcurrent == _TRUE)
-+ {
+ {
+- if(!psta->no_short_slot_time_set)
+ pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv);
+ pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
+ pbuddy_mlmeinfo = &(pbuddy_mlmeext->mlmext_info);
+
+ if(check_fwstate(pbuddy_mlmepriv, _FW_LINKED))
-+ {
+ {
+- psta->no_short_slot_time_set = 1;
+-
+- pmlmepriv->num_sta_no_short_slot_time++;
+-
+- if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
+- (pmlmepriv->num_sta_no_short_slot_time == 1))
+- update_beacon(padapter, 0xFF, NULL, _TRUE);
+-
+ if(check_fwstate(pmlmepriv, _FW_LINKED) &&
+ (pmlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40))
+ {
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
}
+}
-
++
+void dc_set_ap_channel_bandwidth(_adapter *padapter, u8 channel, u8 channel_offset, u8 bwmode)
+{
+ u8 *p;
+ _adapter *pbuddy_adapter = padapter->pbuddy_adapter;
+ struct mlme_priv *pbuddy_mlmepriv = NULL;
+ struct mlme_ext_priv *pbuddy_mlmeext = NULL;
-+
+
+ DBG_871X("dualmac_concurrent_ap_set_channel_bwmode ==>\n");
-+
+
+-#ifdef CONFIG_80211N_HT
+ cur_channel = channel;
+ cur_bwmode = bwmode;
+ cur_ch_offset = channel_offset;
+ change_band = _FALSE;
--#ifdef CONFIG_80211N_HT
--
- if (psta->flags & WLAN_STA_HT)
+ p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ if( p && ie_len)
+ {
+ if(pht_info)
+ pht_info->infos[0] &= ~(BIT(0)|BIT(1));
-+
-+ if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40)
-+ {
-+ cur_ch_offset = pbuddy_mlmeext->cur_ch_offset;
- if (rtw_ht_operation_update(padapter) > 0)
- {
- }
-
-#endif /* CONFIG_80211N_HT */
++ if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40)
++ {
++ cur_ch_offset = pbuddy_mlmeext->cur_ch_offset;
+
+-}
+ //to update cur_ch_offset value in beacon
+ if(pht_info)
+ {
+ cur_bwmode = HT_CHANNEL_WIDTH_20;
+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
--}
-+ if(cur_channel>0 && cur_channel<5)
-+ {
-+ if(pht_info)
-+ pht_info->infos[0] |= 0x1;
-
-void ap_free_sta(_adapter *padapter, struct sta_info *psta)
-{
- _irqL irqL;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- struct sta_priv *pstapriv = &padapter->stapriv;
++ if(cur_channel>0 && cur_channel<5)
++ {
++ if(pht_info)
++ pht_info->infos[0] |= 0x1;
+
+- if(!psta)
+- return;
+ cur_bwmode = HT_CHANNEL_WIDTH_40;
+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
+ }
-- if(!psta)
-- return;
+ if(cur_channel>7 && cur_channel<(14+1))
+ {
+ if(pht_info)
+ pht_info->infos[0] |= 0x3;
-+ cur_bwmode = HT_CHANNEL_WIDTH_40;
-+ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
-+ }
-
- if (psta->nonerp_set) {
- psta->nonerp_set = 0;
- pmlmepriv->num_sta_non_erp--;
- if (pmlmepriv->num_sta_non_erp == 0)
- update_beacon(padapter, _ERPINFO_IE_, NULL, _TRUE);
- }
--
++ cur_bwmode = HT_CHANNEL_WIDTH_40;
++ cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
++ }
+
- if (psta->no_short_slot_time_set) {
- psta->no_short_slot_time_set = 0;
- pmlmepriv->num_sta_no_short_slot_time--;
- && pmlmepriv->num_sta_no_short_slot_time == 0)
- update_beacon(padapter, 0xFF, NULL, _TRUE);
- }
--
++ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
++ }
++ }
+
- if (psta->no_short_preamble_set) {
- psta->no_short_preamble_set = 0;
- pmlmepriv->num_sta_no_short_preamble--;
- }
-
-#ifdef CONFIG_80211N_HT
-+ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
-+ }
-+ }
-
-- if (psta->no_ht_gf_set) {
-- psta->no_ht_gf_set = 0;
-- pmlmepriv->num_sta_ht_no_gf--;
-- }
+ // to update channel value in beacon
+ pnetwork->Configuration.DSConfig = cur_channel;
+ p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _DSSET_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ if(p && ie_len>0)
+ *(p + 2) = cur_channel;
-- if (psta->no_ht_set) {
-- psta->no_ht_set = 0;
-- pmlmepriv->num_sta_no_ht--;
+- if (psta->no_ht_gf_set) {
+- psta->no_ht_gf_set = 0;
+- pmlmepriv->num_sta_ht_no_gf--;
+ if(pht_info)
+ pht_info->primary_channel = cur_channel;
+ }
}
-
-- if (psta->ht_20mhz_set) {
-- psta->ht_20mhz_set = 0;
-- pmlmepriv->num_sta_ht_20mhz--;
+- if (psta->no_ht_set) {
+- psta->no_ht_set = 0;
+- pmlmepriv->num_sta_no_ht--;
+ else
+ {
+ set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode);
}
-- if (rtw_ht_operation_update(padapter) > 0)
+- if (psta->ht_20mhz_set) {
+- psta->ht_20mhz_set = 0;
+- pmlmepriv->num_sta_ht_20mhz--;
+- }
+ DBG_871X("CH=%d, BW=%d, offset=%d\n", cur_channel, cur_bwmode, cur_ch_offset);
-+
+
+- if (rtw_ht_operation_update(padapter) > 0)
+ if((channel <= 14 && cur_channel >= 36) ||
+ (channel >= 36 && cur_channel <= 14))
{
- plist = get_next(plist);
-
- rtw_list_delete(&psta->asoc_list);
-+ pbuddy_adapter = padapter->pbuddy_adapter;
-
+-
- //_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
- ap_free_sta(padapter, psta);
- //_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
- }
- _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
++ pbuddy_adapter = padapter->pbuddy_adapter;
+
+ if(pbuddy_adapter == NULL)
+ return _FALSE;
-
- issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
--
+
- return ret;
+ pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
+ pbuddy_mlmeinfo = &(pbuddy_mlmeext->mlmext_info);
-#ifdef CONFIG_80211N_HT
- //update 802.11n ht cap.
- if(WLAN_STA_HT&flags)
-- {
-- psta->htpriv.ht_option = _TRUE;
-- psta->qos_option = 1;
-- }
-- else
+
+ if(!rtw_buddy_adapter_up(padapter))
{
-- psta->htpriv.ht_option = _FALSE;
+- psta->htpriv.ht_option = _TRUE;
+- psta->qos_option = 1;
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+ return;
}
--
-- if(pmlmepriv->htpriv.ht_option == _FALSE)
-- psta->htpriv.ht_option = _FALSE;
--#endif
-
+- else
++
+ pbuddy_adapter = padapter->pbuddy_adapter;
+ pbuddy_mlmepriv = &(pbuddy_adapter->mlmepriv);
+ pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
+ pbuddy_mlmeinfo = &(pbuddy_mlmeext->mlmext_info);
+ pbuddy_network_mlmeext = &(pbuddy_mlmeinfo->network);
-
-- update_sta_info_apmode(padapter, psta);
--
++
+ if(((pbuddy_mlmeinfo->state&0x03) == WIFI_FW_AP_STATE) &&
+ check_fwstate(pbuddy_mlmepriv, _FW_LINKED))
-+ {
+ {
+- psta->htpriv.ht_option = _FALSE;
+- }
+ //restart and update beacon
-
--}
++
+ DBG_871X("after join,primary adapter, CH=%d, BW=%d, offset=%d\n"
+ , pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset);
-+
+
+- if(pmlmepriv->htpriv.ht_option == _FALSE)
+- psta->htpriv.ht_option = _FALSE;
+-#endif
--/* called >= TSR LEVEL for USB or SDIO Interface*/
--void ap_sta_info_defer_update(_adapter *padapter, struct sta_info *psta)
--{
-- if(psta->state & _FW_LINKED)
-- {
-- //add ratid
-- add_RATid(padapter, psta);
-- }
--}
+ if(join_res >= 0)
+ {
+ u8 *p;
+ int ie_len;
+ u8 change_band = _FALSE;
+ struct HT_info_element *pht_info=NULL;
-+
+
+- update_sta_info_apmode(padapter, psta);
+-
+ if((pmlmeext->cur_channel <= 14 && pbuddy_mlmeext->cur_channel >= 36) ||
+ (pmlmeext->cur_channel >= 36 && pbuddy_mlmeext->cur_channel <= 14))
+ change_band = _TRUE;
-+
+
+-}
+ //sync channel/bwmode/ch_offset with primary adapter
+ pbuddy_mlmeext->cur_channel = pmlmeext->cur_channel;
+ if(pbuddy_mlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40)
+ {
+ pbuddy_mlmeext->cur_ch_offset = pmlmeext->cur_ch_offset;
--void start_ap_mode(_adapter *padapter)
+-/* called >= TSR LEVEL for USB or SDIO Interface*/
+-void ap_sta_info_defer_update(_adapter *padapter, struct sta_info *psta)
-{
-- int i;
-- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
-- struct sta_priv *pstapriv = &padapter->stapriv;
-- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
--
-- pmlmepriv->update_bcn = _FALSE;
--
-- //init_mlme_ap_info(padapter);
-- pmlmeext->bstart_bss = _FALSE;
+- if(psta->state & _FW_LINKED)
+- {
+- //add ratid
+- add_RATid(padapter, psta);
+- }
+-}
+ //to update cur_ch_offset value in beacon
+ if( pht_info )
+ {
+ if(pht_info)
+ pht_info->infos[0] |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
-- pmlmepriv->num_sta_non_erp = 0;
+-void start_ap_mode(_adapter *padapter)
+-{
+- int i;
+- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+- struct sta_priv *pstapriv = &padapter->stapriv;
+- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+-
+- pmlmepriv->update_bcn = _FALSE;
+-
+- //init_mlme_ap_info(padapter);
+- pmlmeext->bstart_bss = _FALSE;
+ pbuddy_mlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40;
+ pbuddy_mlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
+ }
+ pbuddy_mlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+ break;
-- pmlmepriv->num_sta_no_short_slot_time = 0;
+- pmlmepriv->num_sta_non_erp = 0;
+ }
+
+ }
-- pmlmepriv->num_sta_no_short_preamble = 0;
+- pmlmepriv->num_sta_no_short_slot_time = 0;
+ }
-- pmlmepriv->num_sta_ht_no_gf = 0;
+- pmlmepriv->num_sta_no_short_preamble = 0;
+ set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode);
+
+ }
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+ }
+- pmlmepriv->num_sta_ht_no_gf = 0;
+
- pmlmepriv->num_sta_no_ht = 0;
-
- pmlmepriv->num_sta_ht_20mhz = 0;
-
-- pmlmepriv->olbc = _FALSE;
+ // to update channel value in beacon
+ pbuddy_network_mlmeext->Configuration.DSConfig = pmlmeext->cur_channel;
+ p = rtw_get_ie((pbuddy_network_mlmeext->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _DSSET_IE_, &ie_len, (pbuddy_network_mlmeext->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ if(p && ie_len>0)
+ *(p + 2) = pmlmeext->cur_channel;
-+
+
+- pmlmepriv->olbc = _FALSE;
+ p = rtw_get_ie((pbuddy_network_mlmeext->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pbuddy_network_mlmeext->IELength - sizeof(NDIS_802_11_FIXED_IEs)));
+ if( p && ie_len)
+ {
+ pht_info = (struct HT_info_element *)(p+2);
+ pht_info->primary_channel = pmlmeext->cur_channel;
+ }
-+
+
+- pmlmepriv->olbc_ht = _FALSE;
+-
+-#ifdef CONFIG_80211N_HT
+- pmlmepriv->ht_op_mode = 0;
+-#endif
+ //buddy interface band is different from current interface, update ERP, support rate, ext support rate IE
+ if(change_band == _TRUE)
+ change_band_update_ie(pbuddy_adapter, pbuddy_network_mlmeext);
+ set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode);
+ }
-- pmlmepriv->olbc_ht = _FALSE;
--
--#ifdef CONFIG_80211N_HT
-- pmlmepriv->ht_op_mode = 0;
--#endif
-+ DBG_871X("after join, second adapter, CH=%d, BW=%d, offset=%d\n", pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_bwmode, pbuddy_mlmeext->cur_ch_offset);
-
- for(i=0; i<NUM_STA; i++)
- pstapriv->sta_aid[i] = NULL;
-+ DBG_871X("update pbuddy_adapter's beacon\n");
-+
-+ update_beacon(pbuddy_adapter, 0, NULL, _TRUE);
++ DBG_871X("after join, second adapter, CH=%d, BW=%d, offset=%d\n", pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_bwmode, pbuddy_mlmeext->cur_ch_offset);
- pmlmepriv->wps_beacon_ie = NULL;
- pmlmepriv->wps_probe_resp_ie = NULL;
- pmlmepriv->wps_assoc_resp_ie = NULL;
+-
+- pmlmepriv->p2p_beacon_ie = NULL;
+- pmlmepriv->p2p_probe_resp_ie = NULL;
++ DBG_871X("update pbuddy_adapter's beacon\n");
++
++ update_beacon(pbuddy_adapter, 0, NULL, _TRUE);
+
+ }
+ else if(((pbuddy_mlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) &&
+ check_fwstate(pbuddy_mlmepriv, _FW_LINKED))
+ {
+ set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
+ }
-
-- pmlmepriv->p2p_beacon_ie = NULL;
-- pmlmepriv->p2p_probe_resp_ie = NULL;
--
++
}
+#endif //CONFIG_CONCURRENT_MODE
u8 set_chplan_hdl(_adapter *padapter, unsigned char *pbuf)
{
-@@ -12038,6 +13361,7 @@ u8 set_chplan_hdl(_adapter *padapter, un
+@@ -12038,6 +13361,7 @@ u8 set_chplan_hdl(_adapter *padapter, unsigned char *pbuf)
setChannelPlan_param = (struct SetChannelPlan_param *)pbuf;
pmlmeext->max_chan_nums = init_channel_set(padapter, setChannelPlan_param->channel_plan, pmlmeext->channel_set);
return H2C_SUCCESS;
}
-@@ -12062,6 +13386,7 @@ u8 set_csa_hdl(_adapter *padapter, unsig
+@@ -12062,6 +13386,7 @@ u8 set_csa_hdl(_adapter *padapter, unsigned char *pbuf)
{
#ifdef CONFIG_DFS
struct SetChannelSwitch_param *setChannelSwitch_param;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
-@@ -12073,22 +13398,22 @@ u8 set_csa_hdl(_adapter *padapter, unsig
+@@ -12073,22 +13398,22 @@ u8 set_csa_hdl(_adapter *padapter, unsigned char *pbuf)
setChannelSwitch_param = (struct SetChannelSwitch_param *)pbuf;
new_ch_no = setChannelSwitch_param->new_ch_no;
return H2C_SUCCESS;
#else
-@@ -12136,14 +13461,18 @@ u8 tdls_hdl(_adapter *padapter, unsigned
+@@ -12136,14 +13461,18 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf)
}
//_enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL);
break;
case TDLS_SD_PTI:
issue_tdls_peer_traffic_indication(padapter, ptdls_sta);
-@@ -12155,11 +13484,11 @@ u8 tdls_hdl(_adapter *padapter, unsigned
+@@ -12155,11 +13484,11 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf)
ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SWITCH_ON_STATE |
TDLS_PEER_AT_OFF_STATE |
TDLS_AT_OFF_CH_STATE);
pmlmeext->sitesurvey_res.channel_idx = 0;
ptdls_sta->option = TDLS_DONE_CH_SEN;
rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_DONE_CH_SEN);
-@@ -12174,7 +13503,7 @@ u8 tdls_hdl(_adapter *padapter, unsigned
+@@ -12174,7 +13503,7 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf)
}else{
SelectChannel(padapter, pmlmeext->cur_channel);
if(ptdlsinfo->ch_sensing==1){
ptdlsinfo->ch_sensing=0;
-@@ -12189,7 +13518,7 @@ u8 tdls_hdl(_adapter *padapter, unsigned
+@@ -12189,7 +13518,7 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf)
}
ptdlsinfo->collect_pkt_num[0]=0;
ptdlsinfo->candidate_ch=ptdlsinfo->cur_channel;
ptdlsinfo->cur_channel=0;
}
-@@ -12198,20 +13527,20 @@ u8 tdls_hdl(_adapter *padapter, unsigned
+@@ -12198,20 +13527,20 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf)
ptdls_sta->tdls_sta_state |= TDLS_APSD_CHSW_STATE;
}else{
//send null data with pwrbit==1 before send ch_switching_req to peer STA.
ptdls_sta->tdls_sta_state |= TDLS_AT_OFF_CH_STATE;
ptdls_sta->tdls_sta_state &= ~(TDLS_PEER_AT_OFF_STATE);
_set_timer(&ptdls_sta->option_timer, (u32)ptdls_sta->ch_switch_time);
-@@ -12223,21 +13552,21 @@ u8 tdls_hdl(_adapter *padapter, unsigned
+@@ -12223,21 +13552,21 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf)
ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SWITCH_ON_STATE |
TDLS_PEER_AT_OFF_STATE |
TDLS_AT_OFF_CH_STATE);
ptdls_sta->tdls_sta_state |= TDLS_AT_OFF_CH_STATE;
if((ptdls_sta->tdls_sta_state & TDLS_PEER_AT_OFF_STATE) != TDLS_PEER_AT_OFF_STATE){
issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 0);
-@@ -12245,8 +13574,8 @@ u8 tdls_hdl(_adapter *padapter, unsigned
+@@ -12245,8 +13574,8 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf)
_set_timer(&ptdls_sta->base_ch_timer, TDLS_STAY_TIME);
break;
case TDLS_RS_RCR:
break;
case TDLS_CKALV_PH1:
_set_timer(&ptdls_sta->alive_timer2, TDLS_ALIVE_TIMER_PH2);
-@@ -12268,3 +13597,4 @@ u8 tdls_hdl(_adapter *padapter, unsigned
+@@ -12268,3 +13597,4 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf)
#endif //CONFIG_TDLS
}
+
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_mp.c b/drivers/net/wireless/rtl8192cu/core/rtw_mp.c
+index bb76dae..9af42cd 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_mp.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_mp.c
@@ -1,7 +1,7 @@
#ifdef CONFIG_MP_INCLUDED
-@@ -79,35 +86,34 @@ void write_macreg(_adapter *padapter, u3
+@@ -79,35 +86,34 @@ void write_macreg(_adapter *padapter, u32 addr, u32 val, u32 sz)
u32 read_bbreg(_adapter *padapter, u32 addr, u32 bitmask)
{
//-------------------------------------------------------------------------
// HW Initialization for 8190 MPT.
-@@ -503,16 +509,22 @@ void GetPowerTracking(PADAPTER padapter,
+@@ -503,16 +509,22 @@ void GetPowerTracking(PADAPTER padapter, u8 *enable)
static void disable_dm(PADAPTER padapter)
{
rtw_indicate_disconnect(padapter);
rtw_free_assoc_resources(padapter, 1);
}
-@@ -765,7 +777,7 @@ static VOID mpt_AdjustRFRegByRateByChan9
+@@ -765,7 +777,7 @@ static VOID mpt_AdjustRFRegByRateByChan92CU(PADAPTER pAdapter, u8 RateIdx, u8 Ch
static void mpt_SwitchRfSetting(PADAPTER pAdapter)
{
Hal_mpt_SwitchRfSetting(pAdapter);
/*---------------------------hal\rtl8192c\MPT_Phy.c---------------------------*/
/*---------------------------hal\rtl8192c\MPT_HelperFunc.c---------------------------*/
-@@ -827,7 +839,7 @@ void SetAntennaPathPower(PADAPTER pAdapt
+@@ -827,7 +839,7 @@ void SetAntennaPathPower(PADAPTER pAdapter)
void SetTxPower(PADAPTER pAdapter)
{
Hal_SetTxPower(pAdapter);
void SetTxAGCOffset(PADAPTER pAdapter, u32 ulTxAGCOffset)
{
-@@ -904,12 +916,12 @@ void SetCarrierSuppressionTx(PADAPTER pA
+@@ -904,12 +916,12 @@ void SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart)
}
void SetCCKContinuousTx(PADAPTER pAdapter, u8 bStart)
Hal_SetOFDMContinuousTx( pAdapter, bStart);
}/* mpt_StartOfdmContTx */
-@@ -919,12 +931,12 @@ void SetContinuousTx(PADAPTER pAdapter,
+@@ -919,12 +931,12 @@ void SetContinuousTx(PADAPTER pAdapter, u8 bStart)
}
//------------------------------------------------------------------------------
{
struct xmit_frame *pmpframe;
struct xmit_buf *pxmitbuf;
-@@ -936,7 +948,7 @@ struct xmit_frame *alloc_mp_xmitframe(st
+@@ -936,7 +948,7 @@ struct xmit_frame *alloc_mp_xmitframe(struct xmit_priv *pxmitpriv)
if ((pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv)) == NULL)
{
return NULL;
}
-@@ -952,7 +964,7 @@ struct xmit_frame *alloc_mp_xmitframe(st
+@@ -952,7 +964,7 @@ struct xmit_frame *alloc_mp_xmitframe(struct xmit_priv *pxmitpriv)
}
{
struct xmit_frame *pxmitframe;
struct mp_tx *pmptx;
-@@ -965,9 +977,9 @@ thread_return mp_xmit_packet_thread(thre
+@@ -965,9 +977,9 @@ thread_return mp_xmit_packet_thread(thread_context context)
padapter = pmp_priv->papdater;
pxmitpriv = &(padapter->xmitpriv);
while (1) {
pxmitframe = alloc_mp_xmitframe(pxmitpriv);
if (pxmitframe == NULL) {
-@@ -1002,7 +1014,7 @@ thread_return mp_xmit_packet_thread(thre
+@@ -1002,7 +1014,7 @@ thread_return mp_xmit_packet_thread(thread_context context)
}
exit:
}
void SetPacketRx(PADAPTER pAdapter, u8 bStartRx)
-@@ -1151,9 +1176,14 @@ void SetPacketRx(PADAPTER pAdapter, u8 b
+@@ -1151,9 +1176,14 @@ void SetPacketRx(PADAPTER pAdapter, u8 bStartRx)
if(bStartRx)
{
}
else
{
-@@ -1244,15 +1274,15 @@ static u32 GetPSDData(PADAPTER pAdapter,
+@@ -1244,15 +1274,15 @@ static u32 GetPSDData(PADAPTER pAdapter, u32 point)
*/
u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
{
if (check_fwstate(&pAdapter->mlmepriv, WIFI_MP_STATE) == _FALSE) {
RT_TRACE(_module_mp_, _drv_warning_, ("mp_query_psd: Fail! not in MP mode!\n"));
-@@ -1290,28 +1320,5 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *
+@@ -1290,28 +1320,5 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
return strlen(data)+1;
}
-
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c b/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c
+index a851568..b941e2c 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c
@@ -1,7 +1,7 @@
u32 bStartTest;
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
-@@ -820,7 +859,9 @@ NDIS_STATUS oid_rt_pro_trigger_gpio_hdl(
+@@ -820,7 +859,9 @@ NDIS_STATUS oid_rt_pro_trigger_gpio_hdl(struct oid_par_priv *poid_par_priv)
{
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
_irqlevel_changed_(&oldirql, RAISE);
_func_exit_;
-@@ -842,7 +883,9 @@ NDIS_STATUS oid_rt_pro8711_join_bss_hdl(
+@@ -842,7 +883,9 @@ NDIS_STATUS oid_rt_pro8711_join_bss_hdl(struct oid_par_priv *poid_par_priv)
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
}
//------------------------------------------------------------------------------
NDIS_STATUS oid_rt_pro8711_wi_poll_hdl(struct oid_par_priv *poid_par_priv)
-@@ -1227,7 +1295,9 @@ NDIS_STATUS oid_rt_rd_attrib_mem_hdl(str
+@@ -1227,7 +1295,9 @@ NDIS_STATUS oid_rt_rd_attrib_mem_hdl(struct oid_par_priv *poid_par_priv)
struct io_queue *pio_queue = (struct io_queue *)Adapter->pio_queue;
struct intf_hdl *pintfhdl = &pio_queue->intf;
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
#ifdef CONFIG_SDIO_HCI
-@@ -1268,7 +1338,9 @@ NDIS_STATUS oid_rt_wr_attrib_mem_hdl (st
+@@ -1268,7 +1338,9 @@ NDIS_STATUS oid_rt_wr_attrib_mem_hdl (struct oid_par_priv *poid_par_priv)
struct io_queue *pio_queue = (struct io_queue *)Adapter->pio_queue;
struct intf_hdl *pintfhdl = &pio_queue->intf;
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
#ifdef CONFIG_SDIO_HCI
-@@ -1304,7 +1376,9 @@ NDIS_STATUS oid_rt_pro_set_rf_intfs_hdl
+@@ -1304,7 +1376,9 @@ NDIS_STATUS oid_rt_pro_set_rf_intfs_hdl(struct oid_par_priv *poid_par_priv)
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
_func_enter_;
-@@ -1404,7 +1478,9 @@ NDIS_STATUS oid_rt_pro_set_data_rate_ex_
+@@ -1404,7 +1478,9 @@ NDIS_STATUS oid_rt_pro_set_data_rate_ex_hdl(struct oid_par_priv *poid_par_priv)
{
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
u8 thermal = 0;
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
-@@ -1460,7 +1538,9 @@ NDIS_STATUS oid_rt_pro_read_tssi_hdl(str
+@@ -1460,7 +1538,9 @@ NDIS_STATUS oid_rt_pro_read_tssi_hdl(struct oid_par_priv *poid_par_priv)
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
}
//------------------------------------------------------------------------------
NDIS_STATUS oid_rt_pro_qry_pwrstate_hdl(struct oid_par_priv *poid_par_priv)
-@@ -1646,7 +1732,9 @@ NDIS_STATUS oid_rt_pro_h2c_set_rate_tabl
+@@ -1646,7 +1732,9 @@ NDIS_STATUS oid_rt_pro_h2c_set_rate_table_hdl(struct oid_par_priv *poid_par_priv
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
struct setratable_parm *prate_table;
-@@ -1833,13 +1921,15 @@ NDIS_STATUS oid_rt_pro_encryption_ctrl_h
+@@ -1833,13 +1921,15 @@ NDIS_STATUS oid_rt_pro_encryption_ctrl_hdl(struct oid_par_priv *poid_par_priv)
NDIS_STATUS oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv)
{
#if 0
if (poid_par_priv->type_of_oid != SET_OID)
-@@ -1881,13 +1971,15 @@ NDIS_STATUS oid_rt_pro_add_sta_info_hdl(
+@@ -1881,13 +1971,15 @@ NDIS_STATUS oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv)
NDIS_STATUS oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv)
{
#if 0
if (poid_par_priv->type_of_oid != SET_OID)
-@@ -1914,17 +2006,17 @@ NDIS_STATUS oid_rt_pro_dele_sta_info_hdl
+@@ -1914,17 +2006,17 @@ NDIS_STATUS oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv)
#endif
}
//------------------------------------------------------------------------------
RT_TRACE(_module_mp_,_drv_err_, ("Query Information, mp_query_drv_var call recv rx\n"));
// sd_recv_rxfifo(padapter);
}
-@@ -1973,37 +2065,37 @@ u32 mp_query_drv_var(_adapter *padapter,
+@@ -1973,37 +2065,37 @@ u32 mp_query_drv_var(_adapter *padapter, u8 offset, u32 var)
else if(offset >110 &&offset <116){
if(115==offset){
RT_TRACE(_module_mp_, _drv_emerg_, (" mp_query_drv_var(_drv_emerg_): offset(%d): query TRX access type: [tx_block_mode=%x,rx_block_mode=%x]\n",\
break;
default :
break;
-@@ -2088,20 +2180,20 @@ u32 mp_query_drv_var(_adapter *padapter,
+@@ -2088,20 +2180,20 @@ u32 mp_query_drv_var(_adapter *padapter, u8 offset, u32 var)
#endif
return var;
if (poid_par_priv->type_of_oid != QUERY_OID)
-@@ -2133,12 +2225,12 @@ NDIS_STATUS oid_rt_pro_query_dr_variable
+@@ -2133,12 +2225,12 @@ NDIS_STATUS oid_rt_pro_query_dr_variable_hdl(struct oid_par_priv *poid_par_priv)
//------------------------------------------------------------------------------
NDIS_STATUS oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv)
{
if (poid_par_priv->information_buf_len < sizeof (UCHAR)) {
status = NDIS_STATUS_INVALID_LENGTH;
-@@ -2178,7 +2270,9 @@ NDIS_STATUS oid_rt_pro_rx_packet_type_hd
+@@ -2178,7 +2270,9 @@ NDIS_STATUS oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv)
//------------------------------------------------------------------------------
NDIS_STATUS oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv)
{
u16 size;
u8 ret;
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
-@@ -2354,7 +2452,6 @@ NDIS_STATUS oid_rt_get_efuse_max_size_hd
+@@ -2354,7 +2452,6 @@ NDIS_STATUS oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv)
{
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
u8 *data;
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
-@@ -2461,7 +2560,9 @@ NDIS_STATUS oid_rt_set_crystal_cap_hdl(s
+@@ -2461,7 +2560,9 @@ NDIS_STATUS oid_rt_set_crystal_cap_hdl(struct oid_par_priv *poid_par_priv)
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
#endif
_irqlevel_changed_(&oldirql, RAISE);
-@@ -2585,7 +2688,9 @@ NDIS_STATUS oid_rt_pro_set_tx_agc_offset
+@@ -2585,7 +2688,9 @@ NDIS_STATUS oid_rt_pro_set_tx_agc_offset_hdl(struct oid_par_priv *poid_par_priv)
#if 0
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
u32 txagc;
-@@ -2701,7 +2806,7 @@ unsigned int mp_ioctl_xmit_packet_hdl(st
+@@ -2701,7 +2806,7 @@ unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv)
struct mp_xmit_packet *pmp_xmitpkt = (struct mp_xmit_packet*)param;
u8 addr3[] = {0x02, 0xE0, 0x4C, 0x87, 0x66, 0x55};
pxframe = alloc_mp_xmitframe(&padapter->mppriv);
if (pxframe == NULL)
-@@ -2715,10 +2820,10 @@ unsigned int mp_ioctl_xmit_packet_hdl(st
+@@ -2715,10 +2820,10 @@ unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv)
pmp_pkt = (unsigned char*)pmp_xmitpkt->mem;
pethhdr = (struct ethhdr *)pmp_pkt;
//update attribute
pattrib = &pxframe->attrib;
-@@ -2771,10 +2876,16 @@ unsigned int mp_ioctl_xmit_packet_hdl(st
+@@ -2771,10 +2876,16 @@ unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv)
//------------------------------------------------------------------------------
NDIS_STATUS oid_rt_set_power_down_hdl(struct oid_par_priv *poid_par_priv)
{
#endif
#endif
_irqlevel_changed_(&oldirql, RAISE);
-@@ -2810,7 +2921,9 @@ NDIS_STATUS oid_rt_get_power_mode_hdl(st
+@@ -2810,7 +2921,9 @@ NDIS_STATUS oid_rt_get_power_mode_hdl(struct oid_par_priv *poid_par_priv)
#if 0
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
_func_enter_;
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c b/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c
+index 1df9d62..66c5f96 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c
@@ -25,31 +25,24 @@
}
static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf)
-@@ -544,7 +537,7 @@ u32 build_beacon_wfd_ie(struct wifidirec
+@@ -544,7 +537,7 @@ u32 build_beacon_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
u32 len=0, wfdielen = 0;
_adapter *padapter = pwdinfo->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
// WFD OUI
wfdielen = 0;
-@@ -572,24 +565,24 @@ u32 build_beacon_wfd_ie(struct wifidirec
+@@ -572,24 +565,24 @@ u32 build_beacon_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
}
wfdielen += 2;
-@@ -634,13 +627,20 @@ u32 build_beacon_wfd_ie(struct wifidirec
+@@ -634,13 +627,20 @@ u32 build_beacon_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -654,7 +654,7 @@ u32 build_probe_req_wfd_ie(struct wifidi
+@@ -654,7 +654,7 @@ u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
u32 len=0, wfdielen = 0;
_adapter *padapter = pwdinfo->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
// WFD OUI
wfdielen = 0;
-@@ -681,8 +681,23 @@ u32 build_probe_req_wfd_ie(struct wifidi
+@@ -681,8 +681,23 @@ u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
wfdielen += 2;
// Value2:
-@@ -725,13 +740,20 @@ u32 build_probe_req_wfd_ie(struct wifidi
+@@ -725,13 +740,20 @@ u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -739,13 +761,13 @@ u32 build_probe_req_wfd_ie(struct wifidi
+@@ -739,13 +761,13 @@ u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
}
// WFD OUI
wfdielen = 0;
-@@ -773,25 +795,65 @@ u32 build_probe_resp_wfd_ie(struct wifid
+@@ -773,25 +795,65 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
}
wfdielen += 2;
-@@ -836,15 +898,22 @@ u32 build_probe_resp_wfd_ie(struct wifid
+@@ -836,15 +898,22 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
{
// WFD Session Information ATTR
// Type:
-@@ -858,6 +927,28 @@ u32 build_probe_resp_wfd_ie(struct wifid
+@@ -858,6 +927,28 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Todo: to add the list of WFD device info descriptor in WFD group.
}
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -881,7 +972,7 @@ u32 build_assoc_req_wfd_ie(struct wifidi
+@@ -881,7 +972,7 @@ u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
padapter = pwdinfo->padapter;
pmlmepriv = &padapter->mlmepriv;
wfdielen = 0;
wfdie[ wfdielen++ ] = 0x50;
-@@ -907,8 +998,8 @@ u32 build_assoc_req_wfd_ie(struct wifidi
+@@ -907,8 +998,8 @@ u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
wfdielen += 2;
// Value2:
-@@ -951,13 +1042,20 @@ u32 build_assoc_req_wfd_ie(struct wifidi
+@@ -951,13 +1042,20 @@ u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -971,7 +1069,7 @@ u32 build_assoc_resp_wfd_ie(struct wifid
+@@ -971,7 +1069,7 @@ u32 build_assoc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
u32 len=0, wfdielen = 0;
_adapter *padapter = pwdinfo->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
// WFD OUI
wfdielen = 0;
-@@ -998,8 +1096,8 @@ u32 build_assoc_resp_wfd_ie(struct wifid
+@@ -998,8 +1096,8 @@ u32 build_assoc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
wfdielen += 2;
// Value2:
-@@ -1042,13 +1140,20 @@ u32 build_assoc_resp_wfd_ie(struct wifid
+@@ -1042,13 +1140,20 @@ u32 build_assoc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -1062,7 +1167,7 @@ u32 build_nego_req_wfd_ie(struct wifidir
+@@ -1062,7 +1167,7 @@ u32 build_nego_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
u32 len=0, wfdielen = 0;
_adapter *padapter = pwdinfo->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
// WFD OUI
wfdielen = 0;
-@@ -1089,8 +1194,8 @@ u32 build_nego_req_wfd_ie(struct wifidir
+@@ -1089,8 +1194,8 @@ u32 build_nego_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
wfdielen += 2;
// Value2:
-@@ -1133,13 +1238,20 @@ u32 build_nego_req_wfd_ie(struct wifidir
+@@ -1133,13 +1238,20 @@ u32 build_nego_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -1153,7 +1265,7 @@ u32 build_nego_resp_wfd_ie(struct wifidi
+@@ -1153,7 +1265,7 @@ u32 build_nego_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
u32 len=0, wfdielen = 0;
_adapter *padapter = pwdinfo->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
// WFD OUI
wfdielen = 0;
-@@ -1180,8 +1292,8 @@ u32 build_nego_resp_wfd_ie(struct wifidi
+@@ -1180,8 +1292,8 @@ u32 build_nego_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
wfdielen += 2;
// Value2:
-@@ -1224,13 +1336,20 @@ u32 build_nego_resp_wfd_ie(struct wifidi
+@@ -1224,13 +1336,20 @@ u32 build_nego_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -1245,7 +1364,7 @@ u32 build_nego_confirm_wfd_ie(struct wif
+@@ -1245,7 +1364,7 @@ u32 build_nego_confirm_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
u32 len=0, wfdielen = 0;
_adapter *padapter = pwdinfo->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
// WFD OUI
wfdielen = 0;
-@@ -1272,8 +1391,8 @@ u32 build_nego_confirm_wfd_ie(struct wif
+@@ -1272,8 +1391,8 @@ u32 build_nego_confirm_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
wfdielen += 2;
// Value2:
-@@ -1316,13 +1435,20 @@ u32 build_nego_confirm_wfd_ie(struct wif
+@@ -1316,13 +1435,20 @@ u32 build_nego_confirm_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -1331,13 +1457,13 @@ u32 build_nego_confirm_wfd_ie(struct wif
+@@ -1331,13 +1457,13 @@ u32 build_nego_confirm_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
}
// WFD OUI
wfdielen = 0;
-@@ -1364,8 +1490,8 @@ u32 build_provdisc_req_wfd_ie(struct wif
+@@ -1364,8 +1490,8 @@ u32 build_provdisc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
wfdielen += 2;
// Value2:
-@@ -1408,14 +1534,35 @@ u32 build_provdisc_req_wfd_ie(struct wif
+@@ -1408,14 +1534,35 @@ u32 build_provdisc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -1423,13 +1570,13 @@ u32 build_provdisc_req_wfd_ie(struct wif
+@@ -1423,13 +1570,13 @@ u32 build_provdisc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
}
// WFD OUI
wfdielen = 0;
-@@ -1439,7 +1586,7 @@ u32 build_provdisc_resp_wfd_ie(struct wi
+@@ -1439,7 +1586,7 @@ u32 build_provdisc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
wfdie[ wfdielen++ ] = 0x0A; // WFA WFD v1.0
// Commented by Albert 20110825
// 1. WFD Device Information
// 2. Associated BSSID ( Optional )
// 3. Local IP Adress ( Optional )
-@@ -1456,8 +1603,8 @@ u32 build_provdisc_resp_wfd_ie(struct wi
+@@ -1456,8 +1603,8 @@ u32 build_provdisc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Value1:
// WFD device information
wfdielen += 2;
// Value2:
-@@ -1500,13 +1647,35 @@ u32 build_provdisc_resp_wfd_ie(struct wi
+@@ -1500,13 +1647,35 @@ u32 build_provdisc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// Length:
// Note: In the WFD specification, the size of length field is 2.
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
-@@ -1514,68 +1683,280 @@ u32 build_provdisc_resp_wfd_ie(struct wi
+@@ -1514,68 +1683,280 @@ u32 build_provdisc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
}
// Value:
// Availability Period
-@@ -1606,6 +1987,17 @@ u32 build_probe_resp_p2p_ie(struct wifid
+@@ -1606,6 +1987,17 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
// 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes)
// + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes)
//*(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len );
RTW_PUT_LE16(p2pie + p2pielen, 21 + pwdinfo->device_name_len);
p2pielen += 2;
-@@ -1620,23 +2012,77 @@ u32 build_probe_resp_p2p_ie(struct wifid
+@@ -1620,23 +2012,77 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
RTW_PUT_BE16(p2pie + p2pielen, pwdinfo->supported_wps_cm);
p2pielen += 2;
+ //*(u32*) ( p2pie + p2pielen ) = cpu_to_be32( WPSOUI );
+ RTW_PUT_BE32(p2pie + p2pielen, WPSOUI);
+ p2pielen += 4;
-+
+
+- // Sub Category ID
+- //*(u16*) ( p2pie + p2pielen ) = cpu_to_be16( WPS_PDT_SCID_RTK_DMP );
+- RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_SCID_RTK_DMP);
+- p2pielen += 2;
+ // Sub Category ID
+ //*(u16*) ( p2pie + p2pielen ) = cpu_to_be16( WPS_PDT_SCID_MEDIA_SERVER );
+ RTW_PUT_BE16(p2pie + p2pielen, pmlmepriv->p2p_pdt_scid);
+ //*(u16*) ( p2pie + p2pielen ) = cpu_to_be16( WPS_PDT_CID_MULIT_MEDIA );
+ RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_CID_MULIT_MEDIA);
+ p2pielen += 2;
-
-- // Sub Category ID
-- //*(u16*) ( p2pie + p2pielen ) = cpu_to_be16( WPS_PDT_SCID_RTK_DMP );
-- RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_SCID_RTK_DMP);
-- p2pielen += 2;
++
+ // OUI
+ //*(u32*) ( p2pie + p2pielen ) = cpu_to_be32( WPSOUI );
+ RTW_PUT_BE32(p2pie + p2pielen, WPSOUI);
p2pie[ p2pielen++ ] = 0x00; // No Secondary Device Type List
// Device Name
-@@ -1654,7 +2100,6 @@ u32 build_probe_resp_p2p_ie(struct wifid
+@@ -1654,7 +2100,6 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf)
_rtw_memcpy( p2pie + p2pielen, pwdinfo->device_name, pwdinfo->device_name_len );
p2pielen += pwdinfo->device_name_len;
// Group Info ATTR
// Type:
// Length:
-@@ -1701,12 +2146,13 @@ u32 build_prov_disc_request_p2p_ie(struc
+@@ -1701,12 +2146,13 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8
// Value:
// Device Capability Bitmap, 1 byte
// Device Info ATTR
-@@ -1742,8 +2188,8 @@ u32 build_prov_disc_request_p2p_ie(struc
+@@ -1742,8 +2188,8 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8
// Primary Device Type
// Category ID
p2pielen += 2;
// OUI
-@@ -1752,8 +2198,8 @@ u32 build_prov_disc_request_p2p_ie(struc
+@@ -1752,8 +2198,8 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8
p2pielen += 4;
// Sub Category ID
p2pielen += 2;
// Number of Secondary Device Types
-@@ -1896,6 +2342,7 @@ u32 process_probe_req_p2p_ie(struct wifi
+@@ -1896,6 +2342,7 @@ u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l
p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, _SSID_IE_, (int *)&ssid_len,
len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_);
if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE) || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
{
if((p2pie=rtw_get_p2p_ie( pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_ , len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_ , NULL, &p2pielen)))
-@@ -1907,6 +2354,10 @@ u32 process_probe_req_p2p_ie(struct wifi
+@@ -1907,6 +2354,10 @@ u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l
//Check Device ID attribute in P2P IE
ret = _TRUE;
}
}
else
-@@ -2182,7 +2633,7 @@ u8 process_p2p_provdisc_req(struct wifid
+@@ -2182,7 +2633,7 @@ u8 process_p2p_provdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint l
issue_p2p_provision_resp( pwdinfo, GetAddr2Ptr(pframe), frame_body, uconfig_method);
}
}
return _TRUE;
}
-@@ -2193,31 +2644,93 @@ u8 process_p2p_provdisc_resp(struct wifi
+@@ -2193,31 +2644,93 @@ u8 process_p2p_provdisc_resp(struct wifidirect_info *pwdinfo, u8 *pframe)
return _TRUE;
}
{
// Commented by Kurt 20120113
// If some device wants to do p2p handshake without sending prov_disc_req
-@@ -2243,12 +2756,19 @@ u8 process_p2p_group_negotation_req( str
+@@ -2243,12 +2756,19 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe
}
else
{
ies = pframe + _PUBLIC_ACTION_IE_OFFSET_;
ies_len = len - _PUBLIC_ACTION_IE_OFFSET_;
-@@ -2256,7 +2776,7 @@ u8 process_p2p_group_negotation_req( str
+@@ -2256,7 +2776,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe
if ( !p2p_ie )
{
result = P2P_STATUS_FAIL_INCOMPATIBLE_PARAM;
rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL);
}
-@@ -2265,12 +2785,30 @@ u8 process_p2p_group_negotation_req( str
+@@ -2265,12 +2785,30 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe
{
u8 attr_content = 0x00;
u32 attr_contentlen = 0;
pwdinfo->peer_intent = attr_content; // include both intent and tie breaker values.
if ( pwdinfo->intent == ( pwdinfo->peer_intent >> 1 ) )
-@@ -2320,6 +2858,64 @@ u8 process_p2p_group_negotation_req( str
+@@ -2320,6 +2858,64 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe
}
}
//Get the next P2P IE
p2p_ie = rtw_get_p2p_ie(p2p_ie+p2p_ielen, ies_len -(p2p_ie -ies + p2p_ielen), NULL, &p2p_ielen);
}
-@@ -2332,12 +2928,12 @@ u8 process_p2p_group_negotation_req( str
+@@ -2332,12 +2928,12 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe
u8 attr_content[ 10 ] = { 0x00 };
u32 attr_contentlen = 0;
}
}
#endif // CONFIG_WFD
-@@ -2347,6 +2943,7 @@ u8 process_p2p_group_negotation_req( str
+@@ -2347,6 +2943,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe
u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pframe, uint len )
{
u8 result = P2P_STATUS_SUCCESS;
u32 p2p_ielen, wps_ielen;
u8 * ies;
-@@ -2355,7 +2952,10 @@ u8 process_p2p_group_negotation_resp( st
+@@ -2355,7 +2952,10 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
#ifdef CONFIG_WFD
u8 wfd_ie[ 128 ] = { 0x00 };
u32 wfd_ielen = 0;
ies = pframe + _PUBLIC_ACTION_IE_OFFSET_;
ies_len = len - _PUBLIC_ACTION_IE_OFFSET_;
-@@ -2368,7 +2968,7 @@ u8 process_p2p_group_negotation_resp( st
+@@ -2368,7 +2968,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
}
else
{
result = P2P_STATUS_FAIL_INCOMPATIBLE_PARAM;
rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_FAIL);
}
-@@ -2382,28 +2982,48 @@ u8 process_p2p_group_negotation_resp( st
+@@ -2382,28 +2982,48 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
}
else
{
result = attr_content;
break;
}
-@@ -2424,7 +3044,7 @@ u8 process_p2p_group_negotation_resp( st
+@@ -2424,7 +3044,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
attr_contentlen = 0;
if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GO_INTENT , &attr_content, &attr_contentlen) )
{
pwdinfo->peer_intent = attr_content; // include both intent and tie breaker values.
if ( pwdinfo->intent == ( pwdinfo->peer_intent >> 1 ) )
-@@ -2439,6 +3059,7 @@ u8 process_p2p_group_negotation_resp( st
+@@ -2439,6 +3059,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
else
{
rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK);
if ( attr_content & 0x01 )
{
rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT);
-@@ -2452,11 +3073,13 @@ u8 process_p2p_group_negotation_resp( st
+@@ -2452,11 +3073,13 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
else if ( pwdinfo->intent > ( pwdinfo->peer_intent >> 1 ) )
{
rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK);
rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT);
}
-@@ -2474,20 +3097,74 @@ u8 process_p2p_group_negotation_resp( st
+@@ -2474,20 +3097,74 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
attr_contentlen = 0;
if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen))
{
}
// Try to get the group id information if peer is GO
-@@ -2517,8 +3194,8 @@ u8 process_p2p_group_negotation_resp( st
+@@ -2517,8 +3194,8 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen);
if ( attr_contentlen )
{
}
}
#endif // CONFIG_WFD
-@@ -2534,7 +3211,6 @@ u8 process_p2p_group_negotation_confirm(
+@@ -2534,7 +3211,6 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf
u8 * p2p_ie;
u32 p2p_ielen = 0;
u8 result = P2P_STATUS_SUCCESS;
ies = pframe + _PUBLIC_ACTION_IE_OFFSET_;
ies_len = len - _PUBLIC_ACTION_IE_OFFSET_;
-@@ -2549,7 +3225,7 @@ u8 process_p2p_group_negotation_confirm(
+@@ -2549,7 +3225,7 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf
rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen);
if ( attr_contentlen == 1 )
{
result = attr_content;
if ( attr_content == P2P_STATUS_SUCCESS )
-@@ -2561,6 +3237,7 @@ u8 process_p2p_group_negotation_confirm(
+@@ -2561,6 +3237,7 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf
// Commented by Albert 20100911
// Todo: Need to handle the case which both Intents are the same.
rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_OK);
if ( ( pwdinfo->intent ) > ( pwdinfo->peer_intent >> 1 ) )
{
rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO);
-@@ -2581,6 +3258,14 @@ u8 process_p2p_group_negotation_confirm(
+@@ -2581,6 +3258,14 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf
rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO);
}
}
}
else
{
-@@ -2595,7 +3280,7 @@ u8 process_p2p_group_negotation_confirm(
+@@ -2595,7 +3280,7 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf
_rtw_memset( groupid, 0x00, 38 );
if ( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, groupid, &attr_contentlen) )
{
_rtw_memcpy( pwdinfo->groupid_info.go_device_addr, &groupid[0], ETH_ALEN );
_rtw_memcpy( pwdinfo->groupid_info.ssid, &groupid[6], attr_contentlen - ETH_ALEN );
}
-@@ -2603,7 +3288,7 @@ u8 process_p2p_group_negotation_confirm(
+@@ -2603,7 +3288,7 @@ u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pf
attr_contentlen = 0;
if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen) )
{
pwdinfo->peer_operating_ch = operatingch_info[4];
}
-@@ -2632,114 +3317,6 @@ u8 process_p2p_presence_req(struct wifid
+@@ -2632,114 +3317,6 @@ u8 process_p2p_presence_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le
return _TRUE;
}
void restore_p2p_state_handler( _adapter* padapter )
{
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
-@@ -2771,16 +3350,56 @@ void restore_p2p_state_handler( _adapter
+@@ -2771,16 +3350,56 @@ void restore_p2p_state_handler( _adapter* padapter )
_func_enter_;
void pre_tx_provdisc_handler( _adapter* padapter )
{
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
-@@ -2788,8 +3407,8 @@ void pre_tx_provdisc_handler( _adapter*
+@@ -2788,8 +3407,8 @@ void pre_tx_provdisc_handler( _adapter* padapter )
_func_enter_;
set_channel_bwmode(padapter, pwdinfo->tx_prov_disc_info.peer_channel_num[0], HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
_set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT );
_func_exit_;
-@@ -2802,71 +3421,966 @@ void pre_tx_negoreq_handler( _adapter* p
+@@ -2802,67 +3421,962 @@ void pre_tx_negoreq_handler( _adapter* padapter )
_func_enter_;
set_channel_bwmode(padapter, pwdinfo->nego_req_info.peer_channel_num[0], HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
+ }
-void p2p_protocol_wk_hdl(_adapter *padapter, int intCmdType)
--{
-- struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
--
--_func_enter_;
+ rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN);
+ val8 = 1;
+ rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
+#endif //CONFIG_IOCTL_CFG80211
+
+void p2p_protocol_wk_hdl(_adapter *padapter, int intCmdType)
-+{
-+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
-+
-+_func_enter_;
-
- switch(intCmdType)
- {
+ {
+ struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
+
@@ -2882,14 +4396,61 @@ _func_enter_;
}
case P2P_PRE_TX_PROVDISC_PROCESS_WK:
void p2p_ps_wk_hdl(_adapter *padapter, u8 p2p_ps_state)
{
-@@ -2911,42 +4584,53 @@ void p2p_ps_wk_hdl(_adapter *padapter, u
+@@ -2911,42 +4584,53 @@ void p2p_ps_wk_hdl(_adapter *padapter, u8 p2p_ps_state)
_func_enter_;
}
_func_exit_;
-@@ -2962,44 +4646,41 @@ u8 p2p_ps_wk_cmd(_adapter*padapter, u8 p
+@@ -2962,44 +4646,41 @@ u8 p2p_ps_wk_cmd(_adapter*padapter, u8 p2p_ps_state, u8 enqueue)
_func_enter_;
static void restore_p2p_state_timer_process (void *FunctionContext)
{
-@@ -3042,7 +4762,7 @@ static void pre_tx_scan_timer_process (v
+@@ -3042,7 +4762,7 @@ static void pre_tx_scan_timer_process (void *FunctionContext)
if ( _TRUE == pwdinfo->tx_prov_disc_info.benable ) // the provision discovery request frame is trigger to send or not
{
p2p_protocol_wk_cmd( adapter, P2P_PRE_TX_PROVDISC_PROCESS_WK );
//_set_timer( &pwdinfo->pre_tx_scan_timer, P2P_TX_PRESCAN_TIMEOUT );
}
}
-@@ -3051,10 +4771,17 @@ static void pre_tx_scan_timer_process (v
+@@ -3051,10 +4771,17 @@ static void pre_tx_scan_timer_process (void *FunctionContext)
if ( _TRUE == pwdinfo->nego_req_info.benable )
{
p2p_protocol_wk_cmd( adapter, P2P_PRE_TX_NEGOREQ_PROCESS_WK );
else
{
DBG_8192C( "[%s] p2p_state is %d, ignore!!\n", __FUNCTION__, rtw_p2p_state(pwdinfo) );
-@@ -3076,69 +4803,167 @@ static void find_phase_timer_process (vo
+@@ -3076,69 +4803,167 @@ static void find_phase_timer_process (void *FunctionContext)
p2p_protocol_wk_cmd( adapter, P2P_FIND_PHASE_WK );
}
// Use the OFDM rate in the P2P probe response frame. ( 6(B), 9(B), 12, 18, 24, 36, 48, 54 )
pwdinfo->support_rate[0] = 0x8c; // 6(B)
pwdinfo->support_rate[1] = 0x92; // 9(B)
-@@ -3152,12 +4977,10 @@ void init_wifidirect_info( _adapter* pad
+@@ -3152,12 +4977,10 @@ void init_wifidirect_info( _adapter* padapter, enum P2P_ROLE role)
_rtw_memcpy( ( void* ) pwdinfo->p2p_wildcard_ssid, "DIRECT-", 7 );
_rtw_memset( pwdinfo->device_name, 0x00, WPS_MAX_DEVICE_NAME_LEN );
_rtw_memset( &pwdinfo->inviteresp_info, 0x00, sizeof( struct tx_invite_resp_info ) );
pwdinfo->inviteresp_info.token = 0;
-@@ -3165,10 +4988,6 @@ void init_wifidirect_info( _adapter* pad
+@@ -3165,10 +4988,6 @@ void init_wifidirect_info( _adapter* padapter, enum P2P_ROLE role)
pwdinfo->profileindex = 0;
_rtw_memset( &pwdinfo->profileinfo[ 0 ], 0x00, sizeof( struct profile_info ) * P2P_MAX_PERSISTENT_GROUP_NUM );
rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE);
pwdinfo->listen_dwell = ( u8 ) (( rtw_get_current_time() % 3 ) + 1);
-@@ -3187,197 +5006,140 @@ void init_wifidirect_info( _adapter* pad
+@@ -3187,197 +5006,140 @@ void init_wifidirect_info( _adapter* padapter, enum P2P_ROLE role)
pwdinfo->ui_got_wps_info = P2P_NO_WPSINFO;
#ifdef CONFIG_WFD
+ return "P2P_ROLE_GO";
+ default:
+ return "UNKNOWN";
-+ }
-+}
-+
+ }
+-
+- return is_p2p_frame;
+ }
+-#endif //CONFIG_IOCTL_CFG80211
+
+-#ifdef CONFIG_DBG_P2P
+-char * p2p_role_str[] = {
+- "P2P_ROLE_DISABLE",
+- "P2P_ROLE_DEVICE",
+- "P2P_ROLE_CLIENT",
+- "P2P_ROLE_GO"
+-};
+-
+-char * p2p_state_str[] = {
+- "P2P_STATE_NONE",
+- "P2P_STATE_IDLE",
+- "P2P_STATE_LISTEN",
+- "P2P_STATE_SCAN",
+- "P2P_STATE_FIND_PHASE_LISTEN",
+- "P2P_STATE_FIND_PHASE_SEARCH",
+- "P2P_STATE_TX_PROVISION_DIS_REQ",
+- "P2P_STATE_RX_PROVISION_DIS_RSP",
+- "P2P_STATE_RX_PROVISION_DIS_REQ",
+- "P2P_STATE_GONEGO_ING",
+- "P2P_STATE_GONEGO_OK",
+- "P2P_STATE_GONEGO_FAIL",
+- "P2P_STATE_RECV_INVITE_REQ",
+- "P2P_STATE_PROVISIONING_ING",
+- "P2P_STATE_PROVISIONING_DONE"
+-};
+/**
+ * rtw_p2p_state_txt - Get the p2p state name as a text string
+ * @state: P2P state
+ return "P2P_STATE_TX_INFOR_NOREADY";
+ default:
+ return "UNKNOWN";
- }
--
-- return is_p2p_frame;
- }
--#endif //CONFIG_IOCTL_CFG80211
--
--#ifdef CONFIG_DBG_P2P
--char * p2p_role_str[] = {
-- "P2P_ROLE_DISABLE",
-- "P2P_ROLE_DEVICE",
-- "P2P_ROLE_CLIENT",
-- "P2P_ROLE_GO"
--};
--
--char * p2p_state_str[] = {
-- "P2P_STATE_NONE",
-- "P2P_STATE_IDLE",
-- "P2P_STATE_LISTEN",
-- "P2P_STATE_SCAN",
-- "P2P_STATE_FIND_PHASE_LISTEN",
-- "P2P_STATE_FIND_PHASE_SEARCH",
-- "P2P_STATE_TX_PROVISION_DIS_REQ",
-- "P2P_STATE_RX_PROVISION_DIS_RSP",
-- "P2P_STATE_RX_PROVISION_DIS_REQ",
-- "P2P_STATE_GONEGO_ING",
-- "P2P_STATE_GONEGO_OK",
-- "P2P_STATE_GONEGO_FAIL",
-- "P2P_STATE_RECV_INVITE_REQ",
-- "P2P_STATE_PROVISIONING_ING",
-- "P2P_STATE_PROVISIONING_DONE"
--};
++ }
++}
void dbg_rtw_p2p_set_state(struct wifidirect_info *wdinfo, enum P2P_STATE state, const char *caller, int line)
{
-@@ -3385,11 +5147,11 @@ void dbg_rtw_p2p_set_state(struct wifidi
+@@ -3385,11 +5147,11 @@ void dbg_rtw_p2p_set_state(struct wifidirect_info *wdinfo, enum P2P_STATE state,
enum P2P_STATE old_state = _rtw_p2p_state(wdinfo);
_rtw_p2p_set_state(wdinfo, state);
DBG_871X("[CONFIG_DBG_P2P]%s:%d set_state from %s to %s\n", caller, line
);
}
}
-@@ -3399,11 +5161,11 @@ void dbg_rtw_p2p_set_pre_state(struct wi
+@@ -3399,11 +5161,11 @@ void dbg_rtw_p2p_set_pre_state(struct wifidirect_info *wdinfo, enum P2P_STATE st
enum P2P_STATE old_state = _rtw_p2p_pre_state(wdinfo);
_rtw_p2p_set_pre_state(wdinfo, state);
DBG_871X("[CONFIG_DBG_P2P]%s:%d set_pre_state from %s to %s\n", caller, line
);
}
}
-@@ -3428,11 +5190,11 @@ void dbg_rtw_p2p_set_role(struct wifidir
+@@ -3428,11 +5190,11 @@ void dbg_rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role, co
enum P2P_ROLE old_role = wdinfo->role;
_rtw_p2p_set_role(wdinfo, role);
DBG_871X("[CONFIG_DBG_P2P]%s:%d set_role from %s to %s\n", caller, line
);
}
}
-@@ -3450,29 +5212,45 @@ int rtw_p2p_enable(_adapter *padapter, e
+@@ -3450,29 +5212,45 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role)
u8 channel, ch_offset;
u16 bwmode;
//Disable P2P function
if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
-@@ -3480,16 +5258,34 @@ int rtw_p2p_enable(_adapter *padapter, e
+@@ -3480,16 +5258,34 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role)
_cancel_timer_ex( &pwdinfo->find_phase_timer );
_cancel_timer_ex( &pwdinfo->restore_p2p_state_timer );
_cancel_timer_ex( &pwdinfo->pre_tx_scan_timer);
exit:
return ret;
}
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c b/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c
+index 92b3cb8..d1c11fa 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c
@@ -16,8 +16,7 @@
#endif
static void resume_workitem_callback(struct work_struct *work)
{
-@@ -991,9 +1164,8 @@ static void resume_workitem_callback(str
+@@ -991,9 +1164,8 @@ static void resume_workitem_callback(struct work_struct *work)
DBG_871X("%s\n",__FUNCTION__);
#endif
}
-@@ -1011,17 +1183,33 @@ void rtw_resume_in_workqueue(struct pwrc
+@@ -1011,17 +1183,33 @@ void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv)
}
#endif //CONFIG_RESUME_IN_WORKQUEUE
}
static void rtw_late_resume(struct early_suspend *h)
-@@ -1031,16 +1219,22 @@ static void rtw_late_resume(struct early
+@@ -1031,16 +1219,22 @@ static void rtw_late_resume(struct early_suspend *h)
DBG_871X("%s\n",__FUNCTION__);
if(pwrpriv->do_late_resume) {
DBG_871X("%s\n", __FUNCTION__);
//jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit
-@@ -1054,9 +1248,16 @@ void rtw_register_early_suspend(struct p
+@@ -1054,9 +1248,16 @@ void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv)
{
if (pwrpriv->early_suspend.suspend)
unregister_early_suspend(&pwrpriv->early_suspend);
-@@ -1067,16 +1268,15 @@ void rtw_unregister_early_suspend(struct
+@@ -1067,16 +1268,15 @@ void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv)
#endif //CONFIG_HAS_EARLYSUSPEND
#ifdef CONFIG_ANDROID_POWER
}
static void rtw_late_resume(android_early_suspend_t *h)
-@@ -1086,16 +1286,22 @@ static void rtw_late_resume(android_earl
+@@ -1086,16 +1286,22 @@ static void rtw_late_resume(android_early_suspend_t *h)
DBG_871X("%s\n",__FUNCTION__);
if(pwrpriv->do_late_resume) {
DBG_871X("%s\n", __FUNCTION__);
//jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit
-@@ -1107,9 +1313,16 @@ void rtw_register_early_suspend(struct p
+@@ -1107,9 +1313,16 @@ void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv)
{
if (pwrpriv->early_suspend.suspend)
android_unregister_early_suspend(&pwrpriv->early_suspend);
-@@ -1122,24 +1335,81 @@ void rtw_unregister_early_suspend(struct
+@@ -1122,24 +1335,81 @@ void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv)
u8 rtw_interface_ps_func(_adapter *padapter,HAL_INTF_PS_FUNC efunc_id,u8* val)
{
u8 bResult = _TRUE;
//System suspend is not allowed to wakeup
if((pwrpriv->bInternalAutoSuspend == _FALSE) && (_TRUE == pwrpriv->bInSuspend )){
-@@ -1147,11 +1417,6 @@ int _rtw_pwr_wakeup(_adapter *padapter,
+@@ -1147,11 +1417,6 @@ int _rtw_pwr_wakeup(_adapter *padapter, const char *caller)
goto exit;
}
//block???
if((pwrpriv->bInternalAutoSuspend == _TRUE) && (padapter->net_closed == _TRUE)) {
ret = _FAIL;
-@@ -1164,7 +1429,7 @@ int _rtw_pwr_wakeup(_adapter *padapter,
+@@ -1164,7 +1429,7 @@ int _rtw_pwr_wakeup(_adapter *padapter, const char *caller)
ret = _SUCCESS;
goto exit;
}
if(rf_off == pwrpriv->rf_pwrstate )
{
#ifdef CONFIG_USB_HCI
-@@ -1177,7 +1442,7 @@ int _rtw_pwr_wakeup(_adapter *padapter,
+@@ -1177,7 +1442,7 @@ int _rtw_pwr_wakeup(_adapter *padapter, const char *caller)
}
else if(padapter->registrypriv.usbss_enable)
{
if(_FAIL == autoresume_enter(padapter))
{
DBG_8192C("======> autoresume fail.............\n");
-@@ -1190,7 +1455,7 @@ int _rtw_pwr_wakeup(_adapter *padapter,
+@@ -1190,7 +1455,7 @@ int _rtw_pwr_wakeup(_adapter *padapter, const char *caller)
#endif
{
#ifdef CONFIG_IPS
if(_FAIL == ips_leave(padapter))
{
DBG_8192C("======> ips_leave fail.............\n");
-@@ -1199,10 +1464,6 @@ int _rtw_pwr_wakeup(_adapter *padapter,
+@@ -1199,10 +1464,6 @@ int _rtw_pwr_wakeup(_adapter *padapter, const char *caller)
}
#endif
}
}
//TODO: the following checking need to be merged...
-@@ -1220,8 +1481,60 @@ int _rtw_pwr_wakeup(_adapter *padapter,
+@@ -1220,8 +1481,60 @@ int _rtw_pwr_wakeup(_adapter *padapter, const char *caller)
}
exit:
}
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_recv.c b/drivers/net/wireless/rtl8192cu/core/rtw_recv.c
+index 0d5143b..2cc8faa 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_recv.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_recv.c
@@ -16,7 +16,7 @@
void rtw_mfree_recv_priv_lock(struct recv_priv *precvpriv)
{
_rtw_spinlock_free(&precvpriv->lock);
-@@ -171,6 +178,8 @@ void _rtw_free_recv_priv (struct recv_pr
+@@ -171,6 +178,8 @@ void _rtw_free_recv_priv (struct recv_priv *precvpriv)
_func_enter_;
int rtw_free_recvframe(union recv_frame *precvframe, _queue *pfree_recv_queue)
{
_irqL irqL;
-@@ -247,41 +260,34 @@ int rtw_free_recvframe(union recv_frame
+@@ -247,41 +260,34 @@ int rtw_free_recvframe(union recv_frame *precvframe, _queue *pfree_recv_queue)
_func_enter_;
sint rtw_enqueue_recvbuf(struct recv_buf *precvbuf, _queue *queue)
{
_irqL irqL;
-@@ -435,14 +471,16 @@ struct recv_buf *rtw_dequeue_recvbuf (_q
+@@ -435,14 +471,16 @@ struct recv_buf *rtw_dequeue_recvbuf (_queue *queue)
}
{
#ifdef CONFIG_AP_MODE
unsigned char pwrbit;
-@@ -826,11 +866,11 @@ static void process_pwrbit_data(_adapter
+@@ -826,11 +866,11 @@ static void process_pwrbit_data(_adapter *padapter, union recv_frame *precv_fram
{
//psta->state |= WIFI_SLEEP_STATE;
//pstapriv->sta_dz_bitmap |= BIT(psta->aid);
}
else
{
-@@ -838,897 +878,118 @@ static void process_pwrbit_data(_adapter
+@@ -838,10 +878,10 @@ static void process_pwrbit_data(_adapter *padapter, union recv_frame *precv_fram
{
//psta->state ^= WIFI_SLEEP_STATE;
//pstapriv->sta_dz_bitmap &= ~BIT(psta->aid);
-
-- wakeup_sta_to_xmit(padapter, psta);
--
++
+ wakeup_sta_to_xmit(padapter, psta);
+
- //DBG_871X("to wakeup, sta_dz_bitmap=%x\n", pstapriv->sta_dz_bitmap);
-- }
-- }
--
-- }
--
--#endif
--}
--
++ //DBG_871X("to wakeup, sta_dz_bitmap=%x\n", pstapriv->sta_dz_bitmap);
+ }
+ }
+
+@@ -850,7 +890,8 @@ static void process_pwrbit_data(_adapter *padapter, union recv_frame *precv_fram
+ #endif
+ }
+
-static void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame)
--{
--#ifdef CONFIG_AP_MODE
-- struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
-- struct sta_priv *pstapriv = &padapter->stapriv;
-- struct sta_info *psta=NULL;
--
-- psta = rtw_get_stainfo(pstapriv, pattrib->src);
--
-- if(!psta) return;
--
--#ifdef CONFIG_TDLS
-- if( !(psta->tdls_sta_state & TDLS_LINKED_STATE ) )
-- {
++void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame);
++void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame)
+ {
+ #ifdef CONFIG_AP_MODE
+ struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
+@@ -864,871 +905,91 @@ static void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame
+ #ifdef CONFIG_TDLS
+ if( !(psta->tdls_sta_state & TDLS_LINKED_STATE ) )
+ {
-#endif //CONFIG_TDLS
-
- if(!psta->qos_option)
- _rtw_memcpy(&ptdls_sta->ch_switch_timeout, pIE->data+2, 2);
- default:
- break;
-+
-+ wakeup_sta_to_xmit(padapter, psta);
-+
-+ //DBG_871X("to wakeup, sta_dz_bitmap=%x\n", pstapriv->sta_dz_bitmap);
-+ }
- }
-
+- }
+-
- j += (pIE->Length + 2);
-
- }
-
+- }
+-
- //todo: check status
- ptdls_sta->stat_code=0;
- ptdls_sta->tdls_sta_state |= TDLS_CH_SWITCH_ON_STATE;
- rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH);
- }
- return _FAIL;
-+#endif
- }
-
+-}
+-
-sint On_TDLS_Ch_Switch_Rsp(_adapter *adapter, union recv_frame *precv_frame)
-+void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame);
-+void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame)
- {
+-{
- struct sta_info *ptdls_sta= NULL;
- struct sta_priv *pstapriv = &adapter->stapriv;
- u8 *ptr = precv_frame->u.hdr.rx_data;
- u8 FIXED_IE =4;
- u16 stat_code, j, switch_time, switch_timeout;
- struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
--
++#endif //CONFIG_TDLS
+
- psa = get_sa(ptr);
- ptdls_sta = rtw_get_stainfo(pstapriv, psa);
-
- }
- return _FAIL;
- }
-+#ifdef CONFIG_AP_MODE
-+ struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
-+ struct sta_priv *pstapriv = &padapter->stapriv;
-+ struct sta_info *psta=NULL;
++ if(!psta->qos_option)
++ return;
- //avoiding duplicated or unconditional ch. switch. rsp
- if((ptdls_sta->tdls_sta_state & TDLS_CH_SW_INITIATOR_STATE) != TDLS_CH_SW_INITIATOR_STATE)
- return _FAIL;
-+ psta = rtw_get_stainfo(pstapriv, pattrib->src);
-
+-
- //[+1]: payload type
- ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1;
- parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len
- -TYPE_LENGTH_FIELD_SIZE
- -1
- -FIXED_IE;
-+ if(!psta) return;
-
+-
- _rtw_memcpy(&stat_code, ptr+2, 2);
-+#ifdef CONFIG_TDLS
-+ if( !(psta->tdls_sta_state & TDLS_LINKED_STATE ) )
-+ {
-+#endif //CONFIG_TDLS
-
+-
- if(stat_code!=0){
- return _FAIL;
-- }
--
-- //parsing information element
-- for(j=FIXED_IE; j<parsing_length;){
-+ if(!psta->qos_option)
-+ return;
-
-- pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
+ if(!(psta->qos_info&0xf))
+ return;
+
+#ifdef CONFIG_TDLS
-+ }
+ }
+-
+- //parsing information element
+- for(j=FIXED_IE; j<parsing_length;){
+-
+- pIE = (PNDIS_802_11_VARIABLE_IEs)(ptr+ j);
+#endif //CONFIG_TDLS
- switch (pIE->ElementID)
struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib;
sint ret = _SUCCESS;
u8 *paction = get_recvframe_data(precv_frame);
+-
+- //point to action field, [+8]: snap+ether_type, [+1]: payload_type, [+1]: category field
+- paction+=pattrib->hdrlen + pattrib->iv_len+8+1+1;
+ u8 category_field = 1;
+#ifdef CONFIG_WFD
+ u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a };
+ + ETH_TYPE_LEN
+ + PAYLOAD_TYPE_LEN
+ + category_field;
-
-- //point to action field, [+8]: snap+ether_type, [+1]: payload_type, [+1]: category field
-- paction+=pattrib->hdrlen + pattrib->iv_len+8+1+1;
++
+ if(ptdlsinfo->enable == 0)
+ {
+ DBG_871X("recv tdls frame, "
switch(*paction){
case TDLS_SETUP_REQUEST:
-@@ -1763,6 +1024,26 @@ sint OnTDLS(_adapter *adapter, union rec
+@@ -1763,6 +1024,26 @@ sint OnTDLS(_adapter *adapter, union recv_frame *precv_frame)
DBG_871X("recv tdls channel switch response frame\n");
ret=On_TDLS_Ch_Switch_Rsp(adapter, precv_frame);
break;
{
int sz;
struct sta_info *psta = NULL;
-@@ -1791,7 +1073,7 @@ static void count_rx_stats(_adapter *pad
+@@ -1791,7 +1073,7 @@ static void count_rx_stats(_adapter *padapter, union recv_frame *prframe, struct
if( (!MacAddr_isBcst(pattrib->dst)) && (!IS_MCAST(pattrib->dst))){
padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod++;
}
if(sta)
psta = sta;
else
-@@ -1807,7 +1089,12 @@ static void count_rx_stats(_adapter *pad
+@@ -1807,7 +1089,12 @@ static void count_rx_stats(_adapter *padapter, union recv_frame *prframe, struct
}
{
#ifdef CONFIG_AP_MODE
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
-@@ -2346,13 +1602,22 @@ static sint validate_recv_ctrl_frame(_ad
+@@ -2346,13 +1602,22 @@ static sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv
if(wmmps_ac)
return _FAIL;
xmitframe_phead = get_list_head(&psta->sleep_q);
xmitframe_plist = get_next(xmitframe_phead);
-@@ -2376,10 +1641,15 @@ static sint validate_recv_ctrl_frame(_ad
+@@ -2376,10 +1641,15 @@ static sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv
//DBG_871X("handling ps-poll, q_len=%d, tim=%x\n", psta->sleepq_len, pstapriv->tim_bitmap);
if(psta->sleepq_len==0)
{
-@@ -2392,15 +1662,24 @@ static sint validate_recv_ctrl_frame(_ad
+@@ -2392,15 +1662,24 @@ static sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv
update_beacon(padapter, _TIM_IE_, NULL, _FALSE);
}
}
else
{
-@@ -2415,9 +1694,7 @@ static sint validate_recv_ctrl_frame(_ad
+@@ -2415,9 +1694,7 @@ static sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv
update_beacon(padapter, _TIM_IE_, NULL, _FALSE);
}
}
-@@ -2429,37 +1706,58 @@ static sint validate_recv_ctrl_frame(_ad
+@@ -2429,37 +1706,58 @@ static sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv
}
{
struct rx_pkt_attrib * pattrib=&precv_frame->u.hdr.attrib;
struct recv_stat* prxstat=( struct recv_stat * ) precv_frame->u.hdr.rx_head ;
-@@ -2505,32 +1803,28 @@ static sint validate_recv_mgnt_frame(_ad
+@@ -2505,32 +1803,28 @@ static sint validate_recv_mgnt_frame(_adapter *adapter, union recv_frame *precv_
pattrib->priority=0;
pattrib->hdrlen = pattrib->to_fr_ds==3 ? 30 : 24;
nr_subframes = 0;
pattrib = &prframe->u.hdr.attrib;
-@@ -3271,26 +2787,29 @@ static int amsdu_to_msdu(_adapter *padap
+@@ -3271,26 +2787,29 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
while(a_len > ETH_HLEN) {
/* Offset 12 denote 2 mac address */
if(sub_skb)
{
skb_reserve(sub_skb, 12);
-@@ -3298,26 +2817,43 @@ static int amsdu_to_msdu(_adapter *padap
+@@ -3298,26 +2817,43 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
_rtw_memcpy(data_ptr, pdata, nSubframe_Length);
}
else
break;
}
-@@ -3338,11 +2874,15 @@ static int amsdu_to_msdu(_adapter *padap
+@@ -3338,11 +2874,15 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
}
for(i=0; i<nr_subframes; i++){
if (sub_skb->len >= 8 &&
((_rtw_memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) &&
eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) ||
-@@ -3378,7 +2918,7 @@ static int amsdu_to_msdu(_adapter *padap
+@@ -3378,7 +2918,7 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
#endif // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
{
int nat25_handle_frame(_adapter *priv, struct sk_buff *skb);
if (nat25_handle_frame(padapter, sub_skb) == -1) {
-@@ -3389,7 +2929,7 @@ static int amsdu_to_msdu(_adapter *padap
+@@ -3389,7 +2929,7 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
#if 1
// bypass this frame to upper layer!!
#else
continue;
#endif
}
-@@ -3407,10 +2947,74 @@ static int amsdu_to_msdu(_adapter *padap
+@@ -3407,10 +2947,74 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
}
#else /* !CONFIG_TCP_CSUM_OFFLOAD_RX */
sub_skb->ip_summed = CHECKSUM_NONE;
{
u8 wsize = preorder_ctrl->wsize_b;
u16 wend = (preorder_ctrl->indicate_seq + wsize -1) & 0xFFF;//% 4096;
-@@ -3740,7 +3345,7 @@ static int check_indicate_seq(struct rec
+@@ -3740,7 +3345,7 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n
//DbgPrint("CheckRxTsIndicateSeq(): Packet Drop! IndicateSeq: %d, NewSeq: %d\n", precvpriv->indicate_seq, seq_num);
#ifdef DBG_RX_DROP_FRAME
preorder_ctrl->indicate_seq, seq_num);
#endif
-@@ -3783,8 +3388,8 @@ static int check_indicate_seq(struct rec
+@@ -3783,8 +3388,8 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n
return _TRUE;
}
{
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
_queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
-@@ -3845,10 +3450,10 @@ static int enqueue_reorder_recvframe(str
+@@ -3845,10 +3450,10 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, un
}
//u8 bcancelled;
_list *phead, *plist;
union recv_frame *prframe;
-@@ -3894,7 +3499,7 @@ static int recv_indicatepkts_in_order(_a
+@@ -3894,7 +3499,7 @@ static int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ct
// Prepare indication list and indication.
// Check if there is any packet need indicate.
while(!rtw_is_list_empty(phead))
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
pattrib = &prframe->u.hdr.attrib;
-@@ -3935,7 +3540,7 @@ static int recv_indicatepkts_in_order(_a
+@@ -3935,7 +3540,7 @@ static int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ct
//PlatformCancelTimer(Adapter, &pTS->RxPktPendingTimer);
if(bforced!=_TRUE)
{
_cancel_timer(&preorder_ctrl->reordering_ctrl_timer, &bcancelled);
}
}
-@@ -3952,14 +3557,14 @@ static int recv_indicatepkts_in_order(_a
+@@ -3952,14 +3557,14 @@ static int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ct
//DbgPrint("recv_indicatepkts_in_order, indicate_seq=%d, seq_num=%d\n", precvpriv->indicate_seq, pattrib->seq_num);
if(!pattrib->amsdu)
{
}
}
else if(pattrib->amsdu==1)
-@@ -3999,7 +3604,7 @@ static int recv_indicatepkts_in_order(_a
+@@ -3999,7 +3604,7 @@ static int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ct
// Set new pending timer.
//pTS->RxIndicateState = RXTS_INDICATE_REORDER;
//PlatformSetTimer(Adapter, &pTS->RxPktPendingTimer, pHTInfo->RxReorderPendingTime);
_set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME);
}
else
-@@ -4014,12 +3619,11 @@ static int recv_indicatepkts_in_order(_a
+@@ -4014,12 +3619,11 @@ static int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ct
}
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
struct recv_reorder_ctrl *preorder_ctrl = prframe->u.hdr.preorder_ctrl;
_queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
-@@ -4029,7 +3633,9 @@ static int recv_indicatepkt_reorder(_ada
+@@ -4029,7 +3633,9 @@ static int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prfram
//s1.
wlanhdr_to_ethhdr(prframe);
{
if ((padapter->bDriverStopped == _FALSE) &&
(padapter->bSurpriseRemoved == _FALSE))
-@@ -4126,7 +3732,15 @@ static int recv_indicatepkt_reorder(_ada
+@@ -4126,7 +3732,15 @@ static int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prfram
#ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s check_indicate_seq fail\n", __FUNCTION__);
#endif
}
-@@ -4166,6 +3780,8 @@ static int recv_indicatepkt_reorder(_ada
+@@ -4166,6 +3780,8 @@ static int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prfram
}
return _SUCCESS;
_err_exit:
-@@ -4189,7 +3805,7 @@ void rtw_reordering_ctrl_timeout_handler
+@@ -4189,7 +3805,7 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext)
return;
}
_enter_critical_bh(&ppending_recvframe_queue->lock, &irql);
-@@ -4202,19 +3818,29 @@ void rtw_reordering_ctrl_timeout_handler
+@@ -4202,19 +3818,29 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext)
}
{
//prframe->u.hdr.preorder_ctrl = &precvpriv->recvreorder_ctrl[pattrib->priority];
-@@ -4267,24 +3893,17 @@ static int process_recv_indicatepkts(_ad
+@@ -4267,24 +3893,17 @@ static int process_recv_indicatepkts(_adapter *padapter, union recv_frame *prfra
return retval;
}
#ifdef CONFIG_MP_INCLUDED
if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE))//&&(padapter->mppriv.check_mp_pkt == 0))
-@@ -4296,21 +3915,44 @@ static int recv_func(_adapter *padapter,
+@@ -4296,21 +3915,44 @@ static int recv_func(_adapter *padapter, void *pcontext)
if (check_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE) == _FALSE) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_alert_, ("MP - Not in loopback mode , drop pkt \n"));
// DATA FRAME
rtw_led_control(padapter, LED_CTL_RX);
-@@ -4320,22 +3962,38 @@ static int recv_func(_adapter *padapter,
+@@ -4320,22 +3962,38 @@ static int recv_func(_adapter *padapter, void *pcontext)
#ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s decryptor: drop pkt\n", __FUNCTION__);
#endif
prframe = recvframe_chk_defrag(padapter, prframe);
if(prframe==NULL) {
-@@ -4352,16 +4010,22 @@ static int recv_func(_adapter *padapter,
+@@ -4352,16 +4010,22 @@ static int recv_func(_adapter *padapter, void *pcontext)
#ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s portctrl: drop pkt\n", __FUNCTION__);
#endif
{
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("recv_func: process_recv_indicatepkts fail! \n"));
#ifdef DBG_RX_DROP_FRAME
-@@ -4371,12 +4035,12 @@ static int recv_func(_adapter *padapter,
+@@ -4371,12 +4035,12 @@ static int recv_func(_adapter *padapter, void *pcontext)
goto _recv_data_drop;
}
{
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("wlanhdr_to_ethhdr: drop pkt \n"));
#ifdef DBG_RX_DROP_FRAME
-@@ -4390,8 +4054,8 @@ static int recv_func(_adapter *padapter,
+@@ -4390,8 +4054,8 @@ static int recv_func(_adapter *padapter, void *pcontext)
{
RT_TRACE(_module_rtl871x_recv_c_, _drv_alert_, ("@@@@ recv_func: recv_func rtw_recv_indicatepkt\n" ));
//indicate this recv_frame
{
#ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s rtw_recv_indicatepkt fail!\n", __FUNCTION__);
-@@ -4407,7 +4071,7 @@ static int recv_func(_adapter *padapter,
+@@ -4407,7 +4071,7 @@ static int recv_func(_adapter *padapter, void *pcontext)
DBG_871X("DBG_RX_DROP_FRAME %s ecv_func:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", __FUNCTION__,
padapter->bDriverStopped, padapter->bSurpriseRemoved);
#endif
rtw_free_recvframe(orig_prframe, pfree_recv_queue); //free this recv_frame
}
-@@ -4415,8 +4079,8 @@ static int recv_func(_adapter *padapter,
+@@ -4415,8 +4079,8 @@ static int recv_func(_adapter *padapter, void *pcontext)
else if(pattrib->amsdu==1)
{
{
#ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s amsdu_to_msdu fail\n", __FUNCTION__);
-@@ -4430,14 +4094,60 @@ static int recv_func(_adapter *padapter,
+@@ -4430,14 +4094,60 @@ static int recv_func(_adapter *padapter, void *pcontext)
#ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s what is this condition??\n", __FUNCTION__);
#endif
}
-@@ -4445,59 +4155,23 @@ s32 rtw_recv_entry(union recv_frame *pre
+@@ -4445,59 +4155,23 @@ s32 rtw_recv_entry(union recv_frame *precvframe)
{
_adapter *padapter;
struct recv_priv *precvpriv;
#ifdef CONFIG_MP_INCLUDED
padapter->mppriv.rx_pktloss = precvpriv->rx_drop;
#endif
-@@ -4541,53 +4212,74 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER
+@@ -4541,53 +4212,74 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){
if(recvpriv->signal_strength_data.update_req == 0) {// update_req is clear, means we got rx
avg_signal_strength = recvpriv->signal_strength_data.avg_val;
- tmp_s = tmp_s/_alpha;
- if(tmp_s>100)
- tmp_s = 100;
--
++ if (num_signal_strength == 0) {
++ if (rtw_get_on_cur_ch_time(adapter) == 0
++ || rtw_get_passing_time_ms(rtw_get_on_cur_ch_time(adapter)) < 2 * adapter->mlmeextpriv.mlmext_info.bcn_interval
++ ) {
++ goto set_timer;
++ }
++ }
+
- tmp_q = (avg_signal_qual+(_alpha-1)*recvpriv->signal_qual);
- if(tmp_q %_alpha)
- tmp_q = tmp_q/_alpha + 1;
- , num_signal_strength, num_signal_qual
- );
- #endif
-+ if (num_signal_strength == 0) {
-+ if (rtw_get_on_cur_ch_time(adapter) == 0
-+ || rtw_get_passing_time_ms(rtw_get_on_cur_ch_time(adapter)) < 2 * adapter->mlmeextpriv.mlmext_info.bcn_interval
-+ ) {
-+ goto set_timer;
-+ }
-+ }
-+
+ if(check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == _TRUE
+ || check_fwstate(&adapter->mlmepriv, _FW_LINKED) == _FALSE
+ ) {
rtw_set_signal_stat_timer(recvpriv);
}
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_rf.c b/drivers/net/wireless/rtl8192cu/core/rtw_rf.c
+index 665c7e5..7ae8635 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_rf.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_rf.c
@@ -16,8 +16,7 @@
#define _RTW_RF_C_
#include <drv_conf.h>
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_security.c b/drivers/net/wireless/rtl8192cu/core/rtw_security.c
+index 58601b6..8fa8ed5 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_security.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_security.c
@@ -16,8 +16,7 @@
static void xor_128(u8 *a, u8 *b, u8 *out);
static void xor_32(u8 *a, u8 *b, u8 *out);
static u8 sbox(u8 a);
-@@ -922,11 +960,13 @@ static void next_key(u8 *key, sint round
+@@ -922,11 +960,13 @@ static void next_key(u8 *key, sint round);
static void byte_sub(u8 *in, u8 *out);
static void shift_row(u8 *in, u8 *out);
static void mix_column(u8 *in, u8 *out);
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
for (j = 0; j < 8; j++)
-@@ -1508,7 +1578,7 @@ u32 rtw_aes_encrypt(_adapter *padapter,
+@@ -1508,7 +1578,7 @@ u32 rtw_aes_encrypt(_adapter *padapter, u8 *pxmitframe)
sint curfragnum,length;
u32 prwskeylen;
u8 *pframe,*prwskey; //, *payload,*iv
res=_FAIL;
}
-@@ -1591,7 +1682,6 @@ static sint aes_decipher(u8 *key, uint h
+@@ -1591,7 +1682,6 @@ static sint aes_decipher(u8 *key, uint hdrlen,
static u8 message[MAX_MSG_SIZE];
uint qc_exists, a4_exists, i, j, payload_remainder,
num_blocks, payload_index;
+ i,pframe[hdrlen+8+plen-8+i],message[hdrlen+8+plen-8+i]);
+ res = _FAIL;
+ }
- }
++ }
+
+ if(res == _FAIL)
+ {
+ for(gg=0; gg < 32; gg++)
+ DBG_871X(" [%d]=%02x ", gg, pframe[gg]);
+ DBG_871X("error packet header \n");
-+ }
+ }
+
_func_exit_;
return res;
}
-@@ -1861,7 +1971,6 @@ u32 rtw_aes_decrypt(_adapter *padapter,
+@@ -1861,7 +1971,6 @@ u32 rtw_aes_decrypt(_adapter *padapter, u8 *precvframe)
sint length;
/* compress 512-bits */
static int sha256_compress(struct sha256_state *md, unsigned char *buf)
{
-@@ -2179,7 +2417,7 @@ static void hmac_sha256_vector(u8 *key,
+@@ -2179,7 +2417,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
_len[1] = 32;
sha256_vector(2, _addr, _len, mac);
}
/**
* sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2)
* @key: Key for PRF
-@@ -2193,6 +2431,7 @@ static void hmac_sha256_vector(u8 *key,
+@@ -2193,6 +2431,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
* This function is used to derive new, cryptographically separate keys from a
* given key.
*/
static void sha256_prf(u8 *key, size_t key_len, char *label,
u8 *data, size_t data_len, u8 *buf, size_t buf_len)
{
-@@ -2229,6 +2468,7 @@ static void sha256_prf(u8 *key, size_t k
+@@ -2229,6 +2468,7 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
counter++;
}
}
static void rijndaelKeySetupEnc(u32 rk[/*44*/], const u8 cipherKey[])
{
int i;
-@@ -2617,11 +2858,12 @@ static int omac1_aes_128_vector(u8 *key,
+@@ -2617,11 +2858,12 @@ static int omac1_aes_128_vector(u8 *key, size_t num_elem,
* This is a mode for using block cipher (AES in this case) for authentication.
* OMAC1 was standardized with the name CMAC by NIST in a Special Publication
* (SP) 800-38B.
#ifdef CONFIG_TDLS
void wpa_tdls_generate_tpk(_adapter *padapter, struct sta_info *psta)
-@@ -2695,7 +2937,7 @@ int wpa_tdls_ftie_mic(u8 *kck, u8 trans_
+@@ -2695,7 +2937,7 @@ int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq,
2 + timeoutie[1] + 2 + ftie[1];
buf = rtw_zmalloc(len);
if (!buf) {
return -1;
}
-@@ -2741,7 +2983,6 @@ int tdls_verify_mic(u8 *kck, u8 trans_se
+@@ -2741,7 +2983,6 @@ int tdls_verify_mic(u8 *kck, u8 trans_seq,
if (lnkid == NULL || rsnie == NULL ||
timeoutie == NULL || ftie == NULL){
return 0;
}
-@@ -2783,16 +3024,16 @@ int tdls_verify_mic(u8 *kck, u8 trans_se
+@@ -2783,16 +3024,16 @@ int tdls_verify_mic(u8 *kck, u8 trans_seq,
rx_ftie = ftie+4;
if (os_memcmp(mic, rx_ftie, 16) == 0) {
+ return status;
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c b/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c
+new file mode 100644
+index 0000000..e08b1f7
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c
@@ -0,0 +1,352 @@
+#endif
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c b/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c
+index 70b25c9..f818a0c 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c
@@ -15,8 +15,8 @@
#endif // CONFIG_AP_MODE
_func_exit_;
-@@ -94,7 +96,7 @@ u32 _rtw_init_sta_priv(struct sta_priv *
+@@ -94,7 +96,7 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
{
struct sta_info *psta;
s32 i;
rtw_mfree_all_stainfo(pstapriv); //be done before free sta_hash_lock
_rtw_spinlock_free(&pstapriv->free_sta_queue.lock);
-@@ -235,15 +268,46 @@ void rtw_mfree_sta_priv_lock(struct sta_
+@@ -235,15 +268,46 @@ void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
#ifdef CONFIG_AP_MODE
_rtw_spinlock_free(&pstapriv->asoc_list_lock);
return psta;
-@@ -388,6 +458,7 @@ u32 rtw_free_stainfo(_adapter *padapter
+@@ -388,6 +458,7 @@ u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta)
struct sta_xmit_priv *pstaxmitpriv;
struct xmit_priv *pxmitpriv= &padapter->xmitpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
+
}
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c b/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c
+new file mode 100644
+index 0000000..e8c4d4c
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c
@@ -0,0 +1,2941 @@
+
+#endif //CONFIG_TDLS
+
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c b/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c
+index 539b74f..56dac60d 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c
@@ -16,8 +16,7 @@
#define _RTW_WLAN_UTIL_C_
#include <drv_conf.h>
-@@ -42,8 +41,11 @@ unsigned char AIRGOCAP_OUI[] = {0x00, 0x
+@@ -42,8 +41,11 @@ unsigned char AIRGOCAP_OUI[] = {0x00, 0x0a, 0xf5};
unsigned char REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20};
extern unsigned char MCS_rate_2R[16];
int cckrates_included(unsigned char *rate, int ratelen)
{
-@@ -160,6 +179,7 @@ int judge_network_type(_adapter *padapte
+@@ -160,6 +179,7 @@ int judge_network_type(_adapter *padapter, unsigned char *rate, int ratelen)
return network_type;
}
unsigned char ratetbl_val_2wifirate(unsigned char rate)
{
unsigned char val = 0;
-@@ -220,6 +240,7 @@ unsigned char ratetbl_val_2wifirate(unsi
+@@ -220,6 +240,7 @@ unsigned char ratetbl_val_2wifirate(unsigned char rate)
}
int is_basicrate(_adapter *padapter, unsigned char rate)
{
int i;
-@@ -242,7 +263,7 @@ int is_basicrate(_adapter *padapter, uns
+@@ -242,7 +263,7 @@ int is_basicrate(_adapter *padapter, unsigned char rate)
return _FALSE;
}
unsigned int ratetbl2rateset(_adapter *padapter, unsigned char *rateset)
{
int i;
-@@ -288,29 +309,101 @@ void get_rate_set(_adapter *padapter, un
+@@ -288,29 +309,101 @@ void get_rate_set(_adapter *padapter, unsigned char *pbssrate, int *bssrate_len)
_rtw_memcpy(pbssrate, supportedrates, *bssrate_len);
}
}
#if 0
-@@ -330,54 +423,176 @@ void Switch_DM_Func(_adapter *padapter,
+@@ -330,54 +423,176 @@ void Switch_DM_Func(_adapter *padapter, u8 mode, u8 enable)
}
-void Set_NETYPE1_MSR(_adapter *padapter, u8 type)
+static void Set_NETYPE1_MSR(_adapter *padapter, u8 type)
- {
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MEDIA_STATUS1, (u8 *)(&type));
++{
+ rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS1, (u8 *)(&type));
- }
-
--void Set_NETYPE0_MSR(_adapter *padapter, u8 type)
++}
++
+static void Set_NETYPE0_MSR(_adapter *padapter, u8 type)
- {
-- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type));
++{
+ rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type));
+}
+
+void Set_MSR(_adapter *padapter, u8 type)
-+{
+ {
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MEDIA_STATUS1, (u8 *)(&type));
+#ifdef CONFIG_CONCURRENT_MODE
+ if(padapter->iface_type == IFACE_PORT1)
+ {
+ {
+ Set_NETYPE0_MSR(padapter, type);
+ }
-+}
-+
+ }
+
+-void Set_NETYPE0_MSR(_adapter *padapter, u8 type)
+inline u8 rtw_get_oper_ch(_adapter *adapter)
-+{
+ {
+- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type));
+ return adapter_to_dvobj(adapter)->oper_channel;
+}
+
SetBWMode(padapter, bwmode, channel_offset);
}
-@@ -414,8 +629,14 @@ u16 get_beacon_interval(WLAN_BSSID_EX *b
+@@ -414,8 +629,14 @@ u16 get_beacon_interval(WLAN_BSSID_EX *bss)
int is_client_associated_to_ap(_adapter *padapter)
{
{
- padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_CAM_INVALID_ALL, 0);
+ rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, 0);
-+}
+ }
+#if 0
+static u32 _ReadCAM(_adapter *padapter ,u32 addr)
+{
+ printk("offset:0x%02x => 0x%08x \n",addr+j,cmd);
+ }
+ printk("*********************************\n");
- }
++}
+#endif
void write_cam(_adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key)
int j;
u32 cam_val[2];
-@@ -519,14 +770,14 @@ void write_cam(_adapter *padapter, u8 en
+@@ -519,14 +770,14 @@ void write_cam(_adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key)
cam_val[0] = val;
cam_val[1] = addr + (unsigned int)j;
}
-@@ -544,14 +795,14 @@ void clear_cam_entry(_adapter *padapter,
+@@ -544,14 +795,14 @@ void clear_cam_entry(_adapter *padapter, u8 entry)
cam_val[0] = val;
cam_val[1] = addr + (unsigned int)0;
#else
unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-@@ -586,21 +837,54 @@ void flush_all_cam_entry(_adapter *padap
+@@ -586,21 +837,54 @@ void flush_all_cam_entry(_adapter *padapter)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
int WFD_info_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{
struct registry_priv *pregpriv = &padapter->registrypriv;
-@@ -622,8 +906,8 @@ int WFD_info_handler(_adapter *padapter,
+@@ -622,8 +906,8 @@ int WFD_info_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen);
if ( attr_contentlen )
{
return( _TRUE );
}
}
-@@ -638,7 +922,7 @@ int WFD_info_handler(_adapter *padapter,
+@@ -638,7 +922,7 @@ int WFD_info_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
int WMM_param_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{
else
padapter->mlmepriv.acm_mask = acm_mask;
-@@ -751,18 +1034,35 @@ static void bwmode_update_check(_adapter
+@@ -751,18 +1034,35 @@ static void bwmode_update_check(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pI
unsigned char new_bwmode;
unsigned char new_ch_offset;
struct HT_info_element *pHT_info;
switch (pHT_info->infos[0] & 0x3)
{
case 1:
-@@ -791,6 +1091,9 @@ static void bwmode_update_check(_adapter
+@@ -791,6 +1091,9 @@ static void bwmode_update_check(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pI
pmlmeext->cur_bwmode = new_bwmode;
pmlmeext->cur_ch_offset = new_ch_offset;
}
else
{
-@@ -842,7 +1145,8 @@ void HT_caps_handler(_adapter *padapter,
+@@ -842,7 +1145,8 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
if(pIE==NULL) return;
if(phtpriv->ht_option == _FALSE) return;
-@@ -855,57 +1159,68 @@ void HT_caps_handler(_adapter *padapter,
+@@ -855,57 +1159,68 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{
// Commented by Albert 2010/07/12
// Got the endian issue here.
}
//
-@@ -1081,6 +1395,24 @@ void VCS_update(_adapter *padapter, stru
+@@ -1081,6 +1395,24 @@ void VCS_update(_adapter *padapter, struct sta_info *psta)
}
}
void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta_info *psta)
{
unsigned int i;
-@@ -1090,8 +1422,8 @@ void update_beacon_info(_adapter *padapt
+@@ -1090,8 +1422,8 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta
#ifdef CONFIG_TDLS
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
u8 tdls_prohibited[] = { 0x00, 0x00, 0x00, 0x00, 0x10 }; //bit(38): TDLS_prohibited
len = pkt_len - (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN);
for (i = 0; i < len;)
-@@ -1122,10 +1454,10 @@ void update_beacon_info(_adapter *padapt
+@@ -1122,10 +1454,10 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta
#ifdef CONFIG_TDLS
case _EXT_CAP_IE_:
default:
break;
}
-@@ -1181,7 +1513,7 @@ unsigned int is_ap_in_tkip(_adapter *pad
+@@ -1181,7 +1513,7 @@ unsigned int is_ap_in_tkip(_adapter *padapter)
switch (pIE->ElementID)
{
case _VENDOR_SPECIFIC_IE_:
{
return _TRUE;
}
-@@ -1209,6 +1541,7 @@ unsigned int is_ap_in_tkip(_adapter *pad
+@@ -1209,6 +1541,7 @@ unsigned int is_ap_in_tkip(_adapter *padapter)
}
int wifirate2_ratetbl_inx(unsigned char rate)
{
int inx = 0;
-@@ -1303,7 +1636,7 @@ unsigned int update_MSC_rate(struct HT_c
+@@ -1303,7 +1636,7 @@ unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps)
{
unsigned int mask = 0;
return mask;
}
-@@ -1322,7 +1655,7 @@ int support_short_GI(_adapter *padapter,
+@@ -1322,7 +1655,7 @@ int support_short_GI(_adapter *padapter, struct HT_caps_element *pHT_caps)
bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40)? 6: 5;
{
return _SUCCESS;
}
-@@ -1349,11 +1682,12 @@ unsigned char get_highest_rate_idx(u32 m
+@@ -1349,11 +1682,12 @@ unsigned char get_highest_rate_idx(u32 mask)
return rate_idx;
}
for (i = 15; i >= 0; i--)
{
-@@ -1368,9 +1702,10 @@ unsigned char get_highest_mcs_rate(struc
+@@ -1368,9 +1702,10 @@ unsigned char get_highest_mcs_rate(struct HT_caps_element *pHT_caps)
void Update_RA_Entry(_adapter *padapter, u32 mac_id)
{
void enable_rate_adaptive(_adapter *padapter, u32 mac_id)
{
Update_RA_Entry(padapter, mac_id);
-@@ -1382,6 +1717,47 @@ void set_sta_rate(_adapter *padapter, st
+@@ -1382,6 +1717,47 @@ void set_sta_rate(_adapter *padapter, struct sta_info *psta)
enable_rate_adaptive(padapter, psta->mac_id);
}
unsigned char check_assoc_AP(u8 *pframe, uint len)
{
unsigned int i;
-@@ -1496,7 +1872,7 @@ void update_capinfo(PADAPTER Adapter, u1
+@@ -1496,7 +1872,7 @@ void update_capinfo(PADAPTER Adapter, u16 updateCap)
{
ShortPreamble = _TRUE;
pmlmeinfo->preamble_mode = PREAMBLE_SHORT;
}
}
else
-@@ -1505,7 +1881,7 @@ void update_capinfo(PADAPTER Adapter, u1
+@@ -1505,7 +1881,7 @@ void update_capinfo(PADAPTER Adapter, u16 updateCap)
{
ShortPreamble = _FALSE;
pmlmeinfo->preamble_mode = PREAMBLE_LONG;
}
}
}
-@@ -1545,18 +1921,22 @@ void update_capinfo(PADAPTER Adapter, u1
+@@ -1545,18 +1921,22 @@ void update_capinfo(PADAPTER Adapter, u16 updateCap)
}
}
ratelen = rtw_get_rateset_len(cur_network->SupportedRates);
-@@ -1596,16 +1976,39 @@ void update_wireless_mode(_adapter *pada
+@@ -1596,16 +1976,39 @@ void update_wireless_mode(_adapter *padapter)
}
pmlmeext->cur_wireless_mode = network_type & padapter->registrypriv.wireless_mode;
void fire_write_MAC_cmd(_adapter *padapter, unsigned int addr, unsigned int value)
{
#if 0
-@@ -1633,13 +2036,6 @@ void fire_write_MAC_cmd(_adapter *padapt
+@@ -1633,13 +2036,6 @@ void fire_write_MAC_cmd(_adapter *padapter, unsigned int addr, unsigned int valu
#endif
}
void update_bmc_sta_support_rate(_adapter *padapter, u32 mac_id)
{
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-@@ -1648,11 +2044,11 @@ void update_bmc_sta_support_rate(_adapte
+@@ -1648,11 +2044,11 @@ void update_bmc_sta_support_rate(_adapter *padapter, u32 mac_id)
if(pmlmeext->cur_wireless_mode & WIRELESS_11B)
{
// Only B, B/G, and B/G/N AP could use CCK rate
}
}
-@@ -1736,12 +2132,12 @@ void update_TSF(struct mlme_ext_priv *pm
+@@ -1736,12 +2132,12 @@ void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len)
void correct_TSF(_adapter *padapter, struct mlme_ext_priv *pmlmeext)
{
}
#if 0
-@@ -1818,7 +2214,7 @@ unsigned int setup_beacon_frame(_adapter
+@@ -1818,7 +2214,7 @@ unsigned int setup_beacon_frame(_adapter *padapter, unsigned char *beacon_frame)
if ((len + TXDESC_SIZE) > 256)
{
return 0;
}
-@@ -1846,3 +2242,64 @@ unsigned int setup_beacon_frame(_adapter
+@@ -1846,3 +2242,64 @@ unsigned int setup_beacon_frame(_adapter *padapter, unsigned char *beacon_frame)
}
#endif
+ return status;
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c b/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c
+index 178a5b7..18f1fdb 100644
--- a/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c
+++ b/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c
@@ -15,8 +15,8 @@
void rtw_mfree_xmit_priv_lock (struct xmit_priv *pxmitpriv)
{
_rtw_spinlock_free(&pxmitpriv->lock);
-@@ -327,7 +370,7 @@ void _rtw_free_xmit_priv (struct xmit_pr
+@@ -327,7 +370,7 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv)
_func_enter_;
rtw_mfree_xmit_priv_lock(pxmitpriv);
-@@ -336,7 +379,7 @@ void _rtw_free_xmit_priv (struct xmit_pr
+@@ -336,7 +379,7 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv)
for(i=0; i<NR_XMITFRAME; i++)
{
pxmitframe++;
}
-@@ -360,6 +403,17 @@ void _rtw_free_xmit_priv (struct xmit_pr
+@@ -360,6 +403,17 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv)
rtw_vmfree(pxmitpriv->pallocated_xmitbuf, NR_XMITBUFF * sizeof(struct xmit_buf) + 4);
}
// free xmit extension buff
_rtw_spinlock_free(&pxmitpriv->free_xmit_extbuf_queue.lock);
-@@ -380,6 +434,10 @@ void _rtw_free_xmit_priv (struct xmit_pr
+@@ -380,6 +434,10 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv)
rtw_free_hwxmits(padapter);
out:
_func_exit_;
-@@ -394,6 +452,27 @@ static void update_attrib_vcs_info(_adap
+@@ -394,6 +452,27 @@ static void update_attrib_vcs_info(_adapter *padapter, struct xmit_frame *pxmitf
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
if (pattrib->nr_frags != 1)
{
-@@ -496,8 +575,6 @@ static void update_attrib_vcs_info(_adap
+@@ -496,8 +575,6 @@ static void update_attrib_vcs_info(_adapter *padapter, struct xmit_frame *pxmitf
break;
}
}
}
static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info *psta)
-@@ -527,20 +604,22 @@ static void update_attrib_phy_info(struc
+@@ -527,20 +604,22 @@ static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info *
// if(psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority))
// pattrib->ampdu_en = _TRUE;
//}
break;
case 1:
case 2:
-@@ -548,17 +627,19 @@ static void qos_acm(u8 acm_mask, struct
+@@ -548,17 +627,19 @@ static void qos_acm(u8 acm_mask, struct pkt_attrib *pattrib)
case 4:
case 5:
if(acm_mask & BIT(2))
}
static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
-@@ -628,7 +709,7 @@ static s32 update_attrib(_adapter *padap
+@@ -628,7 +709,7 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
_rtw_memcpy(pattrib->ta, get_bssid(pmlmepriv), ETH_ALEN);
}
if (ETH_P_IP == pattrib->ether_type)
{
-@@ -659,12 +740,10 @@ static s32 update_attrib(_adapter *padap
+@@ -659,12 +740,10 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
}
}
#ifdef CONFIG_LPS
// If EAPOL , ARP , OR DHCP packet, driver must be in active mode.
-@@ -730,9 +809,10 @@ static s32 update_attrib(_adapter *padap
+@@ -730,9 +809,10 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
if(pqospriv->qos_option)
{
set_qos(&pktfile, pattrib);
}
}
}
-@@ -831,6 +911,13 @@ static s32 update_attrib(_adapter *padap
+@@ -831,6 +911,13 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("update_attrib: bswenc=_FALSE\n"));
}
rtw_set_tx_chksum_offload(pkt, pattrib);
update_attrib_phy_info(pattrib, psta);
-@@ -860,10 +947,21 @@ static s32 xmitframe_addmic(_adapter *pa
+@@ -860,10 +947,21 @@ static s32 xmitframe_addmic(_adapter *padapter, struct xmit_frame *pxmitframe){
}
else
{
RT_TRACE(_module_rtl871x_xmit_c_,_drv_alert_,("### xmitframe_swencrypt\n"));
switch(pattrib->encrypt){
case _WEP40_:
-@@ -1015,17 +1113,13 @@ s32 rtw_make_wlanhdr (_adapter *padapter
+@@ -1015,17 +1113,13 @@ s32 rtw_make_wlanhdr (_adapter *padapter , u8 *hdr, struct pkt_attrib *pattrib)
struct rtw_ieee80211_hdr *pwlanhdr = (struct rtw_ieee80211_hdr *)hdr;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv = &pmlmepriv->qospriv;
}
}
-@@ -1235,7 +1346,27 @@ s32 rtw_txframes_sta_ac_pending(_adapter
+@@ -1235,7 +1346,27 @@ s32 rtw_txframes_sta_ac_pending(_adapter *padapter, struct pkt_attrib *pattrib)
struct tx_servq *ptxservq;
int priority = pattrib->priority;
switch(priority)
{
-@@ -1263,871 +1394,121 @@ s32 rtw_txframes_sta_ac_pending(_adapter
+@@ -1263,871 +1394,121 @@ s32 rtw_txframes_sta_ac_pending(_adapter *padapter, struct pkt_attrib *pattrib)
}
#ifdef CONFIG_TDLS
-
- //extended capabilities
- pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen));
-
+-
- //QoS capability(WMM_IE)
- pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 7, TDLS_WMMIE, &(pattrib->pktlen));
--
+
- //FTIE(optional)
- if(pattrib->encrypt){
- _rtw_memset(pframe, 0, 84); //All fields except SNonce shall be set to 0
-
- pframe = rtw_set_ie(pframe, _HT_CAPABILITY_IE_,
- sizeof(struct rtw_ieee80211_ht_cap), (unsigned char*)&ht_capie, &(pattrib->pktlen));
--
+
- //20/40 BSS coexistence
- if(pmlmepriv->num_FortyMHzIntolerant>0)
- iedata |= BIT(2);//20 MHz BSS Width Request
- pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen));
-
-}
--
++ if (pattrib->encrypt)
++ SetPrivacy(fctrl);
+
-void rtw_tdls_setup_rsp_fr(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe)
-{
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- u8 k; //for random ANonce
- u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic;
- u32 time;
-
+-
- ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst);
-+ if (pattrib->encrypt)
-+ SetPrivacy(fctrl);
-
+-
- if(ptdls_sta == NULL )
+ if (pqospriv->qos_option)
{
/*
-@@ -2311,17 +1709,33 @@ s32 rtw_xmitframe_coalesce(_adapter *pad
+@@ -2311,17 +1709,33 @@ s32 rtw_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxm
_func_enter_;
+ if(!(psta->state &_FW_LINKED))
+ {
+ DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state);
-+ return _FAIL;
+ return _FAIL;
+ }
+
+ if (pxmitframe->buf_addr == NULL){
+ DBG_8192C("==> %s buf_addr==NULL \n",__FUNCTION__);
- return _FAIL;
++ return _FAIL;
+ }
pbuf_start = pxmitframe->buf_addr;
}
_exit_critical(&pfree_queue->lock, &irqL);
-@@ -2690,7 +2328,7 @@ struct xmit_buf *rtw_alloc_xmitbuf(struc
+@@ -2690,7 +2328,7 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv)
_func_enter_;
}
#ifdef DBG_XMIT_BUF
else
-@@ -2747,13 +2389,18 @@ s32 rtw_free_xmitbuf(struct xmit_priv *p
+@@ -2747,13 +2389,18 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
_func_enter_;
/*
Calling context:
1. OS_TXENTRY
-@@ -2790,7 +2471,6 @@ Otherwise, we must use _enter/_exit crit
+@@ -2790,7 +2471,6 @@ Otherwise, we must use _enter/_exit critical to protect free_xmit_queue...
Must be very very cautious...
*/
struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv)//(_queue *pfree_xmit_queue)
{
/*
-@@ -2803,7 +2483,9 @@ struct xmit_frame *rtw_alloc_xmitframe(s
+@@ -2803,7 +2483,9 @@ struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv)//(_queue *pf
struct xmit_frame *pxframe = NULL;
_list *plist, *phead;
_queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;
- pxframe->buf_addr = NULL;
- pxframe->pxmitbuf = NULL;
+ rtw_init_xmitframe(pxframe);
-
-- _rtw_memset(&pxframe->attrib, 0, sizeof(struct pkt_attrib));
-- //pxframe->attrib.psta = NULL;
++
+_func_exit_;
+
+ return pxframe;
+
+ rtw_init_xmitframe(pxframe);
-- pxframe->frame_tag = DATA_FRAMETAG;
+- _rtw_memset(&pxframe->attrib, 0, sizeof(struct pkt_attrib));
+- //pxframe->attrib.psta = NULL;
+_func_exit_;
--#ifdef CONFIG_USB_HCI
-- pxframe->pkt = NULL;
-- pxframe->pkt_offset = 1;//default use pkt_offset to fill tx desc
+- pxframe->frame_tag = DATA_FRAMETAG;
+ return pxframe;
+}
--#ifdef CONFIG_USB_TX_AGGREGATION
-- pxframe->agg_num = 1;
--#endif
+-#ifdef CONFIG_USB_HCI
+- pxframe->pkt = NULL;
+- pxframe->pkt_offset = 1;//default use pkt_offset to fill tx desc
+struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv)
+{
+ struct xmit_frame *pxframe = NULL;
+ u8 *alloc_addr;
--#endif //#ifdef CONFIG_USB_HCI
+-#ifdef CONFIG_USB_TX_AGGREGATION
+- pxframe->agg_num = 1;
+-#endif
+ alloc_addr = rtw_zmalloc(sizeof(struct xmit_frame) + 4);
+
+ if (alloc_addr == NULL)
+ pxframe = (struct xmit_frame *)N_BYTE_ALIGMENT((SIZE_PTR)(alloc_addr), 4);
+ pxframe->alloc_addr = alloc_addr;
+-#endif //#ifdef CONFIG_USB_HCI
++ pxframe->padapter = pxmitpriv->adapter;
++ pxframe->frame_tag = NULL_FRAMETAG;
+
-#ifdef PLATFORM_LINUX
- if(pxmitpriv->free_xmitframe_cnt==1)
- {
- netif_stop_queue(padapter->pnetdev);
- }
-#endif
-+ pxframe->padapter = pxmitpriv->adapter;
-+ pxframe->frame_tag = NULL_FRAMETAG;
-
-- }
+ pxframe->pkt = NULL;
-- _exit_critical_bh(&pfree_xmit_queue->lock, &irqL);
+- }
+ pxframe->buf_addr = NULL;
+ pxframe->pxmitbuf = NULL;
--_func_exit_;
+- _exit_critical_bh(&pfree_xmit_queue->lock, &irqL);
+ rtw_init_xmitframe(pxframe);
+-_func_exit_;
+ DBG_871X("################## %s ##################\n", __func__);
-+
+
+exit:
return pxframe;
}
+ RT_TRACE(_module_rtl871x_xmit_c_, _drv_debug_, ("rtw_free_xmitframe():free_xframe_ext_cnt=%d\n", pxmitpriv->free_xframe_ext_cnt));
+ } else {
+ }
-+
-+ _exit_critical_bh(&queue->lock, &irqL);
++ _exit_critical_bh(&queue->lock, &irqL);
++
+check_pkt_complete:
if(pndis_pkt)
void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, _queue *pframequeue)
{
_irqL irqL;
-@@ -2995,11 +2717,7 @@ static struct xmit_frame *dequeue_one_xm
+@@ -2995,11 +2717,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str
ptxservq->qcnt--;
#ifdef CONFIG_BR_EXT
int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb)
{
-@@ -3411,7 +3135,7 @@ int rtw_br_client_tx(_adapter *padapter,
+@@ -3411,7 +3135,7 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb)
*((unsigned short *)(skb->data+MACADDRLEN*2+2-i*2)) = *((unsigned short *)(skb->data+MACADDRLEN*2-2-i*2));
skb_pull(skb, 4);
}
if (!memcmp(skb->data+MACADDRLEN, padapter->br_mac, MACADDRLEN) &&
(*((unsigned short *)(skb->data+MACADDRLEN*2)) == __constant_htons(ETH_P_IP)))
memcpy(padapter->br_ip, skb->data+WLAN_ETHHDR_LEN+12, 4);
-@@ -3455,14 +3179,14 @@ int rtw_br_client_tx(_adapter *padapter,
+@@ -3455,14 +3179,14 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb)
*((unsigned short *)(skb->data+MACADDRLEN*2+2)) = vlan_hdr;
}
*pskb = skb = newskb;
if (is_vlan_tag) {
-@@ -3498,7 +3222,7 @@ int rtw_br_client_tx(_adapter *padapter,
+@@ -3498,7 +3222,7 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb)
}
// we just print warning message and let it go
//return -1; // return -1 will cause system crash on 2011/08/30!
return 0;
}
-@@ -3556,8 +3280,8 @@ static void do_queue_select(_adapter *pa
+@@ -3556,8 +3280,8 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("### do_queue_select priority=%d ,qsel = %d\n",pattrib->priority ,qsel));
#ifdef CONFIG_CONCURRENT_MODE
#endif
pattrib->qsel = qsel;
-@@ -3573,6 +3297,8 @@ static void do_queue_select(_adapter *pa
+@@ -3573,6 +3297,8 @@ static void do_queue_select(_adapter *padapter, struct pkt_attrib *pattrib)
*/
s32 rtw_xmit(_adapter *padapter, _pkt **ppkt)
{
#ifdef CONFIG_AP_MODE
_irqL irqL0;
#endif
-@@ -3585,13 +3311,21 @@ s32 rtw_xmit(_adapter *padapter, _pkt **
+@@ -3585,13 +3311,21 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt)
s32 res;
return -1;
}
-@@ -3605,11 +3339,14 @@ s32 rtw_xmit(_adapter *padapter, _pkt **
+@@ -3605,11 +3339,14 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt)
rcu_read_unlock();
#endif // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
}
#endif // CONFIG_BR_EXT
-@@ -3629,7 +3366,7 @@ s32 rtw_xmit(_adapter *padapter, _pkt **
+@@ -3629,7 +3366,7 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt)
do_queue_select(padapter, &pxmitframe->attrib);
_enter_critical_bh(&pxmitpriv->lock, &irqL0);
if(xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe) == _TRUE)
{
-@@ -3637,57 +3374,15 @@ s32 rtw_xmit(_adapter *padapter, _pkt **
+@@ -3637,57 +3374,15 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt)
return 1;
}
_exit_critical_bh(&pxmitpriv->lock, &irqL0);
sint xmitframe_enqueue_for_tdls_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe)
{
sint ret=_FALSE;
-@@ -3697,7 +3392,6 @@ sint xmitframe_enqueue_for_tdls_sleeping
+@@ -3697,7 +3392,6 @@ sint xmitframe_enqueue_for_tdls_sleeping_sta(_adapter *padapter, struct xmit_fra
struct sta_priv *pstapriv = &padapter->stapriv;
struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
int i;
ptdls_sta=rtw_get_stainfo(pstapriv, pattrib->dst);
-@@ -3709,7 +3403,7 @@ sint xmitframe_enqueue_for_tdls_sleeping
+@@ -3709,7 +3403,7 @@ sint xmitframe_enqueue_for_tdls_sleeping_sta(_adapter *padapter, struct xmit_fra
{
ret = _TRUE;
return ret;
_enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL);
-@@ -3749,7 +3443,6 @@ sint xmitframe_enqueue_for_tdls_sleeping
+@@ -3749,7 +3443,6 @@ sint xmitframe_enqueue_for_tdls_sleeping_sta(_adapter *padapter, struct xmit_fra
if(ptdls_sta->sleepq_len==1)
{
//transmit TDLS PTI via AP
rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_SD_PTI);
}
ret = _TRUE;
-@@ -3762,9 +3455,9 @@ sint xmitframe_enqueue_for_tdls_sleeping
+@@ -3762,9 +3455,9 @@ sint xmitframe_enqueue_for_tdls_sleeping_sta(_adapter *padapter, struct xmit_fra
return ret;
}
sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe)
{
-@@ -3778,7 +3471,7 @@ sint xmitframe_enqueue_for_sleeping_sta(
+@@ -3778,7 +3471,7 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p
#ifdef CONFIG_TDLS
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
{
ret = xmitframe_enqueue_for_tdls_sleeping_sta(padapter, pxmitframe);
return ret;
-@@ -3794,11 +3487,21 @@ sint xmitframe_enqueue_for_sleeping_sta(
+@@ -3794,11 +3487,21 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p
}
else
{
if(pattrib->triggered==1)
{
-@@ -3925,6 +3628,7 @@ sint xmitframe_enqueue_for_sleeping_sta(
+@@ -3925,6 +3628,7 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p
static void dequeue_xmitframes_to_sleeping_queue(_adapter *padapter, struct sta_info *psta, _queue *pframequeue)
{
_list *plist, *phead;
u8 ac_index;
struct tx_servq *ptxservq;
-@@ -3941,8 +3645,10 @@ static void dequeue_xmitframes_to_sleepi
+@@ -3941,8 +3645,10 @@ static void dequeue_xmitframes_to_sleeping_queue(_adapter *padapter, struct sta_
plist = get_next(plist);
pattrib = &pxmitframe->attrib;
ptxservq = rtw_get_sta_pending(padapter, psta, pattrib->priority, (u8 *)(&ac_index));
-@@ -3950,6 +3656,12 @@ static void dequeue_xmitframes_to_sleepi
+@@ -3950,6 +3656,12 @@ static void dequeue_xmitframes_to_sleeping_queue(_adapter *padapter, struct sta_
ptxservq->qcnt--;
phwxmits[ac_index].accnt--;
}
}
-@@ -3973,7 +3685,7 @@ void stop_sta_xmit(_adapter *padapter, s
+@@ -3973,7 +3685,7 @@ void stop_sta_xmit(_adapter *padapter, struct sta_info *psta)
#ifdef CONFIG_TDLS
if( !(psta->tdls_sta_state & TDLS_LINKED_STATE) )
pstapriv->sta_dz_bitmap |= BIT(psta->aid);
-@@ -4014,7 +3726,7 @@ void stop_sta_xmit(_adapter *padapter, s
+@@ -4014,7 +3726,7 @@ void stop_sta_xmit(_adapter *padapter, struct sta_info *psta)
_exit_critical_bh(&pxmitpriv->lock, &irqL0);
void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta)
{
-@@ -4024,8 +3736,13 @@ void wakeup_sta_to_xmit(_adapter *padapt
+@@ -4024,8 +3736,13 @@ void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta)
_list *xmitframe_plist, *xmitframe_phead;
struct xmit_frame *pxmitframe=NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
xmitframe_phead = get_list_head(&psta->sleep_q);
xmitframe_plist = get_next(xmitframe_phead);
-@@ -4082,53 +3799,25 @@ void wakeup_sta_to_xmit(_adapter *padapt
+@@ -4082,53 +3799,25 @@ void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta)
pxmitframe->attrib.triggered = 1;
xmitframe_phead = get_list_head(&psta_bmc->sleep_q);
xmitframe_plist = get_next(xmitframe_phead);
-@@ -4148,36 +3837,71 @@ void wakeup_sta_to_xmit(_adapter *padapt
+@@ -4148,36 +3837,71 @@ void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta)
pxmitframe->attrib.triggered = 1;
+ }
+
+ }
-
++
+ if(psta->sleepq_len==0)
+ {
+#ifdef CONFIG_TDLS
+ {
+ if(psta->state&WIFI_SLEEP_STATE)
+ psta->state ^= WIFI_SLEEP_STATE;
-+
+
+ goto _exit;
}
+#endif //CONFIG_TDLS
+ pstapriv->tim_bitmap &= ~BIT(psta->aid);
-+
+
+ //DBG_871X("wakeup to xmit, qlen==0, update_BCNTIM, tim=%x\n", pstapriv->tim_bitmap);
+ //upate BCN for TIM IE
+ //update_BCNTIM(padapter);
+ }
+
+_exit:
-
++
+ //_exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL);
+ _exit_critical_bh(&pxmitpriv->lock, &irqL);
update_beacon(padapter, _TIM_IE_, NULL, _FALSE);
}
-@@ -4190,8 +3914,11 @@ void xmit_delivery_enabled_frames(_adapt
+@@ -4190,8 +3914,11 @@ void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta)
_list *xmitframe_plist, *xmitframe_phead;
struct xmit_frame *pxmitframe=NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
xmitframe_phead = get_list_head(&psta->sleep_q);
xmitframe_plist = get_next(xmitframe_phead);
-@@ -4244,17 +3971,21 @@ void xmit_delivery_enabled_frames(_adapt
+@@ -4244,17 +3971,21 @@ void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta)
pxmitframe->attrib.triggered = 1;
return;
}
#endif //CONFIG_TDLS
-@@ -4267,11 +3998,159 @@ void xmit_delivery_enabled_frames(_adapt
+@@ -4267,11 +3998,159 @@ void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta)
//update_mask = BIT(0);
}
- _exit_critical_bh(&psta->sleep_q.lock, &irqL);
+ //_exit_critical_bh(&psta->sleep_q.lock, &irqL);
+ _exit_critical_bh(&pxmitpriv->lock, &irqL);
-
- }
-
- #endif
-
++
++}
++
++#endif
++
+void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms)
+{
+ sctx->timeout_ms = timeout_ms;
+
+ rtw_msleep_os(10);
+ } while (rtw_get_passing_time_ms(pack_tx_ops->submit_time) < timeout_ms);
-+
+
+ if (pack_tx_ops->status == RTW_SCTX_SUBMITTED) {
+ pack_tx_ops->status = RTW_SCTX_DONE_TIMEOUT;
+ DBG_871X("%s timeout\n", __func__);
+ ret = _SUCCESS;
+
+ return ret;
-+}
+ }
+#endif
+
+int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms)
+ return rtw_ack_tx_polling(pxmitpriv, timeout_ms);
+#else
+ struct submit_ctx *pack_tx_ops = &pxmitpriv->ack_tx_ops;
-+
+
+ pack_tx_ops->submit_time = rtw_get_current_time();
+ pack_tx_ops->timeout_ms = timeout_ms;
+ pack_tx_ops->status = RTW_SCTX_SUBMITTED;
+
+ return rtw_sctx_wait(pack_tx_ops);
-+#endif
+ #endif
+}
+
+void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status)
+ }
+}
+#endif //CONFIG_XMIT_ACK
-+
+
+diff --git a/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c b/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c
+new file mode 100644
+index 0000000..c59bb66
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c
@@ -0,0 +1,177 @@
+}
+
+
+diff --git a/drivers/net/wireless/rtl8192cu/hal/dm.c b/drivers/net/wireless/rtl8192cu/hal/dm.c
+new file mode 100644
+index 0000000..465ca82
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/hal/dm.c
@@ -0,0 +1,314 @@
+#endif /* CONFIG_DM_ADAPTIVITY */
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/hal/dm.h b/drivers/net/wireless/rtl8192cu/hal/dm.h
+new file mode 100644
+index 0000000..dd9a57d
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/hal/dm.h
@@ -0,0 +1,30 @@
+void dm_adaptivity(_adapter *pAdapter);
+
+#endif /* __DM_H__ */
+diff --git a/drivers/net/wireless/rtl8192cu/hal/hal_com.c b/drivers/net/wireless/rtl8192cu/hal/hal_com.c
+new file mode 100644
+index 0000000..4dcafd6
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/hal/hal_com.c
@@ -0,0 +1,371 @@
+ return ret;
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/hal/hal_init.c b/drivers/net/wireless/rtl8192cu/hal/hal_init.c
+deleted file mode 100644
+index edef678..0000000
--- a/drivers/net/wireless/rtl8192cu/hal/hal_init.c
+++ /dev/null
@@ -1,120 +0,0 @@
- padapter->HalFunc.sreset_init_value(padapter);
-}
-#endif
+diff --git a/drivers/net/wireless/rtl8192cu/hal/hal_intf.c b/drivers/net/wireless/rtl8192cu/hal/hal_intf.c
+new file mode 100644
+index 0000000..6c56e72
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/hal/hal_intf.c
@@ -0,0 +1,546 @@
+ return adapter->HalFunc.c2h_id_filter_ccx;
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c
+index 971ef6c..33921e2 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c
@@ -16,8 +16,7 @@
{
u8 read_down = _FALSE;
int retry_cnts = 100;
-@@ -103,17 +47,10 @@ static u8 _is_fw_read_cmd_down(_adapter*
+@@ -103,17 +47,10 @@ static u8 _is_fw_read_cmd_down(_adapter* padapter, u8 isvern, u8 msgbox_num)
// DBG_8192C(" _is_fw_read_cmd_down ,isnormal_chip(%x),reg_1cc(%x),msg_box(%d)...\n",isvern,rtw_read8(padapter,REG_HMETFR),msgbox_num);
do{
}while( (!read_down) && (retry_cnts--));
return read_down;
-@@ -129,19 +66,28 @@ static u8 _is_fw_read_cmd_down(_adapter*
+@@ -129,19 +66,28 @@ static u8 _is_fw_read_cmd_down(_adapter* padapter, u8 isvern, u8 msgbox_num)
******************************************/
int rtl8192c_FillH2CCmd(_adapter* padapter, u8 ElementID, u32 CmdLen, u8* pCmdBuffer)
{
if(!pCmdBuffer){
goto exit;
-@@ -153,7 +99,7 @@ int rtl8192c_FillH2CCmd(_adapter* padapt
+@@ -153,7 +99,7 @@ int rtl8192c_FillH2CCmd(_adapter* padapter, u8 ElementID, u32 CmdLen, u8* pCmdBu
do{
h2c_box_num = pHalData->LastHMEBoxNum;
DBG_8192C(" fw read cmd failed...\n");
goto exit;
}
-@@ -179,14 +125,6 @@ int rtl8192c_FillH2CCmd(_adapter* padapt
+@@ -179,14 +125,6 @@ int rtl8192c_FillH2CCmd(_adapter* padapter, u8 ElementID, u32 CmdLen, u8* pCmdBu
h2c_cmd = cpu_to_le32( h2c_cmd );
rtw_write32(padapter,msgbox_addr, h2c_cmd);
bcmd_down = _TRUE;
// DBG_8192C("MSG_BOX:%d,CmdLen(%d), reg:0x%x =>h2c_cmd:0x%x, reg:0x%x =>h2c_cmd_ex:0x%x ..\n"
-@@ -202,178 +140,13 @@ int rtl8192c_FillH2CCmd(_adapter* padapt
+@@ -202,178 +140,13 @@ int rtl8192c_FillH2CCmd(_adapter* padapter, u8 ElementID, u32 CmdLen, u8* pCmdBu
DBG_8192C("H2C Cmd exe failed. \n" );
*/
ret = _SUCCESS;
}
else
{
-@@ -976,7 +700,7 @@ static void SetFwRsvdPagePkt(PADAPTER Ad
+@@ -976,7 +700,7 @@ static void SetFwRsvdPagePkt(PADAPTER Adapter, BOOLEAN bDLFinished)
pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TxDescLen;
_rtw_memcpy(pmgntframe->buf_addr, ReservedPagePacket, TotalPacketLen);
#ifdef CONFIG_IOL
#include <rtw_iol.h>
-@@ -1199,9 +920,8 @@ int rtl8192c_IOL_exec_cmds_sync(ADAPTER
+@@ -1199,9 +920,8 @@ int rtl8192c_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame,
if (rtw_IOL_append_END_cmd(xmit_frame) != _SUCCESS)
goto exit;
//keep alive period = 3 * 10 BCN interval
pwowlan_parm.mode =3;
pwowlan_parm.gpio_index=3;
-@@ -1356,6 +1155,5 @@ _func_exit_;
+@@ -1358,4 +1157,3 @@ _func_exit_;
-
-
-
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c
+index be1e800..6e5634c 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c
@@ -15,8 +15,8 @@
value_IGI = DM_DIG_FA_LOWER;
if(FalseAlmCnt->Cnt_all > 10000)
-@@ -276,7 +319,10 @@ VOID dm_CtrlInitGainByRssi( IN PADAPTER
+@@ -276,7 +319,10 @@ VOID dm_CtrlInitGainByRssi( IN PADAPTER pAdapter)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
struct dm_priv *pdmpriv = &pHalData->dmpriv;
DIG_T *pDigTable = &pdmpriv->DM_DigTable;
//modify DIG upper bound
if((pDigTable->Rssi_val_min + 20) > DM_DIG_MAX )
-@@ -393,6 +439,22 @@ VOID dm_CtrlInitGainByRssi( IN PADAPTER
+@@ -393,6 +439,22 @@ VOID dm_CtrlInitGainByRssi( IN PADAPTER pAdapter)
if(pDigTable->CurIGValue < pDigTable->rx_gain_range_min)
pDigTable->CurIGValue = pDigTable->rx_gain_range_min;
//printk("%s => rx_gain_range_max(0x%02x) rx_gain_range_min(0x%02x)\n",__FUNCTION__,
// pDigTable->rx_gain_range_max,pDigTable->rx_gain_range_min);
//printk("%s CurIGValue(0x%02x) <====\n",__FUNCTION__,pDigTable->CurIGValue );
-@@ -408,6 +470,10 @@ static VOID dm_CtrlInitGainByRssi(IN PAD
+@@ -408,6 +470,10 @@ static VOID dm_CtrlInitGainByRssi(IN PADAPTER pAdapter)
struct dm_priv *pdmpriv = &pHalData->dmpriv;
DIG_T *pDigTable = &pdmpriv->DM_DigTable;
PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pdmpriv->FalseAlmCnt);
//modify DIG upper bound
if((pDigTable->Rssi_val_min + 20) > DM_DIG_MAX )
-@@ -415,7 +481,6 @@ static VOID dm_CtrlInitGainByRssi(IN PAD
+@@ -415,7 +481,6 @@ static VOID dm_CtrlInitGainByRssi(IN PADAPTER pAdapter)
else
pDigTable->rx_gain_range_max = pDigTable->Rssi_val_min + 20;
//printk("%s Rssi_val_min(0x%02x),rx_gain_range_max(0x%02x)\n",__FUNCTION__,pDigTable->Rssi_val_min,pDigTable->rx_gain_range_max);
//modify DIG lower bound, deal with abnorally large false alarm
if(FalseAlmCnt->Cnt_all > 10000)
{
-@@ -515,6 +580,14 @@ static VOID dm_CtrlInitGainByRssi(IN PAD
+@@ -515,6 +580,14 @@ static VOID dm_CtrlInitGainByRssi(IN PADAPTER pAdapter)
}
#endif
//Check initial gain by upper/lower bound
if(pDigTable->CurIGValue >pDigTable->rx_gain_range_max)
pDigTable->CurIGValue = pDigTable->rx_gain_range_max;
-@@ -522,6 +595,22 @@ static VOID dm_CtrlInitGainByRssi(IN PAD
+@@ -522,6 +595,22 @@ static VOID dm_CtrlInitGainByRssi(IN PADAPTER pAdapter)
if(pDigTable->CurIGValue < pDigTable->rx_gain_range_min)
pDigTable->CurIGValue = pDigTable->rx_gain_range_min;
//RTPRINT(FDM, DM_Monitor, ("dm_DIG() ==>\n"));
if(pdmpriv->bDMInitialGainEnable == _FALSE)
-@@ -854,7 +993,11 @@ static void dm_InitDynamicTxPower(IN PAD
+@@ -854,7 +993,11 @@ static void dm_InitDynamicTxPower(IN PADAPTER Adapter)
struct dm_priv *pdmpriv = &pHalData->dmpriv;
#ifdef CONFIG_USB_HCI
{
dm_SavePowerIndex(Adapter);
pdmpriv->bDynamicTxPowerEnable = _TRUE;
-@@ -900,7 +1043,47 @@ static void dm_DynamicTxPower(IN PADAPTE
+@@ -900,7 +1043,47 @@ static void dm_DynamicTxPower(IN PADAPTER Adapter)
pdmpriv->LastDTPLvl=TxHighPwrLevel_Normal;
return;
}
if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) // Default port
{
//todo: AP Mode
-@@ -938,7 +1121,7 @@ static void dm_DynamicTxPower(IN PADAPTE
+@@ -938,7 +1121,7 @@ static void dm_DynamicTxPower(IN PADAPTER Adapter)
pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
//RT_TRACE(COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n"));
}
u32 DPK_delta_mapping[2][DPK_DELTA_MAPPING_NUM] = {
{0x1c, 0x1c, 0x1d, 0x1d, 0x1e,
0x1f, 0x00, 0x00, 0x01, 0x01,
-@@ -1291,14 +1470,18 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1291,14 +1470,18 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
{0x1c, 0x1d, 0x1e, 0x1e, 0x1e,
0x1f, 0x00, 0x00, 0x01, 0x02,
0x02, 0x03, 0x03}};
pdmpriv->TXPowerTrackingCallbackCnt++; //cosa add for debug
pdmpriv->bTXPowerTrackingInit = _TRUE;
-@@ -1310,12 +1493,11 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1310,12 +1493,11 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
//DBG_8192C("===>dm_TXPowerTrackingCallback_ThermalMeter_92C\n");
if(is2T)
rf = 2;
-@@ -1328,7 +1510,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1328,7 +1510,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
{
//Query OFDM path A default setting
ele_D = PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, bMaskDWord)&bMaskOFDM_D;
{
if(ele_D == (OFDMSwingTable[i]&bMaskOFDM_D))
{
-@@ -1342,7 +1524,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1342,7 +1524,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
if(is2T)
{
ele_D = PHY_QueryBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord)&bMaskOFDM_D;
{
if(ele_D == (OFDMSwingTable[i]&bMaskOFDM_D))
{
-@@ -1434,7 +1616,6 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1434,7 +1616,6 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
}
delta_LCK = (ThermalValue > pdmpriv->ThermalValue_LCK)?(ThermalValue - pdmpriv->ThermalValue_LCK):(pdmpriv->ThermalValue_LCK - ThermalValue);
delta_IQK = (ThermalValue > pdmpriv->ThermalValue_IQK)?(ThermalValue - pdmpriv->ThermalValue_IQK):(pdmpriv->ThermalValue_IQK - ThermalValue);
//DBG_8192C("Readback Thermal Meter = 0x%lx pre thermal meter 0x%lx EEPROMthermalmeter 0x%lx delta 0x%lx delta_LCK 0x%lx delta_IQK 0x%lx\n", ThermalValue, pHalData->ThermalValue, pHalData->EEPROMThermalMeter, delta, delta_LCK, delta_IQK);
-@@ -1480,29 +1661,26 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1480,29 +1661,26 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
{
for(i = 0; i < rf; i++)
pdmpriv->OFDM_index[i] -= delta;
//no adjust
#ifdef CONFIG_USB_HCI
-@@ -1521,8 +1699,8 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1521,8 +1699,8 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
OFDM_index[i] = pdmpriv->OFDM_index[i];
CCK_index = pdmpriv->CCK_index;
}
for(i = 0; i < rf; i++)
{
if(TxPwrLevel[i] >=0 && TxPwrLevel[i] <=26)
-@@ -1584,34 +1762,33 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1584,34 +1762,33 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
for(i = 0; i < rf; i++)
{
X = pdmpriv->RegE94;
Y = pdmpriv->RegE9C;
-@@ -1642,7 +1819,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1642,7 +1819,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
}
else
{
PHY_SetBBReg(Adapter, rOFDM0_XCTxAFE, bMaskH4Bits, 0x00);
PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT31|BIT29, 0x00);
}
-@@ -1651,24 +1828,24 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1651,24 +1828,24 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
//Adjust CCK according to IQK result
if(!pdmpriv->bCCKinCH14){
}
if(is2T)
-@@ -1704,7 +1881,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1704,7 +1881,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
}
else{
PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00);
PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT27|BIT25, 0x00);
}
-@@ -1716,7 +1893,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1716,7 +1893,7 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
DBG_8192C("TxPwrTracking 0xc80 = 0x%x, 0xc94 = 0x%x RF 0x24 = 0x%x\n", \
PHY_QueryBBReg(Adapter, 0xc80, bMaskDWord),\
PHY_QueryBBReg(Adapter, 0xc94, bMaskDWord), \
*/
}
-@@ -1730,20 +1907,6 @@ dm_TXPowerTrackingCallback_ThermalMeter_
+@@ -1730,20 +1907,6 @@ dm_TXPowerTrackingCallback_ThermalMeter_92C(
rtl8192c_PHY_IQCalibrate(Adapter,_FALSE);
}
#endif
}
-@@ -3275,10 +3438,14 @@ static void dm_CheckPbcGPIO(_adapter *pa
+@@ -3275,10 +3438,14 @@ static void dm_CheckPbcGPIO(_adapter *padapter)
{
u8 tmp1byte;
u8 bPbcPressed = _FALSE;
#ifdef CONFIG_USB_HCI
tmp1byte = rtw_read8(padapter, GPIO_IO_SEL);
tmp1byte |= (HAL_8192C_HW_GPIO_WPS_BIT);
-@@ -3294,30 +3461,44 @@ static void dm_CheckPbcGPIO(_adapter *pa
+@@ -3294,30 +3461,44 @@ static void dm_CheckPbcGPIO(_adapter *padapter)
tmp1byte =rtw_read8(padapter, GPIO_IN);
if (tmp1byte == 0xff)
#ifdef RTK_DMP_PLATFORM
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
-@@ -3336,7 +3517,7 @@ static void dm_CheckPbcGPIO(_adapter *pa
+@@ -3336,7 +3517,7 @@ static void dm_CheckPbcGPIO(_adapter *padapter)
rtw_signal_process(padapter->pid[0], SIGUSR1);
#endif
#endif
if(pdmpriv->initialize == 0){
pdmpriv->rf_saving_Reg874 = (PHY_QueryBBReg(pAdapter, rFPGA0_XCD_RFInterfaceSW, bMaskDWord)&0x1CC000)>>14;
pdmpriv->rf_saving_RegC70 = (PHY_QueryBBReg(pAdapter, rOFDM0_AGCParameter1, bMaskDWord)&BIT3)>>3;
-@@ -4424,7 +4603,7 @@ void rtl8192c_init_dm_priv(IN PADAPTER A
+@@ -4424,7 +4603,7 @@ void rtl8192c_init_dm_priv(IN PADAPTER Adapter)
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
struct dm_priv *pdmpriv = &pHalData->dmpriv;
{
- u8 trigger=0,evt_id=0,evt_len=0,idx=0,tmp8=0,evt_seq=0;
- u8 evt_buf[15];
+-
+- trigger=rtw_read8(padapter,REG_C2HEVT_CLEAR);
+- while (trigger ==0xFF)
+- {
+- tmp8=rtw_read8(padapter,REG_C2HEVT_MSG_NORMAL);
+- evt_id=tmp8&0xf;
+- evt_len=(tmp8&0xf0)>>4;
+- evt_seq=rtw_read8(padapter,REG_C2HEVT_MSG_NORMAL+1);
+- DBG_8192C(" %s evt_id =0x%x evt_len=0x%x evt_seq=0x%x\n",__FUNCTION__,evt_id,evt_len,evt_seq);
+- for(idx=0;idx<evt_len;idx++){
+- evt_buf[idx]=rtw_read8(padapter,(REG_C2HEVT_MSG_NORMAL+2+idx));
+- }
+- switch(evt_id){
+- case EVT_EXT_RA_RPT_EID:
+- DBG_8192C(" %s EVT_EXT_RA_RPT_EID[0x%x] evt_len=0x%x\n",__FUNCTION__,evt_id,evt_len);
+- {
+- u8 mac_id=evt_buf[0],num_sta=evt_len-1;
+- struct sta_priv *pstapriv=&padapter->stapriv;
+- struct sta_info *psta=NULL;
+- DBG_8192C(" %s mac_id=%d\n",__FUNCTION__,mac_id);
+- for(idx=0;idx<num_sta;idx++){
+- psta=pstapriv->sta_aid[mac_id-2+idx];
+- if(psta !=NULL){
+- psta->init_rate=evt_buf[idx];
+- DBG_8192C(" %s mac_id=%d psta->init_rate=0x%x\n",__FUNCTION__,mac_id,psta->init_rate);
+- }
+- }
+-
+- }
+- default:
+- DBG_8192C(" %s evt_id =0x%x evt_len=0x%x\n",__FUNCTION__,evt_id,evt_len);
+- }
+- rtw_write8(padapter, REG_C2HEVT_CLEAR,0x0);
+- rtw_mdelay_os(1);
+- trigger=rtw_read8(padapter,REG_C2HEVT_CLEAR);
+ PHAL_DATA_TYPE pbuddy_HalData;
+ struct dm_priv *pbuddy_dmpriv;
+ PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
+
+ pbuddy_HalData = GET_HAL_DATA(pbuddy_adapter);
+ pbuddy_dmpriv = &pbuddy_HalData->dmpriv;
-
-- trigger=rtw_read8(padapter,REG_C2HEVT_CLEAR);
-- while (trigger ==0xFF)
++
+ //get min. [PWDB] when both interfaces are connected
+ if((check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE
+ && Adapter->stapriv.asoc_sta_count > 2
+ && check_buddy_fwstate(Adapter,_FW_LINKED)))
+ {
+ pdmpriv->UndecoratedSmoothedPWDB = pbuddy_dmpriv->UndecoratedSmoothedPWDB;
-+ }
+ }
+- //DBG_8192C(" %s End\n",__FUNCTION__);
+-}
+ //secondary is not connected
+ else if((check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE
+ && Adapter->stapriv.asoc_sta_count > 2) ||
+ (check_fwstate(pmlmepriv, WIFI_STATION_STATE)
+ && check_fwstate(pmlmepriv, _FW_LINKED)))
- {
-- tmp8=rtw_read8(padapter,REG_C2HEVT_MSG_NORMAL);
-- evt_id=tmp8&0xf;
-- evt_len=(tmp8&0xf0)>>4;
-- evt_seq=rtw_read8(padapter,REG_C2HEVT_MSG_NORMAL+1);
-- DBG_8192C(" %s evt_id =0x%x evt_len=0x%x evt_seq=0x%x\n",__FUNCTION__,evt_id,evt_len,evt_seq);
-- for(idx=0;idx<evt_len;idx++){
-- evt_buf[idx]=rtw_read8(padapter,(REG_C2HEVT_MSG_NORMAL+2+idx));
-- }
-- switch(evt_id){
-- case EVT_EXT_RA_RPT_EID:
-- DBG_8192C(" %s EVT_EXT_RA_RPT_EID[0x%x] evt_len=0x%x\n",__FUNCTION__,evt_id,evt_len);
-- {
-- u8 mac_id=evt_buf[0],num_sta=evt_len-1;
-- struct sta_priv *pstapriv=&padapter->stapriv;
-- struct sta_info *psta=NULL;
-- DBG_8192C(" %s mac_id=%d\n",__FUNCTION__,mac_id);
-- for(idx=0;idx<num_sta;idx++){
-- psta=pstapriv->sta_aid[mac_id-2+idx];
-- if(psta !=NULL){
-- psta->init_rate=evt_buf[idx];
-- DBG_8192C(" %s mac_id=%d psta->init_rate=0x%x\n",__FUNCTION__,mac_id,psta->init_rate);
-- }
-- }
--
-- }
-- default:
-- DBG_8192C(" %s evt_id =0x%x evt_len=0x%x\n",__FUNCTION__,evt_id,evt_len);
-- }
-- rtw_write8(padapter, REG_C2HEVT_CLEAR,0x0);
-- rtw_mdelay_os(1);
-- trigger=rtw_read8(padapter,REG_C2HEVT_CLEAR);
++ {
+ pbuddy_dmpriv->UndecoratedSmoothedPWDB = 0;
- }
-- //DBG_8192C(" %s End\n",__FUNCTION__);
--}
++ }
+ //both interfaces are not connected
+ else
+ {
// Check GPIO to determine current RF on/off and Pbc status.
// Check Hardware Radio ON/OFF or not
//if(Adapter->MgntInfo.PowerSaveControl.bGpioRfSw)
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c
+index e3e2ae9..b9e91d7 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c
@@ -16,7 +16,7 @@
- pageNums = size / MAX_PAGE_SIZE ;
- //RT_ASSERT((pageNums <= 4), ("Page numbers should not greater then 4 \n"));
- remainSize = size % MAX_PAGE_SIZE;
--
++ pageNums = size / MAX_PAGE_SIZE ;
++ //RT_ASSERT((pageNums <= 4), ("Page numbers should not greater then 4 \n"));
++ remainSize = size % MAX_PAGE_SIZE;
++
++ for(page = 0; page < pageNums; page++){
++ offset = page *MAX_PAGE_SIZE;
++ ret = _PageWrite(Adapter,page, (bufferPtr+offset),MAX_PAGE_SIZE);
+
- for(page = 0; page < pageNums; page++){
- offset = page *MAX_PAGE_SIZE;
- ret = _PageWrite(Adapter,page, (bufferPtr+offset),MAX_PAGE_SIZE);
- goto exit;
- }
- //RT_TRACE(COMP_INIT, DBG_LOUD, ("_WriteFW Done- for Normal chip.\n"));
-+ pageNums = size / MAX_PAGE_SIZE ;
-+ //RT_ASSERT((pageNums <= 4), ("Page numbers should not greater then 4 \n"));
-+ remainSize = size % MAX_PAGE_SIZE;
-+
-+ for(page = 0; page < pageNums; page++){
-+ offset = page *MAX_PAGE_SIZE;
-+ ret = _PageWrite(Adapter,page, (bufferPtr+offset),MAX_PAGE_SIZE);
-+
+ if(ret == _FAIL)
+ goto exit;
}
- pFwImageFileName = R92CFwImageFileName_UMC;
- FwImage = Rtl819XFwUMCACutImageArray;
- FwImageLen = UMCACutImgArrayLength;
--#ifdef CONFIG_WOWLAN
++ pFwImageFileName = R92CFwImageFileName_UMC;
++ FwImage = Rtl819XFwUMCACutImageArray;
++ FwImageLen = UMCACutImgArrayLength;
+ #ifdef CONFIG_WOWLAN
- pFwImageFileName_WoWLAN = R92CFwImageFileName_UMC_WW;
- FwImageWoWLAN= Rtl8192C_FwUMCWWImageArray;
- FwImageWoWLANLen =UMCACutWWImgArrayLength ;
- pFwImageFileName = R92CFwImageFileName_UMC_B;
- FwImage = Rtl819XFwUMCBCutImageArray;
- FwImageLen = UMCBCutImgArrayLength;
-+ pFwImageFileName = R92CFwImageFileName_UMC;
-+ FwImage = Rtl819XFwUMCACutImageArray;
-+ FwImageLen = UMCACutImgArrayLength;
- #ifdef CONFIG_WOWLAN
-- pFwImageFileName_WoWLAN = R92CFwImageFileName_UMC_B_WW;
-- FwImageWoWLAN= Rtl8192C_FwUMCBCutWWImageArray;
-- FwImageWoWLANLen =UMCBCutWWImgArrayLength ;
--#endif
--
-- DBG_8192C(" ===> FirmwareDownload91C() fw:Rtl819XFwImageArray_UMC_B\n");
-- }
-- else
-- {
-- pFwImageFileName = R92CFwImageFileName_TSMC;
-- FwImage = Rtl819XFwTSMCImageArray;
-- FwImageLen = TSMCImgArrayLength;
+ pFwImageFileName_WoWLAN = R92CFwImageFileName_UMC_WW;
+ FwImageWoWLAN= Rtl8192C_FwUMCWWImageArray;
+ FwImageWoWLANLen =UMCACutWWImgArrayLength ;
+ FwImage = Rtl819XFwUMCBCutImageArray;
+ FwImageLen = UMCBCutImgArrayLength;
#ifdef CONFIG_WOWLAN
+- pFwImageFileName_WoWLAN = R92CFwImageFileName_UMC_B_WW;
+- FwImageWoWLAN= Rtl8192C_FwUMCBCutWWImageArray;
+- FwImageWoWLANLen =UMCBCutWWImgArrayLength ;
+-#endif
+-
+- DBG_8192C(" ===> FirmwareDownload91C() fw:Rtl819XFwImageArray_UMC_B\n");
+- }
+- else
+- {
+- pFwImageFileName = R92CFwImageFileName_TSMC;
+- FwImage = Rtl819XFwTSMCImageArray;
+- FwImageLen = TSMCImgArrayLength;
+-#ifdef CONFIG_WOWLAN
- pFwImageFileName_WoWLAN = R92CFwImageFileName_TSMC_WW;
- FwImageWoWLAN= Rtl8192C_FwTSMCWWImageArray;
- FwImageWoWLANLen =TSMCWWImgArrayLength ;
return ChipVersion;
}
+-
+-RT_CHANNEL_DOMAIN
+-_HalMapChannelPlan8192C(
+- IN PADAPTER Adapter,
+- IN u8 HalChannelPlan
+void
+rtl8192c_EfuseParseChnlPlan(
+ IN PADAPTER padapter,
+ IN u8* hwinfo,
+ IN BOOLEAN AutoLoadFail
-+ )
-+{
-+ padapter->mlmepriv.ChannelPlan = hal_com_get_channel_plan(
-+ padapter
-+ , hwinfo?hwinfo[EEPROM_CHANNEL_PLAN]:0xFF
-+ , padapter->registrypriv.channel_plan
-+ , RT_CHANNEL_DOMAIN_WORLD_WIDE_13
-+ , AutoLoadFail
-+ );
-
--RT_CHANNEL_DOMAIN
--_HalMapChannelPlan8192C(
-- IN PADAPTER Adapter,
-- IN u8 HalChannelPlan
-- )
--{
+ )
+ {
- RT_CHANNEL_DOMAIN rtChannelDomain;
-
- switch(HalChannelPlan)
-
- return rtChannelDomain;
-
++ padapter->mlmepriv.ChannelPlan = hal_com_get_channel_plan(
++ padapter
++ , hwinfo?hwinfo[EEPROM_CHANNEL_PLAN]:0xFF
++ , padapter->registrypriv.channel_plan
++ , RT_CHANNEL_DOMAIN_WORLD_WIDE_13
++ , AutoLoadFail
++ );
++
+ DBG_871X("mlmepriv.ChannelPlan = 0x%02x\n", padapter->mlmepriv.ChannelPlan);
}
{
*pu2Tmp = (u16)EFUSE_MAP_LEN_8723;
}
-@@ -2320,7 +2245,7 @@ hal_EfuseGetCurrentSize_8723(IN PADAPTER
+@@ -2320,7 +2245,7 @@ hal_EfuseGetCurrentSize_8723(IN PADAPTER pAdapter,
}
else
{
}
//RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723(), start_efuse_addr = %d\n", efuse_addr));
-@@ -2368,7 +2293,7 @@ hal_EfuseGetCurrentSize_8723(IN PADAPTER
+@@ -2368,7 +2293,7 @@ hal_EfuseGetCurrentSize_8723(IN PADAPTER pAdapter,
}
else
{
{
ret = hal_EfuseGetCurrentSize_8723(pAdapter, bPseudoTest);
}
-@@ -2631,7 +2556,7 @@ Hal_EfusePgPacketRead( IN PADAPTER pAdap
+@@ -2631,7 +2556,7 @@ Hal_EfusePgPacketRead( IN PADAPTER pAdapter,
{
ret = hal_EfusePgPacketRead_8192C(pAdapter, offset, data, bPseudoTest);
}
startAddr%=EFUSE_REAL_CONTENT_LEN;
}
}
-@@ -3533,7 +3458,7 @@ Hal_EfusePgPacketWrite(IN PADAPTER pAdap
+@@ -3533,7 +3458,7 @@ Hal_EfusePgPacketWrite(IN PADAPTER pAdapter,
{
ret = hal_EfusePgPacketWrite_8192C(pAdapter, offset, word_en, data, bPseudoTest);
}
{
ret = hal_EfusePgPacketWrite_8723(pAdapter, offset, word_en, data, bPseudoTest);
}
-@@ -3591,7 +3516,62 @@ void rtl8192c_read_chip_version(PADAPTER
+@@ -3591,7 +3516,62 @@ void rtl8192c_read_chip_version(PADAPTER pAdapter)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
pHalData->VersionID = rtl8192c_ReadChipVersion(pAdapter);
}
void rtl8192c_set_hal_ops(struct hal_ops *pHalFunc)
{
pHalFunc->free_hal_data = &rtl8192c_free_hal_data;
-@@ -3608,15 +3588,15 @@ void rtl8192c_set_hal_ops(struct hal_ops
+@@ -3608,15 +3588,15 @@ void rtl8192c_set_hal_ops(struct hal_ops *pHalFunc)
pHalFunc->Add_RateATid = &rtl8192c_Add_RateATid;
#ifdef CONFIG_ANTENNA_DIVERSITY
//Efuse related function
pHalFunc->EfusePowerSwitch = &rtl8192c_EfusePowerSwitch;
pHalFunc->ReadEFuse = &rtl8192c_ReadEFuse;
-@@ -3627,16 +3607,22 @@ void rtl8192c_set_hal_ops(struct hal_ops
+@@ -3627,16 +3607,22 @@ void rtl8192c_set_hal_ops(struct hal_ops *pHalFunc)
pHalFunc->Efuse_WordEnableDataWrite = &rtl8192c_Efuse_WordEnableDataWrite;
#ifdef DBG_CONFIG_ERROR_DETECT
+ pHalFunc->c2h_id_filter_ccx = c2h_id_filter_ccx_8192c;
}
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c
+index a3021a9..a4194c4 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c
-@@ -107,7 +107,7 @@ void Hal_mpt_SwitchRfSetting(PADAPTER pA
+@@ -107,7 +107,7 @@ void Hal_mpt_SwitchRfSetting(PADAPTER pAdapter)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
struct mp_priv *pmp = &pAdapter->mppriv;
u8 ulRateIdx = pmp->rateidx;
u8 ulbandwidth = pmp->bandwidth;
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.MptCtx);
-@@ -340,7 +340,7 @@ void Hal_MPT_CCKTxPowerAdjustbyIndex(PAD
+@@ -340,7 +340,7 @@ void Hal_MPT_CCKTxPowerAdjustbyIndex(PADAPTER pAdapter, BOOLEAN beven)
PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx;
#endif
}
-@@ -538,14 +531,6 @@ void Hal_SetOFDMTxPower(PADAPTER pAdapte
+@@ -538,14 +531,6 @@ void Hal_SetOFDMTxPower(PADAPTER pAdapter, u8 *TxPower)
write_bbreg(pAdapter, rTxAGC_A_Mcs11_Mcs08, bMaskDWord, TxAGC);
write_bbreg(pAdapter, rTxAGC_A_Mcs15_Mcs12, bMaskDWord, TxAGC);
// HT Tx-rf(B)
tmpval = TxPower[RF_PATH_B];
TxAGC = (tmpval<<24) | (tmpval<<16) | (tmpval<<8) | tmpval;
-@@ -557,14 +542,6 @@ void Hal_SetOFDMTxPower(PADAPTER pAdapte
+@@ -557,14 +542,6 @@ void Hal_SetOFDMTxPower(PADAPTER pAdapter, u8 *TxPower)
write_bbreg(pAdapter, rTxAGC_B_Mcs11_Mcs08, bMaskDWord, TxAGC);
write_bbreg(pAdapter, rTxAGC_B_Mcs15_Mcs12, bMaskDWord, TxAGC);
}
#endif
// 2009/01/08 MH From Sd3 Willis. We need to enable RFA/B by SW control
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c
+index e527028..1bae6da 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c
@@ -16,8 +16,7 @@
// 2009/10/21 by SD1 Jong. Modified by tynli. Not in Documented in V8.1.
- if(!IS_NORMAL_CHIP(pHalData->VersionID))
- {
- #ifdef CONFIG_USB_HCI
+-#ifdef CONFIG_USB_HCI
- rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x1f);
-#else
- rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x1b);
-+ //To Fix MAC loopback mode fail. Suggested by SD4 Johnny. 2010.03.23.
-+ rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x0f);
-+ rtw_write8(Adapter, 0x15, 0xe9);
- #endif
+-#endif
- }
- else
- {
--#ifdef CONFIG_USB_HCI
+ #ifdef CONFIG_USB_HCI
- //To Fix MAC loopback mode fail. Suggested by SD4 Johnny. 2010.03.23.
- rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x0f);
- rtw_write8(Adapter, 0x15, 0xe9);
--#endif
++ //To Fix MAC loopback mode fail. Suggested by SD4 Johnny. 2010.03.23.
++ rtw_write8(Adapter, REG_LDOHCI12_CTRL, 0x0f);
++ rtw_write8(Adapter, 0x15, 0xe9);
+ #endif
- }
rtw_write8(Adapter, REG_AFE_XTAL_CTRL+1, 0x80);
)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
-@@ -1992,7 +1908,7 @@ u32 Rtl8192S_HighPower_RadioA_Array[High
+@@ -1992,7 +1908,7 @@ u32 Rtl8192S_HighPower_RadioA_Array[HighPowerRadioAArrayLen] = {
int
PHY_ConfigRFExternalPA(
IN PADAPTER Adapter,
switch(pHalData->CurrentChannelBW)
{
-@@ -3041,6 +2941,11 @@ static void _PHY_SwChnl8192C(PADAPTER Ad
+@@ -3041,6 +2941,11 @@ static void _PHY_SwChnl8192C(PADAPTER Adapter, u8 channel)
u32 param1, param2;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
//s1. pre common command - CmdID_SetTxPowerLevel
PHY_SetTxPowerLevel8192C(Adapter, channel);
-@@ -3050,7 +2955,7 @@ static void _PHY_SwChnl8192C(PADAPTER Ad
+@@ -3050,7 +2955,7 @@ static void _PHY_SwChnl8192C(PADAPTER Adapter, u8 channel)
for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
{
pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2);
- APK_value[index] = APK_normal_value[index];
- AFE_on_off[index] = 0x6fdb25a4;
- }
--
+
- for(index = 0; index < APK_BB_REG_NUM; index ++)
- {
- for(path = 0; path < pathbound; path++)
- }
- BB_AP_MODE[index] = BB_normal_AP_MODE[index];
- }
-
+-
- apkbound = 6;
+ //settings adjust for normal chip
+ for(index = 0; index < PATH_NUM; index ++)
- PHY_SetBBReg(pAdapter, 0xb28, bMaskDWord, 0x12680000);
-
- PHY_SetBBReg(pAdapter, 0xb98, bMaskDWord, 0x12680000);
-+ PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_1[index]);
-+ //RTPRINT(FINIT, INIT_IQK, ("PHY_APCalibrate() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord)));
-
+-
- offset = 0xb68;
- index = 11;
- for(; index < 13; index ++) //offset 0xb68, 0xb6c
-
- offset += 0x04;
- }
--
++ PHY_SetBBReg(pAdapter, offset, bMaskDWord, APK_normal_setting_value_1[index]);
++ //RTPRINT(FINIT, INIT_IQK, ("PHY_APCalibrate() offset 0x%x value 0x%x\n", offset, PHY_QueryBBReg(pAdapter, offset, bMaskDWord)));
+
- //page-B1
- PHY_SetBBReg(pAdapter, 0xe28, bMaskDWord, 0x40000000);
+ offset += 0x04;
{
- PHY_SetRFReg(pAdapter, RF90_PATH_A, 0x10, bMaskDWord, 0x1000f);
- PHY_SetRFReg(pAdapter, RF90_PATH_A, 0x11, bMaskDWord, 0x20101);
-+ PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE1, bRFRegOffsetMask, 0x1000f);
-+ PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE2, bRFRegOffsetMask, 0x20101);
- }
+- }
-#if 1
- if(!isNormal)
- {
- RTPRINT(FINIT, INIT_IQK, ("apk result %d 0x%x \t", 4, APK_result[path][4]));
-#endif
-
-- }
++ PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE1, bRFRegOffsetMask, 0x1000f);
++ PHY_SetRFReg(pAdapter, RF_PATH_A, RF_MODE2, bRFRegOffsetMask, 0x20101);
+ }
-#endif
+
+ //note no index == 0
+ rOFDM0_XATxIQImbalance, rOFDM0_XBTxIQImbalance,
+ rOFDM0_XCTxAFE, rOFDM0_XDTxAFE,
+ rOFDM0_RxIQExtAnta};
-
-
--#if (MP_DRIVER == 1)
++
++
+#if MP_DRIVER == 1
+ bStartContTx = pAdapter->mppriv.MptCtx.bStartContTx;
+ bSingleTone = pAdapter->mppriv.MptCtx.bSingleTone;
+ bCarrierSuppression = pAdapter->mppriv.MptCtx.bCarrierSuppression;
+#endif
-+
+
+-
+-#if (MP_DRIVER == 1)
//ignore IQK when continuous Tx
- if (pAdapter->mppriv.MptCtx.bStartContTx == _TRUE)
- return;
- if (pAdapter->mppriv.MptCtx.bCarrierSuppression == _TRUE)
- return;
- if (pAdapter->mppriv.MptCtx.bSingleCarrier == _TRUE)
+- return;
+- if (pAdapter->mppriv.MptCtx.bSingleTone == _TRUE)
+ if(bStartContTx || bSingleTone || bCarrierSuppression)
return;
-- if (pAdapter->mppriv.MptCtx.bSingleTone == _TRUE)
-- return;
-#endif
#if DISABLE_BB_RF
-}
-#endif
-
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c
+index 593ea09..cf46969 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c
@@ -16,8 +16,7 @@
/******************************************************************************
*
*
-@@ -109,35 +108,35 @@ void rtl8192c_RF_ChangeTxPath( IN PADAPT
+@@ -109,35 +108,35 @@ void rtl8192c_RF_ChangeTxPath( IN PADAPTER Adapter,
if (RF_Path_Type == 2 && (DataRate&0xF) <= 0x7)
{
// Set TX SYNC power G2G3 loop filter
}
}
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c
+index 5aa6e61..3e0d795 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c
@@ -16,7 +16,7 @@
#define _RTL8192C_REDESC_C_
#include <drv_conf.h>
#include <osdep_service.h>
-@@ -196,7 +196,7 @@ static s32 translate2dbm(u8 signal_stre
+@@ -196,7 +196,7 @@ static s32 translate2dbm(u8 signal_strength_idx)
return signal_power;
}
{
PHY_STS_OFDM_8192CD_T *pOfdm_buf;
PHY_STS_CCK_8192CD_T *pCck_buf;
-@@ -383,9 +383,9 @@ void rtl8192c_query_rx_phy_status(union
+@@ -383,9 +383,9 @@ void rtl8192c_query_rx_phy_status(union recv_frame *prframe, struct phy_stat *pp
//continue;
rx_pwr[i] = ((pOfdm_buf->trsw_gain_X[i]&0x3F)*2) - 110;
total_rssi += rssi;
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], rssi));
-@@ -733,8 +733,7 @@ static void process_link_qual(_adapter *
+@@ -733,8 +733,7 @@ static void process_link_qual(_adapter *padapter,union recv_frame *prframe)
}// Process_UiLinkQuality8192S
{
union recv_frame *precvframe = (union recv_frame *)prframe;
-@@ -764,4 +763,114 @@ void rtl8192c_process_phy_info(_adapter
-
+@@ -765,3 +764,113 @@ void rtl8192c_process_phy_info(_adapter *padapter, void *prframe)
}
-+
+
+void rtl8192c_translate_rx_signal_stuff(union recv_frame *precvframe, struct phy_stat *pphy_info)
+{
+ struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib;
+
+}
+
-
++
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c
+index e2817f3..1368d66 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c
@@ -16,189 +16,10 @@
void rtl8192c_sreset_xmit_status_check(_adapter *padapter)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
-@@ -210,34 +31,44 @@ void rtl8192c_sreset_xmit_status_check(_
+@@ -210,34 +31,44 @@ void rtl8192c_sreset_xmit_status_check(_adapter *padapter)
u32 txdma_status;
if( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){
DBG_871X("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status);
u32 regc50,regc58,reg824,reg800;
regc50 = rtw_read32(padapter,0xc50);
regc58 = rtw_read32(padapter,0xc58);
-@@ -250,44 +81,14 @@ void rtl8192c_sreset_linked_status_check
+@@ -250,44 +81,14 @@ void rtl8192c_sreset_linked_status_check(_adapter *padapter)
{
DBG_8192C("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__,
regc50, regc58, reg824, reg800);
#endif
-#endif
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c
+new file mode 100644
+index 0000000..2cfd851
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c
@@ -0,0 +1,63 @@
+}
+#endif //CONFIG_XMIT_ACK
+
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c
+index 1615b5d..b49486b 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c
@@ -24,9 +24,994 @@
0x61,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x43,0xba,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x5a,0x45,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-@@ -99,7 +1084,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -99,7 +1084,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x00,0x41,0x9e,0xae,0x00,0x41,0x9e,0x4d,0x80,0x41,0x9e,0x4e,0x80,0x41,0x9e,0xb0,
0x00,0x00,0xf0,0x90,0x9e,0x57,0xe0,0x90,0x9e,0x8a,0xf0,0xe4,0xfb,0xfd,0x7f,0x54,
0x7e,0x01,0xd3,0x10,0xaf,0x01,0xc3,0xc0,0xd0,0x90,0x9e,0x88,0xeb,0xf0,0xa3,0xe0,
0x90,0x01,0x5f,0xe4,0xf0,0x90,0x01,0x3c,0x74,0x08,0xf0,0xe4,0x90,0x9e,0x89,0xf0,
0x90,0x9e,0x55,0xe0,0x90,0x9e,0x8a,0xf0,0xe4,0xfb,0xfd,0x7f,0x5c,0x7e,0x01,0x91,
0x62,0x90,0x01,0x5f,0x74,0x05,0xf0,0x90,0x06,0x92,0x74,0x02,0xf0,0x90,0x9e,0x5c,
-@@ -111,7 +1096,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -111,7 +1096,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x22,0x22,0x00,0x02,0x60,0x8d,0x02,0x60,0x94,0xd3,0x10,0xaf,0x01,0xc3,0xc0,0xd0,
0x8b,0x1b,0x8a,0x1c,0x89,0x1d,0x90,0x9e,0x8b,0x71,0x8b,0xab,0x1e,0xaa,0x1f,0xa9,
0x20,0x90,0x9e,0x8e,0x71,0x8b,0xaf,0x21,0x15,0x21,0xef,0x60,0x1b,0x90,0x9e,0x8e,
0x01,0x71,0x74,0xef,0x51,0x4d,0x80,0xde,0xab,0x1b,0xaa,0x1c,0xa9,0x1d,0xd0,0xd0,
0x92,0xaf,0x22,0x90,0x06,0xa9,0xe0,0xf5,0x50,0x54,0xc0,0x70,0x0d,0x90,0x9e,0x63,
0xe0,0x54,0xfe,0xf0,0xe0,0x54,0xfd,0xf0,0x91,0xd3,0xe5,0x50,0x30,0xe6,0x17,0x90,
-@@ -168,21 +1153,21 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -168,21 +1153,21 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x60,0x0b,0x90,0x9e,0x77,0xe0,0xb4,0x01,0x10,0xe4,0xff,0x80,0x09,0x90,0x9e,0x77,
0xe0,0xb4,0x01,0x05,0x7f,0x01,0x12,0x77,0x66,0x22,0x90,0x01,0x37,0x74,0x02,0xf0,
0x90,0x05,0x22,0x74,0xff,0xf0,0x12,0x77,0x1c,0xef,0x70,0x06,0x90,0x01,0xc8,0x74,
0x08,0xf4,0xff,0x90,0x00,0x43,0xe0,0x5f,0xf0,0xd3,0x10,0xaf,0x01,0xc3,0xc0,0xd0,
0x7f,0x10,0xdf,0xfe,0xd0,0xd0,0x92,0xaf,0x22,0xd3,0x10,0xaf,0x01,0xc3,0xc0,0xd0,
0x90,0x9e,0xad,0xed,0xf0,0x90,0x9e,0xac,0xef,0xf0,0xd3,0x94,0x07,0x50,0x63,0xe0,
-@@ -205,15 +1190,15 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -205,15 +1190,15 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x02,0x61,0x7d,0x90,0x9e,0x1a,0x74,0x02,0xf0,0x90,0x00,0x48,0xe0,0x44,0x0c,0xfd,
0x7f,0x48,0x51,0xc1,0x90,0x00,0x47,0xe0,0x44,0x08,0xfd,0x7f,0x47,0x51,0xc1,0x90,
0x00,0x45,0xe0,0x44,0x10,0xfd,0x7f,0x45,0x80,0x71,0xe4,0x90,0x9e,0x1a,0xf0,0x90,
0xf0,0x90,0x05,0x60,0xe0,0x90,0x9e,0x2a,0xf0,0x90,0x05,0x61,0xe0,0x90,0x9e,0x2b,
0xf0,0x90,0x05,0x62,0xe0,0x90,0x9e,0x2c,0xf0,0x90,0x05,0x63,0xe0,0x90,0x9e,0x2d,
0xf0,0xa2,0xaf,0xe4,0x33,0x90,0x9e,0x3f,0xf0,0xc2,0xaf,0x90,0x9e,0x1b,0xe0,0xff,
-@@ -222,25 +1207,25 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -222,25 +1207,25 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x81,0x84,0xa2,0xaf,0xe4,0x33,0x90,0x9e,0x3f,0xf0,0xc2,0xaf,0x90,0x9e,0x2e,0x74,
0x01,0xf0,0x90,0x9e,0x3f,0xe0,0x24,0xff,0x92,0xaf,0x51,0xb8,0x90,0x00,0x46,0xe0,
0x44,0x01,0xfd,0x7f,0x46,0x51,0xc1,0x90,0x9e,0x14,0xe0,0x60,0x15,0x90,0x9e,0x20,
0xc1,0x90,0x00,0x48,0xe0,0x44,0x0c,0xfd,0x7f,0x48,0x51,0xc1,0x90,0x00,0x46,0xe0,
0x44,0x10,0x80,0x1c,0x90,0x00,0x47,0xe0,0x54,0xf3,0xfd,0x7f,0x47,0x51,0xc1,0x90,
0x00,0x48,0xe0,0x54,0xf3,0xfd,0x7f,0x48,0x51,0xc1,0x90,0x00,0x46,0xe0,0x54,0xef,
-@@ -256,13 +1241,13 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -256,13 +1241,13 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x46,0x51,0xc1,0x7f,0x02,0xf1,0xea,0x8f,0x26,0x90,0x01,0xc9,0xe5,0x26,0xf0,0xb4,
0x01,0x02,0xf1,0x2a,0x22,0x90,0x9e,0x1c,0xe0,0x64,0x01,0x60,0x02,0xc1,0xd7,0x90,
0x00,0x46,0xe0,0x44,0x01,0xfd,0x7f,0x46,0x51,0xc1,0x90,0x9e,0x2e,0xe0,0x70,0x31,
0x90,0x05,0x87,0xe0,0x64,0x80,0xf0,0x90,0x9e,0x2a,0xe0,0x90,0x05,0x84,0xf0,0x90,
0x9e,0x2b,0xe0,0x90,0x05,0x85,0xf0,0x90,0x9e,0x2c,0xe0,0x90,0x05,0x86,0xf0,0x90,
0x9e,0x2d,0xe0,0x90,0x05,0x87,0xf0,0x22,0x90,0x05,0x60,0xe0,0x90,0x9e,0x2a,0xf0,
-@@ -296,7 +1281,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -296,7 +1281,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x29,0x75,0x2a,0x03,0xf5,0x2b,0x90,0x01,0x30,0xe5,0x28,0xf0,0xa3,0xe5,0x29,0xf0,
0xa3,0xe5,0x2a,0xf0,0xa3,0xe5,0x2b,0xf0,0x22,0xe4,0x90,0x9e,0x31,0xf0,0xa3,0xf0,
0x75,0x8e,0x02,0x12,0x4f,0xda,0x12,0x5f,0xa9,0x12,0x5f,0xbc,0xe4,0xf5,0x12,0x12,
0x90,0x00,0xf3,0xe0,0x30,0xe2,0x0d,0x90,0x05,0x41,0x74,0x10,0xf0,0x90,0x05,0x5a,
0xf0,0xa3,0xe4,0xf0,0x12,0x5f,0xf4,0x12,0x5f,0x91,0x12,0x44,0xfe,0x12,0x7d,0x1d,
0x90,0x9e,0x33,0xe5,0xd9,0xf0,0x12,0x4d,0x8b,0xc2,0xaf,0x90,0x00,0x80,0xe0,0x44,
-@@ -353,7 +1338,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -353,7 +1338,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x43,0x6b,0x90,0x00,0x02,0x12,0x42,0x20,0xff,0x90,0x9e,0x48,0x12,0x43,0x6b,0x90,
0x00,0x01,0xef,0x12,0x42,0x5f,0x90,0x9e,0x41,0x12,0x43,0x6b,0x90,0x00,0x01,0x12,
0x42,0x20,0xff,0x90,0x9e,0x46,0xe0,0xfc,0xa3,0xe0,0xfd,0xf5,0x82,0x8c,0x83,0xef,
0x9e,0x3f,0xe0,0xff,0x24,0x82,0xf5,0x82,0xe4,0x34,0x95,0xf5,0x83,0xee,0xf0,0x90,
0x9e,0x40,0xe0,0xfe,0x75,0xf0,0x09,0xef,0x90,0x96,0x4a,0x12,0x43,0x5f,0xee,0xf0,
0x75,0xf0,0x09,0xef,0x90,0x96,0x4b,0x12,0x43,0x5f,0x74,0x01,0xf0,0x90,0x9e,0x45,
-@@ -389,10 +1374,10 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -389,10 +1374,10 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0xe0,0xab,0x5d,0xaa,0x5e,0xa9,0x5f,0x12,0x42,0x4d,0x90,0x04,0x52,0xe0,0xab,0x5d,
0xaa,0x5e,0xa9,0x5f,0x90,0x00,0x01,0x12,0x42,0x5f,0x90,0x04,0x51,0xe0,0x85,0x5c,
0x82,0x85,0x5b,0x83,0xf0,0x90,0x04,0x50,0xe0,0x85,0x5c,0x82,0x85,0x5b,0x83,0xa3,
0x00,0x01,0x12,0x42,0x20,0x5f,0xd0,0x01,0xd0,0x02,0xd0,0x03,0x12,0x42,0x4d,0x85,
0x5c,0x82,0x85,0x5b,0x83,0xc0,0x83,0xc0,0x82,0xe0,0xff,0x85,0x61,0x82,0x85,0x60,
0x83,0xe0,0xfe,0xef,0x5e,0xd0,0x82,0xd0,0x83,0xf0,0x85,0x5c,0x82,0x85,0x5b,0x83,
-@@ -472,7 +1457,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -472,7 +1457,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x4d,0x31,0x76,0xe5,0x74,0x14,0x24,0xfd,0x50,0x02,0x80,0x45,0x90,0x9e,0x61,0xe0,
0x60,0x37,0x90,0x01,0x5b,0xe4,0xf0,0x90,0x01,0x3c,0x74,0x04,0xf0,0xd1,0x05,0xef,
0x64,0x01,0x70,0x2d,0x90,0x9e,0x55,0xe0,0xf5,0x44,0x75,0x45,0x00,0xe4,0xfb,0xfd,
0x74,0x01,0xf0,0x90,0x9e,0x5d,0xf0,0x80,0x08,0xd1,0x05,0xbf,0x01,0x03,0x12,0x44,
0xd3,0xe5,0x2c,0x30,0xe1,0x20,0x90,0x01,0x34,0x74,0x02,0xf0,0x85,0xd1,0x13,0x85,
0xd2,0x14,0x85,0xd3,0x15,0x85,0xd4,0x16,0x85,0xd5,0x17,0x85,0xd6,0x18,0x85,0xd7,
-@@ -515,12 +1500,12 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -515,12 +1500,12 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x01,0xef,0x12,0x42,0x5f,0x7f,0xaf,0x7e,0x01,0xf1,0x3b,0xef,0x60,0x49,0x90,0x9e,
0x91,0x12,0x43,0x6b,0x8b,0x1e,0x8a,0x1f,0x89,0x20,0x75,0x21,0x02,0x7b,0x01,0x7a,
0x01,0x79,0xa0,0x12,0x45,0x09,0x90,0x9e,0x94,0x12,0x43,0x6b,0x8b,0x1e,0x8a,0x1f,
0xe0,0x60,0x06,0x7d,0x01,0x7f,0x0c,0x80,0x0f,0x90,0x9e,0x5e,0xe0,0x54,0x0f,0xc3,
0x94,0x04,0x50,0x07,0x7d,0x01,0x7f,0x04,0x12,0x47,0x1a,0xe4,0xff,0x12,0x48,0x8f,
0x22,0xd1,0x05,0xef,0x64,0x01,0x60,0x08,0x90,0x01,0xb9,0x74,0x01,0xf0,0x80,0x32,
-@@ -532,7 +1517,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -532,7 +1517,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x9e,0xa0,0xe0,0xfe,0xa3,0xe0,0xf5,0x82,0x8e,0x83,0xe0,0x60,0x2d,0xc3,0x90,0x9e,
0xa3,0xe0,0x94,0xe8,0x90,0x9e,0xa2,0xe0,0x94,0x03,0x40,0x0b,0x90,0x01,0xc6,0xe0,
0x44,0x10,0xf0,0x7f,0x00,0x80,0x15,0x90,0x9e,0xa2,0xe4,0x75,0xf0,0x01,0x12,0x42,
0x22,0x75,0x30,0x1f,0x75,0x31,0x01,0xe4,0xf5,0x32,0x90,0x01,0x38,0xe5,0x30,0xf0,
0xa3,0xe5,0x31,0xf0,0xa3,0xe5,0x32,0xf0,0x22,0x90,0x00,0x02,0xe0,0x54,0xe0,0x90,
0x9e,0x75,0x60,0x04,0x74,0x01,0xf0,0x22,0x74,0x02,0xf0,0x22,0x90,0x00,0xf3,0xe0,
-@@ -558,7 +1543,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -558,7 +1543,7 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x9e,0x5b,0x74,0x05,0xf0,0xe4,0x90,0x9e,0x54,0xf0,0x90,0x9e,0x4f,0xf0,0x90,0x9e,
0x76,0xf0,0x22,0xe4,0x90,0x9e,0x62,0xf0,0x90,0x9e,0x51,0xf0,0x90,0x9e,0x63,0xf0,
0x22,0x8b,0x59,0x8a,0x5a,0x89,0x5b,0x31,0x03,0xab,0x59,0xaa,0x5a,0xa9,0x5b,0x12,
0x40,0x7f,0x01,0x80,0x3a,0xab,0x59,0xaa,0x5a,0xa9,0x5b,0x90,0x00,0x02,0x12,0x42,
0x20,0xfd,0xe4,0xff,0x31,0x72,0x80,0x27,0xab,0x59,0xaa,0x5a,0xa9,0x5b,0x90,0x00,
0x02,0x12,0x42,0x20,0xfd,0x7f,0x01,0x31,0x72,0x1f,0x80,0x13,0xab,0x59,0xaa,0x5a,
-@@ -567,13 +1552,13 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -567,13 +1552,13 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x80,0x16,0xed,0x70,0x0a,0x90,0x9e,0x5b,0xe0,0x90,0x9e,0x5f,0xf0,0x80,0x05,0x90,
0x9e,0x5f,0xed,0xf0,0x90,0x9e,0x5f,0xe0,0x90,0x9e,0x50,0xf0,0x22,0xd3,0x10,0xaf,
0x01,0xc3,0xc0,0xd0,0x90,0x00,0x01,0x12,0x42,0x20,0x90,0x9e,0x61,0xf0,0x90,0x00,
0x90,0x9e,0x58,0xe0,0xa3,0xe0,0x90,0x05,0x58,0xf0,0xe5,0x73,0x30,0xe0,0x1b,0x90,
0x9e,0x52,0xe0,0x70,0x1a,0xe0,0x04,0xf0,0x90,0x9e,0x5e,0xe0,0x54,0x0f,0xc3,0x94,
0x04,0x50,0x0c,0x7d,0x01,0x7f,0x04,0x02,0x47,0x1a,0xe4,0x90,0x9e,0x52,0xf0,0x22,
-@@ -600,17 +1585,17 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -600,17 +1585,17 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0xf0,0x22,0x90,0x9e,0xaf,0xef,0xf0,0x71,0xb0,0x90,0x9e,0xaf,0xe0,0x60,0x05,0x90,
0x05,0x22,0xe4,0xf0,0x90,0x9e,0x5e,0xe0,0x54,0xf0,0xf0,0xe0,0x44,0x04,0xf0,0x22,
0x90,0x00,0x11,0xe0,0x44,0x09,0xf0,0x12,0x49,0xb9,0x90,0x9d,0xff,0x12,0x43,0x53,
0xd3,0x90,0x9e,0xa9,0xe0,0x94,0x32,0x90,0x9e,0xa8,0xe0,0x94,0x00,0x40,0xb9,0x90,
0x01,0xc7,0xe0,0x30,0xe0,0xb2,0x22,0x90,0x9e,0x5e,0xe0,0x54,0xf0,0xf0,0xe0,0x44,
0x01,0xf0,0x12,0x44,0xff,0x12,0x45,0x00,0xe0,0x54,0xf0,0xf0,0xe0,0x44,0x02,0xf0,
-@@ -717,21 +1702,21 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -717,21 +1702,21 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x93,0xff,0xd3,0x90,0x9e,0x3b,0xe0,0x9f,0x90,0x9e,0x3a,0xe0,0x94,0x00,0x40,0x09,
0xe4,0xfd,0xaf,0x59,0x12,0x67,0xb1,0xe1,0x2c,0xe5,0x59,0x25,0xe0,0x24,0xc2,0xf5,
0x82,0xe4,0x34,0x95,0xf5,0x83,0xe0,0xf5,0x61,0xa3,0xe0,0xf5,0x62,0xab,0x5b,0xaa,
0x0c,0xe5,0x62,0x9f,0xf5,0x62,0xe5,0x61,0x9e,0xf5,0x61,0x80,0x05,0xe4,0xf5,0x61,
0xf5,0x62,0xe5,0x59,0x25,0xe0,0x24,0xc2,0xf5,0x82,0xe4,0x34,0x95,0xf5,0x83,0xe5,
0x61,0xf0,0xa3,0xe5,0x62,0xf0,0x90,0x9e,0x34,0xe0,0x25,0xe0,0x24,0x66,0xf5,0x82,
-@@ -766,11 +1751,11 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -766,11 +1751,11 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x5f,0xe0,0xb4,0x01,0x10,0xe4,0xf5,0x63,0x74,0xe6,0x25,0x59,0xf5,0x82,0xe4,0x34,
0x9c,0xf5,0x83,0xe4,0xf0,0xad,0x63,0xc1,0xfb,0xec,0x64,0x06,0x60,0x02,0xe1,0x00,
0xf5,0x61,0xf5,0x62,0x90,0x42,0x13,0x93,0xff,0x7e,0x00,0x90,0x9e,0x38,0xe0,0xfc,
0xe0,0x95,0x62,0x90,0x9e,0x36,0xe0,0x95,0x61,0x40,0x07,0x05,0x5a,0xe5,0x5a,0xb4,
0x05,0xbd,0xe5,0x5a,0xc3,0x13,0xf5,0x5a,0xe5,0x63,0xb4,0x01,0x06,0xe5,0x5a,0x70,
0x46,0x80,0x13,0xe5,0x63,0xb4,0x03,0x15,0xe5,0x5a,0x70,0x05,0x75,0x63,0x03,0x80,
-@@ -819,36 +1804,36 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -819,36 +1804,36 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x90,0x96,0x49,0x12,0x43,0x5f,0xe4,0xf0,0xed,0xc3,0x94,0x20,0x50,0x0f,0x74,0x84,
0x2d,0xf5,0x82,0xe4,0x34,0x04,0xf5,0x83,0x74,0x13,0xf0,0x80,0x0d,0x74,0xa6,0x2d,
0xf5,0x82,0xe4,0x34,0x9c,0xf5,0x83,0x74,0x13,0xf0,0x0d,0xed,0x64,0x40,0x60,0x03,
0x90,0x9e,0x44,0xef,0xf0,0xd3,0x94,0x07,0x50,0x4f,0xa3,0xe0,0x70,0x1a,0x90,0x9e,
0x44,0xe0,0xff,0x74,0x01,0xa8,0x07,0x08,0x80,0x02,0xc3,0x33,0xd8,0xfc,0xf4,0xff,
0x90,0x00,0x47,0xe0,0x5f,0xf0,0x80,0x17,0x90,0x9e,0x44,0xe0,0xff,0x74,0x01,0xa8,
-@@ -875,24 +1860,24 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -875,24 +1860,24 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x80,0x1a,0xc3,0x74,0x03,0x95,0x61,0x24,0x66,0xf8,0xe6,0xff,0xe5,0x61,0x7c,0x00,
0x25,0x65,0xfd,0xec,0x35,0x64,0x8d,0x82,0xf5,0x83,0xef,0xf0,0x05,0x61,0x80,0xba,
0xc3,0xe5,0x64,0x94,0x10,0x40,0x02,0xa1,0x93,0x90,0x9e,0x40,0xe0,0x64,0x04,0x60,
0x75,0x5a,0x80,0x80,0x05,0xe4,0xf5,0x59,0xf5,0x5a,0xe5,0x5e,0xc3,0x13,0x90,0xfd,
0x10,0xf0,0x74,0x20,0x25,0x5b,0xf5,0x5b,0xad,0x5a,0xe5,0x5b,0x2d,0xff,0x24,0x01,
0xf5,0x82,0xe4,0x34,0xfc,0xf5,0x83,0xe0,0x90,0x9e,0x6d,0xf0,0x74,0x02,0x2f,0xf5,
-@@ -902,8 +1887,8 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -902,8 +1887,8 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0x83,0xe0,0xfe,0x74,0x6c,0x2f,0xf5,0x82,0xe4,0x34,0x9e,0xf5,0x83,0xee,0xf0,0x0f,
0xbf,0x08,0xe0,0x91,0x0e,0xef,0x70,0x3f,0x90,0x01,0xc3,0xe0,0x60,0x25,0xc3,0xe5,
0x60,0x94,0xe8,0xe5,0x5f,0x94,0x03,0x40,0x09,0x90,0x01,0xc6,0xe0,0x44,0x10,0xf0,
0x80,0x43,0x74,0xff,0xf0,0x80,0x3e,0xe5,0x5b,0xb4,0x78,0x23,0xe4,0xf5,0x5b,0x05,
0x5e,0xe5,0x5a,0x64,0x80,0x45,0x59,0x70,0x06,0xf5,0x59,0xf5,0x5a,0x80,0x06,0x75,
0x59,0x00,0x75,0x5a,0x80,0xe5,0x5e,0xc3,0x13,0x90,0xfd,0x10,0xf0,0x80,0x06,0x74,
-@@ -912,4208 +1897,146 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayL
+@@ -912,4208 +1897,146 @@ u8 Rtl8192CUFwTSMCImgArray[TSMCImgArrayLength] = {
0xe4,0xa3,0xf0,0xa3,0xf0,0xa3,0xf0,0x22,0xe4,0xf5,0x25,0x22,0xe4,0x90,0x9e,0xaa,
0xf0,0xa3,0xf0,0x90,0x05,0xf8,0xe0,0x70,0x0f,0xa3,0xe0,0x70,0x0b,0xa3,0xe0,0x70,
0x07,0xa3,0xe0,0x70,0x03,0x7f,0x01,0x22,0xd3,0x90,0x9e,0xab,0xe0,0x94,0xe8,0x90,
0x05,0x04,0x03,0x02,0x00,0x03,0x06,0x05,0x04,0x03,0x00,0x04,0x06,0x05,0x04,0x02,
0x00,0x04,0x08,0x07,0x06,0x04,0x00,0x06,0x0a,0x09,0x08,0x06,0x00,0x08,0x0a,0x09,
0x08,0x04,0x00,0x08,0x0a,0x09,0x08,0x02,0x00,0x08,0x0a,0x09,0x08,0x00,0x00,0x08,
-@@ -5168,7 +2091,7 @@ u8 Rtl8192CUFwUMCBCutImgArray[UMCBCutImg
+@@ -5168,7 +2091,7 @@ u8 Rtl8192CUFwUMCBCutImgArray[UMCBCutImgArrayLength] = {
0x15,0x82,0x70,0x02,0x15,0x83,0xe0,0xfa,0x38,0xf0,0x22,0xeb,0xf0,0xa3,0xea,0xf0,
0xa3,0xe9,0xf0,0x22,0xd0,0x83,0xd0,0x82,0xf8,0xe4,0x93,0x70,0x12,0x74,0x01,0x93,
0x70,0x0d,0xa3,0xa3,0x93,0xf8,0x74,0x01,0x93,0xf5,0x82,0x88,0x83,0xe4,0x73,0x74,
0xe4,0x93,0xa3,0xf8,0xe4,0x93,0xa3,0x40,0x03,0xf6,0x80,0x01,0xf2,0x08,0xdf,0xf4,
0x80,0x29,0xe4,0x93,0xa3,0xf8,0x54,0x07,0x24,0x0c,0xc8,0xc3,0x33,0xc4,0x54,0x0f,
0x44,0x20,0xc8,0x83,0x40,0x04,0xf4,0x56,0x80,0x01,0x46,0xf6,0xdf,0xe4,0x80,0x0b,
-@@ -5176,833 +2099,797 @@ u8 Rtl8192CUFwUMCBCutImgArray[UMCBCutImg
+@@ -5176,833 +2099,797 @@ u8 Rtl8192CUFwUMCBCutImgArray[UMCBCutImgArrayLength] = {
0xbc,0xa3,0xff,0x54,0x3f,0x30,0xe5,0x09,0x54,0x1f,0xfe,0xe4,0x93,0xa3,0x60,0x01,
0x0e,0xcf,0x54,0xc0,0x25,0xe0,0x60,0xa8,0x40,0xb8,0xe4,0x93,0xa3,0xfa,0xe4,0x93,
0xa3,0xf8,0xe4,0x93,0xa3,0xc8,0xc5,0x82,0xc8,0xca,0xc5,0x83,0xca,0xf0,0xa3,0xc8,
0x90,0x9d,0xfb,0x12,0x43,0x53,0x90,0x80,0x85,0x12,0x2a,0x7f,0x7f,0x8c,0x7e,0x08,
0x12,0x2f,0xd9,0x90,0x9d,0xa7,0x12,0x43,0x53,0x90,0x80,0x85,0x12,0x2a,0x7f,0x7f,
0x44,0x7e,0x08,0x12,0x2f,0xd9,0x90,0x9d,0xab,0x12,0x43,0x53,0x90,0x80,0x85,0x12,
-@@ -6030,1114 +2917,3136 @@ u8 Rtl8192CUFwUMCBCutImgArray[UMCBCutImg
+@@ -6030,1114 +2917,3136 @@ u8 Rtl8192CUFwUMCBCutImgArray[UMCBCutImgArrayLength] = {
0x43,0x53,0x90,0x80,0x85,0x12,0x2a,0x7f,0x7f,0x0c,0x7e,0x09,0x12,0x2f,0xd9,0x90,
0x9d,0xf7,0x12,0x43,0x53,0x90,0x80,0x85,0x12,0x2a,0x7f,0x7f,0x04,0x7e,0x08,0x12,
0x2f,0xd9,0x90,0x9e,0x0f,0x74,0x01,0xf0,0x22,0x90,0x9e,0x0f,0xe0,0x64,0x01,0x60,
u32 Rtl8192CUPHY_REG_2TArray[PHY_REG_2TArrayLength] = {
0x024,0x0011800f,
-@@ -7146,7 +6055,7 @@ u32 Rtl8192CUPHY_REG_2TArray[PHY_REG_2TA
+@@ -7146,7 +6055,7 @@ u32 Rtl8192CUPHY_REG_2TArray[PHY_REG_2TArrayLength] = {
0x804,0x00000003,
0x808,0x0000fc00,
0x80c,0x0000000a,
0x814,0x020c3d10,
0x818,0x02200385,
0x81c,0x00000000,
-@@ -7220,22 +6129,22 @@ u32 Rtl8192CUPHY_REG_2TArray[PHY_REG_2TA
+@@ -7220,22 +6129,22 @@ u32 Rtl8192CUPHY_REG_2TArray[PHY_REG_2TArrayLength] = {
0xc44,0x000100b7,
0xc48,0xec020107,
0xc4c,0x007f037f,
0xc90,0x00121820,
0xc94,0x00000000,
0xc98,0x00121820,
-@@ -7336,7 +6245,7 @@ u32 Rtl8192CUPHY_REG_1TArray[PHY_REG_1TA
+@@ -7336,7 +6245,7 @@ u32 Rtl8192CUPHY_REG_1TArray[PHY_REG_1TArrayLength] = {
0x804,0x00000001,
0x808,0x0000fc00,
0x80c,0x0000000a,
0x814,0x020c3d10,
0x818,0x02200385,
0x81c,0x00000000,
-@@ -7410,9 +6319,9 @@ u32 Rtl8192CUPHY_REG_1TArray[PHY_REG_1TA
+@@ -7410,9 +6319,9 @@ u32 Rtl8192CUPHY_REG_1TArray[PHY_REG_1TArrayLength] = {
0xc44,0x000100b7,
0xc48,0xec020107,
0xc4c,0x007f037f,
0xc5c,0x433c0094,
0xc60,0x00000000,
0xc64,0x5116848b,
-@@ -7450,7 +6359,7 @@ u32 Rtl8192CUPHY_REG_1TArray[PHY_REG_1TA
+@@ -7450,7 +6359,7 @@ u32 Rtl8192CUPHY_REG_1TArray[PHY_REG_1TArrayLength] = {
0xce4,0x00000000,
0xce8,0x37644302,
0xcec,0x2f97d40c,
0xd04,0x00020401,
0xd08,0x0000907f,
0xd0c,0x20010201,
-@@ -7771,7 +6680,7 @@ u32 Rtl8192CUPHY_REG_1T_HPArray[PHY_REG_
+@@ -7771,7 +6680,7 @@ u32 Rtl8192CUPHY_REG_1T_HPArray[PHY_REG_1T_HPArrayLength] = {
0x804,0x00000001,
0x808,0x0000fc00,
0x80c,0x0000000a,
0x814,0x020c3d10,
0x818,0x02200385,
0x81c,0x00000000,
-@@ -7885,7 +6794,7 @@ u32 Rtl8192CUPHY_REG_1T_HPArray[PHY_REG_
+@@ -7885,7 +6794,7 @@ u32 Rtl8192CUPHY_REG_1T_HPArray[PHY_REG_1T_HPArrayLength] = {
0xce4,0x00000000,
0xce8,0x37644302,
0xcec,0x2f97d40c,
0xd04,0x00020401,
0xd08,0x0000907f,
0xd0c,0x20010201,
-@@ -7962,7 +6871,7 @@ u32 Rtl8192CUPHY_REG_1T_mCardArray[PHY_R
+@@ -7962,7 +6871,7 @@ u32 Rtl8192CUPHY_REG_1T_mCardArray[PHY_REG_1T_mCardArrayLength] = {
0x804,0x00000001,
0x808,0x0000fc00,
0x80c,0x0000000a,
0x814,0x020c3d10,
0x818,0x02200385,
0x81c,0x00000000,
-@@ -8036,9 +6945,9 @@ u32 Rtl8192CUPHY_REG_1T_mCardArray[PHY_R
+@@ -8036,9 +6945,9 @@ u32 Rtl8192CUPHY_REG_1T_mCardArray[PHY_REG_1T_mCardArrayLength] = {
0xc44,0x000100b7,
0xc48,0xec020107,
0xc4c,0x007f037f,
0xc5c,0x433c0094,
0xc60,0x00000000,
0xc64,0x5116848b,
-@@ -8076,7 +6985,7 @@ u32 Rtl8192CUPHY_REG_1T_mCardArray[PHY_R
+@@ -8076,7 +6985,7 @@ u32 Rtl8192CUPHY_REG_1T_mCardArray[PHY_REG_1T_mCardArrayLength] = {
0xce4,0x00000000,
0xce8,0x37644302,
0xcec,0x2f97d40c,
0xd04,0x00020401,
0xd08,0x0000907f,
0xd0c,0x20010201,
-@@ -8152,7 +7061,7 @@ u32 Rtl8192CUPHY_REG_2T_mCardArray[PHY_R
+@@ -8152,7 +7061,7 @@ u32 Rtl8192CUPHY_REG_2T_mCardArray[PHY_REG_2T_mCardArrayLength] = {
0x804,0x00000003,
0x808,0x0000fc00,
0x80c,0x0000000a,
0x814,0x020c3d10,
0x818,0x02200385,
0x81c,0x00000000,
-@@ -8226,22 +7135,22 @@ u32 Rtl8192CUPHY_REG_2T_mCardArray[PHY_R
+@@ -8226,22 +7135,22 @@ u32 Rtl8192CUPHY_REG_2T_mCardArray[PHY_REG_2T_mCardArrayLength] = {
0xc44,0x000100b7,
0xc48,0xec020107,
0xc4c,0x007f037f,
0xc90,0x00121820,
0xc94,0x00000000,
0xc98,0x00121820,
-@@ -8784,6 +7693,192 @@ u32 Rtl8192CURadioB_1TArray[RadioB_1TArr
+@@ -8784,6 +7693,192 @@ u32 Rtl8192CURadioB_1TArray[RadioB_1TArrayLength] = {
0x0, };
u32 Rtl8192CURadioA_1T_mCardArray[RadioA_1T_mCardArrayLength] = {
0x000,0x00030159,
0x001,0x00031284,
-@@ -9043,7 +8138,7 @@ u32 Rtl8192CURadioA_1T_HPArray[RadioA_1T
+@@ -9043,7 +8138,7 @@ u32 Rtl8192CURadioA_1T_HPArray[RadioA_1T_HPArrayLength] = {
0x013,0x00028fb4,
0x013,0x00024fa8,
0x013,0x000207a4,
0x013,0x000183a4,
0x013,0x00014398,
0x013,0x000101a4,
-@@ -9078,7 +8173,7 @@ u32 Rtl8192CURadioA_1T_HPArray[RadioA_1T
+@@ -9078,7 +8173,7 @@ u32 Rtl8192CURadioA_1T_HPArray[RadioA_1T_HPArrayLength] = {
u32 Rtl8192CURadioB_GM_Array[RadioB_GM_ArrayLength] = {
0x0, };
u32 Rtl8192CUMAC_2T_Array[MAC_2T_ArrayLength] = {
0x420,0x00000080,
0x423,0x00000000,
-@@ -9153,10 +8248,11 @@ u32 Rtl8192CUMAC_2T_Array[MAC_2T_ArrayLe
+@@ -9153,10 +8248,11 @@ u32 Rtl8192CUMAC_2T_Array[MAC_2T_ArrayLength] = {
0x608,0x0000000e,
0x609,0x0000002a,
0x652,0x00000020,
0x66e,0x00000005,
0x700,0x00000021,
0x701,0x00000043,
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c
+index f39b4cb..0d7af4a 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c
@@ -16,8 +16,7 @@
}
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c
+index 4285d60..1119cf8 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c
@@ -16,8 +16,7 @@
#define _RTL8192CU_RECV_C_
#include <drv_conf.h>
#include <osdep_service.h>
-@@ -150,12 +149,7 @@ int rtl8192cu_init_recv_priv(_adapter *p
+@@ -150,12 +149,7 @@ int rtl8192cu_init_recv_priv(_adapter *padapter)
for(i=0; i<NR_PREALLOC_RECV_SKB; i++)
{
if(pskb)
{
-@@ -216,7 +210,7 @@ void rtl8192cu_free_recv_priv (_adapter
+@@ -216,7 +210,7 @@ void rtl8192cu_free_recv_priv (_adapter *padapter)
DBG_8192C(KERN_WARNING "rx_skb_queue not empty\n");
}
#ifdef CONFIG_PREALLOC_RECV_SKB
-@@ -224,7 +218,7 @@ void rtl8192cu_free_recv_priv (_adapter
+@@ -224,7 +218,7 @@ void rtl8192cu_free_recv_priv (_adapter *padapter)
DBG_8192C(KERN_WARNING "free_recv_skb_queue not empty, %d\n", skb_queue_len(&precvpriv->free_recv_skb_queue));
}
#endif
-@@ -232,149 +226,4 @@ void rtl8192cu_free_recv_priv (_adapter
+@@ -232,149 +226,4 @@ void rtl8192cu_free_recv_priv (_adapter *padapter)
}
-
-}
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c
+index c276b51..3a4137b 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c
@@ -16,8 +16,7 @@
#define _RTL8192C_XMIT_C_
#include <drv_conf.h>
#include <osdep_service.h>
-@@ -95,7 +94,7 @@ u32 rtw_get_ff_hwaddr(struct xmit_frame
+@@ -95,7 +94,7 @@ u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe)
int urb_zero_packet_chk(_adapter *padapter, int sz)
{
int blnSetTxDescOffset;
if ( pdvobj->ishighspeed )
{
-@@ -165,7 +164,7 @@ void fill_txdesc_sectype(struct pkt_attr
+@@ -165,7 +164,7 @@ void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc)
}
{
//DBG_8192C("cvs_mode=%d\n", pattrib->vcs_mode);
-@@ -182,14 +181,27 @@ void fill_txdesc_vcs(struct pkt_attrib *
+@@ -182,14 +181,27 @@ void fill_txdesc_vcs(struct pkt_attrib *pattrib, u32 *pdw)
break;
}
- }
+ if(pattrib->vcs_mode) {
+ *pdw |= cpu_to_le32(BIT(13));
-+
+
+ // Set RTS BW
+ if(pattrib->ht_en)
+ {
+ *pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40)? cpu_to_le32(BIT(27)):0;
-
++
+ if(pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
+ *pdw |= cpu_to_le32((0x01<<28)&0x30000000);
+ else if(pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER)
{
//DBG_8192C("bwmode=%d, ch_off=%d\n", pattrib->bwmode, pattrib->ch_offset);
-@@ -198,220 +210,17 @@ void fill_txdesc_phy(struct pkt_attrib *
+@@ -198,220 +210,17 @@ void fill_txdesc_phy(struct pkt_attrib *pattrib, u32 *pdw)
*pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40)? cpu_to_le32(BIT(25)):0;
if(pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
*pdw |= 0;
else
- *pdw |= cpu_to_le32((0x03<<20)&0x003f0000);
-+ *pdw |= cpu_to_le32((0x03<<20)&0x00300000);
- }
- }
-
+- }
+-}
+-
-#ifdef CONFIG_USB_TX_AGGREGATION
-static void _update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, int sz)
-{
- {
- ptxdesc->txdw4 |= cpu_to_le32(BIT(7)); // Hw set sequence number
- ptxdesc->txdw3 |= cpu_to_le32((8 <<28)); //set bit3 to 1. Suugested by TimChen. 2009.12.29.
-- }
++ *pdw |= cpu_to_le32((0x03<<20)&0x00300000);
+ }
-
- rtl8192cu_cal_txdesc_chksum(ptxdesc);
--}
+ }
-#endif
--
+
-static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
+static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bagg_pkt)
{
int pull=0;
uint qsel;
-@@ -422,17 +231,19 @@ static s32 update_txdesc(struct xmit_fra
+@@ -422,17 +231,19 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
struct dm_priv *pdmpriv = &pHalData->dmpriv;
struct tx_desc *ptxdesc = (struct tx_desc *)pmem;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
}
#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX
-@@ -452,14 +263,13 @@ static s32 update_txdesc(struct xmit_fra
+@@ -452,14 +263,13 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
fill_txdesc_sectype(pattrib, ptxdesc);
//offset 12
ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0xffff0000);
-@@ -480,26 +290,9 @@ static s32 update_txdesc(struct xmit_fra
+@@ -480,26 +290,9 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
ptxdesc->txdw5 |= cpu_to_le32(0x0001ff00);//
//ptxdesc->txdw5 |= cpu_to_le32(0x0000000b);//DataRate - 54M
if(0)//for driver dbg
{
ptxdesc->txdw4 |= cpu_to_le32(BIT(8));//driver uses rate
-@@ -521,20 +314,13 @@ static s32 update_txdesc(struct xmit_fra
+@@ -521,20 +314,13 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
ptxdesc->txdw4 |= cpu_to_le32(BIT(8));//driver uses rate
#ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
if ( pattrib->hw_tcp_csum == 1 ) {
// ptxdesc->txdw6 = 0; // clear TCP_CHECKSUM and IP_CHECKSUM. It's zero already!!
-@@ -559,6 +345,15 @@ static s32 update_txdesc(struct xmit_fra
+@@ -559,6 +345,15 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
//fill_txdesc_sectype(pattrib, ptxdesc);
//offset 8
//offset 12
ptxdesc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0xffff0000);
-@@ -569,26 +364,34 @@ static s32 update_txdesc(struct xmit_fra
+@@ -569,26 +364,34 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
//offset 20
ptxdesc->txdw5 |= cpu_to_le32(BIT(17));//retry limit enable
if(pattrib->retry_ctrl == _TRUE)
}
else if((pxmitframe->frame_tag&0x0f) == TXAGG_FRAMETAG)
{
-@@ -618,6 +421,7 @@ static s32 update_txdesc(struct xmit_fra
+@@ -618,6 +421,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
ptxdesc->txdw4 |= cpu_to_le32(BIT(8));//driver uses rate
//offset 20
}
// 2009.11.05. tynli_test. Suggested by SD4 Filen for FW LPS.
-@@ -647,7 +451,14 @@ static s32 update_txdesc(struct xmit_fra
+@@ -647,7 +451,14 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("offset0-txdesc=0x%x\n", ptxdesc->txdw0));
//offset 4
rtl8192cu_cal_txdesc_chksum(ptxdesc);
-@@ -655,8 +466,10 @@ static s32 update_txdesc(struct xmit_fra
+@@ -655,8 +466,10 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
}
int t, sz, w_sz, pull=0;
u8 *mem_addr;
u32 ff_hwaddr;
-@@ -679,6 +492,9 @@ static void _rtw_dump_xframe(_adapter *p
+@@ -679,6 +492,9 @@ static void _rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe,
for (t = 0; t < pattrib->nr_frags; t++)
{
if (t != (pattrib->nr_frags - 1))
{
RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("pattrib->nr_frags=%d\n", pattrib->nr_frags));
-@@ -691,7 +507,7 @@ static void _rtw_dump_xframe(_adapter *p
+@@ -691,7 +507,7 @@ static void _rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe,
sz = pattrib->last_txcmdsz;
}
if(pull)
{
-@@ -709,10 +525,7 @@ static void _rtw_dump_xframe(_adapter *p
+@@ -709,10 +525,7 @@ static void _rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe,
ff_hwaddr = rtw_get_ff_hwaddr(pxmitframe);
rtw_count_tx_stats(padapter, pxmitframe, sz);
-@@ -726,18 +539,12 @@ static void _rtw_dump_xframe(_adapter *p
+@@ -726,18 +539,12 @@ static void _rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe,
}
}
#ifdef CONFIG_USB_TX_AGGREGATION
-@@ -767,7 +574,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -767,7 +574,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
struct xmit_frame *pfirstframe = NULL;
// aggregate variable
struct sta_info *psta = NULL;
struct tx_servq *ptxservq = NULL;
-@@ -801,7 +608,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -801,7 +608,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
//3 1. pick up first frame
do {
pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
if (pxmitframe == NULL) {
-@@ -816,7 +623,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -816,7 +623,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
RT_TRACE(_module_rtl8192c_xmit_c_, _drv_err_,
("xmitframe_complete: frame tag(%d) is not DATA_FRAMETAG(%d)!\n",
pxmitframe->frame_tag, DATA_FRAMETAG));
continue;
}
-@@ -826,7 +633,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -826,7 +633,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
RT_TRACE(_module_rtl8192c_xmit_c_, _drv_err_,
("xmitframe_complete: TID(%d) should be 0~15!\n",
pxmitframe->attrib.priority));
continue;
}
#endif
-@@ -838,15 +645,12 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -838,15 +645,12 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
//pxmitframe->agg_num = 1; // alloc xmitframe should assign to 1.
pxmitframe->pkt_offset = 1; // first frame of aggregation, reserve offset
// always return ndis_packet after rtw_xmitframe_coalesce
rtw_os_xmit_complete(padapter, pxmitframe);
-@@ -876,26 +680,26 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -876,26 +680,26 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
case 1:
case 2:
ptxservq = &(psta->sta_xmitpriv.bk_q);
break;
}
-@@ -913,6 +717,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -913,6 +717,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
rtw_list_delete(&pxmitframe->list);
ptxservq->qcnt--;
#ifndef IDEA_CONDITION
// suppose only data frames would be in queue
-@@ -920,7 +725,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -920,7 +725,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
RT_TRACE(_module_rtl8192c_xmit_c_, _drv_err_,
("xmitframe_complete: frame tag(%d) is not DATA_FRAMETAG(%d)!\n",
pxmitframe->frame_tag, DATA_FRAMETAG));
continue;
}
-@@ -930,7 +735,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -930,7 +735,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
RT_TRACE(_module_rtl8192c_xmit_c_, _drv_err_,
("xmitframe_complete: TID(%d) should be 0~15!\n",
pxmitframe->attrib.priority));
continue;
}
#endif
-@@ -941,24 +746,20 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -941,24 +746,20 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
pxmitframe->agg_num = 0; // not first frame of aggregation
pxmitframe->pkt_offset = 0; // not first frame of aggregation, no need to reserve offset
// handle pointer and stop condition
pbuf_tail = pbuf + len;
-@@ -998,7 +799,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -998,7 +799,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
pfirstframe->pkt_offset = 0;
}
#endif // CONFIG_USE_USB_BUFFER_ALLOC_TX
//3 4. write xmit buffer to USB FIFO
ff_hwaddr = rtw_get_ff_hwaddr(pfirstframe);
-@@ -1013,7 +814,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -1013,7 +814,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
rtw_count_tx_stats(padapter, pfirstframe, pbuf_tail);
return _TRUE;
}
-@@ -1063,7 +864,7 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -1063,7 +864,7 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
}
rtw_os_xmit_complete(padapter, pxmitframe);//always return ndis_packet after rtw_xmitframe_coalesce
RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("xmitframe_complete(): rtw_dump_xframe\n"));
-@@ -1071,12 +872,12 @@ s32 rtl8192cu_xmitframe_complete(_adapte
+@@ -1071,12 +872,12 @@ s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv
if(res == _SUCCESS)
{
}
xcnt++;
-@@ -1125,15 +926,22 @@ static s32 pre_xmitframe(_adapter *padap
+@@ -1125,15 +926,22 @@ static s32 pre_xmitframe(_adapter *padapter, struct xmit_frame *pxmitframe)
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
if (pxmitbuf == NULL)
-@@ -1147,7 +955,7 @@ static s32 pre_xmitframe(_adapter *padap
+@@ -1147,7 +955,7 @@ static s32 pre_xmitframe(_adapter *padapter, struct xmit_frame *pxmitframe)
if (xmitframe_direct(padapter, pxmitframe) != _SUCCESS) {
rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
}
/*
-@@ -1184,6 +992,30 @@ s32 rtl8192cu_hal_xmit(_adapter *padapte
+@@ -1184,6 +992,30 @@ s32 rtl8192cu_hal_xmit(_adapter *padapter, struct xmit_frame *pxmitframe)
return pre_xmitframe(padapter, pxmitframe);
}
#ifdef CONFIG_HOSTAPD_MLME
static void rtl8192cu_hostap_mgnt_xmit_cb(struct urb *urb)
-@@ -1193,7 +1025,7 @@ static void rtl8192cu_hostap_mgnt_xmit_c
+@@ -1193,7 +1025,7 @@ static void rtl8192cu_hostap_mgnt_xmit_cb(struct urb *urb)
//DBG_8192C("%s\n", __FUNCTION__);
#endif
}
-@@ -1211,7 +1043,7 @@ s32 rtl8192cu_hostap_mgnt_xmit_entry(_ad
+@@ -1211,7 +1043,7 @@ s32 rtl8192cu_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
struct hostapd_priv *phostapdpriv = padapter->phostapdpriv;
struct net_device *pnetdev = padapter->pnetdev;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
//DBG_8192C("%s\n", __FUNCTION__);
-@@ -1226,11 +1058,7 @@ s32 rtl8192cu_hostap_mgnt_xmit_entry(_ad
+@@ -1226,11 +1058,7 @@ s32 rtl8192cu_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
if ((fc & RTW_IEEE80211_FCTL_FTYPE) != RTW_IEEE80211_FTYPE_MGMT)
goto _exit;
if(!pxmit_skb)
goto _exit;
-@@ -1311,7 +1139,7 @@ s32 rtl8192cu_hostap_mgnt_xmit_entry(_ad
+@@ -1311,7 +1139,7 @@ s32 rtl8192cu_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt)
_exit:
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c
+index 6cac2d5..ff89473 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c
@@ -16,7 +16,7 @@
if((value8 >> USB_NORMAL_SIE_EP_SHIFT) & USB_NORMAL_SIE_EP_MASK){
pHalData->OutEpQueueSel |= TX_SELE_NQ;
pHalData->OutEpNumber++;
-@@ -328,38 +262,18 @@ static BOOLEAN HalUsbSetQueuePipeMapping
+@@ -328,38 +262,18 @@ static BOOLEAN HalUsbSetQueuePipeMapping8192CUsb(
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
BOOLEAN result = _FALSE;
return result;
-@@ -368,7 +282,7 @@ static BOOLEAN HalUsbSetQueuePipeMapping
+@@ -368,7 +282,7 @@ static BOOLEAN HalUsbSetQueuePipeMapping8192CUsb(
void rtl8192cu_interface_configure(_adapter *padapter)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
if (pdvobjpriv->ishighspeed == _TRUE)
{
-@@ -399,8 +313,13 @@ void rtl8192cu_interface_configure(_adap
+@@ -399,8 +313,13 @@ void rtl8192cu_interface_configure(_adapter *padapter)
pHalData->UsbRxAggPageTimeout = 0x4; //6, absolute time = 34ms/(2^6)
#endif
}
-@@ -570,7 +489,6 @@ static void _InitPABias(_adapter *padapt
+@@ -570,7 +489,6 @@ static void _InitPABias(_adapter *padapter)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
u8 pa_setting;
BOOLEAN is92C = IS_92C_SERIAL(pHalData->VersionID);
//FIXED PA current issue
-@@ -581,19 +499,19 @@ static void _InitPABias(_adapter *padapt
+@@ -581,19 +499,19 @@ static void _InitPABias(_adapter *padapter)
if(!(pa_setting & BIT0))
{
u8 is92C = IS_92C_SERIAL(pHalData->VersionID);
rt_rf_power_state eRfPowerStateToSet;
#ifdef CONFIG_BT_COEXIST
-@@ -2244,7 +2035,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_DOW
+@@ -2244,7 +2035,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_DOWNLOAD_FW);
//HalDetectPwrDownMode(Adapter);
// 2010/08/26 MH If Efuse does not support sective suspend then disable the function.
//HalDetectSelectiveSuspendMode(Adapter);
// Set RF type for BB/RF configuration
_InitRFType(Adapter);//->_ReadRFType()
-@@ -2258,8 +2048,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INI
+@@ -2258,8 +2048,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_LLTT);
boundary = TX_PAGE_BOUNDARY;
}
else{// for WMM
}
status = InitLLTTable(Adapter, boundary);
if(status == _FAIL){
-@@ -2281,7 +2070,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MIS
+@@ -2281,7 +2070,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02);
_InitDriverInfoSize(Adapter, DRVINFO_SZ);
_InitInterrupt(Adapter);
_InitNetworkType(Adapter);//set msr
_InitWMACSetting(Adapter);
_InitAdaptiveCtrl(Adapter);
-@@ -2340,16 +2129,16 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF)
+@@ -2340,16 +2129,16 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF);
if(IS_VENDOR_UMC_A_CUT(pHalData->VersionID) && !IS_92C_SERIAL(pHalData->VersionID))
{
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_TURN_ON_BLOCK);
_BBTurnOnBlock(Adapter);
-@@ -2424,7 +2213,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MIS
+@@ -2424,7 +2213,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11);
// Those action will be discard in MgntActSet_RF_State because off the same state
//for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
}
else if(pwrctrlpriv->rfoff_reason > RF_CHANGE_BY_PS)
{ // H/W or S/W RF OFF before sleep.
-@@ -2462,7 +2251,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MIS
+@@ -2462,7 +2251,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11);
pwrctrlpriv->rfoff_reason = 0;
pwrctrlpriv->b_hw_radio_off = _FALSE;
pwrctrlpriv->rf_pwrstate = rf_on;
}
-@@ -2478,7 +2267,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MIS
+@@ -2478,7 +2267,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11);
// our HW will be set in power-down mode if PDn source from all functions are configured.
// 2010.10.06.
//
//{
// u1bTmp = rtw_read8(Adapter, REG_MULTI_FUNC_CTRL);
// rtw_write8(Adapter, REG_MULTI_FUNC_CTRL, (u1bTmp|WL_HWPDN_EN));
-@@ -2572,23 +2361,20 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INI
+@@ -2572,23 +2361,20 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM);
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC31);
rtw_write8(Adapter, 0x15, 0xe9);//suggest by Johnny for lower temperature
//reset BB
value16 = rtw_read16(Adapter, REG_SYS_FUNC_EN);
value16 &= ~(FEN_BBRSTB | FEN_BB_GLB_RSTn);
-@@ -3072,11 +2857,12 @@ e. SYS_FUNC_EN 0x02[7:0] = 0x14 //reset
+@@ -3072,11 +2857,12 @@ e. SYS_FUNC_EN 0x02[7:0] = 0x14 //reset BB state machine
***************************************/
u8 eRFPath = 0,value8 = 0;
rtw_write8(Adapter, REG_TXPAUSE, 0xFF);
value8 = 0 ;
value8 |=( FEN_USBD | FEN_USBA | FEN_BB_GLB_RSTn);
rtw_write8(Adapter, REG_SYS_FUNC_EN,value8 );//0x16
-@@ -3435,7 +3221,7 @@ unsigned int rtl8192cu_inirp_init(PADAPT
+@@ -3435,7 +3221,7 @@ unsigned int rtl8192cu_inirp_init(PADAPTER Adapter)
u8 i;
struct recv_buf *precvbuf;
uint status;
struct intf_hdl * pintfhdl=&Adapter->iopriv.intf;
struct recv_priv *precvpriv = &(Adapter->recvpriv);
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
-@@ -3498,69 +3284,6 @@ unsigned int rtl8192cu_inirp_deinit(PADA
+@@ -3498,69 +3284,6 @@ unsigned int rtl8192cu_inirp_deinit(PADAPTER Adapter)
return _SUCCESS;
}
// readAdapterInfo_8723U(Adapter);
//else
readAdapterInfo_8192CU(Adapter);
-@@ -4287,7 +3977,7 @@ static int _ReadAdapterInfo8192CU(PADAPT
+@@ -4287,7 +3977,7 @@ static int _ReadAdapterInfo8192CU(PADAPTER Adapter)
//Efuse_InitSomeVar(Adapter);
// _EfuseCellSel(Adapter);
_ReadRFType(Adapter);//rf_chip -> _InitRFType()
-@@ -4339,20 +4029,8 @@ static void ResumeTxBeacon(_adapter *pad
+@@ -4339,20 +4029,8 @@ static void ResumeTxBeacon(_adapter *padapter)
// 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value
// which should be read from register to a global variable.
}
static void StopTxBeacon(_adapter *padapter)
-@@ -4362,19 +4040,8 @@ static void StopTxBeacon(_adapter *padap
+@@ -4362,19 +4040,8 @@ static void StopTxBeacon(_adapter *padapter)
// 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value
// which should be read from register to a global variable.
content=0;
}
DBG_8192C("\nrtw_wowlan_set_pattern offset[0] content 0x%x [cpu_to_le32 0x%x]\n", content,__cpu_to_le32(content));
-@@ -4624,6 +4553,374 @@ void rtw_wowlan_reload_pattern(_adapter
+@@ -4624,6 +4553,374 @@ void rtw_wowlan_reload_pattern(_adapter *padapter){
}
#endif //CONFIG_WOWLAN
+ case HW_VAR_ON_RCR_AM:
+ rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_AM);
+ DBG_871X("%s, %d, RCR= %x \n", __FUNCTION__,__LINE__, rtw_read32(Adapter, REG_RCR));
-+ break;
+ break;
+ case HW_VAR_OFF_RCR_AM:
+ rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)& (~RCR_AM));
+ DBG_871X("%s, %d, RCR= %x \n", __FUNCTION__,__LINE__, rtw_read32(Adapter, REG_RCR));
- break;
++ break;
+
case HW_VAR_BEACON_INTERVAL:
rtw_write16(Adapter, REG_BCN_INTERVAL, *((u16 *)val));
default:
//RT_TRACE(COMP_INIT, DBG_WARNING, ("GetHalDefVar8192CUsb(): Unkown variable: %d!\n", eVariable));
bResult = _FALSE;
-@@ -5724,6 +5924,7 @@ void _update_response_rate(_adapter *pad
+@@ -5724,6 +5924,7 @@ void _update_response_rate(_adapter *padapter,unsigned int mask)
// Set RRSR rate table.
rtw_write8(padapter, REG_RRSR, mask&0xff);
rtw_write8(padapter,REG_RRSR+1, (mask>>8)&0xff);
// Set RTS initial rate
while(mask > 0x1)
-@@ -5766,6 +5967,9 @@ void UpdateHalRAMask8192CUsb(PADAPTER pa
+@@ -5766,6 +5967,9 @@ void UpdateHalRAMask8192CUsb(PADAPTER padapter, u32 mac_id)
switch (mac_id)
{
case 0:// for infra mode
supportRateNum = rtw_get_rateset_len(cur_network->SupportedRates);
networkType = judge_network_type(padapter, cur_network->SupportedRates, supportRateNum) & 0xf;
//pmlmeext->cur_wireless_mode = networkType;
-@@ -5796,17 +6000,29 @@ void UpdateHalRAMask8192CUsb(PADAPTER pa
+@@ -5796,17 +6000,29 @@ void UpdateHalRAMask8192CUsb(PADAPTER padapter, u32 mac_id)
break;
default: //for each sta in IBSS
}
#ifdef CONFIG_BT_COEXIST
-@@ -5942,6 +6158,7 @@ static void rtl8192cu_init_default_value
+@@ -5942,6 +6158,7 @@ static void rtl8192cu_init_default_value(_adapter * padapter)
for(i = 0; i < HP_THERMAL_NUM; i++)
pdmpriv->ThermalValue_HP[i] = 0;
}
static u8 rtl8192cu_ps_func(PADAPTER Adapter,HAL_INTF_PS_FUNC efunc_id, u8 *val)
{
u8 bResult = _TRUE;
-@@ -5949,10 +6166,10 @@ static u8 rtl8192cu_ps_func(PADAPTER Ada
+@@ -5949,10 +6166,10 @@ static u8 rtl8192cu_ps_func(PADAPTER Adapter,HAL_INTF_PS_FUNC efunc_id, u8 *val)
#if defined(CONFIG_AUTOSUSPEND) && defined(SUPPORT_HW_RFOFF_DETECTED)
case HAL_USB_SELECT_SUSPEND:
break;
#endif //CONFIG_AUTOSUSPEND && SUPPORT_HW_RFOFF_DETECTED
-@@ -5961,6 +6178,7 @@ static u8 rtl8192cu_ps_func(PADAPTER Ada
+@@ -5961,6 +6178,7 @@ static u8 rtl8192cu_ps_func(PADAPTER Adapter,HAL_INTF_PS_FUNC efunc_id, u8 *val)
}
return bResult;
}
rtl8192c_set_hal_ops(pHalFunc);
_func_exit_;
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c
+index 4d01b3c..9523337 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c
@@ -16,8 +16,7 @@
#if 1
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c
+index d6f3376..2d627d3 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c
@@ -16,8 +16,7 @@
unsigned int pipe;
int status = 0;
-@@ -84,6 +53,16 @@ static int usbctrl_vendorreq(struct dvob
+@@ -84,6 +53,16 @@ static int usbctrl_vendorreq(struct dvobj_priv *pdvobjpriv, u8 request, u16 val
u8 tmp_buf[MAX_USB_IO_CTL_SIZE];
#endif
//DBG_871X("%s %s:%d\n",__FUNCTION__, current->comm, current->pid);
if((padapter->bSurpriseRemoved) ||(padapter->pwrctrlpriv.pnp_bstop_trx)){
-@@ -153,7 +132,7 @@ static int usbctrl_vendorreq(struct dvob
+@@ -153,7 +132,7 @@ static int usbctrl_vendorreq(struct dvobj_priv *pdvobjpriv, u8 request, u16 val
if ( status == len) // Success this control transfer.
{
if ( requesttype == 0x01 )
{ // For Control read transfer, we have to copy the read data from pIo_buf to pdata.
_rtw_memcpy( pdata, pIo_buf, len );
-@@ -186,7 +165,7 @@ static int usbctrl_vendorreq(struct dvob
+@@ -186,7 +165,7 @@ static int usbctrl_vendorreq(struct dvobj_priv *pdvobjpriv, u8 request, u16 val
}
}
padapter->bSurpriseRemoved = _TRUE;
break;
}
-@@ -220,8 +199,7 @@ static u8 usb_read8(struct intf_hdl *pin
+@@ -220,8 +199,7 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
u16 wvalue;
u16 index;
u16 len;
_func_enter_;
-@@ -232,7 +210,7 @@ static u8 usb_read8(struct intf_hdl *pin
+@@ -232,7 +210,7 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
wvalue = (u16)(addr&0x0000ffff);
len = 1;
_func_exit_;
-@@ -248,7 +226,6 @@ static u16 usb_read16(struct intf_hdl *p
+@@ -248,7 +226,6 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
u16 index;
u16 len;
u32 data=0;
_func_enter_;
-@@ -259,7 +236,7 @@ static u16 usb_read16(struct intf_hdl *p
+@@ -259,7 +236,7 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
wvalue = (u16)(addr&0x0000ffff);
len = 2;
_func_exit_;
-@@ -275,7 +252,6 @@ static u32 usb_read32(struct intf_hdl *p
+@@ -275,7 +252,6 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
u16 index;
u16 len;
u32 data=0;
_func_enter_;
-@@ -286,7 +262,7 @@ static u32 usb_read32(struct intf_hdl *p
+@@ -286,7 +262,7 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
wvalue = (u16)(addr&0x0000ffff);
len = 4;
_func_exit_;
-@@ -303,7 +279,6 @@ static int usb_write8(struct intf_hdl *p
+@@ -303,7 +279,6 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
u16 len;
u32 data;
int ret;
_func_enter_;
-@@ -317,7 +292,7 @@ static int usb_write8(struct intf_hdl *p
+@@ -317,7 +292,7 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
data = val;
data = cpu_to_le32(data&0x000000ff);
_func_exit_;
-@@ -334,7 +309,6 @@ static int usb_write16(struct intf_hdl *
+@@ -334,7 +309,6 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
u16 len;
u32 data;
int ret;
_func_enter_;
-@@ -348,7 +322,7 @@ static int usb_write16(struct intf_hdl *
+@@ -348,7 +322,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
data = val;
data = cpu_to_le32(data&0x0000ffff);
_func_exit_;
-@@ -365,7 +339,6 @@ static int usb_write32(struct intf_hdl *
+@@ -365,7 +339,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
u16 len;
u32 data;
int ret;
_func_enter_;
-@@ -378,14 +351,14 @@ static int usb_write32(struct intf_hdl *
+@@ -378,14 +351,14 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
data = cpu_to_le32(val);
static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
{
u8 request;
-@@ -395,7 +368,6 @@ static int usb_writeN(struct intf_hdl *p
+@@ -395,7 +368,6 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
u16 len;
u8 buf[VENDOR_CMD_MAX_DATA_LEN]={0};
int ret;
_func_enter_;
-@@ -407,7 +379,7 @@ static int usb_writeN(struct intf_hdl *p
+@@ -407,7 +379,7 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
len = length;
_rtw_memcpy(buf, pdata, len );
_func_exit_;
-@@ -415,271 +387,6 @@ static int usb_writeN(struct intf_hdl *p
+@@ -415,271 +387,6 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
}
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs)
{
-@@ -731,8 +438,8 @@ static u32 usb_read_interrupt(struct int
+@@ -731,8 +438,8 @@ static u32 usb_read_interrupt(struct intf_hdl *pintfhdl, u32 addr)
int err;
unsigned int pipe;
u32 ret = _SUCCESS;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct recv_priv *precvpriv = &padapter->recvpriv;
_queue *pfree_recv_queue = &precvpriv->free_recv_queue;
-@@ -795,28 +705,41 @@ static int recvbuf2recvframe(_adapter *p
+@@ -795,28 +705,41 @@ static int recvbuf2recvframe(_adapter *padapter, struct recv_buf *precvbuf)
("recvbuf2recvframe: rxdesc=offsset 0:0x%08x, 4:0x%08x, 8:0x%08x, C:0x%08x\n",
prxstat->rxdw0, prxstat->rxdw1, prxstat->rxdw2, prxstat->rxdw4));
- pkt_len = le32_to_cpu(prxstat->rxdw0)&0x00003fff;
-
+ prxstat = (struct recv_stat *)pbuf;
-
-- mf = (le32_to_cpu(prxstat->rxdw1) >> 27) & 0x1;//more fragment bit
-- frag = (le32_to_cpu(prxstat->rxdw2) >> 12) & 0xf;//fragmentation number
++
+ precvframe = rtw_alloc_recvframe(pfree_recv_queue);
+ if(precvframe==NULL)
+ {
+ precvframe->u.hdr.precvbuf = NULL; //can't access the precvbuf for new arch.
+ precvframe->u.hdr.len=0;
+- mf = (le32_to_cpu(prxstat->rxdw1) >> 27) & 0x1;//more fragment bit
+- frag = (le32_to_cpu(prxstat->rxdw2) >> 12) & 0xf;//fragmentation number
++ rtl8192c_query_rx_desc_status(precvframe, prxstat);
+
- drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16;
- drvinfo_sz = drvinfo_sz << 3;//uint (2^3) = 8 bytes; REG_RX_DRVINFO_SZ
- RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("recvbuf2recvframe: DRV_INFO_SIZE=%d\n", drvinfo_sz));
-+ rtl8192c_query_rx_desc_status(precvframe, prxstat);
-+
+ pattrib = &precvframe->u.hdr.attrib;
+ if(pattrib->physt)
+ {
{
shift_sz = 6;
}
-@@ -825,23 +748,11 @@ static int recvbuf2recvframe(_adapter *p
+@@ -825,23 +748,11 @@ static int recvbuf2recvframe(_adapter *padapter, struct recv_buf *precvbuf)
shift_sz = 0;
}
//alloc_sz = 1664; //1664 is 128 alignment.
if(skb_len <= 1650)
alloc_sz = 1664;
-@@ -854,27 +765,24 @@ static int recvbuf2recvframe(_adapter *p
+@@ -854,27 +765,24 @@ static int recvbuf2recvframe(_adapter *padapter, struct recv_buf *precvbuf)
// 8 is for skb->data 4 bytes alignment.
alloc_sz += 14;
}
//precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pbuf;
//precvframe->u.hdr.rx_end = pbuf + (pkt_offset>1612?pkt_offset:1612);
-@@ -903,13 +811,30 @@ static int recvbuf2recvframe(_adapter *p
+@@ -901,15 +809,32 @@ static int recvbuf2recvframe(_adapter *padapter, struct recv_buf *precvbuf)
+ default:
+ break;
}
- #endif
-
+-#endif
+-
- //because the endian issue, driver avoid reference to the rxstat after calling update_recvframe_attrib_from_recvstat();
- rtl8192cu_update_recvframe_attrib_from_recvstat(precvframe, prxstat);
-
++#endif
++
+#ifdef CONFIG_CONCURRENT_MODE
+ if(rtw_buddy_adapter_up(padapter))
+ {
pkt_cnt--;
transfer_len -= pkt_offset;
-@@ -924,7 +849,7 @@ static int recvbuf2recvframe(_adapter *p
+@@ -924,7 +849,7 @@ static int recvbuf2recvframe(_adapter *padapter, struct recv_buf *precvbuf)
_exit_recvbuf2recvframe:
}
void rtl8192cu_recv_tasklet(void *priv)
-@@ -977,7 +902,7 @@ static void usb_read_port_complete(struc
+@@ -977,7 +902,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
}
else
{
precvbuf->transfer_len = purb->actual_length;
-@@ -993,7 +918,7 @@ static void usb_read_port_complete(struc
+@@ -993,7 +918,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
DBG_8192C("###=> usb_read_port_complete => urb status(%d)\n", purb->status);
padapter->bSurpriseRemoved = _TRUE;
}
-@@ -1009,6 +934,10 @@ static void usb_read_port_complete(struc
+@@ -1009,6 +934,10 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped=TRUE\n"));
break;
case -EPROTO:
#ifdef DBG_CONFIG_ERROR_DETECT
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
-@@ -1037,10 +966,10 @@ static u32 usb_read_port(struct intf_hdl
+@@ -1037,10 +966,10 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
int err;
unsigned int pipe;
u32 ret = _SUCCESS;
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct recv_priv *precvpriv = &padapter->recvpriv;
_queue *pfree_recv_queue = &precvpriv->free_recv_queue;
-@@ -1116,7 +1047,7 @@ static int recvbuf2recvframe(_adapter *p
+@@ -1116,7 +1047,7 @@ static int recvbuf2recvframe(_adapter *padapter, _pkt *pskb)
prxstat = (struct recv_stat *)pbuf;
pkt_cnt = (le32_to_cpu(prxstat->rxdw2)>>16) & 0xff;
#if 0 //temp remove when disable usb rx aggregation
if((pkt_cnt > 10) || (pkt_cnt < 1) || (transfer_len<RXDESC_SIZE) ||(pkt_len<=0))
{
-@@ -1129,27 +1060,41 @@ static int recvbuf2recvframe(_adapter *p
+@@ -1129,27 +1060,41 @@ static int recvbuf2recvframe(_adapter *padapter, _pkt *pskb)
("recvbuf2recvframe: rxdesc=offsset 0:0x%08x, 4:0x%08x, 8:0x%08x, C:0x%08x\n",
prxstat->rxdw0, prxstat->rxdw1, prxstat->rxdw2, prxstat->rxdw4));
{
shift_sz = 6;
}
-@@ -1158,23 +1103,11 @@ static int recvbuf2recvframe(_adapter *p
+@@ -1158,23 +1103,11 @@ static int recvbuf2recvframe(_adapter *padapter, _pkt *pskb)
shift_sz = 0;
}
//alloc_sz = 1664; //1664 is 128 alignment.
if(skb_len <= 1650)
alloc_sz = 1664;
-@@ -1187,26 +1120,24 @@ static int recvbuf2recvframe(_adapter *p
+@@ -1187,26 +1120,24 @@ static int recvbuf2recvframe(_adapter *padapter, _pkt *pskb)
// 8 is for skb->data 4 bytes alignment.
alloc_sz += 14;
}
if(pkt_copy)
{
precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pbuf;
-@@ -1214,7 +1145,8 @@ static int recvbuf2recvframe(_adapter *p
+@@ -1214,7 +1145,8 @@ static int recvbuf2recvframe(_adapter *padapter, _pkt *pskb)
}
else
{
goto _exit_recvbuf2recvframe;
}
}
-@@ -1238,13 +1170,30 @@ static int recvbuf2recvframe(_adapter *p
+@@ -1238,13 +1170,30 @@ static int recvbuf2recvframe(_adapter *padapter, _pkt *pskb)
}
#endif
#endif
}
-@@ -1331,10 +1277,11 @@ static void usb_read_port_complete(struc
+@@ -1331,10 +1277,11 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
#else
if(precvbuf->pskb){
DBG_8192C("==> free skb(%p)\n",precvbuf->pskb);
goto exit;
}
-@@ -1345,10 +1292,11 @@ static void usb_read_port_complete(struc
+@@ -1345,10 +1292,11 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete: (purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n"));
precvbuf->reuse = _TRUE;
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
precvbuf->transfer_len = purb->actual_length;
skb_put(precvbuf->pskb, purb->actual_length);
-@@ -1368,7 +1316,7 @@ static void usb_read_port_complete(struc
+@@ -1368,7 +1316,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
DBG_8192C("###=> usb_read_port_complete => urb status(%d)\n", purb->status);
padapter->bSurpriseRemoved = _TRUE;
}
-@@ -1384,6 +1332,10 @@ static void usb_read_port_complete(struc
+@@ -1384,6 +1332,10 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port_complete:bDriverStopped=TRUE\n"));
break;
case -EPROTO:
#ifdef DBG_CONFIG_ERROR_DETECT
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
-@@ -1394,9 +1346,11 @@ static void usb_read_port_complete(struc
+@@ -1394,9 +1346,11 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
break;
case -EINPROGRESS:
break;
}
-@@ -1418,12 +1372,11 @@ static u32 usb_read_port(struct intf_hdl
+@@ -1418,12 +1372,11 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
u32 ret = _SUCCESS;
PURB purb = NULL;
struct recv_buf *precvbuf = (struct recv_buf *)rmem;
void rtl8192cu_set_intf_ops(struct _io_ops *pops)
{
_func_enter_;
-@@ -2029,8 +1521,7 @@ void rtl8192cu_set_intf_ops(struct _io_o
+@@ -2029,8 +1521,7 @@ void rtl8192cu_set_intf_ops(struct _io_ops *pops)
pops->_write32_async = &usb_async_write32;
#endif
pops->_write_mem = &usb_write_mem;
pops->_read_port_cancel = &usb_read_port_cancel;
pops->_write_port_cancel = &usb_write_port_cancel;
+diff --git a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c
+index 82adeff..32ff645 100644
--- a/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c
+++ b/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c
@@ -16,8 +16,7 @@
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/ifcfg-wlan0 b/drivers/net/wireless/rtl8192cu/ifcfg-wlan0
+old mode 100644
+new mode 100755
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h
+index 2ecb65d..4ae3630 100644
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h
+++ b/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h
@@ -25,26 +25,29 @@
#define PHY_REG_2TArrayLength 374
extern u32 Rtl8192CEPHY_REG_2TArray[PHY_REG_2TArrayLength];
#define PHY_REG_1TArrayLength 374
-@@ -69,7 +72,8 @@ extern u32 Rtl8192CERadioA_1TArray[Radio
+@@ -69,7 +72,8 @@ extern u32 Rtl8192CERadioA_1TArray[RadioA_1TArrayLength];
extern u32 Rtl8192CERadioB_1TArray[RadioB_1TArrayLength];
#define RadioB_GM_ArrayLength 1
extern u32 Rtl8192CERadioB_GM_Array[RadioB_GM_ArrayLength];
extern u32 Rtl8192CEMAC_2T_Array[MAC_2T_ArrayLength];
#define MACPHY_Array_PGLength 1
extern u32 Rtl8192CEMACPHY_Array_PG[MACPHY_Array_PGLength];
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h
+index 6ecb754..3afb292 100644
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h
+++ b/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h
@@ -111,15 +111,7 @@ typedef enum _HW90_BLOCK{
typedef struct _BB_REGISTER_DEFINITION{
u32 rfintfs; // set software control:
// 0x870~0x877[8 bytes]
-@@ -294,11 +273,11 @@ void rtl8192c_PHY_SetBBReg( IN PADAPTER
+@@ -294,11 +273,11 @@ void rtl8192c_PHY_SetBBReg( IN PADAPTER Adapter,
IN u32 BitMask,
IN u32 Data );
u32 rtl8192c_PHY_QueryRFReg( IN PADAPTER Adapter,
IN u32 RegAddr,
IN u32 BitMask,
IN u32 Data );
-@@ -313,14 +292,14 @@ int PHY_RFConfig8192C( IN PADAPTER Adapt
+@@ -313,14 +292,14 @@ int PHY_RFConfig8192C( IN PADAPTER Adapter );
/* RF config */
int rtl8192c_PHY_ConfigRFWithParaFile( IN PADAPTER Adapter,
IN u8* pFileName,
/* Read initi reg value for tx power setting. */
void rtl8192c_PHY_GetHWRegOriginalValue( IN PADAPTER Adapter );
-@@ -409,8 +388,6 @@ VOID rtl8192c_PHY_LCCalibrate(IN PADAPTE
+@@ -409,8 +388,6 @@ VOID rtl8192c_PHY_LCCalibrate(IN PADAPTER pAdapter);
//
VOID rtl8192c_PHY_APCalibrate(IN PADAPTER pAdapter, IN char delta);
VOID rtl8192c_PHY_SetRFPathSwitch(IN PADAPTER pAdapter, IN BOOLEAN bMain);
//
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h
+index 1f9f330..6364166 100644
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h
+++ b/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h
@@ -197,6 +197,19 @@
#define RF_BS_IQGEN 0x0F //
#define RF_MODE1 0x10 //
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h
+index 254a060..ba3c282 100644
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h
+++ b/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h
@@ -20,31 +20,31 @@
#define PHY_REG_2TArrayLength 374
extern u32 Rtl8192CUPHY_REG_2TArray[PHY_REG_2TArrayLength];
#define PHY_REG_1TArrayLength 374
-@@ -77,6 +77,10 @@ extern u32 Rtl8192CURadioB_2TArray[Radio
+@@ -77,6 +77,10 @@ extern u32 Rtl8192CURadioB_2TArray[RadioB_2TArrayLength];
extern u32 Rtl8192CURadioA_1TArray[RadioA_1TArrayLength];
#define RadioB_1TArrayLength 1
extern u32 Rtl8192CURadioB_1TArray[RadioB_1TArrayLength];
#define RadioA_1T_mCardArrayLength 282
extern u32 Rtl8192CURadioA_1T_mCardArray[RadioA_1T_mCardArrayLength];
#define RadioB_1T_mCardArrayLength 1
-@@ -85,7 +89,9 @@ extern u32 Rtl8192CURadioB_1T_mCardArray
+@@ -85,7 +89,9 @@ extern u32 Rtl8192CURadioB_1T_mCardArray[RadioB_1T_mCardArrayLength];
extern u32 Rtl8192CURadioA_1T_HPArray[RadioA_1T_HPArrayLength];
#define RadioB_GM_ArrayLength 1
extern u32 Rtl8192CURadioB_GM_Array[RadioB_GM_ArrayLength];
extern u32 Rtl8192CUMAC_2T_Array[MAC_2T_ArrayLength];
#define MACPHY_Array_PGLength 1
extern u32 Rtl8192CUMACPHY_Array_PG[MACPHY_Array_PGLength];
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h
+index dc2bc17..0639775 100644
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h
+++ b/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h
@@ -17,50 +17,50 @@
+extern const u32 Rtl8192DEAGCTAB_1TArray[Rtl8192DEAGCTAB_1TArrayLength];
#endif //__INC_HAL8192CU_FW_IMG_H
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192DETestHWImg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192DETestHWImg.h
+deleted file mode 100644
+index 2432bcd..0000000
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192DETestHWImg.h
+++ /dev/null
@@ -1,54 +0,0 @@
-extern u32 Rtl8192DTestAGCTAB_2GArray[Rtl8192DTestAGCTAB_2GArrayLength];
-
-#endif //__INC_HAL8192CU_FW_IMG_H
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h
+index 475cf36..624fbda 100644
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h
+++ b/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h
@@ -157,6 +157,16 @@ typedef enum _MACPHY_MODE_8192D{
/*--------------------------Exported Function prototype---------------------*/
#define PHY_SetBBReg1Byte(Adapter, RegAddr, BitMask, Data) rtl8192d_PHY_SetBBReg1Byte((Adapter), (RegAddr), (BitMask), (Data))
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h
+index d931001..d6c66d9 100644
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h
+++ b/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h
@@ -24,7 +24,7 @@
extern const u8 Rtl8192DUFwImgArray[Rtl8192DUImgArrayLength];
#define Rtl8192DUMainArrayLength 1
extern const u8 Rtl8192DUFwMainArray[Rtl8192DUMainArrayLength];
-@@ -36,7 +36,7 @@ extern const u32 Rtl8192DUPHY_REG_2TArra
+@@ -36,7 +36,7 @@ extern const u32 Rtl8192DUPHY_REG_2TArray[Rtl8192DUPHY_REG_2TArrayLength];
extern const u32 Rtl8192DUPHY_REG_1TArray[Rtl8192DUPHY_REG_1TArrayLength];
#define Rtl8192DUPHY_REG_Array_PGLength 624
extern const u32 Rtl8192DUPHY_REG_Array_PG[Rtl8192DUPHY_REG_Array_PGLength];
extern const u32 Rtl8192DUPHY_REG_Array_MP[Rtl8192DUPHY_REG_Array_MPLength];
#define Rtl8192DURadioA_2TArrayLength 378
extern const u32 Rtl8192DURadioA_2TArray[Rtl8192DURadioA_2TArrayLength];
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h b/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h
+index a297e76..cc27a77 100644
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h
+++ b/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h
@@ -23,7 +23,7 @@
extern u8 Rtl8192DUFwWWImgArray[DUWWImgArrayLength];
#endif //__INC_HAL8192DU_FW_IMG_WOWLAN_H
+diff --git a/drivers/net/wireless/rtl8192cu/include/Hal8192DUTestHWImg.h b/drivers/net/wireless/rtl8192cu/include/Hal8192DUTestHWImg.h
+deleted file mode 100644
+index e0491ff..0000000
--- a/drivers/net/wireless/rtl8192cu/include/Hal8192DUTestHWImg.h
+++ /dev/null
@@ -1,54 +0,0 @@
-extern u32 Rtl8192DTestAGCTAB_2GArray[Rtl8192DTestAGCTAB_2GArrayLength];
-
-#endif //__INC_HAL8192CU_FW_IMG_H
+diff --git a/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h b/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h
+new file mode 100644
+index 0000000..e5d151c
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h
@@ -0,0 +1,137 @@
+ WLAN_PWR_CFG PwrCfgCmd[]);
+
+#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/autoconf.h b/drivers/net/wireless/rtl8192cu/include/autoconf.h
+index 7d6db40..12294df 100644
--- a/drivers/net/wireless/rtl8192cu/include/autoconf.h
+++ b/drivers/net/wireless/rtl8192cu/include/autoconf.h
@@ -31,11 +31,13 @@
// Added by Albert 20110314
#define CONFIG_P2P 1
-+#ifdef CONFIG_P2P
+-
+-
+ #ifdef CONFIG_P2P
+-// Added by Albert 20110812
+-// The CONFIG_WFD is for supporting the Wi-Fi display
+-//#define CONFIG_WFD 1
+-
+-// Unmarked if there is low p2p scanned ratio; Kurt
+-//#define CONFIG_P2P_AGAINST_NOISE 1
+-#define CONFIG_P2P_REMOVE_GROUP_INFO
+-//#define CONFIG_DBG_P2P
+ //Added by Albert 20110812
+ //The CONFIG_WFD is for supporting the Wi-Fi display
+ #define CONFIG_WFD
+ #define CONFIG_P2P_REMOVE_GROUP_INFO
+ #endif
+ //#define CONFIG_DBG_P2P
-
++
+ //#define CONFIG_P2P_PS
+ //#define CONFIG_P2P_IPS
-
--#ifdef CONFIG_P2P
--// Added by Albert 20110812
--// The CONFIG_WFD is for supporting the Wi-Fi display
--//#define CONFIG_WFD 1
--
--// Unmarked if there is low p2p scanned ratio; Kurt
--//#define CONFIG_P2P_AGAINST_NOISE 1
--#define CONFIG_P2P_REMOVE_GROUP_INFO
--//#define CONFIG_DBG_P2P
++
+ #define P2P_OP_CHECK_SOCIAL_CH
+ // Added comment by Borg 2013/06/21
+ // Issue: Nexus 4 is hard to do miracast.
+
+//turn off power tracking when traffic is busy
+//#define CONFIG_BUSY_TRAFFIC_SKIP_PWR_TRACK
+diff --git a/drivers/net/wireless/rtl8192cu/include/basic_types.h b/drivers/net/wireless/rtl8192cu/include/basic_types.h
+index f880224..f76e68f 100644
--- a/drivers/net/wireless/rtl8192cu/include/basic_types.h
+++ b/drivers/net/wireless/rtl8192cu/include/basic_types.h
@@ -106,6 +106,51 @@
#define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T))
#define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1)
+diff --git a/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h b/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h
+index 246ba89..7c8d4d7 100644
--- a/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h
+++ b/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h
@@ -98,7 +98,7 @@
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) || defined(PLATFORM_MPIXEL)
+diff --git a/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h b/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h
+index 117c84d..a3ca9ea 100644
--- a/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h
+++ b/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h
@@ -16,12 +16,11 @@
#ifndef __u16
typedef unsigned short __u16;
#endif
-@@ -74,7 +73,7 @@ __inline static __u64 ___swab64(__u64 x
+@@ -74,7 +73,7 @@ __inline static __u64 ___swab64(__u64 x)
(__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \
(__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \
}
#ifndef __arch__swab16
__inline static __u16 __arch__swab16(__u16 x)
-@@ -109,11 +108,19 @@ __inline static __u64 __arch__swab64(__u
+@@ -109,11 +108,19 @@ __inline static __u64 __arch__swab64(__u64 x)
#define __swab64(x) __fswab64(x)
#endif // __swab16
{
return __arch__swab32(x);
}
+diff --git a/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h b/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h
+index 1735349..7e2a118 100644
--- a/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h
+++ b/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h
@@ -16,8 +16,7 @@
#ifndef _LINUX_BYTEORDER_SWABB_H
#define _LINUX_BYTEORDER_SWABB_H
+diff --git a/drivers/net/wireless/rtl8192cu/include/drv_conf.h b/drivers/net/wireless/rtl8192cu/include/drv_conf.h
+index a2b6cc4..1317687 100644
--- a/drivers/net/wireless/rtl8192cu/include/drv_conf.h
+++ b/drivers/net/wireless/rtl8192cu/include/drv_conf.h
@@ -38,7 +38,7 @@
//Android expect dbm as the rx signal strength unit
#define CONFIG_SIGNAL_DISPLAY_DBM
+diff --git a/drivers/net/wireless/rtl8192cu/include/drv_types.h b/drivers/net/wireless/rtl8192cu/include/drv_types.h
+index 95e20cc..0ac34f2 100644
--- a/drivers/net/wireless/rtl8192cu/include/drv_types.h
+++ b/drivers/net/wireless/rtl8192cu/include/drv_types.h
@@ -1,7 +1,7 @@
};
typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
-@@ -65,11 +65,12 @@ typedef struct _ADAPTER _adapter, ADAPTE
+@@ -65,11 +65,12 @@ typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
#include <rtw_cmd.h>
#include <wlan_bssdef.h>
#include <rtw_pwrctrl.h>
#include <rtw_io.h>
#include <rtw_eeprom.h>
-@@ -81,6 +82,8 @@ typedef struct _ADAPTER _adapter, ADAPTE
+@@ -81,6 +82,8 @@ typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
#include <rtw_led.h>
#include <rtw_mlme_ext.h>
#include <rtw_p2p.h>
#ifdef CONFIG_DRVEXT_MODULE
#include <drvext_api.h>
-@@ -106,23 +109,23 @@ typedef struct _ADAPTER _adapter, ADAPTE
+@@ -106,23 +109,23 @@ typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
#define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5)
struct specific_device_id{
#endif
+ u8 special_rf_path; //0: 2T2R ,1: only turn on path A 1T1R, 2: only turn on path B 1T1R
+ u8 mac_phy_mode; //0:by efuse, 1:smsp, 2:dmdp, 3:dmsp.
-+
+
+-#ifdef SUPPORT_64_STA
+- u8 bcmc_rate;
+#ifdef CONFIG_80211D
+ u8 enable80211d;
+#endif
+ u8 if2name[16];
+
+ u8 notch_filter;
-
--#ifdef SUPPORT_64_STA
-- u8 bcmc_rate;
++
+#ifdef CONFIG_MULTI_VIR_IFACES
+ u8 ext_iface_num;//primary/secondary iface is excluded
#endif
+ _mutex h2c_fwcmd_mutex;
+ _mutex setch_mutex;
+ _mutex setbw_mutex;
-+
+
+-#ifdef PLATFORM_LINUX
+- struct sdio_func *func;
+-#endif//PLATFORM_LINUX
+ unsigned char oper_channel; //saved channel info when call set_channel_bw
+ unsigned char oper_bwmode;
+ unsigned char oper_ch_offset;//PRIME_CHNL_OFFSET
+ //padapters[IFACE_ID1] == if2
+ _adapter *padapters[IFACE_ID_MAX];
+ u8 iface_nums; // total number of ifaces used runtime
-
--#ifdef PLATFORM_LINUX
-- struct sdio_func *func;
--#endif//PLATFORM_LINUX
++
+ //For 92D, DMDP have 2 interface.
+ u8 InterfaceNumber;
+ u8 NumInterfaces;
+ u8 DualMacMode;
+ u8 irq_alloc;
-+
-+/*-------- below is for SDIO INTERFACE --------*/
- u8 func_number;//unsigned char FunctionNumber;
- u32 block_transfer_len;//unsigned long BLOCK_TRANSFER_LEN;
- u16 sdio_hisr;
- u16 sdio_himr;
-#endif// CONFIG_SDIO_HCI
++/*-------- below is for SDIO INTERFACE --------*/
++
+#ifdef INTF_DATA
+ INTF_DATA intf_data;
+#endif
- _thread_hdl_ evtThread;
- _thread_hdl_ xmitThread;
- _thread_hdl_ recvThread;
--
-- NDIS_STATUS (*dvobj_init)(_adapter * adapter);
-- void (*dvobj_deinit)(_adapter * adapter);
+ _thread_hdl_ cmdThread;
+ _thread_hdl_ evtThread;
+ _thread_hdl_ xmitThread;
+ _thread_hdl_ recvThread;
-+
+
+- NDIS_STATUS (*dvobj_init)(_adapter * adapter);
+- void (*dvobj_deinit)(_adapter * adapter);
+#ifndef PLATFORM_LINUX
+ NDIS_STATUS (*dvobj_init)(struct dvobj_priv *dvobj);
+ void (*dvobj_deinit)(struct dvobj_priv *dvobj);
__inline static u8 *myid(struct eeprom_priv *peepriv)
{
return (peepriv->mac_addr);
+diff --git a/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h b/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h
+new file mode 100644
+index 0000000..fd467ca
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h
@@ -0,0 +1,70 @@
+
+#endif
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/farray.h b/drivers/net/wireless/rtl8192cu/include/farray.h
+deleted file mode 100644
+index 79d2a42..0000000
--- a/drivers/net/wireless/rtl8192cu/include/farray.h
+++ /dev/null
@@ -1,31480 +0,0 @@
-0x08,0xFB,0x90,0xB8,
-0xFF,0xFF,0xFF,0xFF,
-};
+diff --git a/drivers/net/wireless/rtl8192cu/include/hal_com.h b/drivers/net/wireless/rtl8192cu/include/hal_com.h
+new file mode 100644
+index 0000000..42aae0e
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/hal_com.h
@@ -0,0 +1,146 @@
+
+#endif //__HAL_COMMON_H__
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/hal_init.h b/drivers/net/wireless/rtl8192cu/include/hal_init.h
+deleted file mode 100644
+index ec48f83..0000000
--- a/drivers/net/wireless/rtl8192cu/include/hal_init.h
+++ /dev/null
@@ -1,305 +0,0 @@
-
-#endif //__HAL_INIT_H__
-
+diff --git a/drivers/net/wireless/rtl8192cu/include/hal_intf.h b/drivers/net/wireless/rtl8192cu/include/hal_intf.h
+new file mode 100644
+index 0000000..dd82662
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/hal_intf.h
@@ -0,0 +1,432 @@
+
+#endif //__HAL_INTF_H__
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/ieee80211.h b/drivers/net/wireless/rtl8192cu/include/ieee80211.h
+index 5c17a28..e283a5f 100644
--- a/drivers/net/wireless/rtl8192cu/include/ieee80211.h
+++ b/drivers/net/wireless/rtl8192cu/include/ieee80211.h
@@ -43,6 +43,8 @@
#define RTW_IEEE80211_STYPE_CFACKPOLL 0x0070
-#define RTW_IEEE80211_QOS_DATAGRP 0x0080
-#define RTW_IEEE80211_QoS_DATAGRP RTW_IEEE80211_QOS_DATAGRP
--
--#define RTW_IEEE80211_SCTL_FRAG 0x000F
--#define RTW_IEEE80211_SCTL_SEQ 0xFFF0
+#define RTW_IEEE80211_STYPE_QOS_DATA 0x0080
+#define RTW_IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
+#define RTW_IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
+/* sequence control field */
+#define RTW_IEEE80211_SCTL_FRAG 0x000F
+#define RTW_IEEE80211_SCTL_SEQ 0xFFF0
-+
+
+-#define RTW_IEEE80211_SCTL_FRAG 0x000F
+-#define RTW_IEEE80211_SCTL_SEQ 0xFFF0
+
+#define RTW_ERP_INFO_NON_ERP_PRESENT BIT(0)
+#define RTW_ERP_INFO_USE_PROTECTION BIT(1)
extern __inline int is_multicast_mac_addr(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
-@@ -1175,6 +1205,13 @@ extern __inline int is_broadcast_mac_add
+@@ -1175,6 +1205,13 @@ extern __inline int is_broadcast_mac_addr(const u8 *addr)
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
}
RTW_WLAN_CATEGORY_WMM = 17,
RTW_WLAN_CATEGORY_P2P = 0x7f,//P2P action frames
};
-@@ -1276,8 +1276,22 @@ enum rtw_ieee80211_spectrum_mgmt_actionc
+@@ -1276,8 +1276,22 @@ enum rtw_ieee80211_spectrum_mgmt_actioncode {
enum _PUBLIC_ACTION{
ACT_PUBLIC_BSSCOEXIST = 0, // 20/40 BSS Coexistence
void rtw_set_supported_rate(u8* SupportedRates, uint mode) ;
unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit);
-@@ -1426,19 +1527,31 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_le
+@@ -1426,19 +1527,31 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_attr, u32 *len_attr);
u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_content, uint *len_content);
int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *attr_content, uint *attr_contentlen);
#endif // CONFIG_WFD
-@@ -1457,5 +1570,11 @@ uint rtw_is_cckratesonly_included(u8 *ra
+@@ -1457,5 +1570,11 @@ uint rtw_is_cckratesonly_included(u8 *rate);
int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
void rtw_macaddr_cfg(u8 *mac_addr);
+
#endif /* IEEE80211_H */
+diff --git a/drivers/net/wireless/rtl8192cu/include/if_ether.h b/drivers/net/wireless/rtl8192cu/include/if_ether.h
+index 045c067..9e36d7f 100644
--- a/drivers/net/wireless/rtl8192cu/include/if_ether.h
+++ b/drivers/net/wireless/rtl8192cu/include/if_ether.h
@@ -1,22 +1,22 @@
#ifndef _LINUX_IF_ETHER_H
#define _LINUX_IF_ETHER_H
+diff --git a/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h b/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h
+index 7846927..ceb0db8 100644
--- a/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h
+++ b/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h
@@ -27,6 +27,62 @@
void rtw_cfg80211_indicate_connect(_adapter *padapter);
void rtw_cfg80211_indicate_disconnect(_adapter *padapter);
void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool aborted);
-@@ -74,8 +139,42 @@ void rtw_cfg80211_indicate_sta_disassoc(
+@@ -74,8 +139,42 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, u
void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, size_t len);
void rtw_cfg80211_rx_p2p_action_public(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
void rtw_cfg80211_rx_action_p2p(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
+
#endif //__IOCTL_CFG80211_H__
+diff --git a/drivers/net/wireless/rtl8192cu/include/ip.h b/drivers/net/wireless/rtl8192cu/include/ip.h
+index 5846347..d7f723d 100644
--- a/drivers/net/wireless/rtl8192cu/include/ip.h
+++ b/drivers/net/wireless/rtl8192cu/include/ip.h
@@ -1,19 +1,22 @@
#ifndef _LINUX_IP_H
#define _LINUX_IP_H
#include <rtw_byteorder.h>
+diff --git a/drivers/net/wireless/rtl8192cu/include/linux/wireless.h b/drivers/net/wireless/rtl8192cu/include/linux/wireless.h
+new file mode 100644
+index 0000000..24a22d6
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/linux/wireless.h
@@ -0,0 +1,90 @@
+};
+
+#endif /* _LINUX_WIRELESS_H */
+diff --git a/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h b/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h
+index 1583053..75754db 100644
--- a/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h
+++ b/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h
-@@ -34,10 +34,6 @@ extern void rtw_os_indicate_connect( _ad
+@@ -34,10 +34,6 @@ extern void rtw_os_indicate_connect( _adapter *adapter );
void rtw_os_indicate_scan_done( _adapter *padapter, bool aborted);
extern void rtw_report_sec_ie(_adapter *adapter,u8 authmode,u8 *sec_ie);
void rtw_reset_securitypriv( _adapter *adapter );
#endif //_MLME_OSDEP_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/osdep_intf.h b/drivers/net/wireless/rtl8192cu/include/osdep_intf.h
+index 86b3f1f..3cd1659 100644
--- a/drivers/net/wireless/rtl8192cu/include/osdep_intf.h
+++ b/drivers/net/wireless/rtl8192cu/include/osdep_intf.h
@@ -1,7 +1,7 @@
/*
Under Sync. IRP (SDIO/USB)
-@@ -53,9 +50,9 @@ The protection mechanism is through the
+@@ -53,9 +50,9 @@ The protection mechanism is through the pending queue.
_mutex ioctl_mutex;
// when in USB, IO is through interrupt in/out endpoints
struct usb_device *udev;
PURB piorw_urb;
-@@ -70,7 +67,7 @@ The protection mechanism is through the
+@@ -70,7 +67,7 @@ The protection mechanism is through the pending queue.
#ifdef PLATFORM_OS_XP
#ifdef CONFIG_SDIO_HCI
PMDL pmdl;
PSDBUS_REQUEST_PACKET sdrp;
PSDBUS_REQUEST_PACKET recv_sdrp;
-@@ -84,11 +81,11 @@ The protection mechanism is through the
+@@ -84,11 +81,11 @@ The protection mechanism is through the pending queue.
PIRP piorw_irp;
u8 io_irp_cnt;
u8 bio_irp_pending;
#ifdef CONFIG_R871X_TEST
-@@ -96,6 +93,9 @@ int rtw_start_pseudo_adhoc(_adapter *pad
+@@ -96,6 +93,9 @@ int rtw_start_pseudo_adhoc(_adapter *padapter);
int rtw_stop_pseudo_adhoc(_adapter *padapter);
#endif
u8 rtw_init_drv_sw(_adapter *padapter);
u8 rtw_free_drv_sw(_adapter *padapter);
u8 rtw_reset_drv_sw(_adapter *padapter);
-@@ -109,20 +109,47 @@ int rtw_ioctl(struct net_device *dev, st
+@@ -109,20 +109,47 @@ int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname);
struct net_device *rtw_init_netdev(_adapter *padapter);
#endif //_OSDEP_INTF_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/osdep_service.h b/drivers/net/wireless/rtl8192cu/include/osdep_service.h
+index 6fedff4..c5c465e 100644
--- a/drivers/net/wireless/rtl8192cu/include/osdep_service.h
+++ b/drivers/net/wireless/rtl8192cu/include/osdep_service.h
@@ -24,8 +24,9 @@
#endif
__inline static _list *get_next(_list *list)
-@@ -271,6 +994,15 @@ __inline static void _set_workitem(_work
+@@ -271,6 +994,15 @@ __inline static void _set_workitem(_workitem *pwork)
schedule_work(pwork);
}
//
// Global Mutex: can only be used at PASSIVE level.
//
-@@ -289,6 +1021,45 @@ __inline static void _set_workitem(_work
+@@ -289,6 +1021,45 @@ __inline static void _set_workitem(_workitem *pwork)
atomic_dec((atomic_t *)&(_MutexCounter)); \
}
#endif // PLATFORM_LINUX
-@@ -296,7 +1067,6 @@ __inline static void _set_workitem(_work
+@@ -296,7 +1067,6 @@ __inline static void _set_workitem(_workitem *pwork)
#include <ndis.h>
#include <ntddk.h>
#include <ntddndis.h>
#include <ntdef.h>
-@@ -470,46 +1240,160 @@ extern int RTW_STATUS_CODE(int error_cod
+@@ -470,46 +1240,160 @@ extern int RTW_STATUS_CODE(int error_code);
#define CONFIG_USE_VMALLOC
extern void _rtw_memcpy(void* dec, void* sour, u32 sz);
extern int _rtw_memcmp(void *dst, void *src, u32 sz);
-@@ -517,8 +1401,11 @@ extern void _rtw_memset(void *pbuf, int
+@@ -517,8 +1401,11 @@ extern void _rtw_memset(void *pbuf, int c, u32 sz);
extern void _rtw_init_listhead(_list *list);
extern u32 rtw_is_list_empty(_list *phead);
extern void _rtw_spinlock_free(_lock *plock);
extern void _rtw_spinlock(_lock *plock);
extern void _rtw_spinunlock(_lock *plock);
-@@ -539,6 +1428,7 @@ extern u32 rtw_end_of_queue_search(_list
+@@ -539,6 +1428,7 @@ extern u32 rtw_end_of_queue_search(_list *queue, _list *pelement);
extern u32 rtw_get_current_time(void);
extern u32 rtw_systime_to_ms(u32 systime);
extern s32 rtw_get_passing_time_ms(u32 start);
extern s32 rtw_get_time_interval_ms(u32 start, u32 end);
-@@ -547,6 +1437,8 @@ extern void rtw_sleep_schedulable(int ms
+@@ -547,6 +1437,8 @@ extern void rtw_sleep_schedulable(int ms);
extern void rtw_msleep_os(int ms);
extern void rtw_usleep_os(int us);
__inline static unsigned char _cancel_timer_ex(_timer *ptimer)
-@@ -564,7 +1457,10 @@ __inline static unsigned char _cancel_ti
+@@ -564,7 +1457,10 @@ __inline static unsigned char _cancel_timer_ex(_timer *ptimer)
#ifdef PLATFORM_LINUX
return del_timer_sync(ptimer);
#endif
#ifdef PLATFORM_WINDOWS
u8 bcancelled;
-@@ -574,16 +1470,25 @@ __inline static unsigned char _cancel_ti
+@@ -574,16 +1470,25 @@ __inline static unsigned char _cancel_timer_ex(_timer *ptimer)
#endif
}
__inline static void flush_signals_thread(void)
{
#ifdef PLATFORM_LINUX
-@@ -598,7 +1503,7 @@ __inline static _OS_STATUS res_to_status
+@@ -598,7 +1503,7 @@ __inline static _OS_STATUS res_to_status(sint res)
{
return res;
#endif
-@@ -613,6 +1518,22 @@ __inline static _OS_STATUS res_to_status
+@@ -613,6 +1518,22 @@ __inline static _OS_STATUS res_to_status(sint res)
}
#endif
extern void ATOMIC_SET(ATOMIC_T *v, int i);
-@@ -738,7 +1662,6 @@ extern int rtw_retrive_from_file(char *p
+@@ -738,7 +1662,6 @@ extern int rtw_retrive_from_file(char *path, u8* buf, u32 sz);
extern int rtw_store_to_file(char *path, u8* buf, u32 sz);
#endif
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/pci_ops.h b/drivers/net/wireless/rtl8192cu/include/pci_ops.h
+index dd63f5f..9404ff4 100644
--- a/drivers/net/wireless/rtl8192cu/include/pci_ops.h
+++ b/drivers/net/wireless/rtl8192cu/include/pci_ops.h
@@ -37,6 +37,7 @@ void rtl8192ce_xmit_tasklet(void *priv);
u32 MpReadPCIDwordDBI8192D(IN PADAPTER Adapter, IN u16 Offset, IN u8 Direct);
void MpWritePCIDwordDBI8192D(IN PADAPTER Adapter, IN u16 Offset, IN u32 Value, IN u8 Direct);
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h
+index 1689c54..c54cc31 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h
@@ -16,8 +16,7 @@
struct H2C_SS_RFOFF_PARAM{
u8 ROFOn; // 1: on, 0:off
-@@ -132,8 +122,7 @@ void rtl8192c_set_FwPwrMode_cmd(_adapter
+@@ -132,8 +122,7 @@ void rtl8192c_set_FwPwrMode_cmd(_adapter*padapter, u8 Mode);
void rtl8192c_set_FwJoinBssReport_cmd(_adapter* padapter, u8 mstatus);
u8 rtl8192c_set_rssi_cmd(_adapter*padapter, u8 *param);
u8 rtl8192c_set_raid_cmd(_adapter*padapter, u32 mask, u8 arg);
+
+#endif // __RTL8192C_CMD_H_
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h
+index 80b4a67..9d06540 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h
@@ -16,8 +16,7 @@
//============================================================
// structure and define
//============================================================
-@@ -211,6 +95,7 @@ typedef struct _Dynamic_Initial_Gain_Thr
+@@ -211,6 +95,7 @@ typedef struct _Dynamic_Initial_Gain_Threshold_
u8 LargeFAHit;
u8 ForbiddenIGI;
u32 Recover_cnt;
};
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h
+index 131b658..1013f74 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h
@@ -16,8 +16,7 @@
#ifndef _RTL8192C_EVENT_H_
#define _RTL8192C_EVENT_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h
+index cddd998..3348971 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h
@@ -16,11 +16,11 @@
u8 LegacyHTTxPowerDiff;// Legacy to HT rate power diff
-@@ -672,7 +689,7 @@ typedef struct hal_data_8192ce HAL_DATA_
+@@ -672,7 +689,7 @@ typedef struct hal_data_8192ce HAL_DATA_TYPE, *PHAL_DATA_TYPE;
#define IS_MULTI_FUNC_CHIP(_Adapter) (((((PHAL_DATA_TYPE)(_Adapter->HalData))->MultiFunc) & (RT_MULTI_FUNC_BT|RT_MULTI_FUNC_GPS)) ? _TRUE : _FALSE)
void InterruptRecognized8192CE(PADAPTER Adapter, PRT_ISR_CONTENT pIsrContent);
u8 LegacyHTTxPowerDiff;// Legacy to HT rate power diff
-@@ -876,12 +893,45 @@ VOID rtl8192c_FirmwareSelfReset(IN PADAP
+@@ -876,12 +893,45 @@ VOID rtl8192c_FirmwareSelfReset(IN PADAPTER Adapter);
int FirmwareDownload92C(IN PADAPTER Adapter,IN BOOLEAN bUsedWoWLANFw);
VOID InitializeFirmwareVars92C(PADAPTER Adapter);
u8 GetEEPROMSize8192C(PADAPTER Adapter);
+
+
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h
+index b361ba5..1ccf935 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h
@@ -16,8 +16,7 @@
#ifndef __RTL8192C_LED_H_
#define __RTL8192C_LED_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h
+index b532a59..d5656f5 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h
@@ -16,8 +16,7 @@
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h
+index d3c4b67..26c678a 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h
@@ -16,8 +16,7 @@
/******************************************************************************
*
*
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h
+index 27e0f0e..8ff13a7 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h
@@ -16,8 +16,7 @@
// The same function but different bit field.
#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4)
#define DIS_TSF_UDT0_TEST_CHIP BIT(5)
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h
+index dace413..20e88b5 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h
@@ -16,39 +16,17 @@
-extern u8 rtl8192c_sreset_get_wifi_status(_adapter *padapter);
#endif
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h b/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h
+index efb5f99..7d2059d 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h
@@ -16,22 +16,10 @@
#ifdef CONFIG_USB_HCI
#ifdef CONFIG_USB_TX_AGGREGATION
-@@ -58,10 +91,12 @@ void rtl8192cu_cal_txdesc_chksum(struct
+@@ -58,10 +91,12 @@ void rtl8192cu_cal_txdesc_chksum(struct tx_desc *ptxdesc);
s32 rtl8192cu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
#ifdef CONFIG_HOSTAPD_MLME
s32 rtl8192cu_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt);
#endif
-@@ -77,10 +112,13 @@ struct xmit_buf *rtl8192ce_dequeue_xmitb
+@@ -77,10 +112,13 @@ struct xmit_buf *rtl8192ce_dequeue_xmitbuf(struct rtw_tx_ring *ring);
void rtl8192ce_xmitframe_resume(_adapter *padapter);
#ifdef CONFIG_HOSTAPD_MLME
s32 rtl8192ce_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt);
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h b/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h
+index cb414a1..ad7e783 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h
@@ -16,8 +16,7 @@
H2C_CMD_MAX
}RTL8192D_H2C_CMD;
-@@ -98,12 +103,14 @@ void rtl8192d_set_FwPwrMode_cmd(_adapter
+@@ -98,12 +103,14 @@ void rtl8192d_set_FwPwrMode_cmd(_adapter*padapter, u8 Mode);
void rtl8192d_set_FwJoinBssReport_cmd(_adapter* padapter, u8 mstatus);
u8 rtl8192d_set_rssi_cmd(_adapter*padapter, u8 *param);
u8 rtl8192d_set_raid_cmd(_adapter*padapter, u32 mask, u8 arg);
#ifdef CONFIG_WOWLAN
typedef struct _SETWOWLAN_PARM{
-@@ -130,4 +137,6 @@ void rtl8192d_set_wowlan_cmd(_adapter* p
+@@ -130,4 +137,6 @@ void rtl8192d_set_wowlan_cmd(_adapter* padapter);
void SetFwRelatedForWoWLAN8192DU(_adapter* padapter,u8 bHostIsGoingtoSleep);
#endif // CONFIG_WOWLAN
+#endif // __RTL8192D_CMD_H_
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h b/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h
+index ce674f8..ab5e5f7 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h
@@ -16,7 +16,7 @@
//============================================================
// structure and define
//============================================================
-@@ -101,7 +92,9 @@ typedef struct _Dynamic_Initial_Gain_Thr
+@@ -101,7 +92,9 @@ typedef struct _Dynamic_Initial_Gain_Threshold_
u8 LargeFAHit;
u8 ForbiddenIGI;
u32 Recover_cnt;
};
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h b/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h
+index 30f2955..1ab5f98 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h
@@ -20,6 +20,7 @@
#if 1
IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM];
#else
-@@ -935,11 +1079,10 @@ typedef struct hal_data_8192du HAL_DATA_
+@@ -935,11 +1079,10 @@ typedef struct hal_data_8192du HAL_DATA_TYPE, *PHAL_DATA_TYPE;
int FirmwareDownload92D(IN PADAPTER Adapter,IN BOOLEAN bUsedWoWLANFw);
VOID rtl8192d_FirmwareSelfReset(IN PADAPTER Adapter);
void rtl8192d_ReadChipVersion(IN PADAPTER Adapter);
BOOLEAN PHY_CheckPowerOffFor8192D(PADAPTER Adapter);
VOID PHY_SetPowerOnFor8192D(PADAPTER Adapter);
//void PHY_ConfigMacPhyMode92D(PADAPTER Adapter);
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h b/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h
+index 454a1b8..d736bda4 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h
@@ -16,8 +16,7 @@
#ifndef __RTL8192D_LED_H_
#define __RTL8192D_LED_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h b/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h
+index 3ffc646..36cc232 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h
@@ -61,7 +61,11 @@
#else
#define MAX_RECVBUF_SZ (4000) // about 4K
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h b/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h
+index 6995464..0b439a3 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h
@@ -16,8 +16,7 @@
/******************************************************************************
*
*
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h b/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h
+index 9bba78a..bef7184 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h
@@ -113,7 +113,9 @@
// The same function but different bit field.
#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4)
#define DIS_TSF_UDT0_TEST_CHIP BIT(5)
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h b/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h
+index 0babb27..d01fb4a 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h
@@ -16,22 +16,10 @@
#ifdef CONFIG_USB_HCI
#ifdef CONFIG_USB_TX_AGGREGATION
-@@ -72,10 +106,13 @@ void rtl8192du_cal_txdesc_chksum(struct
+@@ -72,10 +106,13 @@ void rtl8192du_cal_txdesc_chksum(struct tx_desc *ptxdesc);
s32 rtl8192du_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
#ifdef CONFIG_HOSTAPD_MLME
s32 rtl8192du_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt);
#endif
-@@ -91,10 +128,12 @@ struct xmit_buf *rtl8192de_dequeue_xmitb
+@@ -91,10 +128,12 @@ struct xmit_buf *rtl8192de_dequeue_xmitbuf(struct rtw_tx_ring *ring);
void rtl8192de_xmitframe_resume(_adapter *padapter);
#ifdef CONFIG_HOSTAPD_MLME
s32 rtl8192de_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt);
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_android.h b/drivers/net/wireless/rtl8192cu/include/rtw_android.h
+index e1a0432..f9214c2 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_android.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_android.h
@@ -59,22 +59,32 @@ enum ANDROID_WIFI_CMD {
#endif //__RTW_ANDROID_H__
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_ap.h b/drivers/net/wireless/rtl8192cu/include/rtw_ap.h
+new file mode 100644
+index 0000000..42be4c6
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_ap.h
@@ -0,0 +1,64 @@
+
+#endif
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h b/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h
+index 1313a25..0f06b7a 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h
@@ -16,8 +16,7 @@
#ifndef _RTL871X_BYTEORDER_H_
#define _RTL871X_BYTEORDER_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h b/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h
+index 0556d0b..ab115c5 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h
@@ -16,8 +16,7 @@
extern u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
extern struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);
-@@ -131,6 +149,7 @@ extern struct evt_obj *rtw_dequeue_evt(_
+@@ -131,6 +149,7 @@ extern struct evt_obj *rtw_dequeue_evt(_queue *queue);
extern void rtw_free_evt_obj(struct evt_obj *pcmd);
#endif
extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
extern u8 rtw_setdatarate_cmd(_adapter *padapter, u8 *rateset);
extern u8 rtw_setbasicrate_cmd(_adapter *padapter, u8 *rateset);
-@@ -931,7 +960,9 @@ extern u8 rtw_setfwdig_cmd(_adapter*pada
+@@ -931,7 +960,9 @@ extern u8 rtw_setfwdig_cmd(_adapter*padapter, u8 type);
extern u8 rtw_setfwra_cmd(_adapter*padapter, u8 type);
extern u8 rtw_addbareq_cmd(_adapter*padapter, u8 tid, u8 *addr);
GEN_CMD_CODE(_SetChannelSwitch), /*61*/
GEN_CMD_CODE(_TDLS), /*62*/
-@@ -1123,6 +1157,7 @@ struct _cmd_callback rtw_cmd_callback[]
+@@ -1123,6 +1157,7 @@ struct _cmd_callback rtw_cmd_callback[] =
{GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
{GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
{GEN_CMD_CODE(_LedBlink), NULL},/*60*/
{GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
{GEN_CMD_CODE(_TDLS), NULL},/*62*/
};
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_debug.h b/drivers/net/wireless/rtl8192cu/include/rtw_debug.h
+index eca6692..0ccf220 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_debug.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_debug.h
@@ -1,7 +1,7 @@
#define _drv_info_ 7
#define _drv_dump_ 8
#define _drv_debug_ 9
-+#define _drv_always_ _drv_emerg_
-
+-
-
-#define _module_rtl871x_xmit_c_ BIT(0)
-#define _module_xmit_osdep_c_ BIT(1)
-#define _module_hci_intfs_c_ BIT(20)
-#define _module_hci_ops_c_ BIT(21)
-#define _module_osdep_service_c_ BIT(22)
++#define _drv_always_ _drv_emerg_
++
+#define _module_rtl871x_xmit_c_ BIT(0)
+#define _module_xmit_osdep_c_ BIT(1)
+#define _module_rtl871x_recv_c_ BIT(2)
#elif defined _RTL8712_RECV_C_
#define _MODULE_DEFINE_ _module_rtl8712_recv_c_
#elif defined _RTL8192CU_RECV_C_
-@@ -161,19 +171,23 @@ extern void rtl871x_cedbg(const char *fm
+@@ -161,19 +171,23 @@ extern void rtl871x_cedbg(const char *fmt, ...);
#ifdef PLATFORM_WINDOWS
- #ifdef PLATFORM_OS_XP
+ #ifdef PLATFORM_OS_XP
-+
-+ #define _dbgdump DbgPrint
- #define _dbgdump DbgPrint
-+ #elif defined PLATFORM_OS_CE
++ #define _dbgdump DbgPrint
- #elif defined PLATFORM_OS_CE
-+ #define _dbgdump rtl871x_cedbg
++ #elif defined PLATFORM_OS_CE
- #define _dbgdump rtl871x_cedbg
-+ #endif
-+
-+#elif defined PLATFORM_LINUX
++ #define _dbgdump rtl871x_cedbg
- #endif
-+ #define _dbgdump printk
++ #endif
- #elif defined PLATFORM_LINUX
-+#elif defined PLATFORM_FREEBSD
++#elif defined PLATFORM_LINUX
- #define _dbgdump printk
++ #define _dbgdump printk
++
++#elif defined PLATFORM_FREEBSD
++
+ #define _dbgdump printf
#endif
-@@ -186,8 +200,8 @@ extern void rtl871x_cedbg(const char *fm
+@@ -186,8 +200,8 @@ extern void rtl871x_cedbg(const char *fmt, ...);
#define RT_TRACE(_Comp, _Level, Fmt)\
do {\
if((_Comp & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) {\
}\
}while(0)
-@@ -233,21 +247,34 @@ extern void rtl871x_cedbg(const char *fm
+@@ -233,21 +247,34 @@ extern void rtl871x_cedbg(const char *fmt, ...);
#ifdef CONFIG_DEBUG_RTL819X
#ifdef PLATFORM_WINDOWS
#define DBG_871X do {} while(0)
#define MSG_8192C do {} while(0)
-@@ -264,15 +291,38 @@ extern void rtl871x_cedbg(const char *fm
+@@ -264,15 +291,38 @@ extern void rtl871x_cedbg(const char *fmt, ...);
#define ERR_8192C(x,...) do {} while(0)
#endif
+ #define WRN_8192C(x,...) do {} while(0)
+ #define ERR_8192C(x,...) do {} while(0)
+#endif
-
-- #undef MSG_8192C
-- #define MSG_8192C _dbgdump
++
+extern u32 GlobalDebugLevel;
+#define LOG_LEVEL(level, ...)\
+ do {\
+ }while(0)
+
+#define DBG_871X_LEVEL LOG_LEVEL
-+
+
+- #undef MSG_8192C
+- #define MSG_8192C _dbgdump
+#if defined (_dbgdump)
+ #undef DBG_871X
+// #define DBG_871X _dbgdump
#undef WRN_8192C
#define WRN_8192C _dbgdump
-@@ -282,13 +332,25 @@ extern void rtl871x_cedbg(const char *fm
+@@ -282,13 +332,25 @@ extern void rtl871x_cedbg(const char *fmt, ...);
#endif
int proc_get_write_reg(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
-@@ -340,6 +402,45 @@ extern void rtl871x_cedbg(const char *fm
+@@ -340,6 +402,45 @@ extern void rtl871x_cedbg(const char *fmt, ...);
off_t offset, int count,
int *eof, void *data);
#ifdef CONFIG_AP_MODE
-@@ -359,6 +460,8 @@ extern void rtl871x_cedbg(const char *fm
+@@ -359,6 +460,8 @@ extern void rtl871x_cedbg(const char *fmt, ...);
int proc_get_best_channel(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
#endif
int proc_get_rx_signal(char *page, char **start,
-@@ -367,13 +470,47 @@ extern void rtl871x_cedbg(const char *fm
+@@ -367,13 +470,47 @@ extern void rtl871x_cedbg(const char *fmt, ...);
int proc_set_rx_signal(struct file *file, const char *buffer,
unsigned long count, void *data);
int proc_get_rssi_disp(char *page, char **start,
off_t offset, int count,
-@@ -381,7 +518,19 @@ extern void rtl871x_cedbg(const char *fm
+@@ -381,7 +518,19 @@ extern void rtl871x_cedbg(const char *fmt, ...);
int proc_set_rssi_disp(struct file *file, const char *buffer,
unsigned long count, void *data);
#endif //CONFIG_PROC_DEBUG
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h b/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h
+index 9d31998..ce834dd 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h
@@ -16,8 +16,7 @@
#ifndef __RTW_EEPROM_H__
#define __RTW_EEPROM_H__
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h b/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h
+index 66be910..224aa4f 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h
@@ -1,7 +1,7 @@
* 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.
-@@ -106,7 +106,7 @@ u8 rtw_efuse_map_write(PADAPTER padapter
+@@ -106,7 +106,7 @@ u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data);
u16 Efuse_GetCurrentSize(PADAPTER pAdapter, u8 efuseType, BOOLEAN bPseudoTest);
u8 Efuse_CalculateWordCnts(u8 word_en);
void ReadEFuseByte(PADAPTER Adapter, u16 _offset, u8 *pbuf, BOOLEAN bPseudoTest) ;
u8 efuse_OneByteRead(PADAPTER pAdapter, u16 addr, u8 *data, BOOLEAN bPseudoTest);
u8 efuse_OneByteWrite(PADAPTER pAdapter, u16 addr, u8 data, BOOLEAN bPseudoTest);
-@@ -121,3 +121,4 @@ void EFUSE_ShadowMapUpdate(PADAPTER pAda
+@@ -121,3 +121,4 @@ void EFUSE_ShadowMapUpdate(PADAPTER pAdapter, u8 efuseType, BOOLEAN bPseudoTest)
void EFUSE_ShadowRead(PADAPTER pAdapter, u8 Type, u16 Offset, u32 *Value);
#endif
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_event.h b/drivers/net/wireless/rtl8192cu/include/rtw_event.h
+index dd9f097..4299ddc 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_event.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_event.h
@@ -16,8 +16,7 @@
};
struct addba_event
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_ht.h b/drivers/net/wireless/rtl8192cu/include/rtw_ht.h
+index 4dcad2b..3cd904d 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_ht.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_ht.h
@@ -16,8 +16,7 @@
#ifndef _RTW_HT_H_
#define _RTW_HT_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_io.h b/drivers/net/wireless/rtl8192cu/include/rtw_io.h
+index b1f57c1..c66845c 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_io.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_io.h
@@ -16,8 +16,8 @@
};
struct io_req {
-@@ -424,26 +381,30 @@ extern int _rtw_write16_async(_adapter *
+@@ -424,26 +381,30 @@ extern int _rtw_write16_async(_adapter *adapter, u32 addr, u16 val);
extern int _rtw_write32_async(_adapter *adapter, u32 addr, u32 val);
extern void _rtw_write_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
#define rtw_write8(adapter, addr, val) dbg_rtw_write8((adapter), (addr), (val), __FUNCTION__, __LINE__)
#define rtw_write16(adapter, addr, val) dbg_rtw_write16((adapter), (addr), (val), __FUNCTION__, __LINE__)
#define rtw_write32(adapter, addr, val) dbg_rtw_write32((adapter), (addr), (val), __FUNCTION__, __LINE__)
-@@ -455,7 +416,7 @@ extern int dbg_rtw_writeN(_adapter *adap
+@@ -455,7 +416,7 @@ extern int dbg_rtw_writeN(_adapter *adapter, u32 addr ,u32 length , u8 *data, co
#define rtw_write_mem(adapter, addr, cnt, mem) _rtw_write_mem((adapter), addr, cnt, mem)
#define rtw_write_port(adapter, addr, cnt, mem) _rtw_write_port(adapter, addr, cnt, mem)
#define rtw_write_port_cancel(adapter) _rtw_write_port_cancel(adapter)
#else //DBG_IO
#define rtw_read8(adapter, addr) _rtw_read8((adapter), (addr))
-@@ -476,7 +437,7 @@ extern int dbg_rtw_writeN(_adapter *adap
+@@ -476,7 +437,7 @@ extern int dbg_rtw_writeN(_adapter *adapter, u32 addr ,u32 length , u8 *data, co
#define rtw_write_mem(adapter, addr, cnt, mem) _rtw_write_mem((adapter), (addr), (cnt), (mem))
#define rtw_write_port(adapter, addr, cnt, mem) _rtw_write_port((adapter), (addr), (cnt), (mem))
#define rtw_write_port_cancel(adapter) _rtw_write_port_cancel((adapter))
#endif //DBG_IO
-@@ -512,7 +473,7 @@ extern void async_write_mem(_adapter *ad
+@@ -512,7 +473,7 @@ extern void async_write_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
extern void async_write_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
extern uint alloc_io_queue(_adapter *adapter);
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h b/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h
+index e6d34f0..c4da301 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h
@@ -16,8 +16,7 @@
static NDIS_STATUS oid_null_function(struct oid_par_priv* poid_par_priv)
{
_func_enter_;
-@@ -243,10 +243,8 @@ void Set_802_3_MULTICAST_LIST(ADAPTER *p
+@@ -243,10 +243,8 @@ void Set_802_3_MULTICAST_LIST(ADAPTER *pAdapter, UCHAR *MCListbuf, ULONG MCListl
#endif// end of PLATFORM_WINDOWS
#endif
extern NDIS_STATUS drv_query_info(
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h b/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h
+index e9ad16f1..5b6018a 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h
@@ -16,8 +16,7 @@
#ifndef _RTW_IOCTL_QUERY_H_
#define _RTW_IOCTL_QUERY_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h b/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h
+index 1ea8f21..3bff766 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h
@@ -16,8 +16,7 @@
#ifndef _RTW_IOCTL_RTL_H_
#define _RTW_IOCTL_RTL_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h b/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h
+index 577af51..82f9810 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h
@@ -16,8 +16,7 @@
#ifndef __RTW_IOCTL_SET_H_
#define __RTW_IOCTL_SET_H_
-@@ -60,19 +59,21 @@ u8 rtw_set_802_11_authentication_mode(_a
+@@ -60,19 +59,21 @@ u8 rtw_set_802_11_authentication_mode(_adapter *pdapter, NDIS_802_11_AUTHENTICAT
u8 rtw_set_802_11_bssid(_adapter* padapter, u8 *bssid);
u8 rtw_set_802_11_add_wep(_adapter * padapter, NDIS_802_11_WEP * wep);
u8 rtw_set_802_11_disassociate(_adapter * padapter);
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_led.h b/drivers/net/wireless/rtl8192cu/include/rtw_led.h
+index 72634f8..b5365ba 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_led.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_led.h
@@ -16,8 +16,7 @@
} LED_871x, *PLED_871x;
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h b/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h
+index 0beca93..d9d6456 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h
@@ -16,18 +16,21 @@
extern int event_thread(void *context);
extern void rtw_join_timeout_handler(void* FunctionContext);
extern void _rtw_scan_timeout_handler(void* FunctionContext);
-@@ -563,6 +721,11 @@ __inline static void up_scanned_network(
+@@ -563,6 +721,11 @@ __inline static void up_scanned_network(struct mlme_priv *pmlmepriv)
_exit_critical_bh(&pmlmepriv->lock, &irqL);
}
__inline static void down_scanned_network(struct mlme_priv *pmlmepriv)
{
_irqL irqL;
-@@ -592,6 +755,7 @@ extern void rtw_free_assoc_resources(_ad
+@@ -592,6 +755,7 @@ extern void rtw_free_assoc_resources(_adapter* adapter, int lock_scanned_queue);
extern void rtw_indicate_disconnect(_adapter* adapter);
extern void rtw_indicate_connect(_adapter* adapter);
void rtw_indicate_scan_done( _adapter *padapter, bool aborted);
extern int rtw_restruct_sec_ie(_adapter *adapter,u8 *in_ie,u8 *out_ie,uint in_len);
extern int rtw_restruct_wmm_ie(_adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_len, uint initial_out_len);
-@@ -606,8 +770,15 @@ extern void rtw_scan_timeout_handler(_ad
+@@ -606,8 +770,15 @@ extern void rtw_scan_timeout_handler(_adapter *adapter);
extern void rtw_dynamic_check_timer_handlder(_adapter *adapter);
#ifdef CONFIG_SET_SCAN_DENY_TIMER
#endif
-@@ -643,16 +814,24 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *
+@@ -643,16 +814,24 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie);
void rtw_joinbss_reset(_adapter *padapter);
#ifdef CONFIG_80211N_HT
#endif
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h b/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h
+index d9a203f..5cddca4 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h
@@ -16,8 +16,7 @@
};
int init_mlme_ext_priv(_adapter* padapter);
-@@ -444,26 +515,34 @@ int init_hw_mlme_ext(_adapter *padapter)
+@@ -444,26 +515,34 @@ int init_hw_mlme_ext(_adapter *padapter);
void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext);
extern void init_mlme_ext_timer(_adapter *padapter);
extern void init_addba_retry_timer(_adapter *padapter, struct sta_info *psta);
void set_channel_bwmode(_adapter *padapter, unsigned char channel, unsigned char channel_offset, unsigned short bwmode);
void SelectChannel(_adapter *padapter, unsigned char channel);
-@@ -500,7 +579,6 @@ int WMM_param_handler(_adapter *padapter
+@@ -500,7 +579,6 @@ int WMM_param_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE);
#ifdef CONFIG_WFD
int WFD_info_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE);
#endif
void WMMOnAssocRsp(_adapter *padapter);
void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE);
-@@ -517,6 +595,7 @@ void process_csa_ie(_adapter *padapter,
+@@ -517,6 +595,7 @@ void process_csa_ie(_adapter *padapter, u8 *pframe, uint len);
void update_IOT_info(_adapter *padapter);
void update_capinfo(PADAPTER Adapter, u16 updateCap);
void update_wireless_mode(_adapter * padapter);
void update_bmc_sta_support_rate(_adapter *padapter, u32 mac_id);
int update_sta_support_rate(_adapter *padapter, u8* pvar_ie, uint var_ie_len, int cam_idx);
-@@ -544,50 +623,37 @@ void report_add_sta_event(_adapter *pada
+@@ -544,50 +623,37 @@ void report_add_sta_event(_adapter *padapter, unsigned char* MacAddr, int cam_id
void beacon_timing_control(_adapter *padapter);
extern u8 set_tx_beacon_cmd(_adapter*padapter);
unsigned int setup_beacon_frame(_adapter *padapter, unsigned char *beacon_frame);
unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr);
unsigned int send_beacon(_adapter *padapter);
-@@ -609,11 +675,15 @@ unsigned int OnAuthClient(_adapter *pada
+@@ -609,11 +675,15 @@ unsigned int OnAuthClient(_adapter *padapter, union recv_frame *precv_frame);
unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame);
unsigned int OnAction(_adapter *padapter, union recv_frame *precv_frame);
unsigned int OnAction_wmm(_adapter *padapter, union recv_frame *precv_frame);
unsigned int OnAction_p2p(_adapter *padapter, union recv_frame *precv_frame);
-@@ -627,6 +697,9 @@ void linked_status_chk(_adapter *padapte
+@@ -627,6 +697,9 @@ void linked_status_chk(_adapter *padapter);
void survey_timer_hdl (_adapter *padapter);
void link_timer_hdl (_adapter *padapter);
void addba_timer_hdl(struct sta_info *psta);
//void reauth_timer_hdl(_adapter *padapter);
//void reassoc_timer_hdl(_adapter *padapter);
-@@ -641,7 +714,13 @@ void addba_timer_hdl(struct sta_info *ps
+@@ -641,7 +714,13 @@ void addba_timer_hdl(struct sta_info *psta);
/*DBG_871X("%s set_link_timer(%p, %d)\n", __FUNCTION__, (mlmeext), (ms));*/ \
_set_timer(&(mlmeext)->link_timer, (ms)); \
} while(0)
extern int cckrates_included(unsigned char *rate, int ratelen);
extern int cckratesonly_included(unsigned char *rate, int ratelen);
-@@ -650,24 +729,29 @@ extern void process_addba_req(_adapter *
+@@ -650,24 +729,29 @@ extern void process_addba_req(_adapter *padapter, u8 *paddba_req, u8 *addr);
extern void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
extern void correct_TSF(_adapter *padapter, struct mlme_ext_priv *pmlmeext);
struct cmd_hdl {
uint parmsize;
-@@ -699,6 +783,7 @@ u8 add_ba_hdl(_adapter *padapter, unsign
+@@ -699,6 +783,7 @@ u8 add_ba_hdl(_adapter *padapter, unsigned char *pbuf);
u8 mlme_evt_hdl(_adapter *padapter, unsigned char *pbuf);
u8 h2c_msg_hdl(_adapter *padapter, unsigned char *pbuf);
u8 tx_beacon_hdl(_adapter *padapter, unsigned char *pbuf);
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
GEN_MLME_EXT_HANDLER(0, NULL)
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_mp.h b/drivers/net/wireless/rtl8192cu/include/rtw_mp.h
+index a468714..0ebb1ba 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_mp.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_mp.h
@@ -192,7 +192,7 @@ struct mp_tx
//=======================================================================
//extern struct mp_xmit_frame *alloc_mp_xmitframe(struct mp_priv *pmp_priv);
-@@ -673,8 +679,6 @@ extern void GetPowerTracking(PADAPTER pa
+@@ -673,8 +679,6 @@ extern void GetPowerTracking(PADAPTER padapter, u8 *enable);
extern u32 mp_query_psd(PADAPTER pAdapter, u8 *data);
extern void Hal_SetAntenna(PADAPTER pAdapter);
extern void Hal_SetBandwidth(PADAPTER pAdapter);
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h b/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h
+index e16df40..962bc38 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h
@@ -1,7 +1,7 @@
* 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.
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h b/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h
+index 4906005..0b47cb5 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h
@@ -16,8 +16,7 @@
/*****************************************************************************
*
* Module: __RTW_MP_PHY_REGDEF_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h b/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h
+index a29ceaa..4249bc9 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h
-@@ -29,11 +29,13 @@ u32 build_assoc_resp_p2p_ie(struct wifid
+@@ -29,11 +29,13 @@ u32 build_assoc_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 status
u32 build_deauth_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
#ifdef CONFIG_WFD
u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
u32 build_assoc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
u32 build_provdisc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
-@@ -51,16 +53,24 @@ u8 process_p2p_group_negotation_resp( st
+@@ -51,16 +53,24 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
u8 process_p2p_group_negotation_confirm( struct wifidirect_info *pwdinfo, u8 *pframe, uint len );
u8 process_p2p_presence_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint len);
void init_wifidirect_info( _adapter* padapter, enum P2P_ROLE role);
int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role);
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h b/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h
+index 2b00beb..a4cb292 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h
@@ -16,8 +16,7 @@
-#define PS_ALL_ON BIT(2)
-#define PS_ST_ACTIVE BIT(3)
-#define PS_LP BIT(4) // low performance
--
--#define PS_STATE_MASK (0x0F)
--#define PS_STATE_HW_MASK (0x07)
--#define PS_SEQ_MASK (0xc0)
--
--#define PS_STATE(x) (PS_STATE_MASK & (x))
--#define PS_STATE_HW(x) (PS_STATE_HW_MASK & (x))
--#define PS_SEQ(x) (PS_SEQ_MASK & (x))
--
--#define PS_STATE_S0 (PS_DPS)
--#define PS_STATE_S1 (PS_LCLK)
--#define PS_STATE_S2 (PS_RF_OFF)
--#define PS_STATE_S3 (PS_ALL_ON)
--#define PS_STATE_S4 ((PS_ST_ACTIVE) | (PS_ALL_ON))
--
--
--#define PS_IS_RF_ON(x) ((x) & (PS_ALL_ON))
--#define PS_IS_ACTIVE(x) ((x) & (PS_ST_ACTIVE))
--#define CLR_PS_STATE(x) ((x) = ((x) & (0xF0)))
+#define PS_DPS BIT(0)
+#define PS_LCLK (PS_DPS)
+#define PS_RF_OFF BIT(1)
+#define PS_ALL_ON BIT(2)
+#define PS_ST_ACTIVE BIT(3)
-+
+
+-#define PS_STATE_MASK (0x0F)
+-#define PS_STATE_HW_MASK (0x07)
+-#define PS_SEQ_MASK (0xc0)
+#define PS_ISR_ENABLE BIT(4)
+#define PS_IMR_ENABLE BIT(5)
+#define PS_ACK BIT(6)
+#define PS_TOGGLE BIT(7)
-+
+
+-#define PS_STATE(x) (PS_STATE_MASK & (x))
+-#define PS_STATE_HW(x) (PS_STATE_HW_MASK & (x))
+-#define PS_SEQ(x) (PS_SEQ_MASK & (x))
+#define PS_STATE_MASK (0x0F)
+#define PS_STATE_HW_MASK (0x07)
+#define PS_SEQ_MASK (0xc0)
-+
+
+-#define PS_STATE_S0 (PS_DPS)
+-#define PS_STATE_S1 (PS_LCLK)
+-#define PS_STATE_S2 (PS_RF_OFF)
+-#define PS_STATE_S3 (PS_ALL_ON)
+-#define PS_STATE_S4 ((PS_ST_ACTIVE) | (PS_ALL_ON))
+#define PS_STATE(x) (PS_STATE_MASK & (x))
+#define PS_STATE_HW(x) (PS_STATE_HW_MASK & (x))
+#define PS_SEQ(x) (PS_SEQ_MASK & (x))
-+
+
+#define PS_STATE_S0 (PS_DPS)
+#define PS_STATE_S1 (PS_LCLK)
+#define PS_STATE_S2 (PS_RF_OFF)
+#define PS_STATE_S3 (PS_ALL_ON)
+#define PS_STATE_S4 ((PS_ST_ACTIVE) | (PS_ALL_ON))
-+
+
+-#define PS_IS_RF_ON(x) ((x) & (PS_ALL_ON))
+-#define PS_IS_ACTIVE(x) ((x) & (PS_ST_ACTIVE))
+-#define CLR_PS_STATE(x) ((x) = ((x) & (0xF0)))
+
+#define PS_IS_RF_ON(x) ((x) & (PS_ALL_ON))
+#define PS_IS_ACTIVE(x) ((x) & (PS_ST_ACTIVE))
int ips_leave(_adapter * padapter);
#endif
-@@ -331,13 +338,25 @@ void rtw_resume_in_workqueue(struct pwrc
+@@ -331,13 +338,25 @@ void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv);
#endif //CONFIG_RESUME_IN_WORKQUEUE
#if defined(CONFIG_HAS_EARLYSUSPEND ) || defined(CONFIG_ANDROID_POWER)
+int rtw_pm_set_lps(_adapter *padapter, u8 mode);
#endif //__RTL871X_PWRCTRL_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_qos.h b/drivers/net/wireless/rtl8192cu/include/rtw_qos.h
+index e35b77f..a359c5f 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_qos.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_qos.h
@@ -16,8 +16,7 @@
#ifndef _RTW_QOS_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_recv.h b/drivers/net/wireless/rtl8192cu/include/rtw_recv.h
+index e204ef3..3a4b14b 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_recv.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_recv.h
@@ -1,7 +1,7 @@
struct rtw_rx_ring {
struct recv_stat *desc;
-@@ -207,27 +210,28 @@ accesser of recv_priv: rtw_recv_entry(di
+@@ -207,27 +210,28 @@ accesser of recv_priv: rtw_recv_entry(dispatch / passive level); recv_thread(pas
using enter_critical section to protect
*/
sint rtw_enqueue_recvbuf(struct recv_buf *precvbuf, _queue *queue);
struct recv_buf *rtw_dequeue_recvbuf (_queue *queue);
-@@ -479,32 +502,32 @@ __inline static u8 *get_rxmem(union recv
+@@ -479,32 +502,32 @@ __inline static u8 *get_rxmem(union recv_frame *precvframe)
__inline static u8 *get_rx_status(union recv_frame *precvframe)
{
if(precvframe==NULL)
return NULL;
-@@ -519,7 +542,7 @@ __inline static u8 *recvframe_push(union
+@@ -519,7 +542,7 @@ __inline static u8 *recvframe_push(union recv_frame *precvframe, sint sz)
precvframe->u.hdr.len +=sz;
return precvframe->u.hdr.rx_data;
}
-@@ -533,7 +556,7 @@ __inline static u8 *recvframe_pull(union
+@@ -533,7 +556,7 @@ __inline static u8 *recvframe_pull(union recv_frame *precvframe, sint sz)
if(precvframe==NULL)
return NULL;
precvframe->u.hdr.rx_data += sz;
if(precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail)
-@@ -543,9 +566,9 @@ __inline static u8 *recvframe_pull(union
+@@ -543,9 +566,9 @@ __inline static u8 *recvframe_pull(union recv_frame *precvframe, sint sz)
}
precvframe->u.hdr.len -=sz;
}
__inline static u8 *recvframe_put(union recv_frame *precvframe, sint sz)
-@@ -553,16 +576,16 @@ __inline static u8 *recvframe_put(union
+@@ -553,16 +576,16 @@ __inline static u8 *recvframe_put(union recv_frame *precvframe, sint sz)
// rx_tai += sz; move rx_tail sz bytes hereafter
//used for append sz bytes from ptr to rx_tail, update rx_tail and return the updated rx_tail to the caller
if(precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end)
{
precvframe->u.hdr.rx_tail -= sz;
-@@ -580,7 +603,7 @@ __inline static u8 *recvframe_put(union
+@@ -580,7 +603,7 @@ __inline static u8 *recvframe_put(union recv_frame *precvframe, sint sz)
__inline static u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz)
{
// rmv data from rx_tail (by yitsen)
//used for extract sz bytes from rx_end, update rx_end and return the updated rx_end to the caller
//after pulling, rx_end must be still larger than rx_data.
-@@ -606,10 +629,10 @@ __inline static u8 *recvframe_pull_tail(
+@@ -606,10 +629,10 @@ __inline static u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz)
__inline static _buffer * get_rxbuf_desc(union recv_frame *precvframe)
{
_buffer * buf_desc;
NdisQueryPacket(precvframe->u.hdr.pkt, NULL, NULL, &buf_desc, NULL);
#endif
-@@ -619,18 +642,17 @@ __inline static _buffer * get_rxbuf_desc
+@@ -619,18 +642,17 @@ __inline static _buffer * get_rxbuf_desc(union recv_frame *precvframe)
__inline static union recv_frame *rxmem_to_recvframe(u8 *rxmem)
{
u8 * buf_star;
union recv_frame * precv_frame;
#ifdef PLATFORM_WINDOWS
-@@ -648,7 +670,7 @@ __inline static union recv_frame *pkt_to
+@@ -648,7 +670,7 @@ __inline static union recv_frame *pkt_to_recvframe(_pkt *pkt)
__inline static u8 *pkt_to_recvmem(_pkt *pkt)
{
// return the rx_head
union recv_frame * precv_frame = pkt_to_recvframe(pkt);
return precv_frame->u.hdr.rx_head;
-@@ -662,7 +684,7 @@ __inline static u8 *pkt_to_recvdata(_pkt
+@@ -662,7 +684,7 @@ __inline static u8 *pkt_to_recvdata(_pkt *pkt)
union recv_frame * precv_frame =pkt_to_recvframe(pkt);
return precv_frame->u.hdr.rx_data;
}
-@@ -686,13 +708,14 @@ __inline static u8 query_rx_pwr_percenta
+@@ -686,13 +708,14 @@ __inline static u8 query_rx_pwr_percentage(s8 antpower )
return (100+antpower);
}
}
return SignalPower;
}
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_rf.h b/drivers/net/wireless/rtl8192cu/include/rtw_rf.h
+index 7414c1b6..697dd4e 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_rf.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_rf.h
@@ -16,7 +16,7 @@
#ifndef __RTW_RF_H_
#define __RTW_RF_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_security.h b/drivers/net/wireless/rtl8192cu/include/rtw_security.h
+index 02ef9b0..835677c3 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_security.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_security.h
@@ -16,8 +16,7 @@
void rtw_secmicsetkey(struct mic_data *pmicdata, u8 * key );
void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b );
void rtw_secmicappend(struct mic_data *pmicdata, u8 * src, u32 nBytes );
-@@ -398,7 +412,9 @@ void rtw_wep_encrypt(_adapter *padapter,
+@@ -398,7 +412,9 @@ void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe);
u32 rtw_aes_decrypt(_adapter *padapter, u8 *precvframe);
u32 rtw_tkip_decrypt(_adapter *padapter, u8 *precvframe);
void rtw_wep_decrypt(_adapter *padapter, u8 *precvframe);
#ifdef CONFIG_TDLS
void wpa_tdls_generate_tpk(_adapter *padapter, struct sta_info *psta);
int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq,
-@@ -406,7 +422,7 @@ int wpa_tdls_ftie_mic(u8 *kck, u8 trans_
+@@ -406,7 +422,7 @@ int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq,
u8 *mic);
int tdls_verify_mic(u8 *kck, u8 trans_seq,
u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie);
+
#endif //__RTL871X_SECURITY_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h b/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h
+new file mode 100644
+index 0000000..45dd2bf
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h
@@ -0,0 +1,74 @@
+
+#endif
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h b/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h
+new file mode 100644
+index 0000000..1005331
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h
@@ -0,0 +1,143 @@
+
+#endif
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_version.h b/drivers/net/wireless/rtl8192cu/include/rtw_version.h
+index f88ea77..4fb9dd4 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_version.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_version.h
@@ -1 +1 @@
-#define DRIVERVERSION "v3.4.4_4749.20121105"
+#define DRIVERVERSION "v4.0.2_9000.20130911"
+diff --git a/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h b/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h
+index 54e0b2d..f7eaf4a 100644
--- a/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h
+++ b/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h
@@ -1,7 +1,7 @@
};
extern struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv);
-@@ -622,6 +694,8 @@ extern s32 rtw_make_wlanhdr(_adapter *pa
+@@ -622,6 +694,8 @@ extern s32 rtw_make_wlanhdr(_adapter *padapter, u8 *hdr, struct pkt_attrib *patt
extern s32 rtw_put_snap(u8 *data, u16 h_proto);
extern struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv);
extern s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe);
extern void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, _queue *pframequeue);
struct tx_servq *rtw_get_sta_pending(_adapter *padapter, struct sta_info *psta, sint up, u8 *ac);
-@@ -630,15 +704,15 @@ extern struct xmit_frame* rtw_dequeue_xf
+@@ -630,15 +704,15 @@ extern struct xmit_frame* rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct
extern s32 rtw_xmit_classifier(_adapter *padapter, struct xmit_frame *pxmitframe);
extern thread_return rtw_xmit_thread(thread_context context);
s32 _rtw_init_hw_txqueue(struct hw_txqueue* phw_txqueue, u8 ac_tag);
void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv);
-@@ -655,20 +729,26 @@ void _rtw_free_xmit_priv (struct xmit_pr
+@@ -655,20 +729,26 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv);
void rtw_alloc_hwxmits(_adapter *padapter);
void rtw_free_hwxmits(_adapter *padapter);
+
#endif //_RTL871X_XMIT_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/sdio_hal.h b/drivers/net/wireless/rtl8192cu/include/sdio_hal.h
+deleted file mode 100644
+index 51139bb..0000000
--- a/drivers/net/wireless/rtl8192cu/include/sdio_hal.h
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#endif //__SDIO_HAL_H__
-
+diff --git a/drivers/net/wireless/rtl8192cu/include/sdio_ops.h b/drivers/net/wireless/rtl8192cu/include/sdio_ops.h
+deleted file mode 100644
+index b1e9b63..0000000
--- a/drivers/net/wireless/rtl8192cu/include/sdio_ops.h
+++ /dev/null
@@ -1,80 +0,0 @@
-
-#endif
-
+diff --git a/drivers/net/wireless/rtl8192cu/include/sdio_ops_ce.h b/drivers/net/wireless/rtl8192cu/include/sdio_ops_ce.h
+deleted file mode 100644
+index 81687c9..0000000
--- a/drivers/net/wireless/rtl8192cu/include/sdio_ops_ce.h
+++ /dev/null
@@ -1,56 +0,0 @@
-
-#endif
-
+diff --git a/drivers/net/wireless/rtl8192cu/include/sdio_ops_linux.h b/drivers/net/wireless/rtl8192cu/include/sdio_ops_linux.h
+deleted file mode 100644
+index c58ab08..0000000
--- a/drivers/net/wireless/rtl8192cu/include/sdio_ops_linux.h
+++ /dev/null
@@ -1,55 +0,0 @@
-
-#endif
-
+diff --git a/drivers/net/wireless/rtl8192cu/include/sdio_ops_xp.h b/drivers/net/wireless/rtl8192cu/include/sdio_ops_xp.h
+deleted file mode 100644
+index 3569611..0000000
--- a/drivers/net/wireless/rtl8192cu/include/sdio_ops_xp.h
+++ /dev/null
@@ -1,56 +0,0 @@
-
-#endif
-
+diff --git a/drivers/net/wireless/rtl8192cu/include/sdio_osintf.h b/drivers/net/wireless/rtl8192cu/include/sdio_osintf.h
+deleted file mode 100644
+index 099262b..0000000
--- a/drivers/net/wireless/rtl8192cu/include/sdio_osintf.h
+++ /dev/null
@@ -1,48 +0,0 @@
-
-#endif
-
+diff --git a/drivers/net/wireless/rtl8192cu/include/sta_info.h b/drivers/net/wireless/rtl8192cu/include/sta_info.h
+index 8f01f21..75763db 100644
--- a/drivers/net/wireless/rtl8192cu/include/sta_info.h
+++ b/drivers/net/wireless/rtl8192cu/include/sta_info.h
@@ -15,8 +15,8 @@
#endif
};
-@@ -342,12 +415,18 @@ __inline static u32 wifi_mac_hash(u8 *ma
+@@ -342,12 +415,18 @@ __inline static u32 wifi_mac_hash(u8 *mac)
extern u32 _rtw_init_sta_priv(struct sta_priv *pstapriv);
extern u32 _rtw_free_sta_priv(struct sta_priv *pstapriv);
#endif //_STA_INFO_H_
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/usb_hal.h b/drivers/net/wireless/rtl8192cu/include/usb_hal.h
+index 9cd21f3..d765b82 100644
--- a/drivers/net/wireless/rtl8192cu/include/usb_hal.h
+++ b/drivers/net/wireless/rtl8192cu/include/usb_hal.h
@@ -16,8 +16,7 @@
#ifndef __USB_HAL_H__
#define __USB_HAL_H__
-@@ -28,5 +27,11 @@ void rtl8192du_set_hal_ops(_adapter * pa
+@@ -28,5 +27,11 @@ void rtl8192du_set_hal_ops(_adapter * padapter);
#ifdef CONFIG_INTEL_PROXIM
extern _adapter *rtw_usb_get_sw_pointer(void);
#endif //CONFIG_INTEL_PROXIM
+#endif //CONFIG_WOWLAN
#endif //__USB_HAL_H__
+diff --git a/drivers/net/wireless/rtl8192cu/include/usb_ops.h b/drivers/net/wireless/rtl8192cu/include/usb_ops.h
+index 3868bc0..8bbec2d 100644
--- a/drivers/net/wireless/rtl8192cu/include/usb_ops.h
+++ b/drivers/net/wireless/rtl8192cu/include/usb_ops.h
@@ -16,8 +16,7 @@
}
return ret;
}
-@@ -92,9 +101,10 @@ static inline int rtw_inc_and_chk_contin
+@@ -92,9 +101,10 @@ static inline int rtw_inc_and_chk_continual_urb_error(struct dvobj_priv *dvobjpr
/*
* Set the continual_urb_error of this @param dvobjprive to 0
*/
#endif //__USB_OPS_H_
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h b/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h
+new file mode 100644
+index 0000000..d418ba2
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h
@@ -0,0 +1,63 @@
+
+#endif
+
+diff --git a/drivers/net/wireless/rtl8192cu/include/usb_osintf.h b/drivers/net/wireless/rtl8192cu/include/usb_osintf.h
+index 8642aa2..753013d 100644
--- a/drivers/net/wireless/rtl8192cu/include/usb_osintf.h
+++ b/drivers/net/wireless/rtl8192cu/include/usb_osintf.h
@@ -16,8 +16,7 @@
#ifndef __USB_OSINTF_H
#define __USB_OSINTF_H
+diff --git a/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h b/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h
+index 72864de..f33e982 100644
--- a/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h
+++ b/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h
@@ -16,8 +16,7 @@
#ifndef _USB_VENDOR_REQUEST_H_
#define _USB_VENDOR_REQUEST_H_
+diff --git a/drivers/net/wireless/rtl8192cu/include/wifi.h b/drivers/net/wireless/rtl8192cu/include/wifi.h
+index a80a805..0bb55bb 100644
--- a/drivers/net/wireless/rtl8192cu/include/wifi.h
+++ b/drivers/net/wireless/rtl8192cu/include/wifi.h
@@ -16,8 +16,7 @@
#ifndef _WIFI_H_
#define _WIFI_H_
-@@ -551,6 +550,7 @@ __inline static int IsFrameTypeCtrl(unsi
+@@ -551,6 +550,7 @@ __inline static int IsFrameTypeCtrl(unsigned char *pframe)
#define _IBSS_PARA_IE_ 6
#define _COUNTRY_IE_ 7
#define _CHLGETXT_IE_ 16
#define _SUPPORTED_CH_IE_ 36
#define _CH_SWTICH_ANNOUNCE_ 37 //Secondary Channel Offset
#define _RSN_IE_2_ 48
-@@ -561,6 +561,7 @@ __inline static int IsFrameTypeCtrl(unsi
+@@ -561,6 +561,7 @@ __inline static int IsFrameTypeCtrl(unsigned char *pframe)
#define _HT_CAPABILITY_IE_ 45
#define _FTIE_ 55
#define _TIMEOUT_ITVL_IE_ 56
#define _HT_EXTRA_INFO_IE_ 61
#define _HT_ADD_INFO_IE_ 61 //_HT_EXTRA_INFO_IE_
-@@ -568,6 +569,9 @@ __inline static int IsFrameTypeCtrl(unsi
+@@ -568,6 +569,9 @@ __inline static int IsFrameTypeCtrl(unsigned char *pframe)
#define EID_BSSIntolerantChlReport 73
#define _RIC_Descriptor_IE_ 75
#define _LINK_ID_IE_ 101
#define _CH_SWITCH_TIMING_ 104
#define _PTI_BUFFER_STATUS_ 106
-@@ -624,7 +628,10 @@ __inline static int IsFrameTypeCtrl(unsi
+@@ -624,7 +628,10 @@ __inline static int IsFrameTypeCtrl(unsigned char *pframe)
#define _WEP_104_PRIVACY_ 5
#define _WEP_WPA_MIXED_PRIVACY_ 6 // WEP + WPA
*/
/*-----------------------------------------------------------------------------
Below is the definition for WMM
------------------------------------------------------------------------------*/
-@@ -654,7 +661,7 @@ __inline static int IsFrameTypeCtrl(unsi
+@@ -654,7 +661,7 @@ __inline static int IsFrameTypeCtrl(unsigned char *pframe)
/**
+ P2P_PRE_TX_INVITEREQ_PROCESS_WK = 4,
+ P2P_AP_P2P_CH_SWITCH_PROCESS_WK =5,
+ P2P_RO_CH_WK = 6,
-+};
-+
+ };
+
+-enum P2P_PS
+#ifdef CONFIG_P2P_PS
+enum P2P_PS_STATE
-+{
+ {
+- P2P_PS_DISABLE=0,
+- P2P_PS_ENABLE=1,
+- P2P_PS_SCAN=2,
+- P2P_PS_SCAN_DONE=3,
+- P2P_PS_ALLSTASLEEP=4, // for owner
+ P2P_PS_DISABLE = 0,
+ P2P_PS_ENABLE = 1,
+ P2P_PS_SCAN = 2,
+ P2P_PS_ALLSTASLEEP = 4, // for P2P GO
};
--enum P2P_PS
+enum P2P_PS_MODE
- {
-- P2P_PS_DISABLE=0,
-- P2P_PS_ENABLE=1,
-- P2P_PS_SCAN=2,
-- P2P_PS_SCAN_DONE=3,
-- P2P_PS_ALLSTASLEEP=4, // for owner
++{
+ P2P_PS_NONE = 0,
+ P2P_PS_CTWINDOW = 1,
+ P2P_PS_NOA = 2,
+ P2P_PS_MIX = 3, // CTWindow and NoA
- };
++};
+#endif // CONFIG_P2P_PS
-
++
// =====================WFD Section=====================
// For Wi-Fi Display
#define WFD_ATTR_DEVICE_INFO 0x00
#ifdef CONFIG_TX_MCAST2UNI
#define IP_MCAST_MAC(mac) ((mac[0]==0x01)&&(mac[1]==0x00)&&(mac[2]==0x5e))
+diff --git a/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h b/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h
+index fe555c6..1cf93dc 100644
--- a/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h
+++ b/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h
@@ -16,8 +16,7 @@
}
struct wlan_network {
+diff --git a/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h b/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h
+index 7d28d43..e5848ec 100644
--- a/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h
+++ b/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h
@@ -16,8 +16,7 @@
extern int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev);
#endif
-@@ -86,5 +91,5 @@ extern sint rtw_endofpktfile (struct pkt
+@@ -86,5 +91,5 @@ extern sint rtw_endofpktfile (struct pkt_file *pfile);
extern void rtw_os_pkt_complete(_adapter *padapter, _pkt *pkt);
extern void rtw_os_xmit_complete(_adapter *padapter, struct xmit_frame *pxframe);
-#endif //
+#endif //__XMIT_OSDEP_H_
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c
+index b592e27..5975d1e 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c
@@ -1,6 +1,6 @@
};
#define RATETAB_ENT(_rate, _rateid, _flags) \
-@@ -85,9 +90,12 @@ static struct ieee80211_rate rtw_rates[]
+@@ -85,9 +90,12 @@ static struct ieee80211_rate rtw_rates[] = {
};
#define rtw_a_rates (rtw_rates + 4)
static struct ieee80211_channel rtw_2ghz_channels[] = {
CHAN2G(1, 2412, 0),
-@@ -106,8 +114,6 @@ static struct ieee80211_channel rtw_2ghz
+@@ -106,8 +114,6 @@ static struct ieee80211_channel rtw_2ghz_channels[] = {
CHAN2G(14, 2484, 0),
};
static struct ieee80211_channel rtw_5ghz_a_channels[] = {
CHAN5G(34, 0), CHAN5G(36, 0),
CHAN5G(38, 0), CHAN5G(40, 0),
-@@ -130,23 +136,116 @@ static struct ieee80211_channel rtw_5ghz
+@@ -130,23 +136,116 @@ static struct ieee80211_channel rtw_5ghz_a_channels[] = {
CHAN5G(216, 0),
};
static const struct ieee80211_txrx_stypes
rtw_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
[NL80211_IFTYPE_ADHOC] = {
-@@ -217,6 +316,7 @@ static int rtw_ieee80211_channel_to_freq
+@@ -217,6 +316,7 @@ static int rtw_ieee80211_channel_to_frequency(int chan, int band)
}
}
static int rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_network *pnetwork)
{
int ret=0;
-@@ -231,30 +331,102 @@ static int rtw_cfg80211_inform_bss(_adap
+@@ -231,30 +331,102 @@ static int rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_network *pnet
u8 *notify_ie;
size_t notify_ielen;
s32 notify_signal;
- //printk("%s\n", __func__);
-
+ //DBG_8192C("%s\n", __func__);
-+
+
+- channel = pnetwork->network.Configuration.DSConfig;
+- if (channel <= RTW_CH_MAX_2G_CHANNEL)
+ bssinf_len = pnetwork->network.IELength+sizeof (struct rtw_ieee80211_hdr_3addr);
+ if(bssinf_len > MAX_BSSINFO_LEN){
+ DBG_871X("%s IE Length too long > %d byte \n",__FUNCTION__,MAX_BSSINFO_LEN);
+ //To reduce PBC Overlap rate
+ //_enter_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
+ if(wdev_to_priv(wdev)->scan_request != NULL)
-+ {
+ {
+- //band = wiphy->bands[IEEE80211_BAND_2GHZ];
+ u8 *psr=NULL, sr = 0;
+ NDIS_802_11_SSID *pssid = &pnetwork->network.Ssid;
+ struct cfg80211_scan_request *request = wdev_to_priv(wdev)->scan_request;
+ }
+ }
+ //_exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
-
-- channel = pnetwork->network.Configuration.DSConfig;
++
+ channel = pnetwork->network.Configuration.DSConfig;
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
-- {
-- //band = wiphy->bands[IEEE80211_BAND_2GHZ];
++ if (channel <= RTW_CH_MAX_2G_CHANNEL)
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
- }
else
notify_channel = ieee80211_get_channel(wiphy, freq);
-@@ -267,53 +439,59 @@ static int rtw_cfg80211_inform_bss(_adap
+@@ -267,53 +439,59 @@ static int rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_network *pnet
notify_ie = pnetwork->network.IEs+_FIXED_IE_LENGTH_;
notify_ielen = pnetwork->network.IELength-_FIXED_IE_LENGTH_;
#if 1
-@@ -327,26 +505,96 @@ static int rtw_cfg80211_inform_bss(_adap
+@@ -327,26 +505,96 @@ static int rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_network *pnet
#endif
if (unlikely(!bss)) {
&& pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT
#endif
) {
-@@ -355,33 +603,59 @@ void rtw_cfg80211_indicate_connect(_adap
+@@ -355,33 +603,59 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
return;
}
}
-@@ -389,12 +663,14 @@ void rtw_cfg80211_indicate_disconnect(_a
+@@ -389,12 +663,14 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wireless_dev *pwdev = padapter->rtw_wdev;
&& pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT
#endif
) {
-@@ -404,28 +680,36 @@ void rtw_cfg80211_indicate_disconnect(_a
+@@ -404,28 +680,36 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter)
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
return;
- printk("pwdev->sme_state=%d\n", pwdev->sme_state);
+ if (!padapter->mlmepriv.not_indic_disco) {
+ DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
-+
+
+ if(pwdev->sme_state==CFG80211_SME_CONNECTING)
+ cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0,
+ WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/);
+ cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC);
+ //else
+ //DBG_8192C("pwdev->sme_state=%d\n", pwdev->sme_state);
-
++
+ DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state);
+ }
}
-@@ -493,6 +777,8 @@ static int set_group_key(_adapter *padap
+@@ -493,6 +777,8 @@ static int set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid)
_rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm));
psetkeyparm->keyid=(u8)keyid;
psetkeyparm->algorithm = alg;
-@@ -558,7 +844,6 @@ static int rtw_cfg80211_ap_set_encryptio
+@@ -558,7 +844,6 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
{
int ret = 0;
u32 wep_key_idx, wep_key_len,wep_total_len;
struct sta_info *psta = NULL, *pbcmc_sta = NULL;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-@@ -624,67 +909,33 @@ static int rtw_cfg80211_ap_set_encryptio
+@@ -624,67 +909,33 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
goto exit;
}
+ _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), param->u.crypt.key, wep_key_len);
- _rtw_memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength);
--
-- psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->KeyLength;
+ psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len;
+- psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->KeyLength;
+-
- set_wep_key(padapter, pwep->KeyMaterial, pwep->KeyLength, wep_key_idx);
-
- }
goto exit;
-@@ -693,8 +944,7 @@ static int rtw_cfg80211_ap_set_encryptio
+@@ -693,8 +944,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) // //group key
{
{
if(strcmp(param->u.crypt.alg, "WEP") == 0)
{
-@@ -765,7 +1015,7 @@ static int rtw_cfg80211_ap_set_encryptio
+@@ -765,7 +1015,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
{
if(check_fwstate(pmlmepriv, WIFI_AP_STATE))
{
{
_rtw_memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
-@@ -874,11 +1124,6 @@ static int rtw_cfg80211_ap_set_encryptio
+@@ -874,11 +1124,6 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
exit:
return ret;
}
-@@ -888,7 +1133,6 @@ static int rtw_cfg80211_set_encryption(s
+@@ -888,7 +1133,6 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
{
int ret = 0;
u32 wep_key_idx, wep_key_len,wep_total_len;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct security_priv *psecuritypriv = &padapter->securitypriv;
-@@ -898,7 +1142,7 @@ static int rtw_cfg80211_set_encryption(s
+@@ -898,7 +1142,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
_func_enter_;
u8 key_index, bool pairwise, const u8 *mac_addr,
#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
u8 key_index, const u8 *mac_addr,
-@@ -1128,22 +1355,15 @@ static int cfg80211_rtw_add_key(struct w
+@@ -1128,22 +1355,15 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
_adapter *padapter = wiphy_to_adapter(wiphy);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
param_len = sizeof(struct ieee_param) + params->key_len;
param = (struct ieee_param *)rtw_malloc(param_len);
if (param == NULL)
-@@ -1170,6 +1390,11 @@ static int cfg80211_rtw_add_key(struct w
+@@ -1170,6 +1390,11 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
case WLAN_CIPHER_SUITE_CCMP:
alg_name = "CCMP";
break;
default:
return -ENOTSUPP;
}
-@@ -1179,9 +1404,9 @@ static int cfg80211_rtw_add_key(struct w
+@@ -1179,9 +1404,9 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
if (!mac_addr || is_broadcast_ether_addr(mac_addr))
{
}
-@@ -1199,12 +1424,11 @@ static int cfg80211_rtw_add_key(struct w
+@@ -1199,12 +1424,11 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
_rtw_memcpy(param->u.crypt.key, params->key, params->key_len);
}
{
#ifdef CONFIG_AP_MODE
if(mac_addr)
-@@ -1215,7 +1439,7 @@ static int cfg80211_rtw_add_key(struct w
+@@ -1215,7 +1439,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
}
else
{
}
-@@ -1229,7 +1453,7 @@ static int cfg80211_rtw_add_key(struct w
+@@ -1229,7 +1453,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
}
static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_index, bool pairwise, const u8 *mac_addr,
#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
u8 key_index, const u8 *mac_addr,
-@@ -1256,123 +1480,165 @@ static int cfg80211_rtw_get_key(struct w
+@@ -1256,123 +1480,165 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
callback(cookie, ¶ms);
return key->key_len ? 0 : -ENOENT;
- struct iwm_priv *iwm = ndev_to_iwm(ndev);
+ _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+ struct security_priv *psecuritypriv = &padapter->securitypriv;
-+
+
+- IWM_DBG_WEXT(iwm, DBG, "Default key index is: %d\n", key_index);
+ DBG_871X(FUNC_NDEV_FMT" key_index=%d"
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
+ ", unicast=%d, multicast=%d"
+ #endif
+ );
-- IWM_DBG_WEXT(iwm, DBG, "Default key index is: %d\n", key_index);
-+ if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) //set wep default key
-+ {
-+ psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
-
- if (!iwm->keys[key_index].key_len) {
- IWM_ERR(iwm, "Key %d not used\n", key_index);
- return -EINVAL;
- }
-+ psecuritypriv->dot11PrivacyKeyIndex = key_index;
++ if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) //set wep default key
++ {
++ psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
- iwm->default_key = key_index;
++ psecuritypriv->dot11PrivacyKeyIndex = key_index;
++
+ psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
+ psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
+ if (psecuritypriv->dot11DefKeylen[key_index] == 13)
static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct net_device *ndev,
enum nl80211_iftype type, u32 *flags,
-@@ -1381,60 +1647,99 @@ static int cfg80211_rtw_change_iface(str
+@@ -1381,60 +1647,99 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
enum nl80211_iftype old_type;
NDIS_802_11_NETWORK_INFRASTRUCTURE networkType ;
_adapter *padapter = wiphy_to_adapter(wiphy);
break;
default:
return -EOPNOTSUPP;
-@@ -1442,12 +1747,19 @@ static int cfg80211_rtw_change_iface(str
+@@ -1442,12 +1747,19 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
rtw_wdev->iftype = type;
rtw_setopmode_cmd(padapter, networkType);
-@@ -1465,18 +1777,27 @@ void rtw_cfg80211_indicate_scan_done(str
+@@ -1465,18 +1777,27 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool abor
{
//struct cfg80211_scan_request *scan_request = pwdev_priv->scan_request;
}
_exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL);
}
-@@ -1498,46 +1819,7 @@ void rtw_cfg80211_surveydone_event_callb
+@@ -1498,46 +1819,7 @@ void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
#ifdef CONFIG_DEBUG_CFG80211
#endif
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-@@ -1553,10 +1835,9 @@ void rtw_cfg80211_surveydone_event_callb
+@@ -1553,10 +1835,9 @@ void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
//report network only if the current channel set contains the channel to which this network belongs
)
{
//ev=translate_scan(padapter, a, pnetwork, ev, stop);
-@@ -1568,44 +1849,24 @@ void rtw_cfg80211_surveydone_event_callb
+@@ -1568,44 +1849,24 @@ void rtw_cfg80211_surveydone_event_callback(_adapter *padapter)
}
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
#endif
if(len>0)
-@@ -1613,7 +1874,7 @@ static int rtw_cfg80211_set_probe_req_wp
+@@ -1613,7 +1874,7 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct net_device *net, char *buf
if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
{
#ifdef CONFIG_DEBUG_CFG80211
#endif
if(pmlmepriv->wps_probe_req_ie)
-@@ -1626,7 +1887,7 @@ static int rtw_cfg80211_set_probe_req_wp
+@@ -1626,7 +1887,7 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct net_device *net, char *buf
pmlmepriv->wps_probe_req_ie = rtw_malloc(wps_ielen);
if ( pmlmepriv->wps_probe_req_ie == NULL) {
return -EINVAL;
}
-@@ -1634,12 +1895,18 @@ static int rtw_cfg80211_set_probe_req_wp
+@@ -1634,12 +1895,18 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct net_device *net, char *buf
pmlmepriv->wps_probe_req_ie_len = wps_ielen;
}
#endif
if(pmlmepriv->p2p_probe_req_ie)
-@@ -1650,58 +1917,67 @@ static int rtw_cfg80211_set_probe_req_wp
+@@ -1650,58 +1917,67 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct net_device *net, char *buf
pmlmepriv->p2p_probe_req_ie = NULL;
}
{
int i;
u8 _status = _FALSE;
-@@ -1709,11 +1985,14 @@ static int cfg80211_rtw_scan(struct wiph
+@@ -1709,11 +1985,14 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy, struct net_device *ndev,
_adapter *padapter = wiphy_to_adapter(wiphy);
struct mlme_priv *pmlmepriv= &padapter->mlmepriv;
NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
#endif //CONFIG_P2P
-@@ -1721,10 +2000,21 @@ static int cfg80211_rtw_scan(struct wiph
+@@ -1721,10 +2000,21 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_ssid *ssids = request->ssids;
int social_channel = 0, j = 0;
bool need_indicate_scan_done = _FALSE;
#ifdef CONFIG_MP_INCLUDED
if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE)
-@@ -1740,8 +2030,22 @@ static int cfg80211_rtw_scan(struct wiph
+@@ -1740,8 +2030,22 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy, struct net_device *ndev,
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
{
}
if(_FAIL == rtw_pwr_wakeup(padapter)) {
-@@ -1749,26 +2053,31 @@ static int cfg80211_rtw_scan(struct wiph
+@@ -1749,26 +2053,31 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy, struct net_device *ndev,
goto check_need_indicate_scan_done;
}
if(request->n_channels == 3 &&
request->channels[0]->hw_value == 1 &&
request->channels[1]->hw_value == 6 &&
-@@ -1779,37 +2088,72 @@ static int cfg80211_rtw_scan(struct wiph
+@@ -1779,37 +2088,72 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy, struct net_device *ndev,
}
}
}
}
#endif //CONFIG_P2P
-@@ -1818,20 +2162,38 @@ static int cfg80211_rtw_scan(struct wiph
+@@ -1818,20 +2162,38 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy, struct net_device *ndev,
//parsing request ssids, n_ssids
for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) {
#ifdef CONFIG_DEBUG_CFG80211
_exit_critical_bh(&pmlmepriv->lock, &irqL);
-@@ -1881,11 +2243,11 @@ static int cfg80211_rtw_set_wiphy_params
+@@ -1881,11 +2243,11 @@ static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed)
return ret;
}
#endif
struct cfg80211_ibss_params *params)
{
#if 0
-@@ -1908,11 +2270,11 @@ static int cfg80211_rtw_join_ibss(struct
+@@ -1908,11 +2270,11 @@ static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *dev,
return iwm_send_mlme_profile(iwm);
#endif
{
#if 0
struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
-@@ -1920,14 +2282,13 @@ static int cfg80211_rtw_leave_ibss(struc
+@@ -1920,14 +2282,13 @@ static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
if (iwm->umac_profile_active)
return iwm_invalidate_mlme_profile(iwm);
#endif
if (!wpa_version) {
psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
-@@ -1954,7 +2315,7 @@ static int rtw_cfg80211_set_wpa_version(
+@@ -1954,7 +2315,7 @@ static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32
static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv,
enum nl80211_auth_type sme_auth_type)
{
switch (sme_auth_type) {
-@@ -1995,7 +2356,7 @@ static int rtw_cfg80211_set_cipher(struc
+@@ -1995,7 +2356,7 @@ static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 ciph
u32 *profile_cipher = ucast ? &psecuritypriv->dot11PrivacyAlgrthm :
&psecuritypriv->dot118021XGrpPrivacy;
if (!cipher) {
-@@ -2026,7 +2387,7 @@ static int rtw_cfg80211_set_cipher(struc
+@@ -2026,7 +2387,7 @@ static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 ciph
ndisencryptstatus = Ndis802_11Encryption3Enabled;
break;
default:
return -ENOTSUPP;
}
-@@ -2043,7 +2404,7 @@ static int rtw_cfg80211_set_cipher(struc
+@@ -2043,7 +2404,7 @@ static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 ciph
static int rtw_cfg80211_set_key_mgt(struct security_priv *psecuritypriv, u32 key_mgt)
{
if (key_mgt == WLAN_AKM_SUITE_8021X)
//*auth_type = UMAC_AUTH_TYPE_8021X;
-@@ -2051,7 +2412,7 @@ static int rtw_cfg80211_set_key_mgt(stru
+@@ -2051,7 +2412,7 @@ static int rtw_cfg80211_set_key_mgt(struct security_priv *psecuritypriv, u32 key
else if (key_mgt == WLAN_AKM_SUITE_PSK) {
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
} else {
//return -EINVAL;
}
-@@ -2064,230 +2425,225 @@ static int rtw_cfg80211_set_wpa_ie(_adap
+@@ -2064,230 +2425,225 @@ static int rtw_cfg80211_set_wpa_ie(_adapter *padapter, u8 *pie, size_t ielen)
u32 left;
int group_cipher = 0, pairwise_cipher = 0;
int ret = 0;
struct cfg80211_connect_params *sme)
{
int ret=0;
-@@ -2306,10 +2662,9 @@ static int cfg80211_rtw_connect(struct w
+@@ -2306,10 +2662,9 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *dev,
struct security_priv *psecuritypriv = &padapter->securitypriv;
_queue *queue = &pmlmepriv->scanned_queue;
if(wdev_to_priv(padapter->rtw_wdev)->block == _TRUE)
-@@ -2319,6 +2674,22 @@ static int cfg80211_rtw_connect(struct w
+@@ -2319,6 +2674,22 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *dev,
goto exit;
}
if(_FAIL == rtw_pwr_wakeup(padapter)) {
ret= -EPERM;
goto exit;
-@@ -2329,6 +2700,17 @@ static int cfg80211_rtw_connect(struct w
+@@ -2329,6 +2700,17 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *dev,
goto exit;
}
if (!sme->ssid || !sme->ssid_len)
{
ret = -EINVAL;
-@@ -2341,104 +2723,25 @@ static int cfg80211_rtw_connect(struct w
+@@ -2341,104 +2723,25 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *dev,
goto exit;
}
psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
-@@ -2455,6 +2758,11 @@ static int cfg80211_rtw_connect(struct w
+@@ -2455,6 +2758,11 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *dev,
if (ret < 0)
goto exit;
if (sme->crypto.n_ciphers_pairwise) {
ret = rtw_cfg80211_set_cipher(psecuritypriv, sme->crypto.ciphers_pairwise[0], _TRUE);
-@@ -2534,24 +2842,17 @@ static int cfg80211_rtw_connect(struct w
+@@ -2534,24 +2842,17 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *dev,
goto exit;
}
rtw_free_assoc_resources(padapter, 1);
}
-@@ -2582,11 +2889,14 @@ static int cfg80211_rtw_disconnect(struc
+@@ -2582,11 +2889,14 @@ static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *dev,
}
static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
{
#if 0
struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
-@@ -2614,44 +2924,47 @@ static int cfg80211_rtw_set_txpower(stru
+@@ -2614,44 +2924,47 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
return -EOPNOTSUPP;
}
#endif
return 0;
}
-@@ -2660,12 +2973,52 @@ static int cfg80211_rtw_set_pmksa(struct
+@@ -2660,12 +2973,52 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy,
struct net_device *netdev,
struct cfg80211_pmksa *pmksa)
{
+ break;
+ }
+ }
-+
+
+- printk("%s\n", __func__);
+ if(!blInserted)
+ {
+ // Find a new entry
+ DBG_871X(FUNC_NDEV_FMT" Use the new entry index = %d for this PMKID.\n",
+ FUNC_NDEV_ARG(netdev), psecuritypriv->PMKIDIndex );
-
-- printk("%s\n", __func__);
++
+ _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, pmksa->bssid, ETH_ALEN);
+ _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pmksa->pmkid, WLAN_PMKID_LEN);
+
return 0;
}
-@@ -2673,28 +3026,45 @@ static int cfg80211_rtw_del_pmksa(struct
+@@ -2673,28 +3026,45 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy,
struct net_device *netdev,
struct cfg80211_pmksa *pmksa)
{
return 0;
}
-@@ -2705,30 +3075,50 @@ void rtw_cfg80211_indicate_sta_assoc(_ad
+@@ -2705,30 +3075,50 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
int channel;
struct wireless_dev *pwdev = padapter->rtw_wdev;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
- {
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
- }
--
+-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) && !defined(CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER)
- cfg80211_rx_mgmt(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
-#else
}
-@@ -2743,21 +3133,18 @@ void rtw_cfg80211_indicate_sta_disassoc(
+@@ -2743,21 +3133,18 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, u
u8 mgmt_buf[128] = {0};
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
pmgmt_frame = mgmt_buf;
pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame;
-@@ -2781,20 +3168,22 @@ void rtw_cfg80211_indicate_sta_disassoc(
+@@ -2781,20 +3168,22 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, u
reason = cpu_to_le16(reason);
pmgmt_frame = rtw_set_fixed_ie(pmgmt_frame, _RSON_CODE_ , (unsigned char *)&reason, &frame_len);
return ret;
}
-@@ -2803,7 +3192,7 @@ static int rtw_cfg80211_monitor_if_close
+@@ -2803,7 +3192,7 @@ static int rtw_cfg80211_monitor_if_close(struct net_device *ndev)
{
int ret = 0;
return ret;
}
-@@ -2816,14 +3205,17 @@ static int rtw_cfg80211_monitor_if_xmit_
+@@ -2816,14 +3205,17 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de
int dot11_hdr_len = 24;
int snap_len = 6;
unsigned char *pdata;
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
goto fail;
-@@ -2838,7 +3230,7 @@ static int rtw_cfg80211_monitor_if_xmit_
+@@ -2838,7 +3230,7 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de
if(rtap_len != 14)
{
goto fail;
}
-@@ -2848,7 +3240,7 @@ static int rtw_cfg80211_monitor_if_xmit_
+@@ -2848,7 +3240,7 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de
dot11_hdr = (struct ieee80211_hdr *)skb->data;
frame_ctl = le16_to_cpu(dot11_hdr->frame_control);
/* Check if the QoS bit is set */
/* Check if this ia a Wireless Distribution System (WDS) frame
* which has 4 MAC addresses
*/
-@@ -2868,15 +3260,17 @@ static int rtw_cfg80211_monitor_if_xmit_
+@@ -2868,15 +3260,17 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de
memcpy(pdata, dst_mac_addr, sizeof(dst_mac_addr));
memcpy(pdata + sizeof(dst_mac_addr), src_mac_addr, sizeof(src_mac_addr));
{
//only for action frames
struct xmit_frame *pmgntframe;
-@@ -2889,50 +3283,27 @@ static int rtw_cfg80211_monitor_if_xmit_
+@@ -2889,50 +3283,27 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
u8 *buf = skb->data;
u32 len = skb->len;
//starting alloc mgmt frame to dump it
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
{
-@@ -2949,6 +3320,19 @@ static int rtw_cfg80211_monitor_if_xmit_
+@@ -2949,6 +3320,19 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
_rtw_memcpy(pframe, (void*)buf, len);
pattrib->pktlen = len;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-@@ -2961,12 +3345,11 @@ static int rtw_cfg80211_monitor_if_xmit_
+@@ -2961,12 +3345,11 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de
pattrib->last_txcmdsz = pattrib->pktlen;
dump_mgntframe(padapter, pmgntframe);
return ret;
}
-@@ -2997,181 +3380,210 @@ static const struct net_device_ops rtw_c
+@@ -2997,181 +3380,210 @@ static const struct net_device_ops rtw_cfg80211_monitor_if_ops = {
.ndo_open = rtw_cfg80211_monitor_if_open,
.ndo_stop = rtw_cfg80211_monitor_if_close,
.ndo_start_xmit = rtw_cfg80211_monitor_if_xmit_entry,
+ struct net_device *ndev;
+ ndev = wdev ? wdev->netdev : NULL;
+#endif
-
-- printk("%s\n", __func__);
++
+ if (!ndev)
+ goto exit;
+- printk("%s\n", __func__);
++ unregister_netdevice(ndev);
+
- if(dev)
- {
- unregister_netdev(dev);
-
- free_netdev(dev);
-+ unregister_netdevice(ndev);
++ if (ndev == pwdev_priv->pmon_ndev) {
++ pwdev_priv->pmon_ndev = NULL;
++ pwdev_priv->ifname_mon[0] = '\0';
++ DBG_871X(FUNC_NDEV_FMT" remove monitor interface\n", FUNC_NDEV_ARG(ndev));
++ }
- if(dev == pwdev_priv->pmon_ndev)
- {
- }
- }
-
-+ if (ndev == pwdev_priv->pmon_ndev) {
-+ pwdev_priv->pmon_ndev = NULL;
-+ pwdev_priv->ifname_mon[0] = '\0';
-+ DBG_871X(FUNC_NDEV_FMT" remove monitor interface\n", FUNC_NDEV_ARG(ndev));
-+ }
-+
+exit:
return 0;
}
if(!pbuf)
return -ENOMEM;
-@@ -3182,38 +3594,33 @@ static int cfg80211_rtw_add_beacon(struc
+@@ -3182,38 +3594,33 @@ static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *dev,
// pstapriv->max_num_sta = NUM_STA;
}
else
{
-@@ -3221,20 +3628,32 @@ static int cfg80211_rtw_add_beacon(struc
+@@ -3221,20 +3628,32 @@ static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *dev,
_cancel_timer_ex( &pwdinfo->restore_p2p_state_timer );
_cancel_timer_ex( &pwdinfo->pre_tx_scan_timer);
+ }
+ }
+#endif // CONFIG_P2P
-
++
+ /* pbss_network->IEs will not include p2p_ie, wfd ie */
+ rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, P2P_OUI, 4);
+ rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, _VENDOR_SPECIFIC_IE_, WFD_OUI, 4);
-+
+
+ if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS)
+ {
+#ifdef CONFIG_P2P
}
else
{
-@@ -3242,66 +3661,136 @@ static int cfg80211_rtw_add_beacon(struc
+@@ -3242,66 +3661,136 @@ static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *dev,
}
{
- printk("%s\n", __func__);
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
- return 0;
- }
++
++ return 0;
++}
+#else
+static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_ap_settings *settings)
+{
+ int ret = 0;
+ _adapter *adapter = wiphy_to_adapter(wiphy);
-+
+
+ DBG_871X(FUNC_NDEV_FMT" hidden_ssid:%d, auth_type:%d\n", FUNC_NDEV_ARG(ndev),
+ settings->hidden_ssid, settings->auth_type);
+
+{
+ int ret = 0;
+ _adapter *adapter = wiphy_to_adapter(wiphy);
-
++
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-
--static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *dev,
++
+ ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
+
+ return ret;
+static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
+{
+ DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
-+ return 0;
-+}
-+
+ return 0;
+ }
+
+#endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-+
+
+-static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *dev,
+static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev,
u8 *mac, struct station_parameters *params)
{
flush_all_cam_entry(padapter); //clear CAM
-@@ -3311,7 +3800,7 @@ static int cfg80211_rtw_del_station(stru
+@@ -3311,7 +3800,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *dev,
}
if (mac[0] == 0xff && mac[1] == 0xff &&
mac[2] == 0xff && mac[3] == 0xff &&
-@@ -3344,9 +3833,10 @@ static int cfg80211_rtw_del_station(stru
+@@ -3344,9 +3833,10 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *dev,
DBG_8192C("free psta=%p, aid=%d\n", psta, psta->aid);
rtw_list_delete(&psta->asoc_list);
//_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
psta = NULL;
-@@ -3360,73 +3850,48 @@ static int cfg80211_rtw_del_station(stru
+@@ -3360,73 +3850,48 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *dev,
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
}
*/
-@@ -3434,27 +3899,31 @@ static int cfg80211_rtw_change_bss(struc
+@@ -3434,27 +3899,31 @@ static int cfg80211_rtw_change_bss(struct wiphy *wiphy, struct net_device *dev,
}
return 0;
}
-@@ -3462,66 +3931,108 @@ static int cfg80211_rtw_assoc(struct wip
+@@ -3462,66 +3931,108 @@ static int cfg80211_rtw_assoc(struct wiphy *wiphy, struct net_device *dev,
void rtw_cfg80211_rx_action_p2p(_adapter *padapter, u8 *pmgmt_frame, uint frame_len)
{
- struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+ u8 category, action;
-
--#ifdef CONFIG_DEBUG_CFG80211
-- printk("%s\n", __func__);
--#endif
++
+ channel = rtw_get_oper_ch(padapter);
-
-- rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE);
++
+ DBG_8192C("RTW_Rx:cur_ch=%d\n", channel);
+ #ifdef CONFIG_P2P
+ type = rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE);
+ rtw_action_frame_parse(pmgmt_frame, frame_len, &category, &action);
+ DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
-- channel = pmlmeext->cur_channel;
--
+-#ifdef CONFIG_DEBUG_CFG80211
+- printk("%s\n", __func__);
+indicate:
- if (channel <= RTW_CH_MAX_2G_CHANNEL)
-- {
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
-- }
- else
-- {
- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-- }
-
--#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
-- cfg80211_rx_mgmt(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
++ if (channel <= RTW_CH_MAX_2G_CHANNEL)
++ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
++ else
++ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
++
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
- #else
- cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
++#else
++ cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
#endif
+}
-+
+
+- rtw_p2p_check_frames(padapter, pmgmt_frame, frame_len, _FALSE);
+void rtw_cfg80211_rx_action(_adapter *adapter, u8 *frame, uint frame_len, const char*msg)
+{
+ s32 freq;
+ DBG_871X("RTW_Rx:%s\n", msg);
+ else
+ DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
-+
-+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
-+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
-+ else
-+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
-+
+
+- channel = pmlmeext->cur_channel;
+-
+ if (channel <= RTW_CH_MAX_2G_CHANNEL)
+- {
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+- }
+ else
+- {
+ freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
+- }
+
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+- cfg80211_rx_mgmt(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, GFP_ATOMIC);
-+#else
+ #else
+- cfg80211_rx_action(padapter->pnetdev, freq, pmgmt_frame, frame_len, GFP_ATOMIC);
+ cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC);
-+#endif
+ #endif
}
void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, size_t len)
{
u16 wps_devicepassword_id = 0x0000;
-@@ -3625,9 +4136,9 @@ void rtw_cfg80211_issue_p2p_provision_re
+@@ -3625,9 +4136,9 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf,
fctrl = &(pwlanhdr->frame_ctl);
*(fctrl) = 0;
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
-@@ -3668,8 +4179,7 @@ void rtw_cfg80211_issue_p2p_provision_re
+@@ -3668,8 +4179,7 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf,
// Value:
// Device Capability Bitmap, 1 byte
_rtw_memcpy(p2p_ie + p2pielen, &capability, 2);
p2pielen += 2;
-@@ -3736,344 +4246,528 @@ void rtw_cfg80211_issue_p2p_provision_re
+@@ -3736,344 +4246,528 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf,
pattrib->last_txcmdsz = pattrib->pktlen;
+ DBG_8192C("%s, cancel ro ch timer\n", __func__);
+
+ _cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer);
-
++
+#ifdef CONFIG_CONCURRENT_MODE
+ ATOMIC_SET(&pwdev_priv->ro_ch_to, 1);
+#endif //CONFIG_CONCURRENT_MODE
-
-- printk("%s, len=%d, ch=%d, ch_type=%d\n", __func__, len,
-- ieee80211_frequency_to_channel(chan->center_freq), channel_type);
++
+ p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK);
+ }
+
+ pcfg80211_wdinfo->is_ro_ch = _TRUE;
-
--#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
-- printk("channel_type_valid=%d\n", channel_type_valid);
++
+ if(_FAIL == rtw_pwr_wakeup(padapter)) {
+ err = -EFAULT;
+ goto exit;
+ }
-+
+
+ _rtw_memcpy(&pcfg80211_wdinfo->remain_on_ch_channel, channel, sizeof(struct ieee80211_channel));
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
+ pcfg80211_wdinfo->remain_on_ch_type= channel_type;
+ #endif
+ pcfg80211_wdinfo->remain_on_ch_cookie= *cookie;
-+
+
+- printk("%s, len=%d, ch=%d, ch_type=%d\n", __func__, len,
+- ieee80211_frequency_to_channel(chan->center_freq), channel_type);
+ rtw_scan_abort(padapter);
+#ifdef CONFIG_CONCURRENT_MODE
+ if(rtw_buddy_adapter_up(padapter))
+ rtw_scan_abort(padapter->pbuddy_adapter);
+#endif //CONFIG_CONCURRENT_MODE
-+
+
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+- printk("channel_type_valid=%d\n", channel_type_valid);
+ //if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT) && !rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO))
+ if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
+ {
+
+ if(duration < 400)
+ duration = duration*3;//extend from exper.
-+
- mgmt = (const struct ieee80211_mgmt *) buf;
- fc = mgmt->frame_control;
- if (fc != IEEE80211_STYPE_ACTION)
++
+#ifdef CONFIG_CONCURRENT_MODE
+ if(check_buddy_fwstate(padapter, _FW_LINKED) &&
+ (duration<pwdinfo->ext_listen_interval))
{
- if (fc == IEEE80211_STYPE_PROBE_RESP)
-- {
-- printk("%s, fc == IEEE80211_STYPE_PROBE_RESP\n", __func__);
-- }
-- else
+ duration = duration + pwdinfo->ext_listen_interval;
+ }
+#endif
+#ifdef CONFIG_CONCURRENT_MODE
+ if ( check_buddy_fwstate(padapter, _FW_LINKED ) )
{
-- printk("%s, frame_control == 0x%x\n", __func__, fc);
+- printk("%s, fc == IEEE80211_STYPE_PROBE_RESP\n", __func__);
- }
--
-- //cfg80211_mgmt_tx_status(dev, *cookie, buf, len, ack, GFP_KERNEL);
--
-- goto exit;
+- else
+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
+
+ _set_timer(&pwdinfo->ap_p2p_switch_timer, duration-pwdinfo->ext_listen_interval);
+ }
+ }
-
-- }
-- else
-- {
-- u32 cnt=0;
-- u32 wait_for_surveydone;
-- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
++
+ ready_on_channel = _TRUE;
+ //pmlmeext->cur_channel = remain_ch;
+ //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
+ }else
+#endif //CONFIG_CONCURRENT_MODE
+ if(remain_ch != pmlmeext->cur_channel )
-+ {
+ {
+- printk("%s, frame_control == 0x%x\n", __func__, fc);
+ ready_on_channel = _TRUE;
+ //pmlmeext->cur_channel = remain_ch;
+ //set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
-+ }
+ }
+-
+- //cfg80211_mgmt_tx_status(dev, *cookie, buf, len, ack, GFP_KERNEL);
+-
+- goto exit;
+-
+- }
+- else
+ } else {
+ DBG_871X("%s remain_ch:%u not in channel plan!!!!\n", __FUNCTION__, remain_ch);
+ }
+
-
--#ifdef CONFIG_DEBUG_CFG80211
-- printk("%s, do: scan_abort\n", __func__);
++
+ //call this after other things have been done
+#ifdef CONFIG_CONCURRENT_MODE
+ if(ATOMIC_READ(&pwdev_priv->ro_ch_to)==1 ||
+ (remain_ch != pmlmeext->cur_channel))
-+ {
+ {
+- u32 cnt=0;
+- u32 wait_for_surveydone;
+- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ u8 co_channel = 0xff;
+ ATOMIC_SET(&pwdev_priv->ro_ch_to, 0);
++#endif
+
+-#ifdef CONFIG_DEBUG_CFG80211
+- printk("%s, do: scan_abort\n", __func__);
++ if(ready_on_channel == _TRUE)
++ {
++ if ( !check_fwstate(&padapter->mlmepriv, _FW_LINKED ) )
++ pmlmeext->cur_channel = remain_ch;
++
++#ifdef CONFIG_CONCURRENT_MODE
++ co_channel = rtw_get_oper_ch(padapter);
++
++ if(co_channel !=remain_ch)
#endif
-
- /* Abort the dwell time of any previous off-channel action frame that may
- * still in progress (including the dwell time), then this new action
- * frame will not be sent out.
- */
-
+-
- rtw_cfg80211_scan_abort(padapter);
- }
-#if 0
- wldev_iovar_setint(dev, "mpc", 1);
- } else if (act_frm->subtype == P2P_PAF_DEVDIS_REQ) {
- af_params->dwell_time = WL_LONG_DWELL_TIME;
-+ if(ready_on_channel == _TRUE)
-+ {
-+ if ( !check_fwstate(&padapter->mlmepriv, _FW_LINKED ) )
-+ pmlmeext->cur_channel = remain_ch;
-+
-+#ifdef CONFIG_CONCURRENT_MODE
-+ co_channel = rtw_get_oper_ch(padapter);
-+
-+ if(co_channel !=remain_ch)
-+#endif
+ {
+ if (!padapter->mlmepriv.LinkDetectInfo.bBusyTraffic)
+ set_channel_bwmode(padapter, remain_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
+ if(rtw_buddy_adapter_up(padapter))
+ rtw_scan_abort(padapter->pbuddy_adapter);
+ #endif /* CONFIG_CONCURRENT_MODE */
-+
+
+- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
+ if (padapter->cfg80211_wdinfo.is_ro_ch == _TRUE) {
+ //DBG_8192C("%s, cancel ro ch timer\n", __func__);
+ //_cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer);
+ #endif //CONFIG_CONCURRENT_MODE
+ }
-- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-+#ifdef CONFIG_CONCURRENT_MODE
-+ if (check_buddy_fwstate(padapter, _FW_LINKED )) {
-+ u8 co_channel=0xff;
-+ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
-+ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
-
- _rtw_memcpy(pframe, (void*)buf, len);
- pattrib->pktlen = len;
-
- pmlmeext->mgnt_seq = GetSequence(pwlanhdr);
- pattrib->seqnum = pmlmeext->mgnt_seq;
- pmlmeext->mgnt_seq++;
-+ co_channel = rtw_get_oper_ch(padapter);
++#ifdef CONFIG_CONCURRENT_MODE
++ if (check_buddy_fwstate(padapter, _FW_LINKED )) {
++ u8 co_channel=0xff;
++ PADAPTER pbuddy_adapter = padapter->pbuddy_adapter;
++ struct mlme_ext_priv *pbuddy_mlmeext = &pbuddy_adapter->mlmeextpriv;
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-#ifdef CONFIG_DEBUG_CFG80211
- printk("%s, ack=%d, ok!\n", __func__, ack );
-#endif
-+ if (tx_ch != pbuddy_mlmeext->cur_channel) {
++ co_channel = rtw_get_oper_ch(padapter);
- //indicate ack before issue frame to avoid racing with rsp frame
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
-exit:
-
- printk("%s, ack=%d \n", __func__, ack );
-+ u16 ext_listen_period;
++ if (tx_ch != pbuddy_mlmeext->cur_channel) {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- cfg80211_mgmt_tx_status(dev, *cookie, buf, len, ack, GFP_KERNEL);
-#endif
-
- return ret;
++ u16 ext_listen_period;
+
+-}
+ if (ATOMIC_READ(&pwdev_priv->switch_ch_to)==1) {
+ DBG_8192C("%s, issue nulldata pwrbit=1\n", __func__);
+ issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500);
--}
-+ ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
-
-static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, struct net_device *dev,
- struct ieee80211_channel * channel,
- enum nl80211_channel_type channel_type,
- struct wifidirect_info *pwdinfo = &padapter->wdinfo;
- struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo;
- u8 remain_ch = (u8) ieee80211_frequency_to_channel(channel->center_freq);
++ ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
++
+ //DBG_8192C("%s, set switch ch timer, period=%d\n", __func__, pwdinfo->ext_listen_period);
+ //_set_timer(&pwdinfo->ap_p2p_switch_timer, pwdinfo->ext_listen_period);
+ }
- printk("%s channel %02u duration %d\n", __func__, remain_ch, duration);
+ if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED ))
+ pmlmeext->cur_channel = tx_ch;
-
-- if(_FAIL == rtw_pwr_wakeup(padapter)) {
-- err = -EFAULT;
++
+ if (tx_ch != co_channel)
+ set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
+ }else
+ pmlmeext->cur_channel = tx_ch;
+ set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
+ }
-+
+
+- if(_FAIL == rtw_pwr_wakeup(padapter)) {
+- err = -EFAULT;
+ //starting alloc mgmt frame to dump it
+ if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL)
+ {
#endif
if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ))
-@@ -4082,7 +4776,7 @@ static void cfg80211_rtw_mgmt_frame_regi
+@@ -4082,7 +4776,7 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, struct net_dev
return;
}
{
int ret = 0;
uint wps_ielen = 0;
-@@ -4090,18 +4784,20 @@ static int rtw_cfg80211_set_beacon_wpsp2
+@@ -4090,18 +4784,20 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *net, char *buf, i
u32 p2p_ielen = 0;
u8 wps_oui[8]={0x0,0x50,0xf2,0x04};
u8 *p2p_ie;
#endif
if(pmlmepriv->wps_beacon_ie)
-@@ -4114,7 +4810,7 @@ static int rtw_cfg80211_set_beacon_wpsp2
+@@ -4114,7 +4810,7 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *net, char *buf, i
pmlmepriv->wps_beacon_ie = rtw_malloc(wps_ielen);
if ( pmlmepriv->wps_beacon_ie == NULL) {
return -EINVAL;
}
-@@ -4126,13 +4822,14 @@ static int rtw_cfg80211_set_beacon_wpsp2
+@@ -4126,13 +4822,14 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *net, char *buf, i
}
#endif
if(pmlmepriv->p2p_beacon_ie)
-@@ -4145,7 +4842,7 @@ static int rtw_cfg80211_set_beacon_wpsp2
+@@ -4145,7 +4842,7 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *net, char *buf, i
pmlmepriv->p2p_beacon_ie = rtw_malloc(p2p_ielen);
if ( pmlmepriv->p2p_beacon_ie == NULL) {
return -EINVAL;
}
-@@ -4154,6 +4851,35 @@ static int rtw_cfg80211_set_beacon_wpsp2
+@@ -4154,6 +4851,35 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *net, char *buf, i
pmlmepriv->p2p_beacon_ie_len = p2p_ielen;
}
pmlmeext->bstart_bss = _TRUE;
-@@ -4170,11 +4896,13 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4170,11 +4896,13 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
u8 *wps_ie;
u32 p2p_ielen = 0;
u8 *p2p_ie;
#endif
if(len>0)
-@@ -4185,9 +4913,25 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4185,9 +4913,25 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
u16 uconfig_method, *puconfig_method = NULL;
#ifdef CONFIG_DEBUG_CFG80211
if(pmlmepriv->wps_probe_resp_ie)
{
u32 free_len = pmlmepriv->wps_probe_resp_ie_len;
-@@ -4198,7 +4942,7 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4198,7 +4942,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
pmlmepriv->wps_probe_resp_ie = rtw_malloc(wps_ielen);
if ( pmlmepriv->wps_probe_resp_ie == NULL) {
return -EINVAL;
}
-@@ -4221,9 +4965,10 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4221,9 +4965,10 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
}
if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen)))
{
u8 is_GO = _FALSE;
-@@ -4231,7 +4976,7 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4231,7 +4976,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
u16 cap_attr=0;
#ifdef CONFIG_DEBUG_CFG80211
#endif
//Check P2P Capability ATTR
-@@ -4245,7 +4990,7 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4245,7 +4990,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
is_GO = (grp_cap&BIT(0)) ? _TRUE:_FALSE;
if(is_GO)
}
-@@ -4261,7 +5006,7 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4261,7 +5006,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
pmlmepriv->p2p_probe_resp_ie = rtw_malloc(p2p_ielen);
if ( pmlmepriv->p2p_probe_resp_ie == NULL) {
return -EINVAL;
}
-@@ -4280,7 +5025,7 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4280,7 +5025,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
pmlmepriv->p2p_go_probe_resp_ie = rtw_malloc(p2p_ielen);
if ( pmlmepriv->p2p_go_probe_resp_ie == NULL) {
return -EINVAL;
}
-@@ -4288,7 +5033,36 @@ static int rtw_cfg80211_set_probe_resp_w
+@@ -4288,7 +5033,36 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu
pmlmepriv->p2p_go_probe_resp_ie_len = p2p_ielen;
}
}
-@@ -4302,7 +5076,7 @@ static int rtw_cfg80211_set_assoc_resp_w
+@@ -4302,7 +5076,7 @@ static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, char *bu
_adapter *padapter = (_adapter *)rtw_netdev_priv(net);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
if(len>0)
{
-@@ -4316,7 +5090,7 @@ static int rtw_cfg80211_set_assoc_resp_w
+@@ -4316,7 +5090,7 @@ static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, char *bu
pmlmepriv->wps_assoc_resp_ie = rtw_malloc(len);
if ( pmlmepriv->wps_assoc_resp_ie == NULL) {
return -EINVAL;
}
-@@ -4336,11 +5110,14 @@ int rtw_cfg80211_set_mgnt_wpsp2pie(struc
+@@ -4336,11 +5110,14 @@ int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len,
u32 p2p_ielen = 0;
#ifdef CONFIG_DEBUG_CFG80211
{
if (net != NULL)
{
-@@ -4382,24 +5159,39 @@ static struct cfg80211_ops rtw_cfg80211_
+@@ -4382,24 +5159,39 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
.set_pmksa = cfg80211_rtw_set_pmksa,
.del_pmksa = cfg80211_rtw_del_pmksa,
.flush_pmksa = cfg80211_rtw_flush_pmksa,
.mgmt_tx = cfg80211_rtw_mgmt_tx,
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35))
-@@ -4458,7 +5250,7 @@ static void rtw_cfg80211_init_ht_capab(s
+@@ -4458,7 +5250,7 @@ static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum
}
else
{
}
}
-@@ -4470,18 +5262,48 @@ void rtw_cfg80211_init_wiphy(_adapter *p
+@@ -4470,18 +5262,48 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter)
struct wireless_dev *pwdev = padapter->rtw_wdev;
struct wiphy *wiphy = pwdev->wiphy;
static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy)
{
-@@ -4491,95 +5313,134 @@ static void rtw_cfg80211_preinit_wiphy(_
+@@ -4491,95 +5313,134 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy)
wiphy->max_scan_ie_len = RTW_SCAN_IE_LEN_MAX;
wiphy->max_num_pmkids = RTW_MAX_NUM_PMKIDS;
return ret;
}
-@@ -4588,30 +5449,40 @@ void rtw_wdev_free(struct wireless_dev *
+@@ -4588,30 +5449,40 @@ void rtw_wdev_free(struct wireless_dev *wdev)
{
struct rtw_wdev_priv *pwdev_priv;
}
#endif //CONFIG_IOCTL_CFG80211
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c
+index f999502..9adbeaf 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c
@@ -34,7 +34,7 @@
u32 rtw_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-@@ -139,11 +138,12 @@ static int hwaddr_aton_i(const char *txt
+@@ -139,11 +138,12 @@ static int hwaddr_aton_i(const char *txt, u8 *addr)
static void indicate_wx_custom_event(_adapter *padapter, char *msg)
{
return;
}
-@@ -152,90 +152,96 @@ static void indicate_wx_custom_event(_ad
+@@ -152,90 +152,96 @@ static void indicate_wx_custom_event(_adapter *padapter, char *msg)
return;
_rtw_memcpy(buff, msg, strlen(msg));
}
/*
-@@ -291,36 +297,87 @@ static char *translate_scan(_adapter *pa
+@@ -291,36 +297,87 @@ static char *translate_scan(_adapter *padapter,
#endif //CONFIG_P2P
#ifdef CONFIG_P2P
/* AP MAC address */
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
-@@ -335,7 +392,7 @@ static char *translate_scan(_adapter *pa
+@@ -335,7 +392,7 @@ static char *translate_scan(_adapter *padapter,
start = iwe_stream_add_point(info, start, stop, &iwe, pnetwork->network.Ssid.Ssid);
//parsing HT_CAP_IE
if(p && ht_ielen>0)
{
-@@ -445,7 +502,7 @@ static char *translate_scan(_adapter *pa
+@@ -445,7 +502,7 @@ static char *translate_scan(_adapter *padapter,
}
else//default MCS7
{
max_rate = (bw_40MHz) ? ((short_GI)?150:135):((short_GI)?72:65);
}
-@@ -508,58 +565,56 @@ static char *translate_scan(_adapter *pa
+@@ -508,58 +565,56 @@ static char *translate_scan(_adapter *padapter,
}
{ //parsing WPS IE
#ifdef CONFIG_PLATFORM_ROCKCHIPS
iwe.u.qual.noise = -100; // noise level suggest by zhf@rockchips
-@@ -567,14 +622,10 @@ static char *translate_scan(_adapter *pa
+@@ -567,14 +622,10 @@ static char *translate_scan(_adapter *padapter,
iwe.u.qual.noise = 0; // noise level
#endif //CONFIG_PLATFORM_ROCKCHIPS
return start;
}
-@@ -586,14 +637,14 @@ static int wpa_set_auth_algs(struct net_
+@@ -586,14 +637,14 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value)
if ((value & AUTH_ALG_SHARED_KEY)&&(value & AUTH_ALG_OPEN_SYSTEM))
{
padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
#ifdef CONFIG_PLATFORM_MT53XX
-@@ -606,7 +657,7 @@ static int wpa_set_auth_algs(struct net_
+@@ -606,7 +657,7 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value)
}
else if(value & AUTH_ALG_OPEN_SYSTEM)
{
//padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled;
if(padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK)
{
-@@ -622,11 +673,11 @@ static int wpa_set_auth_algs(struct net_
+@@ -622,11 +673,11 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value)
}
else if(value & AUTH_ALG_LEAP)
{
}
_func_exit_;
-@@ -857,12 +941,13 @@ static int rtw_set_wpa_ie(_adapter *pada
+@@ -857,12 +941,13 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen)
u32 left;
int group_cipher = 0, pairwise_cipher = 0;
int ret = 0;
if(pie == NULL)
return ret;
else
-@@ -882,9 +967,9 @@ static int rtw_set_wpa_ie(_adapter *pada
+@@ -882,9 +967,9 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen)
//dump
{
int i;
}
pos = buf;
-@@ -923,6 +1008,15 @@ static int rtw_set_wpa_ie(_adapter *pada
+@@ -923,6 +1008,15 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen)
_rtw_memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen);
}
switch(group_cipher)
{
case WPA_CIPHER_NONE:
-@@ -971,7 +1065,7 @@ static int rtw_set_wpa_ie(_adapter *pada
+@@ -971,7 +1065,7 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen)
break;
}
{//set wps_ie
u16 cnt = 0;
u8 eid, wps_oui[4]={0x0,0x50,0xf2,0x04};
-@@ -982,13 +1076,13 @@ static int rtw_set_wpa_ie(_adapter *pada
+@@ -982,13 +1076,13 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen)
if((eid==_VENDOR_SPECIFIC_IE_)&&(_rtw_memcmp(&buf[cnt+2], wps_oui, 4)==_TRUE))
{
#ifdef CONFIG_P2P
if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_OK))
-@@ -996,8 +1090,6 @@ static int rtw_set_wpa_ie(_adapter *pada
+@@ -996,8 +1090,6 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen)
rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_ING);
}
#endif //CONFIG_P2P
cnt += buf[cnt+1]+2;
break;
-@@ -1007,7 +1099,15 @@ static int rtw_set_wpa_ie(_adapter *pada
+@@ -1007,7 +1099,15 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen)
}
}
}
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_,
("rtw_set_wpa_ie: pairwise_cipher=0x%08x padapter->securitypriv.ndisencryptstatus=%d padapter->securitypriv.ndisauthtype=%d\n",
pairwise_cipher, padapter->securitypriv.ndisencryptstatus, padapter->securitypriv.ndisauthtype));
-@@ -1135,10 +1235,12 @@ static int rtw_wx_set_mode(struct net_de
+@@ -1135,10 +1235,12 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
NDIS_802_11_NETWORK_INFRASTRUCTURE networkType ;
int ret = 0;
ret= -EPERM;
goto exit;
}
-@@ -1152,20 +1254,20 @@ static int rtw_wx_set_mode(struct net_de
+@@ -1152,20 +1254,20 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
{
case IW_MODE_AUTO:
networkType = Ndis802_11AutoUnknown;
break;
default :
-@@ -1184,14 +1286,18 @@ static int rtw_wx_set_mode(struct net_de
+@@ -1184,14 +1286,18 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
rtw_setopmode_cmd(padapter, Ndis802_11AutoUnknown);
}
*/
rtw_setopmode_cmd(padapter, networkType);
exit:
-@@ -1267,7 +1373,7 @@ static int rtw_wx_set_pmkid(struct net_d
+@@ -1267,7 +1373,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
_rtw_memcpy( strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN);
if ( pPMK->cmd == IW_PMKSA_ADD )
{
if ( _rtw_memcmp( strIssueBssid, strZeroMacAddress, ETH_ALEN ) == _TRUE )
{
return( intReturn );
-@@ -1284,7 +1390,7 @@ static int rtw_wx_set_pmkid(struct net_d
+@@ -1284,7 +1390,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
if( _rtw_memcmp( psecuritypriv->PMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==_TRUE )
{ // BSSID is matched, the same AP => rewrite with new PMKID.
_rtw_memcpy( psecuritypriv->PMKIDList[j].PMKID, pPMK->pmkid, IW_PMKID_LEN);
psecuritypriv->PMKIDList[ j ].bUsed = _TRUE;
-@@ -1297,7 +1403,7 @@ static int rtw_wx_set_pmkid(struct net_d
+@@ -1297,7 +1403,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
if(!blInserted)
{
// Find a new entry
psecuritypriv->PMKIDIndex );
_rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, strIssueBssid, ETH_ALEN);
-@@ -1313,7 +1419,7 @@ static int rtw_wx_set_pmkid(struct net_d
+@@ -1313,7 +1419,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
}
else if ( pPMK->cmd == IW_PMKSA_REMOVE )
{
intReturn = _TRUE;
for(j=0 ; j<NUM_PMKID_CACHE; j++)
{
-@@ -1327,7 +1433,7 @@ static int rtw_wx_set_pmkid(struct net_d
+@@ -1327,7 +1433,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
}
else if ( pPMK->cmd == IW_PMKSA_FLUSH )
{
_rtw_memset( &psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE );
psecuritypriv->PMKIDIndex = 0;
intReturn = _TRUE;
-@@ -1509,10 +1615,39 @@ static int rtw_wx_set_wap(struct net_dev
+@@ -1509,10 +1615,39 @@ static int rtw_wx_set_wap(struct net_device *dev,
_queue *queue = &(pmlmepriv->scanned_queue);
struct wlan_network *pnetwork = NULL;
NDIS_802_11_AUTHENTICATION_MODE authmode;
{
ret= -1;
goto exit;
-@@ -1530,6 +1665,7 @@ static int rtw_wx_set_wap(struct net_dev
+@@ -1530,6 +1665,7 @@ static int rtw_wx_set_wap(struct net_device *dev,
}
authmode = padapter->securitypriv.ndisauthtype;
_enter_critical_bh(&queue->lock, &irqL);
phead = get_list_head(queue);
pmlmepriv->pscanned = get_next(phead);
-@@ -1572,6 +1708,7 @@ static int rtw_wx_set_wap(struct net_dev
+@@ -1572,6 +1708,7 @@ static int rtw_wx_set_wap(struct net_device *dev,
{
ret = -1;
_exit_critical_bh(&queue->lock, &irqL);
goto exit;
}
-@@ -1580,7 +1717,7 @@ static int rtw_wx_set_wap(struct net_dev
+@@ -1580,7 +1717,7 @@ static int rtw_wx_set_wap(struct net_device *dev,
}
_exit_critical_bh(&queue->lock, &irqL);
static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-@@ -1756,7 +1827,6 @@ static int rtw_wx_set_scan(struct net_de
+@@ -1756,7 +1827,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
struct mlme_priv *pmlmepriv= &padapter->mlmepriv;
NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
_irqL irqL;
}
if(_status == _FALSE)
-@@ -1972,7 +2074,7 @@ static int rtw_wx_get_scan(struct net_de
+@@ -1972,7 +2074,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
_irqL irqL;
_list *plist, *phead;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
_queue *queue = &(pmlmepriv->scanned_queue);
struct wlan_network *pnetwork = NULL;
char *ev = extra;
-@@ -1981,6 +2083,10 @@ static int rtw_wx_get_scan(struct net_de
+@@ -1981,6 +2083,10 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
u32 cnt=0;
u32 wait_for_surveydone;
sint wait_status;
#ifdef CONFIG_P2P
struct wifidirect_info* pwdinfo = &padapter->wdinfo;
#endif //CONFIG_P2P
-@@ -1993,6 +2099,15 @@ static int rtw_wx_get_scan(struct net_de
+@@ -1993,6 +2099,15 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
DBG_871X("DBG_IOCTL %s:%d\n",__FUNCTION__, __LINE__);
#endif
if(padapter->pwrctrlpriv.brfoffbyhw && padapter->bDriverStopped)
{
ret = -EINVAL;
-@@ -2003,7 +2118,10 @@ static int rtw_wx_get_scan(struct net_de
+@@ -2003,7 +2118,10 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
{
// P2P is enabled
}
else
{
-@@ -2016,14 +2134,39 @@ static int rtw_wx_get_scan(struct net_de
+@@ -2016,14 +2134,39 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
}
#endif //CONFIG_P2P
rtw_msleep_os(30);
cnt++;
if(cnt > wait_for_surveydone )
-@@ -2048,10 +2191,9 @@ static int rtw_wx_get_scan(struct net_de
+@@ -2048,10 +2191,9 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
//report network only if the current channel set contains the channel to which this network belongs
)
{
ev=translate_scan(padapter, a, pnetwork, ev, stop);
-@@ -2095,7 +2237,6 @@ static int rtw_wx_set_essid(struct net_d
+@@ -2095,7 +2237,6 @@ static int rtw_wx_set_essid(struct net_device *dev,
_list *phead;
s8 status = _TRUE;
struct wlan_network *pnetwork = NULL;
NDIS_802_11_AUTHENTICATION_MODE authmode;
NDIS_802_11_SSID ndis_ssid;
u8 *dst_ssid, *src_ssid;
-@@ -2108,9 +2249,39 @@ static int rtw_wx_set_essid(struct net_d
+@@ -2108,9 +2249,39 @@ static int rtw_wx_set_essid(struct net_device *dev,
DBG_871X("DBG_IOCTL %s:%d\n",__FUNCTION__, __LINE__);
#endif
{
ret = -1;
goto exit;
-@@ -2136,7 +2307,7 @@ static int rtw_wx_set_essid(struct net_d
+@@ -2136,7 +2307,7 @@ static int rtw_wx_set_essid(struct net_device *dev,
}
authmode = padapter->securitypriv.ndisauthtype;
if (wrqu->essid.flags && wrqu->essid.length)
{
// Commented by Albert 20100519
-@@ -2153,7 +2324,8 @@ static int rtw_wx_set_essid(struct net_d
+@@ -2153,7 +2324,8 @@ static int rtw_wx_set_essid(struct net_device *dev,
len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length : IW_ESSID_MAX_SIZE;
#endif
_rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID));
ndis_ssid.SsidLength = len;
-@@ -2161,6 +2333,7 @@ static int rtw_wx_set_essid(struct net_d
+@@ -2161,6 +2333,7 @@ static int rtw_wx_set_essid(struct net_device *dev,
src_ssid = ndis_ssid.Ssid;
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_wx_set_essid: ssid=[%s]\n", src_ssid));
_enter_critical_bh(&queue->lock, &irqL);
phead = get_list_head(queue);
pmlmepriv->pscanned = get_next(phead);
-@@ -2215,6 +2388,7 @@ static int rtw_wx_set_essid(struct net_d
+@@ -2215,6 +2388,7 @@ static int rtw_wx_set_essid(struct net_device *dev,
{
ret = -1;
_exit_critical_bh(&queue->lock, &irqL);
goto exit;
}
-@@ -2222,6 +2396,7 @@ static int rtw_wx_set_essid(struct net_d
+@@ -2222,6 +2396,7 @@ static int rtw_wx_set_essid(struct net_device *dev,
}
}
_exit_critical_bh(&queue->lock, &irqL);
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_,
("set ssid: set_802_11_auth. mode=%d\n", authmode));
rtw_set_802_11_authentication_mode(padapter, authmode);
-@@ -2234,7 +2409,7 @@ static int rtw_wx_set_essid(struct net_d
+@@ -2234,7 +2409,7 @@ static int rtw_wx_set_essid(struct net_device *dev,
exit:
#ifdef DBG_IOCTL
DBG_871X("DBG_IOCTL %s:%d return %d\n",__FUNCTION__, __LINE__, ret);
-@@ -2379,94 +2554,43 @@ static int rtw_wx_get_rate(struct net_de
+@@ -2379,94 +2554,43 @@ static int rtw_wx_get_rate(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
}
static int rtw_wx_get_rts(struct net_device *dev,
-@@ -2476,7 +2600,8 @@ static int rtw_wx_get_rts(struct net_dev
+@@ -2476,7 +2600,8 @@ static int rtw_wx_get_rts(struct net_device *dev,
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
_func_enter_;
wrqu->rts.value = padapter->registrypriv.rts_thresh;
wrqu->rts.fixed = 0; /* no auto select */
-@@ -2504,6 +2629,8 @@ static int rtw_wx_set_frag(struct net_de
+@@ -2504,6 +2629,8 @@ static int rtw_wx_set_frag(struct net_device *dev,
padapter->xmitpriv.frag_len = wrqu->frag.value & ~0x1;
}
_func_exit_;
-@@ -2511,7 +2638,6 @@ static int rtw_wx_set_frag(struct net_de
+@@ -2511,7 +2638,6 @@ static int rtw_wx_set_frag(struct net_device *dev,
}
static int rtw_wx_get_frag(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
-@@ -2519,6 +2645,8 @@ static int rtw_wx_get_frag(struct net_de
+@@ -2519,6 +2645,8 @@ static int rtw_wx_get_frag(struct net_device *dev,
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
_func_enter_;
wrqu->frag.value = padapter->xmitpriv.frag_len;
wrqu->frag.fixed = 0; /* no auto select */
-@@ -2579,7 +2707,7 @@ static int rtw_wx_set_enc(struct net_dev
+@@ -2579,7 +2707,7 @@ static int rtw_wx_set_enc(struct net_device *dev,
struct iw_point *erq = &(wrqu->encoding);
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
_rtw_memset(&wep, 0, sizeof(NDIS_802_11_WEP));
-@@ -2589,7 +2717,7 @@ static int rtw_wx_set_enc(struct net_dev
+@@ -2589,7 +2717,7 @@ static int rtw_wx_set_enc(struct net_device *dev,
if (erq->flags & IW_ENCODE_DISABLED)
{
padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled;
padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_;
padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_;
-@@ -2610,13 +2738,13 @@ static int rtw_wx_set_enc(struct net_dev
+@@ -2610,13 +2738,13 @@ static int rtw_wx_set_enc(struct net_device *dev,
{
keyindex_provided = 0;
key = padapter->securitypriv.dot11PrivacyKeyIndex;
padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;//Ndis802_11EncryptionDisabled;
#ifdef CONFIG_PLATFORM_MT53XX
-@@ -2632,7 +2760,7 @@ static int rtw_wx_set_enc(struct net_dev
+@@ -2632,7 +2760,7 @@ static int rtw_wx_set_enc(struct net_device *dev,
}
else if(erq->flags & IW_ENCODE_RESTRICTED)
{
padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
#ifdef CONFIG_PLATFORM_MT53XX
-@@ -2648,7 +2776,7 @@ static int rtw_wx_set_enc(struct net_dev
+@@ -2648,7 +2776,7 @@ static int rtw_wx_set_enc(struct net_device *dev,
}
else
{
padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;//Ndis802_11EncryptionDisabled;
padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_Open; //open system
-@@ -2673,7 +2801,7 @@ static int rtw_wx_set_enc(struct net_dev
+@@ -2673,7 +2801,7 @@ static int rtw_wx_set_enc(struct net_device *dev,
{
padapter->securitypriv.dot11PrivacyKeyIndex = key;
switch(padapter->securitypriv.dot11DefKeylen[key])
{
-@@ -2910,7 +3038,8 @@ static int rtw_wx_set_auth(struct net_de
+@@ -2910,7 +3038,8 @@ static int rtw_wx_set_auth(struct net_device *dev,
* It's the starting point of a link layer connection using wpa_supplicant
*/
if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
DBG_871X("%s...call rtw_indicate_disconnect\n ",__FUNCTION__);
rtw_indicate_disconnect(padapter);
rtw_free_assoc_resources(padapter, 1);
-@@ -2987,6 +3116,11 @@ static int rtw_wx_set_enc_ext(struct net
+@@ -2987,6 +3116,11 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
case IW_ENCODE_ALG_CCMP:
alg_name = "CCMP";
break;
default:
return -1;
}
-@@ -2994,7 +3128,11 @@ static int rtw_wx_set_enc_ext(struct net
+@@ -2994,7 +3128,11 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN);
{
param->u.crypt.set_tx = 0;
}
-@@ -3065,40 +3203,40 @@ static int rtw_wx_get_nick(struct net_de
+@@ -3065,40 +3203,40 @@ static int rtw_wx_get_nick(struct net_device *dev,
u32 ndisencryptstatus;
*/
#endif
return 0;
-@@ -3109,15 +3247,51 @@ static int rtw_wx_read32(struct net_devi
+@@ -3109,15 +3247,51 @@ static int rtw_wx_read32(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
return 0;
}
-@@ -3126,15 +3300,35 @@ static int rtw_wx_write32(struct net_dev
+@@ -3126,15 +3300,35 @@ static int rtw_wx_write32(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
return 0;
}
-@@ -3149,8 +3343,8 @@ static int rtw_wx_read_rf(struct net_dev
+@@ -3149,8 +3343,8 @@ static int rtw_wx_read_rf(struct net_device *dev,
path = *(u32*)extra;
addr = *((u32*)extra + 1);
/*
* IMPORTANT!!
* Only when wireless private ioctl is at odd order,
-@@ -3172,8 +3366,8 @@ static int rtw_wx_write_rf(struct net_de
+@@ -3172,8 +3366,8 @@ static int rtw_wx_write_rf(struct net_device *dev,
path = *(u32*)extra;
addr = *((u32*)extra + 1);
data32 = *((u32*)extra + 2);
return 0;
}
-@@ -3190,7 +3384,7 @@ static int dummy(struct net_device *dev,
+@@ -3190,7 +3384,7 @@ static int dummy(struct net_device *dev, struct iw_request_info *a,
//_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
//struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
return -1;
-@@ -3213,7 +3407,7 @@ static int rtw_wx_set_channel_plan(struc
+@@ -3213,7 +3407,7 @@ static int rtw_wx_set_channel_plan(struct net_device *dev,
#endif
if( _SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req, 1) ) {
} else
return -EPERM;
-@@ -3245,7 +3439,7 @@ static int rtw_wx_get_sensitivity(struct
+@@ -3245,7 +3439,7 @@ static int rtw_wx_get_sensitivity(struct net_device *dev,
// Modified by Albert 20110914
// This is in dbm format for MTK platform.
wrqu->qual.level = padapter->recvpriv.rssi;
#endif
return 0;
}
-@@ -3391,12 +3585,12 @@ static void rtw_dbg_mode_hdl(_adapter *p
+@@ -3391,12 +3585,12 @@ static void rtw_dbg_mode_hdl(_adapter *padapter, u32 id, u8 *pdata, u32 len)
u8 offset;
u32 value;
break;
case GEN_MP_IOCTL_SUBCODE(READ_REG):
RegRWStruct = (pRW_Reg)pdata;
-@@ -3441,7 +3635,7 @@ static void rtw_dbg_mode_hdl(_adapter *p
+@@ -3441,7 +3635,7 @@ static void rtw_dbg_mode_hdl(_adapter *padapter, u32 id, u8 *pdata, u32 len)
path = (u8)prfreg->path;
offset = (u8)prfreg->offset;
prfreg->value = value;
-@@ -3454,27 +3648,26 @@ static void rtw_dbg_mode_hdl(_adapter *p
+@@ -3454,27 +3648,26 @@ static void rtw_dbg_mode_hdl(_adapter *padapter, u32 id, u8 *pdata, u32 len)
offset = (u8)prfreg->offset;
value = prfreg->value;
break;
#endif
-@@ -3495,10 +3688,10 @@ static int rtw_mp_ioctl_hdl(struct net_d
+@@ -3495,10 +3688,10 @@ static int rtw_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info
uint status=0;
u16 len;
u8 *pparmbuf = NULL, bset;
//mutex_lock(&ioctl_mutex);
-@@ -3532,7 +3725,7 @@ static int rtw_mp_ioctl_hdl(struct net_d
+@@ -3532,7 +3725,7 @@ static int rtw_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info
goto _rtw_mp_ioctl_hdl_exit;
}
#ifdef CONFIG_MP_INCLUDED
phandler = mp_ioctl_hdl + poidparam->subcode;
-@@ -3572,7 +3765,7 @@ static int rtw_mp_ioctl_hdl(struct net_d
+@@ -3572,7 +3765,7 @@ static int rtw_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info
//todo:check status, BytesNeeded, etc.
}
else {
poidparam->subcode, phandler->oid, phandler->handler);
ret = -EFAULT;
goto _rtw_mp_ioctl_hdl_exit;
-@@ -3620,7 +3813,7 @@ static int rtw_get_ap_info(struct net_de
+@@ -3620,7 +3813,7 @@ static int rtw_get_ap_info(struct net_device *dev,
_queue *queue = &(pmlmepriv->scanned_queue);
struct iw_point *pdata = &wrqu->data;
if((padapter->bDriverStopped) || (pdata==NULL))
{
-@@ -3669,7 +3862,7 @@ static int rtw_get_ap_info(struct net_de
+@@ -3669,7 +3862,7 @@ static int rtw_get_ap_info(struct net_device *dev,
//if(hwaddr_aton_i(pdata->pointer, bssid))
if(hwaddr_aton_i(data, bssid))
{
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
return -EINVAL;
}
-@@ -3677,7 +3870,7 @@ static int rtw_get_ap_info(struct net_de
+@@ -3677,7 +3870,7 @@ static int rtw_get_ap_info(struct net_device *dev,
if(_rtw_memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN) == _TRUE)//BSSID match, then check if supporting wpa/wpa2
{
pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12);
if(pbuf && (wpa_ielen>0))
-@@ -3768,17 +3961,17 @@ static int rtw_wps_start(struct net_devi
+@@ -3768,17 +3961,17 @@ static int rtw_wps_start(struct net_device *dev,
goto exit;
}
else if ( u32wps_start == 2 ) // WPS Stop because of wps success
{
rtw_led_control(padapter, LED_CTL_STOP_WPS);
-@@ -3787,6 +3980,11 @@ static int rtw_wps_start(struct net_devi
+@@ -3787,6 +3980,11 @@ static int rtw_wps_start(struct net_device *dev,
{
rtw_led_control(padapter, LED_CTL_STOP_WPS_FAIL);
}
static int rtw_wext_p2p_enable(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
-@@ -3834,9 +4031,34 @@ static int rtw_wext_p2p_enable(struct ne
+@@ -3834,9 +4031,34 @@ static int rtw_wext_p2p_enable(struct net_device *dev,
{
// Stay at the listen state and wait for discovery.
channel = pwdinfo->listen_channel;
else
{
pwdinfo->operating_channel = pmlmeext->cur_channel;
-@@ -3865,7 +4087,7 @@ static int rtw_p2p_set_go_nego_ssid(stru
+@@ -3865,7 +4087,7 @@ static int rtw_p2p_set_go_nego_ssid(struct net_device *dev,
struct iw_point *pdata = &wrqu->data;
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
_rtw_memcpy( pwdinfo->nego_ssid, extra, strlen( extra ) );
pwdinfo->nego_ssidlen = strlen( extra );
-@@ -3878,28 +4100,15 @@ static int rtw_p2p_set_intent(struct net
+@@ -3878,28 +4100,15 @@ static int rtw_p2p_set_intent(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
if ( intent <= 15 )
{
pwdinfo->intent= intent;
-@@ -3909,10 +4118,10 @@ static int rtw_p2p_set_intent(struct net
+@@ -3909,10 +4118,10 @@ static int rtw_p2p_set_intent(struct net_device *dev,
ret = -1;
}
}
static int rtw_p2p_set_listen_ch(struct net_device *dev,
-@@ -3922,26 +4131,13 @@ static int rtw_p2p_set_listen_ch(struct
+@@ -3922,26 +4131,13 @@ static int rtw_p2p_set_listen_ch(struct net_device *dev,
int ret = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
{
pwdinfo->listen_channel = listen_ch;
set_channel_bwmode(padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
-@@ -3951,7 +4147,7 @@ static int rtw_p2p_set_listen_ch(struct
+@@ -3951,7 +4147,7 @@ static int rtw_p2p_set_listen_ch(struct net_device *dev,
ret = -1;
}
return ret;
-@@ -3966,30 +4162,13 @@ static int rtw_p2p_set_op_ch(struct net_
+@@ -3966,30 +4162,13 @@ static int rtw_p2p_set_op_ch(struct net_device *dev,
int ret = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
{
pwdinfo->operating_channel = op_ch;
}
-@@ -3998,10 +4177,10 @@ static int rtw_p2p_set_op_ch(struct net_
+@@ -3998,10 +4177,10 @@ static int rtw_p2p_set_op_ch(struct net_device *dev,
ret = -1;
}
}
-@@ -4012,8 +4191,6 @@ static int rtw_p2p_profilefound(struct n
+@@ -4012,8 +4191,6 @@ static int rtw_p2p_profilefound(struct net_device *dev,
int ret = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
// Comment by Albert 2010/10/13
-@@ -4026,7 +4203,7 @@ static int rtw_p2p_profilefound(struct n
+@@ -4026,7 +4203,7 @@ static int rtw_p2p_profilefound(struct net_device *dev,
// YY => SSID Length
// SSID => SSID for persistence group
// The upper application should pass the SSID to driver by using this rtw_p2p_profilefound function.
-@@ -4055,8 +4232,8 @@ static int rtw_p2p_profilefound(struct n
+@@ -4055,8 +4232,8 @@ static int rtw_p2p_profilefound(struct net_device *dev,
pwdinfo->profileinfo[ pwdinfo->profileindex ].peermac[ jj ] = key_2char2num(extra[ kk ], extra[ kk+ 1 ]);
}
pwdinfo->profileindex++;
}
}
-@@ -4073,16 +4250,14 @@ static int rtw_p2p_setDN(struct net_devi
+@@ -4073,16 +4250,14 @@ static int rtw_p2p_setDN(struct net_device *dev,
int ret = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
return ret;
}
-@@ -4098,23 +4273,20 @@ static int rtw_p2p_get_status(struct net
+@@ -4098,23 +4273,20 @@ static int rtw_p2p_get_status(struct net_device *dev,
struct iw_point *pdata = &wrqu->data;
struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
return ret;
}
-@@ -4152,7 +4324,7 @@ static int rtw_p2p_get_role(struct net_d
+@@ -4152,7 +4324,7 @@ static int rtw_p2p_get_role(struct net_device *dev,
struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
pwdinfo->p2p_peer_interface_addr[ 0 ], pwdinfo->p2p_peer_interface_addr[ 1 ], pwdinfo->p2p_peer_interface_addr[ 2 ],
pwdinfo->p2p_peer_interface_addr[ 3 ], pwdinfo->p2p_peer_interface_addr[ 4 ], pwdinfo->p2p_peer_interface_addr[ 5 ]);
-@@ -4174,7 +4346,7 @@ static int rtw_p2p_get_peer_ifaddr(struc
+@@ -4174,7 +4346,7 @@ static int rtw_p2p_get_peer_ifaddr(struct net_device *dev,
struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
pwdinfo->p2p_peer_interface_addr[ 0 ], pwdinfo->p2p_peer_interface_addr[ 1 ], pwdinfo->p2p_peer_interface_addr[ 2 ],
pwdinfo->p2p_peer_interface_addr[ 3 ], pwdinfo->p2p_peer_interface_addr[ 4 ], pwdinfo->p2p_peer_interface_addr[ 5 ]);
-@@ -4197,7 +4369,7 @@ static int rtw_p2p_get_peer_devaddr(stru
+@@ -4197,7 +4369,7 @@ static int rtw_p2p_get_peer_devaddr(struct net_device *dev,
struct iw_point *pdata = &wrqu->data;
struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
pwdinfo->rx_prov_disc_info.peerDevAddr[ 0 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 1 ],
pwdinfo->rx_prov_disc_info.peerDevAddr[ 2 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 3 ],
pwdinfo->rx_prov_disc_info.peerDevAddr[ 4 ], pwdinfo->rx_prov_disc_info.peerDevAddr[ 5 ]);
-@@ -4210,6 +4382,30 @@ static int rtw_p2p_get_peer_devaddr(stru
+@@ -4210,6 +4382,30 @@ static int rtw_p2p_get_peer_devaddr(struct net_device *dev,
}
static int rtw_p2p_get_groupid(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
-@@ -4221,7 +4417,7 @@ static int rtw_p2p_get_groupid(struct ne
+@@ -4221,7 +4417,7 @@ static int rtw_p2p_get_groupid(struct net_device *dev,
struct iw_point *pdata = &wrqu->data;
struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
pwdinfo->groupid_info.go_device_addr[ 0 ], pwdinfo->groupid_info.go_device_addr[ 1 ],
pwdinfo->groupid_info.go_device_addr[ 2 ], pwdinfo->groupid_info.go_device_addr[ 3 ],
pwdinfo->groupid_info.go_device_addr[ 4 ], pwdinfo->groupid_info.go_device_addr[ 5 ],
-@@ -4231,46 +4427,551 @@ static int rtw_p2p_get_groupid(struct ne
+@@ -4231,46 +4427,551 @@ static int rtw_p2p_get_groupid(struct net_device *dev,
}
}
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-@@ -4286,67 +4987,441 @@ static int rtw_p2p_get_wps_configmethod(
+@@ -4286,67 +4987,441 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev,
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
if ( _rtw_memcmp( pnetwork->network.MacAddress, peerMAC, ETH_ALEN ) )
{
+ {
+ // The P2P Device ID attribute is included in the Beacon frame.
+ // The P2P Device Info attribute is included in the probe response frame.
-+
+
+- if ( (wpsie=rtw_get_wps_ie( &pnetwork->network.IEs[ 12 ], pnetwork->network.IELength - 12, NULL, &wpsie_len )) )
+ if ( rtw_get_p2p_attr_content( p2pie, p2pielen, P2P_ATTR_DEVICE_ID, attr_content, &attr_contentlen) )
-+ {
+ {
+- rtw_get_wps_attr_content( wpsie, wpsie_len, WPS_ATTR_CONF_METHOD, ( u8* ) &attr_content, &attr_contentlen);
+- if ( attr_contentlen )
+ // Handle the P2P Device ID attribute of Beacon first
+ if ( _rtw_memcmp( attr_content, pinvite_req_info->peer_macaddr, ETH_ALEN ) )
-+ {
+ {
+- attr_content = be16_to_cpu( attr_content );
+- sprintf( attr_content_str, "\n\nM=%.4d", attr_content );
+- blnMatch = 1;
+ uintPeerChannel = pnetwork->network.Configuration.DSConfig;
+ break;
+ }
+ {
+ u8 wfd_devinfo[ 6 ] = { 0x00 };
+ uint wfd_devlen = 6;
-
-- if ( (wpsie=rtw_get_wps_ie( &pnetwork->network.IEs[ 12 ], pnetwork->network.IELength - 12, NULL, &wpsie_len )) )
++
+ DBG_871X( "[%s] Found WFD IE!\n", __FUNCTION__ );
+ if ( rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, wfd_devinfo, &wfd_devlen ) )
- {
-- rtw_get_wps_attr_content( wpsie, wpsie_len, WPS_ATTR_CONF_METHOD, ( u8* ) &attr_content, &attr_contentlen);
-- if ( attr_contentlen )
++ {
+ u16 wfd_devinfo_field = 0;
+
+ // Commented by Albert 20120319
+ // In big endian format.
+ wfd_devinfo_field = RTW_GET_BE16(wfd_devinfo);
+ if ( wfd_devinfo_field & WFD_DEVINFO_SESSION_AVAIL )
- {
-- attr_content = be16_to_cpu( attr_content );
-- sprintf( attr_content_str, "\n\nM=%.4d", attr_content );
-- blnMatch = 1;
++ {
+ pwfd_info->peer_session_avail = _TRUE;
+ }
+ else
+{
+ const char *pos;
+ u8 *opos;
-+
+
+- plist = get_next(plist);
+-
+- }
+ pos = str;
+ opos = bin;
-+
+
+- _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
+ if (hexstr2bin(pos, opos, 4))
+ return -1;
+ pos += 8;
+ opos += 4;
-+
+
+- if ( !blnMatch )
+- {
+- sprintf( attr_content_str, "\n\nM=0000" );
+- }
+ if (*pos++ != '-' || hexstr2bin(pos, opos, 2))
+ return -1;
+ pos += 4;
+ opos += 2;
-- plist = get_next(plist);
+- if ( copy_to_user(wrqu->data.pointer, attr_content_str, 6 + 17)) {
+- return -EFAULT;
+- }
-
-- }
+- return ret;
+-
+ if (*pos++ != '-' || hexstr2bin(pos, opos, 2))
+ return -1;
+ pos += 4;
+ opos += 2;
-
-- _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
++
+ if (*pos++ != '-' || hexstr2bin(pos, opos, 2))
+ return -1;
+ pos += 4;
+ opos += 2;
-
-- if ( !blnMatch )
-- {
-- sprintf( attr_content_str, "\n\nM=0000" );
-- }
++
+ if (*pos++ != '-' || hexstr2bin(pos, opos, 6))
+ return -1;
-
-- if ( copy_to_user(wrqu->data.pointer, attr_content_str, 6 + 17)) {
-- return -EFAULT;
-- }
--
-- return ret;
--
++
+ return 0;
}
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-@@ -4357,32 +5432,37 @@ static int rtw_p2p_get_device_name(struc
+@@ -4357,32 +5432,37 @@ static int rtw_p2p_get_device_name(struct net_device *dev,
struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
u8 peerMAC[ ETH_ALEN ] = { 0x00 };
int jj,kk;
}
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-@@ -4396,146 +5476,260 @@ static int rtw_p2p_get_device_name(struc
+@@ -4396,146 +5476,260 @@ static int rtw_p2p_get_device_name(struct net_device *dev,
break;
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
+ printk( "[%s] channel = %d\n", __FUNCTION__, uintPeerChannel );
-+
+
+- if ( !blnMatch )
+ if ( uintPeerChannel )
-+ {
+ {
+- sprintf( dev_name_str, "\n\nN=0000" );
+- }
+ u8 wfd_ie[ 128 ] = { 0x00 };
+ uint wfd_ielen = 0;
+
+ u8 wfd_devinfo[ 6 ] = { 0x00 };
+ uint wfd_devlen = 6;
-- if ( !blnMatch )
+- if ( copy_to_user(wrqu->data.pointer, dev_name_str, 5+ (( dev_len > 17 )? dev_len : 17) )) {
+- return -EFAULT;
+ DBG_871X( "[%s] Found WFD IE!\n", __FUNCTION__ );
+ if ( rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, wfd_devinfo, &wfd_devlen ) )
+ {
+ }
+ }
+ else
- {
-- sprintf( dev_name_str, "\n\nN=0000" );
++ {
+ DBG_871X( "[%s] NOT Found in the Scanning Queue!\n", __FUNCTION__ );
}
-
-- if ( copy_to_user(wrqu->data.pointer, dev_name_str, 5+ (( dev_len > 17 )? dev_len : 17) )) {
-- return -EFAULT;
-- }
++
+exit:
return ret;
+ else if ( extra[ 0 ] == '1' )
+ {
+ pwfd_info->scan_result_type = SCAN_RESULT_ALL;
-+ }
+ }
+ else if ( extra[ 0 ] == '2' )
+ {
+ pwfd_info->scan_result_type = SCAN_RESULT_WFD_TYPE;
+ else
+ {
+ pwfd_info->scan_result_type = SCAN_RESULT_P2P_ONLY;
- }
++ }
+
+exit:
+
struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
u8 peerMAC[ ETH_ALEN ] = { 0x00 };
int jj,kk;
-@@ -4545,10 +5739,19 @@ static int rtw_p2p_prov_disc(struct net_
+@@ -4545,10 +5739,19 @@ static int rtw_p2p_prov_disc(struct net_device *dev,
_queue *queue = &(pmlmepriv->scanned_queue);
struct wlan_network *pnetwork = NULL;
uint uintPeerChannel = 0;
// Commented by Albert 20110301
// The input data contains two informations.
-@@ -4559,21 +5762,28 @@ static int rtw_p2p_prov_disc(struct net_
+@@ -4559,21 +5762,28 @@ static int rtw_p2p_prov_disc(struct net_device *dev,
// Format: 00:E0:4C:00:00:05_pbc
// Format: 00:E0:4C:00:00:05_label
pwdinfo->tx_prov_disc_info.benable = _FALSE;
}
-@@ -4600,10 +5810,11 @@ static int rtw_p2p_prov_disc(struct net_
+@@ -4600,10 +5810,11 @@ static int rtw_p2p_prov_disc(struct net_device *dev,
}
else
{
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
phead = get_list_head(queue);
-@@ -4614,37 +5825,64 @@ static int rtw_p2p_prov_disc(struct net_
+@@ -4614,37 +5825,64 @@ static int rtw_p2p_prov_disc(struct net_device *dev,
if (rtw_end_of_queue_search(phead,plist)== _TRUE)
break;
plist = get_next(plist);
-@@ -4654,6 +5892,51 @@ static int rtw_p2p_prov_disc(struct net_
+@@ -4654,6 +5892,51 @@ static int rtw_p2p_prov_disc(struct net_device *dev,
if ( uintPeerChannel )
{
_rtw_memcpy( pwdinfo->tx_prov_disc_info.peerIFAddr, pnetwork->network.MacAddress, ETH_ALEN );
_rtw_memcpy( pwdinfo->tx_prov_disc_info.peerDevAddr, peerMAC, ETH_ALEN );
pwdinfo->tx_prov_disc_info.peer_channel_num[0] = ( u16 ) uintPeerChannel;
-@@ -4665,20 +5948,56 @@ static int rtw_p2p_prov_disc(struct net_
+@@ -4665,20 +5948,56 @@ static int rtw_p2p_prov_disc(struct net_device *dev,
{
_rtw_memcpy( &pwdinfo->tx_prov_disc_info.ssid, &pnetwork->network.Ssid, sizeof( NDIS_802_11_SSID ) );
}
}
exit:
-@@ -4697,11 +6016,10 @@ static int rtw_p2p_got_wpsinfo(struct ne
+@@ -4697,11 +6016,10 @@ static int rtw_p2p_got_wpsinfo(struct net_device *dev,
int ret = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
// Added by Albert 20110328
// if the input data is P2P_NO_WPSINFO -> reset the wpsinfo
// if the input data is P2P_GOT_WPSINFO_PEER_DISPLAY_PIN -> the utility just input the PIN code got from the peer P2P device.
-@@ -4749,7 +6067,7 @@ static int rtw_p2p_set(struct net_device
+@@ -4749,7 +6067,7 @@ static int rtw_p2p_set(struct net_device *dev,
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
if ( _rtw_memcmp( extra, "enable=", 7 ) )
{
-@@ -4809,8 +6127,56 @@ static int rtw_p2p_set(struct net_device
+@@ -4809,8 +6127,56 @@ static int rtw_p2p_set(struct net_device *dev,
wrqu->data.length -= 7;
rtw_p2p_set_op_ch( dev, info, wrqu, &extra[6] );
}
#endif //CONFIG_P2P
return ret;
-@@ -4832,7 +6198,10 @@ static int rtw_p2p_get(struct net_device
+@@ -4832,7 +6198,10 @@ static int rtw_p2p_get(struct net_device *dev,
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
if ( _rtw_memcmp( wrqu->data.pointer, "status", 6 ) )
{
-@@ -4852,16 +6221,34 @@ static int rtw_p2p_get(struct net_device
+@@ -4852,16 +6221,34 @@ static int rtw_p2p_get(struct net_device *dev,
}
else if ( _rtw_memcmp( wrqu->data.pointer, "peer_deva", 9 ) )
{
}
#endif // CONFIG_WFD
-@@ -4872,40 +6259,64 @@ static int rtw_p2p_get(struct net_device
+@@ -4872,40 +6259,64 @@ static int rtw_p2p_get(struct net_device *dev,
}
static int rtw_p2p_get2(struct net_device *dev,
extern int rtw_change_ifname(_adapter *padapter, const char *ifname);
static int rtw_rereg_nd_name(struct net_device *dev,
struct iw_request_info *info,
-@@ -4917,7 +6328,15 @@ static int rtw_rereg_nd_name(struct net_
+@@ -4917,7 +6328,15 @@ static int rtw_rereg_nd_name(struct net_device *dev,
char new_ifname[IFNAMSIZ];
if(rereg_priv->old_ifname[0] == 0) {
rereg_priv->old_ifname[IFNAMSIZ-1] = 0;
}
-@@ -4940,7 +6359,7 @@ static int rtw_rereg_nd_name(struct net_
+@@ -4940,7 +6359,7 @@ static int rtw_rereg_nd_name(struct net_device *dev,
if(_rtw_memcmp(rereg_priv->old_ifname, "disable%d", 9) == _TRUE) {
padapter->ledpriv.bRegUseLed= rereg_priv->old_bRegUseLed;
rtw_ips_mode_req(&padapter->pwrctrlpriv, rereg_priv->old_ips_mode);
}
-@@ -4957,7 +6376,7 @@ static int rtw_rereg_nd_name(struct net_
+@@ -4957,7 +6376,7 @@ static int rtw_rereg_nd_name(struct net_device *dev,
rtw_led_control(padapter, LED_CTL_POWER_OFF);
rereg_priv->old_bRegUseLed = padapter->ledpriv.bRegUseLed;
padapter->ledpriv.bRegUseLed= _FALSE;
static int rtw_dbg_port(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
-@@ -5111,13 +6533,13 @@ static int rtw_dbg_port(struct net_devic
+@@ -5111,13 +6533,13 @@ static int rtw_dbg_port(struct net_device *dev,
switch(minor_cmd)
{
case 1:
break;
}
break;
-@@ -5126,31 +6548,31 @@ static int rtw_dbg_port(struct net_devic
+@@ -5126,31 +6548,31 @@ static int rtw_dbg_port(struct net_device *dev,
{
case 1:
rtw_write8(padapter, arg, extra_arg);
break;
case 0x76:
-@@ -5315,29 +6737,33 @@ static int rtw_dbg_port(struct net_devic
+@@ -5315,29 +6737,33 @@ static int rtw_dbg_port(struct net_device *dev,
#endif //CONFIG_IOL
}
break;
break;
case 0x05:
psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress);
-@@ -5346,41 +6772,43 @@ static int rtw_dbg_port(struct net_devic
+@@ -5346,41 +6772,43 @@ static int rtw_dbg_port(struct net_device *dev,
int i;
struct recv_reorder_ctrl *preorder_ctrl;
padapter->bSurpriseRemoved, padapter->bDriverStopped);
break;
case 0x08:
-@@ -5388,10 +6816,14 @@ static int rtw_dbg_port(struct net_devic
+@@ -5388,10 +6816,14 @@ static int rtw_dbg_port(struct net_device *dev,
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct recv_priv *precvpriv = &padapter->recvpriv;
#endif
}
break;
-@@ -5402,7 +6834,7 @@ static int rtw_dbg_port(struct net_devic
+@@ -5402,7 +6834,7 @@ static int rtw_dbg_port(struct net_device *dev,
struct recv_reorder_ctrl *preorder_ctrl;
#ifdef CONFIG_AP_MODE
#endif
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
-@@ -5419,20 +6851,22 @@ static int rtw_dbg_port(struct net_devic
+@@ -5419,20 +6851,22 @@ static int rtw_dbg_port(struct net_device *dev,
if(extra_arg == psta->aid)
{
-@@ -5441,7 +6875,7 @@ static int rtw_dbg_port(struct net_devic
+@@ -5441,7 +6875,7 @@ static int rtw_dbg_port(struct net_device *dev,
preorder_ctrl = &psta->recvreorder_ctrl[j];
if(preorder_ctrl->enable)
{
}
}
-@@ -5457,9 +6891,9 @@ static int rtw_dbg_port(struct net_devic
+@@ -5457,9 +6891,9 @@ static int rtw_dbg_port(struct net_device *dev,
case 0x0c://dump rx packet
{
}
break;
#if 0
-@@ -5477,31 +6911,88 @@ static int rtw_dbg_port(struct net_devic
+@@ -5477,31 +6911,88 @@ static int rtw_dbg_port(struct net_device *dev,
case 0x0f:
{
if(extra_arg == 0){
#if 1
case 0xdd://registers dump , 0 for mac reg,1 for bb reg, 2 for rf reg
{
-@@ -5523,15 +7014,15 @@ static int rtw_dbg_port(struct net_devic
+@@ -5523,15 +7014,15 @@ static int rtw_dbg_port(struct net_device *dev,
u8 dm_flag;
if(0xf==extra_arg){
}
else{
/* extra_arg = 0 - disable all dynamic func
-@@ -5539,56 +7030,56 @@ static int rtw_dbg_port(struct net_devic
+@@ -5539,56 +7030,56 @@ static int rtw_dbg_port(struct net_device *dev,
extra_arg = 2 - disable tx power tracking
extra_arg = 3 - turn on all dynamic func
*/
break;
}
-@@ -5688,7 +7179,7 @@ static int wpa_set_param(struct net_devi
+@@ -5688,7 +7179,7 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value)
case IEEE_PARAM_WPAX_SELECT:
// added for WPA2 mixed mode
/*
spin_lock_irqsave(&ieee->wpax_suitlist_lock,flags);
ieee->wpax_type_set = 1;
-@@ -5789,7 +7280,7 @@ static int wpa_supplicant_ioctl(struct n
+@@ -5789,7 +7280,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
break;
default:
ret = -EOPNOTSUPP;
break;
-@@ -5855,7 +7346,7 @@ static int set_group_key(_adapter *padap
+@@ -5855,7 +7346,7 @@ static int set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid)
struct cmd_priv *pcmdpriv=&(padapter->cmdpriv);
int res=_SUCCESS;
pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
if(pcmd==NULL){
-@@ -5872,6 +7363,8 @@ static int set_group_key(_adapter *padap
+@@ -5872,6 +7363,8 @@ static int set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid)
_rtw_memset(psetkeyparm, 0, sizeof(struct setkey_parm));
psetkeyparm->keyid=(u8)keyid;
psetkeyparm->algorithm = alg;
-@@ -5945,7 +7438,7 @@ static int rtw_set_encryption(struct net
+@@ -5945,7 +7438,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
struct security_priv* psecuritypriv=&(padapter->securitypriv);
struct sta_priv *pstapriv = &padapter->stapriv;
param->u.crypt.err = 0;
param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
-@@ -5974,7 +7467,7 @@ static int rtw_set_encryption(struct net
+@@ -5974,7 +7467,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
if(!psta)
{
//ret = -EINVAL;
goto exit;
}
}
-@@ -5983,7 +7476,7 @@ static int rtw_set_encryption(struct net
+@@ -5983,7 +7476,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
{
//todo:clear default encryption keys
goto exit;
}
-@@ -5991,12 +7484,12 @@ static int rtw_set_encryption(struct net
+@@ -5991,12 +7484,12 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta==NULL))
{
if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0))
{
-@@ -6011,7 +7504,7 @@ static int rtw_set_encryption(struct net
+@@ -6011,7 +7504,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
wep_total_len = wep_key_len + FIELD_OFFSET(NDIS_802_11_WEP, KeyMaterial);
pwep =(NDIS_802_11_WEP *)rtw_malloc(wep_total_len);
if(pwep == NULL){
goto exit;
}
-@@ -6028,7 +7521,7 @@ static int rtw_set_encryption(struct net
+@@ -6028,7 +7521,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
if(param->u.crypt.set_tx)
{
psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
psecuritypriv->dot11PrivacyAlgrthm=_WEP40_;
-@@ -6053,7 +7546,7 @@ static int rtw_set_encryption(struct net
+@@ -6053,7 +7546,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
}
else
{
//don't update "psecuritypriv->dot11PrivacyAlgrthm" and
//"psecuritypriv->dot11PrivacyKeyIndex=keyid", but can rtw_set_key to cam
-@@ -6077,7 +7570,7 @@ static int rtw_set_encryption(struct net
+@@ -6077,7 +7570,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
{
if(strcmp(param->u.crypt.alg, "WEP") == 0)
{
_rtw_memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len));
-@@ -6090,7 +7583,7 @@ static int rtw_set_encryption(struct net
+@@ -6090,7 +7583,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
}
else if(strcmp(param->u.crypt.alg, "TKIP") == 0)
{
psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
-@@ -6106,7 +7599,7 @@ static int rtw_set_encryption(struct net
+@@ -6106,7 +7599,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
}
else if(strcmp(param->u.crypt.alg, "CCMP") == 0)
{
psecuritypriv->dot118021XGrpPrivacy = _AES_;
-@@ -6114,7 +7607,7 @@ static int rtw_set_encryption(struct net
+@@ -6114,7 +7607,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
}
else
{
psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
}
-@@ -6150,7 +7643,7 @@ static int rtw_set_encryption(struct net
+@@ -6150,7 +7643,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
if(strcmp(param->u.crypt.alg, "WEP") == 0)
{
psta->dot118021XPrivacy = _WEP40_;
if(param->u.crypt.key_len==13)
-@@ -6160,7 +7653,7 @@ static int rtw_set_encryption(struct net
+@@ -6160,7 +7653,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
}
else if(strcmp(param->u.crypt.alg, "TKIP") == 0)
{
psta->dot118021XPrivacy = _TKIP_;
-@@ -6175,13 +7668,13 @@ static int rtw_set_encryption(struct net
+@@ -6175,13 +7668,13 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
else if(strcmp(param->u.crypt.alg, "CCMP") == 0)
{
}
return ret;
-@@ -6269,25 +7762,23 @@ static int rtw_set_beacon(struct net_dev
+@@ -6269,25 +7762,23 @@ static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int
unsigned char *pbuf = param->u.bcn_ie.buf;
return ret;
}
-@@ -6301,40 +7792,10 @@ static int rtw_hostapd_sta_flush(struct
+@@ -6301,40 +7792,10 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
//struct sta_priv *pstapriv = &padapter->stapriv;
ret = rtw_sta_flush(padapter);
return ret;
-@@ -6350,7 +7811,7 @@ static int rtw_add_sta(struct net_device
+@@ -6350,7 +7811,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct sta_priv *pstapriv = &padapter->stapriv;
if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE)
{
-@@ -6368,7 +7829,7 @@ static int rtw_add_sta(struct net_device
+@@ -6368,7 +7829,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
psta = rtw_get_stainfo(pstapriv, param->sta_addr);
if(psta)
{
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
rtw_free_stainfo(padapter, psta);
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
-@@ -6382,7 +7843,7 @@ static int rtw_add_sta(struct net_device
+@@ -6382,7 +7843,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
{
int flags = param->u.add_sta.flags;
psta->aid = param->u.add_sta.aid;//aid=1~2007
-@@ -6430,75 +7891,149 @@ static int rtw_add_sta(struct net_device
-
- }
-
--static int rtw_del_sta(struct net_device *dev, struct ieee_param *param)
+@@ -6423,82 +7884,156 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
+ }
+ else
+ {
+- ret = -ENOMEM;
+- }
++ ret = -ENOMEM;
++ }
++
++ return ret;
++
++}
++
+static int rtw_del_sta(struct net_device *dev, struct ieee_param *param)
+{
+ _irqL irqL;
+ //ret = -1;
+ }
+
-+
-+ return ret;
-+
-+}
-+
+
+ return ret;
+
+ }
+
+-static int rtw_del_sta(struct net_device *dev, struct ieee_param *param)
+static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *param, int len)
{
- _irqL irqL;
-
- pstapriv->sta_dz_bitmap &=~BIT(psta->aid);
- pstapriv->tim_bitmap &=~BIT(psta->aid);
--#endif
+#if 0
+ struct {
+ u16 aid;
+ u64 tx_bytes;
+ u64 tx_drops;
+ } get_sta;
-+#endif
+ #endif
+ psta_data->aid = (u16)psta->aid;
+ psta_data->capability = psta->capability;
+ psta_data->flags = psta->flags;
}
static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)
-@@ -6509,7 +8044,7 @@ static int rtw_get_sta_wpaie(struct net_
+@@ -6509,7 +8044,7 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct sta_priv *pstapriv = &padapter->stapriv;
if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != _TRUE)
{
-@@ -6542,7 +8077,7 @@ static int rtw_get_sta_wpaie(struct net_
+@@ -6542,7 +8077,7 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)
else
{
//ret = -1;
}
}
else
-@@ -6564,7 +8099,7 @@ static int rtw_set_wps_beacon(struct net
+@@ -6564,7 +8099,7 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
int ie_len;
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
return -EINVAL;
-@@ -6583,7 +8118,7 @@ static int rtw_set_wps_beacon(struct net
+@@ -6583,7 +8118,7 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,
pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len);
pmlmepriv->wps_beacon_ie_len = ie_len;
if ( pmlmepriv->wps_beacon_ie == NULL) {
return -EINVAL;
}
-@@ -6607,7 +8142,7 @@ static int rtw_set_wps_probe_resp(struct
+@@ -6607,7 +8142,7 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
int ie_len;
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
return -EINVAL;
-@@ -6626,7 +8161,7 @@ static int rtw_set_wps_probe_resp(struct
+@@ -6626,7 +8161,7 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len);
pmlmepriv->wps_probe_resp_ie_len = ie_len;
if ( pmlmepriv->wps_probe_resp_ie == NULL) {
return -EINVAL;
}
_rtw_memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len);
-@@ -6637,38 +8172,6 @@ static int rtw_set_wps_probe_resp(struct
+@@ -6637,38 +8172,6 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
}
static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *param, int len)
{
int ret=0;
-@@ -6676,7 +8179,7 @@ static int rtw_set_wps_assoc_resp(struct
+@@ -6676,7 +8179,7 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
int ie_len;
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
return -EINVAL;
-@@ -6695,7 +8198,7 @@ static int rtw_set_wps_assoc_resp(struct
+@@ -6695,7 +8198,7 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len);
pmlmepriv->wps_assoc_resp_ie_len = ie_len;
if ( pmlmepriv->wps_assoc_resp_ie == NULL) {
return -EINVAL;
}
-@@ -6707,13 +8210,125 @@ static int rtw_set_wps_assoc_resp(struct
+@@ -6707,13 +8210,125 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
}
/*
* this function is expect to call in master mode, which allows no power saving
-@@ -6746,7 +8361,7 @@ static int rtw_hostapd_ioctl(struct net_
+@@ -6746,7 +8361,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
goto out;
}
switch (param->cmd)
{
-@@ -6809,9 +8424,33 @@ static int rtw_hostapd_ioctl(struct net_
+@@ -6809,9 +8424,33 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
ret = rtw_set_hidden_ssid(dev, param, p->length);
break;
ret = -EOPNOTSUPP;
break;
-@@ -6850,7 +8489,8 @@ static int rtw_wx_set_priv(struct net_de
+@@ -6850,7 +8489,8 @@ static int rtw_wx_set_priv(struct net_device *dev,
struct iw_point *dwrq = (struct iw_point*)awrq;
//RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_notice_, ("+rtw_wx_set_priv\n"));
len = dwrq->length;
if (!(ext = rtw_vmalloc(len)))
return -ENOMEM;
-@@ -6952,16 +8592,7 @@ static int rtw_wx_set_priv(struct net_de
+@@ -6952,16 +8592,7 @@ static int rtw_wx_set_priv(struct net_device *dev,
break;
case ANDROID_WIFI_CMD_LINKSPEED :
{
sprintf(ext, "LINKSPEED %d", mbps);
}
break;
-@@ -6970,15 +8601,13 @@ static int rtw_wx_set_priv(struct net_de
+@@ -6970,15 +8601,13 @@ static int rtw_wx_set_priv(struct net_device *dev,
break;
case ANDROID_WIFI_CMD_SCAN_ACTIVE :
{
sprintf(ext, "OK");
}
break;
-@@ -6986,33 +8615,11 @@ static int rtw_wx_set_priv(struct net_de
+@@ -6986,33 +8615,11 @@ static int rtw_wx_set_priv(struct net_device *dev,
case ANDROID_WIFI_CMD_COUNTRY :
{
char country_code[10];
default :
#ifdef CONFIG_DEBUG_RTW_WX_SET_PRIV
DBG_871X("%s: %s unknowned req=%s\n", __FUNCTION__,
-@@ -7069,7 +8676,7 @@ static int rtw_mp_efuse_get(struct net_d
+@@ -7069,7 +8676,7 @@ static int rtw_mp_efuse_get(struct net_device *dev,
return -EFAULT;
pch = extra;
i=0;
//mac 16 "00e04c871200" rmap,00,2
-@@ -7082,38 +8689,38 @@ static int rtw_mp_efuse_get(struct net_d
+@@ -7082,38 +8689,38 @@ static int rtw_mp_efuse_get(struct net_device *dev,
if ( strcmp(tmp[0],"realmap") == 0 ) {
wrqu->length = strlen(extra);
return 0;
-@@ -7123,39 +8730,39 @@ static int rtw_mp_efuse_get(struct net_d
+@@ -7123,39 +8730,39 @@ static int rtw_mp_efuse_get(struct net_device *dev,
// rmap addr cnts
addr = simple_strtoul(tmp[1], &ptmp, 16);
return 0;
}
-@@ -7165,24 +8772,24 @@ static int rtw_mp_efuse_get(struct net_d
+@@ -7165,24 +8772,24 @@ static int rtw_mp_efuse_get(struct net_device *dev,
if (rtw_efuse_access(padapter, _FALSE, addr, mapLen, rawdata) == _FAIL)
{
sprintf(extra, "%s\t", extra);
}
}
-@@ -7201,21 +8808,21 @@ static int rtw_mp_efuse_get(struct net_d
+@@ -7201,21 +8808,21 @@ static int rtw_mp_efuse_get(struct net_device *dev,
#endif
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
if ((addr + mapLen) > max_available_size) {
sprintf(extra,"%s ",extra);
}
wrqu->length = strlen(extra);
-@@ -7232,21 +8839,21 @@ static int rtw_mp_efuse_get(struct net_d
+@@ -7232,21 +8839,21 @@ static int rtw_mp_efuse_get(struct net_device *dev,
cnts = 4;
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
if ((addr + mapLen) > max_available_size) {
sprintf(extra,"%s ",extra);
}
wrqu->length = strlen(extra);
-@@ -7271,7 +8878,7 @@ static int rtw_mp_efuse_get(struct net_d
+@@ -7271,7 +8878,7 @@ static int rtw_mp_efuse_get(struct net_device *dev,
static int rtw_mp_efuse_set(struct net_device *dev,
struct iw_request_info *info,
{
struct iw_point *wrqu = (struct iw_point *)wdata;
PADAPTER padapter = rtw_netdev_priv(dev);
-@@ -7286,7 +8893,7 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7286,7 +8893,7 @@ static int rtw_mp_efuse_set(struct net_device *dev,
u32 cnts = 0;
pch = extra;
i=0;
while ( (token = strsep (&pch,",") )!=NULL )
-@@ -7304,13 +8911,13 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7304,13 +8911,13 @@ static int rtw_mp_efuse_set(struct net_device *dev,
addr = simple_strtoul( tmp[1], &ptmp, 16 );
addr = addr & 0xFF;
for( jj = 0, kk = 0; jj < cnts; jj++, kk += 2 )
{
-@@ -7320,14 +8927,14 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7320,14 +8927,14 @@ static int rtw_mp_efuse_set(struct net_device *dev,
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
if ((addr + cnts) > max_available_size) {
return 0;
}
-@@ -7336,13 +8943,13 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7336,13 +8943,13 @@ static int rtw_mp_efuse_set(struct net_device *dev,
if ( ! strlen( tmp[2] )/2 > 1 ) return -EFAULT;
addr = simple_strtoul( tmp[1], &ptmp, 16 );
addr = addr & 0xFF;
for( jj = 0, kk = 0; jj < cnts; jj++, kk += 2 )
{
-@@ -7350,10 +8957,10 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7350,10 +8957,10 @@ static int rtw_mp_efuse_set(struct net_device *dev,
}
if ( rtw_efuse_access( padapter, _TRUE, addr, cnts, setrawdata ) == _FAIL ){
return 0;
}
-@@ -7369,11 +8976,11 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7369,11 +8976,11 @@ static int rtw_mp_efuse_set(struct net_device *dev,
cnts = strlen( tmp[1] )/2;
if ( cnts == 0) return -EFAULT;
if ( cnts > 6 ){
for( jj = 0, kk = 0; jj < cnts; jj++, kk += 2 )
{
-@@ -7383,14 +8990,14 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7383,14 +8990,14 @@ static int rtw_mp_efuse_set(struct net_device *dev,
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
if ((addr + cnts) > max_available_size) {
return 0;
}
-@@ -7406,7 +9013,7 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7406,7 +9013,7 @@ static int rtw_mp_efuse_set(struct net_device *dev,
cnts=strlen( tmp[1] )/2;
if ( cnts == 0) return -EFAULT;
for( jj = 0, kk = 0; jj < cnts; jj++, kk += 2 )
{
-@@ -7416,20 +9023,20 @@ static int rtw_mp_efuse_set(struct net_d
+@@ -7416,20 +9023,20 @@ static int rtw_mp_efuse_set(struct net_device *dev,
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
if ((addr + cnts) > max_available_size) {
return 0;
}
-@@ -7534,12 +9141,15 @@ static int rtw_mp_read_reg(struct net_de
+@@ -7534,12 +9141,15 @@ static int rtw_mp_read_reg(struct net_device *dev,
u32 ret, i=0, j=0, strtout=0;
PADAPTER padapter = rtw_netdev_priv(dev);
pch = input;
pnext = strpbrk(pch, " ,.-");
if (pnext == NULL) return -EINVAL;
-@@ -7559,7 +9169,7 @@ static int rtw_mp_read_reg(struct net_de
+@@ -7559,7 +9169,7 @@ static int rtw_mp_read_reg(struct net_device *dev,
// 1 byte
// *(u8*)data = rtw_read8(padapter, addr);
sprintf(extra, "%d\n", rtw_read8(padapter, addr));
break;
case 'w':
// 2 bytes
-@@ -7578,7 +9188,7 @@ static int rtw_mp_read_reg(struct net_de
+@@ -7578,7 +9188,7 @@ static int rtw_mp_read_reg(struct net_device *dev,
j++;
}
pch = tmp;
while( *pch != '\0' )
{
-@@ -7594,7 +9204,7 @@ static int rtw_mp_read_reg(struct net_de
+@@ -7594,7 +9204,7 @@ static int rtw_mp_read_reg(struct net_device *dev,
}
pch = pnext;
}
break;
case 'd':
// 4 bytes
-@@ -7612,7 +9222,7 @@ static int rtw_mp_read_reg(struct net_de
+@@ -7612,7 +9222,7 @@ static int rtw_mp_read_reg(struct net_device *dev,
j++;
}
pch = tmp;
while( *pch != '\0' )
{
-@@ -7628,7 +9238,7 @@ static int rtw_mp_read_reg(struct net_de
+@@ -7628,7 +9238,7 @@ static int rtw_mp_read_reg(struct net_device *dev,
}
pch = pnext;
}
break;
default:
-@@ -7666,9 +9276,12 @@ static int rtw_mp_read_reg(struct net_de
+@@ -7666,9 +9276,12 @@ static int rtw_mp_read_reg(struct net_device *dev,
if (path >= MAX_RF_PATH_NUMS) return -EINVAL;
if (addr > 0xFF) return -EINVAL;
if (data > 0xFFFFF) return -EINVAL;
return 0;
}
-@@ -7697,12 +9310,14 @@ static int rtw_mp_read_rf(struct net_dev
+@@ -7697,12 +9310,14 @@ static int rtw_mp_read_rf(struct net_device *dev,
if (copy_from_user(input, wrqu->pointer, wrqu->length))
return -EFAULT;
//*data = read_rfreg(padapter, path, addr);
sprintf(data, "%08x", read_rfreg(padapter, path, addr));
//add read data format blank
-@@ -7717,7 +9332,7 @@ static int rtw_mp_read_rf(struct net_dev
+@@ -7717,7 +9332,7 @@ static int rtw_mp_read_rf(struct net_device *dev,
j++;
}
pch = tmp;
while( *pch != '\0' )
{
-@@ -7733,7 +9348,7 @@ static int rtw_mp_read_rf(struct net_dev
+@@ -7733,7 +9348,7 @@ static int rtw_mp_read_rf(struct net_device *dev,
}
pch = pnext;
}
return 0;
}
-@@ -7794,7 +9409,7 @@ static int rtw_mp_rate(struct net_device
+@@ -7794,7 +9409,7 @@ static int rtw_mp_rate(struct net_device *dev,
else
rate =(rate-0x80+MPT_RATE_MCS0);
if (rate >= MPT_RATE_LAST )
return -EINVAL;
-@@ -7819,7 +9434,7 @@ static int rtw_mp_channel(struct net_dev
+@@ -7819,7 +9434,7 @@ static int rtw_mp_channel(struct net_device *dev,
return -EFAULT;
channel = rtw_atoi(input);
sprintf( extra, "Change channel %d to channel %d", padapter->mppriv.channel , channel );
padapter->mppriv.channel = channel;
-@@ -7839,14 +9454,14 @@ static int rtw_mp_bandwidth(struct net_d
+@@ -7839,14 +9454,14 @@ static int rtw_mp_bandwidth(struct net_device *dev,
//if (copy_from_user(buffer, (void*)wrqu->data.pointer, wrqu->data.length))
// return -EFAULT;
padapter->mppriv.bandwidth = (u8)bandwidth;
padapter->mppriv.preamble = sg;
-@@ -7869,7 +9484,7 @@ static int rtw_mp_txpower(struct net_dev
+@@ -7869,7 +9484,7 @@ static int rtw_mp_txpower(struct net_device *dev,
return -EFAULT;
sscanf(input,"patha=%d,pathb=%d",&idx_a,&idx_b);
sprintf( extra, "Set power level path_A:%d path_B:%d", idx_a , idx_b );
padapter->mppriv.txpoweridx = (u8)idx_a;
-@@ -7893,7 +9508,7 @@ static int rtw_mp_ant_tx(struct net_devi
+@@ -7893,7 +9508,7 @@ static int rtw_mp_ant_tx(struct net_device *dev,
if (copy_from_user(input, wrqu->pointer, wrqu->length))
return -EFAULT;
sprintf( extra, "switch Tx antenna to %s", input );
-@@ -7910,9 +9525,9 @@ static int rtw_mp_ant_tx(struct net_devi
+@@ -7910,9 +9525,9 @@ static int rtw_mp_ant_tx(struct net_device *dev,
}
}
//antenna |= BIT(extra[i]-'a');
Hal_SetAntenna(padapter);
-@@ -7931,8 +9546,11 @@ static int rtw_mp_ant_rx(struct net_devi
+@@ -7931,8 +9546,11 @@ static int rtw_mp_ant_rx(struct net_device *dev,
if (copy_from_user(input, wrqu->pointer, wrqu->length))
return -EFAULT;
for (i=0; i < strlen(input); i++) {
switch( input[i] )
-@@ -7946,11 +9564,11 @@ static int rtw_mp_ant_rx(struct net_devi
+@@ -7946,11 +9564,11 @@ static int rtw_mp_ant_rx(struct net_device *dev,
}
}
return 0;
}
-@@ -7973,7 +9591,7 @@ static int rtw_mp_ctx(struct net_device
+@@ -7973,7 +9591,7 @@ static int rtw_mp_ctx(struct net_device *dev,
if (copy_from_user(extra, wrqu->pointer, wrqu->length))
return -EFAULT;
countPkTx = strncmp(extra, "count=", 5); // strncmp TRUE is 0
cotuTx = strncmp(extra, "background", 20);
-@@ -7984,9 +9602,9 @@ static int rtw_mp_ctx(struct net_device
+@@ -7984,9 +9602,9 @@ static int rtw_mp_ctx(struct net_device *dev,
stop = strncmp(extra, "stop", 5);
sscanf(extra, "count=%d,pkt", &count);
if (stop == 0) {
bStartTest = 0; // To set Stop
pmp_priv->tx.stop = 1;
-@@ -7995,7 +9613,7 @@ static int rtw_mp_ctx(struct net_device
+@@ -7995,7 +9613,7 @@ static int rtw_mp_ctx(struct net_device *dev,
bStartTest = 1;
if (pmp_priv->mode != MP_ON) {
if (pmp_priv->tx.stop != 1) {
return -EFAULT;
}
}
-@@ -8016,7 +9634,7 @@ static int rtw_mp_ctx(struct net_device
+@@ -8016,7 +9634,7 @@ static int rtw_mp_ctx(struct net_device *dev,
{
case MP_PACKET_TX:
if (bStartTest == 0)
{
pmp_priv->tx.stop = 1;
-@@ -8026,7 +9644,7 @@ static int rtw_mp_ctx(struct net_device
+@@ -8026,7 +9644,7 @@ static int rtw_mp_ctx(struct net_device *dev,
else if (pmp_priv->tx.stop == 1)
{
sprintf( extra, "Start continuous DA=ffffffffffff len=1500 count=%u,\n",count);
pmp_priv->tx.stop = 0;
pmp_priv->tx.count = count;
pmp_priv->tx.payload = 2;
-@@ -8036,50 +9654,51 @@ static int rtw_mp_ctx(struct net_device
+@@ -8036,50 +9654,51 @@ static int rtw_mp_ctx(struct net_device *dev,
SetPacketTx(padapter);
}
else {
sprintf( extra, "Error! Continuous-Tx is not on-going.");
return -EFAULT;
}
-@@ -8088,7 +9707,7 @@ static int rtw_mp_ctx(struct net_device
+@@ -8088,7 +9707,7 @@ static int rtw_mp_ctx(struct net_device *dev,
struct mp_priv *pmp_priv = &padapter->mppriv;
if (pmp_priv->tx.stop == 0) {
pmp_priv->tx.stop = 1;
rtw_msleep_os(5);
}
pmp_priv->tx.stop = 0;
-@@ -8113,7 +9732,7 @@ static int rtw_mp_arx(struct net_device
+@@ -8113,7 +9732,7 @@ static int rtw_mp_arx(struct net_device *dev,
if (copy_from_user(input, wrqu->pointer, wrqu->length))
return -EFAULT;
bStartRx = (strncmp(input, "start", 5)==0)?1:0; // strncmp TRUE is 0
bStopRx = (strncmp(input, "stop", 5)==0)?1:0; // strncmp TRUE is 0
-@@ -8166,23 +9785,33 @@ static int rtw_mp_pwrtrk(struct net_devi
+@@ -8166,23 +9785,33 @@ static int rtw_mp_pwrtrk(struct net_device *dev,
u32 thermal;
s32 ret;
PADAPTER padapter = rtw_netdev_priv(dev);
return 0;
}
-@@ -8192,13 +9821,15 @@ static int rtw_mp_psd(struct net_device
+@@ -8192,13 +9821,15 @@ static int rtw_mp_psd(struct net_device *dev,
struct iw_point *wrqu, char *extra)
{
PADAPTER padapter = rtw_netdev_priv(dev);
return 0;
}
-@@ -8206,7 +9837,7 @@ static int rtw_mp_thermal(struct net_dev
+@@ -8206,7 +9837,7 @@ static int rtw_mp_thermal(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *wrqu, char *extra)
{
u16 bwrite=1;
#ifdef CONFIG_RTL8192C
u16 addr=0x78;
-@@ -8221,7 +9852,7 @@ static int rtw_mp_thermal(struct net_dev
+@@ -8221,7 +9852,7 @@ static int rtw_mp_thermal(struct net_device *dev,
if (copy_from_user(extra, wrqu->pointer, wrqu->length))
return -EFAULT;
bwrite = strncmp(extra, "write", 6); // strncmp TRUE is 0
-@@ -8229,16 +9860,16 @@ static int rtw_mp_thermal(struct net_dev
+@@ -8229,16 +9860,16 @@ static int rtw_mp_thermal(struct net_device *dev,
if( bwrite == 0 )
{
return -EFAULT;
}
else
-@@ -8248,7 +9879,7 @@ static int rtw_mp_thermal(struct net_dev
+@@ -8248,7 +9879,7 @@ static int rtw_mp_thermal(struct net_device *dev,
}
else
{
}
wrqu->length = strlen(extra);
-@@ -8291,24 +9922,24 @@ static int rtw_mp_dump(struct net_device
+@@ -8291,24 +9922,24 @@ static int rtw_mp_dump(struct net_device *dev,
if ( strncmp(extra, "all", 4)==0 )
{
if(( RF_1T2R == rf_type ) ||( RF_1T1R ==rf_type ))
path_nums = 1;
else
-@@ -8323,10 +9954,10 @@ static int rtw_mp_dump(struct net_device
+@@ -8323,10 +9954,10 @@ static int rtw_mp_dump(struct net_device *dev,
#endif
{
//value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord);
}
}
}
-@@ -8345,7 +9976,7 @@ static int rtw_mp_phypara(struct net_dev
+@@ -8345,7 +9976,7 @@ static int rtw_mp_phypara(struct net_device *dev,
if (copy_from_user(input, wrqu->pointer, wrqu->length))
return -EFAULT;
sscanf(input, "xcap=%d", &valxcap);
-@@ -8407,31 +10038,27 @@ static int rtw_mp_set(struct net_device
+@@ -8407,31 +10038,27 @@ static int rtw_mp_set(struct net_device *dev,
break;
case MP_START:
rtw_mp_efuse_set (dev,info,wdata,extra);
break;
-@@ -8450,7 +10077,7 @@ static int rtw_mp_get(struct net_device
+@@ -8450,7 +10077,7 @@ static int rtw_mp_get(struct net_device *dev,
u32 subcmd = wrqu->flags;
PADAPTER padapter = rtw_netdev_priv(dev);
if (padapter == NULL)
{
-@@ -8465,86 +10092,212 @@ static int rtw_mp_get(struct net_device
+@@ -8465,86 +10092,212 @@ static int rtw_mp_get(struct net_device *dev,
switch(subcmd)
{
case MP_PHYPARA:
+ else
+ {
+ padapter->wdinfo.wfd_tdls_enable = 1;
-+ }
-+
+ }
+
+-return 0;
+#endif //CONFIG_WFD
+#endif //CONFIG_TDLS
+
+ else
+ {
+ padapter->wdinfo.wfd_tdls_weaksec = 1;
- }
--
--return 0;
++ }
+#endif
+
+ return ret;
static int rtw_tdls_setup(struct net_device *dev,
struct iw_request_info *info,
-@@ -8558,20 +10311,40 @@ static int rtw_tdls_setup(struct net_dev
+@@ -8558,20 +10311,40 @@ static int rtw_tdls_setup(struct net_device *dev,
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
u8 mac_addr[ETH_ALEN];
static int rtw_tdls_teardown(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
-@@ -8585,12 +10358,12 @@ static int rtw_tdls_teardown(struct net_
+@@ -8585,12 +10358,12 @@ static int rtw_tdls_teardown(struct net_device *dev,
struct sta_info *ptdls_sta = NULL;
u8 mac_addr[ETH_ALEN];
ptdls_sta = rtw_get_stainfo( &(padapter->stapriv), mac_addr);
if(ptdls_sta != NULL)
-@@ -8599,12 +10372,11 @@ static int rtw_tdls_teardown(struct net_
+@@ -8599,12 +10372,11 @@ static int rtw_tdls_teardown(struct net_device *dev,
issue_tdls_teardown(padapter, mac_addr);
}
static int rtw_tdls_discovery(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
-@@ -8617,11 +10389,11 @@ static int rtw_tdls_discovery(struct net
+@@ -8617,11 +10389,11 @@ static int rtw_tdls_discovery(struct net_device *dev,
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
return ret;
}
-@@ -8639,7 +10411,7 @@ static int rtw_tdls_ch_switch(struct net
+@@ -8639,7 +10411,7 @@ static int rtw_tdls_ch_switch(struct net_device *dev,
u8 i, j, mac_addr[ETH_ALEN];
struct sta_info *ptdls_sta = NULL;
for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){
mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1));
-@@ -8648,15 +10420,14 @@ static int rtw_tdls_ch_switch(struct net
+@@ -8648,15 +10420,14 @@ static int rtw_tdls_ch_switch(struct net_device *dev,
ptdls_sta = rtw_get_stainfo(&padapter->stapriv, mac_addr);
if( ptdls_sta == NULL )
return ret;
static int rtw_tdls_pson(struct net_device *dev,
struct iw_request_info *info,
-@@ -8672,7 +10443,7 @@ static int rtw_tdls_pson(struct net_devi
+@@ -8672,7 +10443,7 @@ static int rtw_tdls_pson(struct net_device *dev,
u8 i, j, mac_addr[ETH_ALEN];
struct sta_info *ptdls_sta = NULL;
for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){
mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1));
-@@ -8682,9 +10453,9 @@ static int rtw_tdls_pson(struct net_devi
+@@ -8682,9 +10453,9 @@ static int rtw_tdls_pson(struct net_device *dev,
issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 1);
}
static int rtw_tdls_psoff(struct net_device *dev,
-@@ -8701,7 +10472,7 @@ static int rtw_tdls_psoff(struct net_dev
+@@ -8701,7 +10472,7 @@ static int rtw_tdls_psoff(struct net_device *dev,
u8 i, j, mac_addr[ETH_ALEN];
struct sta_info *ptdls_sta = NULL;
for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){
mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1));
-@@ -8711,9 +10482,185 @@ static int rtw_tdls_psoff(struct net_dev
+@@ -8711,11 +10482,187 @@ static int rtw_tdls_psoff(struct net_device *dev,
issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 0);
+
+#endif //CONFIG_WFD
+#endif //CONFIG_TDLS
-+
-+ return ret;
-+}
-+
+
+ return ret;
+ }
+
+static int rtw_tdls_getport(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+
+#endif //CONFIG_WFD
+#endif //CONFIG_TDLS
-
- return ret;
++
++ return ret;
+
- }
-
++}
++
static int rtw_tdls_ch_switch_off(struct net_device *dev,
-@@ -8728,7 +10675,7 @@ static int rtw_tdls_ch_switch_off(struct
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+@@ -8728,7 +10675,7 @@ static int rtw_tdls_ch_switch_off(struct net_device *dev,
u8 i, j, mac_addr[ETH_ALEN];
struct sta_info *ptdls_sta = NULL;
for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){
mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1));
-@@ -8741,11 +10688,11 @@ static int rtw_tdls_ch_switch_off(struct
+@@ -8741,11 +10688,11 @@ static int rtw_tdls_ch_switch_off(struct net_device *dev,
if((ptdls_sta->tdls_sta_state & TDLS_AT_OFF_CH_STATE) && (ptdls_sta->tdls_sta_state & TDLS_PEER_AT_OFF_STATE)){
pmlmeinfo->tdls_candidate_ch= pmlmeext->cur_channel;
issue_tdls_ch_switch_req(padapter, mac_addr);
return ret;
}
-@@ -8757,8 +10704,34 @@ static int rtw_tdls(struct net_device *d
+@@ -8757,8 +10704,34 @@ static int rtw_tdls(struct net_device *dev,
int ret = 0;
#ifdef CONFIG_TDLS
if ( _rtw_memcmp( extra, "setup=", 6 ) )
{
-@@ -8795,89 +10768,56 @@ static int rtw_tdls(struct net_device *d
+@@ -8795,89 +10768,56 @@ static int rtw_tdls(struct net_device *dev,
wrqu->data.length -= 6;
rtw_tdls_psoff( dev, info, wrqu, &extra[6] );
}
+ if ( _rtw_memcmp( wrqu->data.pointer, "ip", 2 ) )
+ {
+ rtw_tdls_getip( dev, info, wrqu, extra );
-+ }
+ }
+- else {
+- return -EFAULT;
+ if ( _rtw_memcmp( wrqu->data.pointer, "port", 4 ) )
+ {
+ rtw_tdls_getport( dev, info, wrqu, extra );
}
-- else {
-- return -EFAULT;
+- return 0;
+
+ //WFDTDLS, for sigma test
+ if ( _rtw_memcmp( wrqu->data.pointer, "dis", 3 ) )
+ {
+ rtw_tdls_dis_result( dev, info, wrqu, extra );
- }
-- return 0;
++ }
+ if ( _rtw_memcmp( wrqu->data.pointer, "status", 6 ) )
+ {
+ rtw_wfd_tdls_status( dev, info, wrqu, extra );
}
static int rtw_pm_set(struct net_device *dev,
-@@ -8885,27 +10825,32 @@ static int rtw_pm_set(struct net_device
+@@ -8885,27 +10825,32 @@ static int rtw_pm_set(struct net_device *dev,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
{
int ret = 0;
struct oid_par_priv oid_par;
-@@ -8946,7 +10891,7 @@ static int rtw_wowlan_ctrl(struct net_de
+@@ -8946,7 +10891,7 @@ static int rtw_wowlan_ctrl(struct net_device *dev,
DBG_871X("+rtw_wowlan_ctrl: Device didn't support the remote wakeup!!\n");
goto _rtw_wowlan_ctrl_exit_free;
}
+ rtw_free_xmitframe(pxmitpriv, pframe);
+ rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
+}
-+
+
+extern u32 get_txfifo_hwaddr(struct xmit_frame *pxmitframe);
+
+thread_return lbk_thread(thread_context context)
+ printk("%s: no memory!\n", __func__);
+ return -ENOMEM;
+ }
-
++
+ if (copy_from_user(pbuf, wrqu->data.pointer, len)) {
+ rtw_mfree(pbuf, len);
+ printk("%s: copy from user fail!\n", __func__);
#include <rtw_android.h>
int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-@@ -8981,6 +11531,11 @@ int rtw_ioctl(struct net_device *dev, st
+@@ -8981,6 +11531,11 @@ int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
case RTL_IOCTL_HOSTAPD:
ret = rtw_hostapd_ioctl(dev, &wrq->u.data);
break;
rtw_wx_get_rts, /* SIOCGIWRTS */
rtw_wx_set_frag, /* SIOCSIWFRAG */
rtw_wx_get_frag, /* SIOCGIWFRAG */
-@@ -9060,44 +11615,45 @@ static const struct iw_priv_args rtw_pri
+@@ -9060,44 +11615,45 @@ static const struct iw_priv_args rtw_private_args[] =
{ SIOCIWFIRSTPRIV + 0x00, IW_PRIV_TYPE_CHAR | 1024, 0 , ""}, //set
{ SIOCIWFIRSTPRIV + 0x01, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK , ""},//get
/* --- sub-ioctls definitions --- */
{ SIOCIWFIRSTPRIV + 0x02, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK , "test"},//set
-@@ -9110,23 +11666,23 @@ static iw_handler rtw_private_handler[]
+@@ -9110,23 +11666,23 @@ static iw_handler rtw_private_handler[] =
rtw_mp_get,
};
},
{
SIOCIWFIRSTPRIV + 0x4,
-@@ -9172,40 +11728,57 @@ static const struct iw_priv_args rtw_pri
+@@ -9172,40 +11728,57 @@ static const struct iw_priv_args rtw_private_args[] = {
SIOCIWFIRSTPRIV + 0xD,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "rfr"
},
};
static iw_handler rtw_private_handler[] =
-@@ -9234,18 +11807,20 @@ static iw_handler rtw_private_handler[]
+@@ -9234,18 +11807,20 @@ static iw_handler rtw_private_handler[] =
rtw_wx_write_rf, //0x0C
rtw_wx_read_rf, //0x0D
rtw_pm_set, //0x16
rtw_wx_priv_null, //0x17
-@@ -9254,7 +11829,12 @@ static iw_handler rtw_private_handler[]
+@@ -9254,7 +11829,12 @@ static iw_handler rtw_private_handler[] =
rtw_mp_efuse_set, //0x1A
rtw_mp_efuse_get, //0x1B
};
#endif // #if defined(CONFIG_MP_INCLUDED) && defined(CONFIG_MP_IWPRIV_SUPPORT)
-@@ -9273,7 +11853,7 @@ static struct iw_statistics *rtw_get_wir
+@@ -9273,7 +11853,7 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
piwstats->qual.qual = 0;
piwstats->qual.level = 0;
piwstats->qual.noise = 0;
}
else{
#ifdef CONFIG_SIGNAL_DISPLAY_DBM
-@@ -9284,7 +11864,7 @@ static struct iw_statistics *rtw_get_wir
+@@ -9284,7 +11864,7 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
tmp_qual = padapter->recvpriv.signal_qual;
tmp_noise =padapter->recvpriv.noise;
piwstats->qual.level = tmp_level;
piwstats->qual.qual = tmp_qual;
-@@ -9310,16 +11890,20 @@ static struct iw_statistics *rtw_get_wir
+@@ -9310,16 +11890,20 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
}
#endif
};
+#endif
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c
+index 0175ea2..6fc9f03 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c
-@@ -135,7 +135,6 @@ extern void rtw_indicate_wx_disassoc_eve
+@@ -135,7 +135,6 @@ extern void rtw_indicate_wx_disassoc_event(_adapter *padapter);
void rtw_os_indicate_connect(_adapter *adapter)
{
#endif
_func_exit_;
-@@ -173,7 +171,12 @@ void rtw_reset_securitypriv( _adapter *a
+@@ -173,7 +171,12 @@ void rtw_reset_securitypriv( _adapter *adapter )
u8 backupPMKIDIndex = 0;
u8 backupTKIPCountermeasure = 0x00;
u32 backupTKIPcountermeasure_time = 0;
if(adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)//802.1x
{
// Added by Albert 2009/02/18
-@@ -187,8 +190,11 @@ void rtw_reset_securitypriv( _adapter *a
+@@ -187,8 +190,11 @@ void rtw_reset_securitypriv( _adapter *adapter )
_rtw_memcpy( &backupPMKIDList[ 0 ], &adapter->securitypriv.PMKIDList[ 0 ], sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE );
backupPMKIDIndex = adapter->securitypriv.PMKIDIndex;
backupTKIPCountermeasure = adapter->securitypriv.btkip_countermeasure;
_rtw_memset((unsigned char *)&adapter->securitypriv, 0, sizeof (struct security_priv));
//_init_timer(&(adapter->securitypriv.tkip_timer),adapter->pnetdev, rtw_use_tkipkey_handler, adapter);
-@@ -197,7 +203,7 @@ void rtw_reset_securitypriv( _adapter *a
+@@ -197,7 +203,7 @@ void rtw_reset_securitypriv( _adapter *adapter )
_rtw_memcpy( &adapter->securitypriv.PMKIDList[ 0 ], &backupPMKIDList[ 0 ], sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE );
adapter->securitypriv.PMKIDIndex = backupPMKIDIndex;
adapter->securitypriv.btkip_countermeasure = backupTKIPCountermeasure;
adapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
adapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;
-@@ -218,9 +224,10 @@ void rtw_reset_securitypriv( _adapter *a
+@@ -218,9 +224,10 @@ void rtw_reset_securitypriv( _adapter *adapter )
psec_priv->ndisauthtype = Ndis802_11AuthModeOpen;
psec_priv->ndisencryptstatus = Ndis802_11WEPDisabled;
}
void rtw_os_indicate_disconnect( _adapter *adapter )
-@@ -229,17 +236,19 @@ void rtw_os_indicate_disconnect( _adapte
+@@ -229,17 +236,19 @@ void rtw_os_indicate_disconnect( _adapter *adapter )
_func_enter_;
_func_exit_;
-@@ -313,186 +322,20 @@ void _addba_timer_hdl(void *FunctionCont
+@@ -313,185 +322,19 @@ void _addba_timer_hdl(void *FunctionContext)
addba_timer_hdl(psta);
}
-}
-
-void _off_ch_timer_hdl(void *FunctionContext)
-+#ifdef CONFIG_IEEE80211W
-+void _sa_query_timer_hdl (void *FunctionContext)
- {
+-{
- struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
- rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_BASE_CH );
- }
-}
-
-void _tdls_handshake_timer_hdl(void *FunctionContext)
--{
++#ifdef CONFIG_IEEE80211W
++void _sa_query_timer_hdl (void *FunctionContext)
+ {
- struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext;
-
- if(ptdls_sta != NULL)
- ptdls_sta->timer_flag = 0;
- _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL);
-}
-
-+ _init_timer(&psta->addba_retry_timer, padapter->pnetdev, _addba_timer_hdl, psta);
- }
+-
+-}
-void init_tdls_alive_timer(_adapter *padapter, struct sta_info *psta)
-{
- psta->padapter=padapter;
- _init_timer(&psta->alive_timer1, padapter->pnetdev, _tdls_alive_timer_phase1_hdl, psta);
- _init_timer(&psta->alive_timer2, padapter->pnetdev, _tdls_alive_timer_phase2_hdl, psta);
--}
++ _init_timer(&psta->addba_retry_timer, padapter->pnetdev, _addba_timer_hdl, psta);
+ }
-#endif //CONFIG_TDLS
--
+
/*
void _reauth_timer_hdl(void *FunctionContext)
- {
-@@ -513,6 +356,9 @@ void init_mlme_ext_timer(_adapter *padap
+@@ -513,6 +356,9 @@ void init_mlme_ext_timer(_adapter *padapter)
_init_timer(&pmlmeext->survey_timer, padapter->pnetdev, _survey_timer_hdl, padapter);
_init_timer(&pmlmeext->link_timer, padapter->pnetdev, _link_timer_hdl, padapter);
//_init_timer(&pmlmeext->ADDBA_timer, padapter->pnetdev, _addba_timer_hdl, padapter);
//_init_timer(&pmlmeext->reauth_timer, padapter->pnetdev, _reauth_timer_hdl, padapter);
-@@ -579,24 +425,24 @@ static int mgnt_xmit_entry(struct sk_buf
+@@ -579,24 +425,24 @@ static int mgnt_xmit_entry(struct sk_buff *skb, struct net_device *pnetdev)
struct hostapd_priv *phostapdpriv = rtw_netdev_priv(pnetdev);
_adapter *padapter = (_adapter *)phostapdpriv->padapter;
netif_carrier_on(pnetdev);
-@@ -609,14 +455,14 @@ static int mgnt_netdev_close(struct net_
+@@ -609,14 +455,14 @@ static int mgnt_netdev_close(struct net_device *pnetdev)
{
struct hostapd_priv *phostapdpriv = rtw_netdev_priv(pnetdev);
//rtw_write16(phostapdpriv->padapter, 0x0116, 0x3f3f);
-@@ -658,7 +504,7 @@ int hostapd_mode_init(_adapter *padapter
+@@ -658,7 +504,7 @@ int hostapd_mode_init(_adapter *padapter)
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
pnetdev->netdev_ops = &rtl871x_mgnt_netdev_ops;
-@@ -690,7 +536,7 @@ int hostapd_mode_init(_adapter *padapter
+@@ -690,7 +536,7 @@ int hostapd_mode_init(_adapter *padapter)
if(dev_alloc_name(pnetdev,"mgnt.wlan%d") < 0)
{
}
-@@ -713,7 +559,7 @@ int hostapd_mode_init(_adapter *padapter
+@@ -713,7 +559,7 @@ int hostapd_mode_init(_adapter *padapter)
/* Tell the network stack we exist */
if (register_netdev(pnetdev) != 0)
{
if(pnetdev)
{
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c
+index b88a5eb..82dee6d 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c
@@ -1,7 +1,7 @@
int rtw_wireless_mode = WIRELESS_11BG_24N;
int rtw_vrtl_carrier_sense = AUTO_VCS;
int rtw_vcs_type = RTS_CTS;//*
-@@ -74,18 +70,18 @@ int rtw_preamble = PREAMBLE_LONG;//long,
+@@ -74,18 +70,18 @@ int rtw_preamble = PREAMBLE_LONG;//long, short, auto
int rtw_scan_mode = 1;//active, passive
int rtw_adhoc_tx_pwr = 1;
int rtw_soft_ap = 0;
int rtw_ampdu_enable = 1;//for enable tx_ampdu
int rtw_rx_stbc = 1;// 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ
int rtw_ampdu_amsdu = 0;// 0: disabled, 1:enabled, 2:auto
-@@ -123,7 +119,7 @@ int rtw_ampdu_amsdu = 0;// 0: disabled,
+@@ -123,7 +119,7 @@ int rtw_ampdu_amsdu = 0;// 0: disabled, 1:enabled, 2:auto
int rtw_lowrate_two_xmit = 1;//Use 2 path Tx to transmit MCS0~7 and legacy mode
#ifdef CONFIG_FILE_FWIMG
char *rtw_fw_file_path= "";
module_param(rtw_fw_file_path, charp, 0644);
-@@ -243,7 +252,18 @@ MODULE_PARM_DESC(rtw_fw_file_path, "The
+@@ -243,7 +252,18 @@ MODULE_PARM_DESC(rtw_fw_file_path, "The path of fw image");
module_param(rtw_mc2u_disable, int, 0644);
#endif // CONFIG_TX_MCAST2UNI
if(rtw_proc == NULL)
{
-@@ -283,6 +294,18 @@ void rtw_proc_init_one(struct net_device
+@@ -283,6 +294,18 @@ void rtw_proc_init_one(struct net_device *dev)
{
_rtw_memcpy(rtw_proc_name, RTL8192D_PROC_NAME, sizeof(RTL8192D_PROC_NAME));
}
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, proc_net);
-@@ -290,23 +313,40 @@ void rtw_proc_init_one(struct net_device
+@@ -290,23 +313,40 @@ void rtw_proc_init_one(struct net_device *dev)
rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net);
#endif
if (rtw_proc == NULL) {
rtw_proc);
dir_dev = padapter->dir_dev;
-@@ -320,12 +360,12 @@ void rtw_proc_init_one(struct net_device
+@@ -320,12 +360,12 @@ void rtw_proc_init_one(struct net_device *dev)
remove_proc_entry(rtw_proc_name, proc_net);
#else
remove_proc_entry(rtw_proc_name, init_net.proc_net);
return;
}
}
-@@ -337,147 +377,283 @@ void rtw_proc_init_one(struct net_device
+@@ -337,147 +377,283 @@ void rtw_proc_init_one(struct net_device *dev)
rtw_proc_cnt++;
entry = create_proc_read_entry("write_reg", S_IFREG | S_IRUGO,
dir_dev = padapter->dir_dev;
padapter->dir_dev = NULL;
-@@ -491,29 +667,64 @@ void rtw_proc_remove_one(struct net_devi
+@@ -491,29 +667,64 @@ void rtw_proc_remove_one(struct net_device *dev)
remove_proc_entry("mlmext_state", dir_dev);
remove_proc_entry("qos_option", dir_dev);
remove_proc_entry("ht_option", dir_dev);
}
else
{
-@@ -526,22 +737,26 @@ void rtw_proc_remove_one(struct net_devi
+@@ -526,22 +737,26 @@ void rtw_proc_remove_one(struct net_device *dev)
{
if(rtw_proc){
remove_proc_entry("ver_info", rtw_proc);
//addr->sa_data[4], addr->sa_data[5]);
_rtw_memcpy(padapter->eeprompriv.mac_addr, addr->sa_data, ETH_ALEN);
//_rtw_memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
-@@ -673,20 +901,103 @@ static struct net_device_stats *rtw_net_
+@@ -673,20 +901,103 @@ static struct net_device_stats *rtw_net_get_stats(struct net_device *pnetdev)
struct recv_priv *precvpriv = &(padapter->recvpriv);
padapter->stats.tx_packets = pxmitpriv->tx_pkts;//pxmitpriv->tx_pkts++;
.ndo_set_mac_address = rtw_net_set_mac_address,
.ndo_get_stats = rtw_net_get_stats,
.ndo_do_ioctl = rtw_ioctl,
-@@ -715,24 +1026,24 @@ int rtw_init_netdev_name(struct net_devi
+@@ -715,24 +1026,24 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
TargetNetdev = dev_get_by_name(devnet, "wlan0");
#endif
if(TargetNetdev) {
if(dev_alloc_name(pnetdev, ifname) < 0)
{
-@@ -740,41 +1051,41 @@ int rtw_init_netdev_name(struct net_devi
+@@ -740,41 +1051,41 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
}
netif_carrier_off(pnetdev);
pnetdev->hard_start_xmit = rtw_xmit_entry;
pnetdev->set_mac_address = rtw_net_set_mac_address;
pnetdev->get_stats = rtw_net_get_stats;
-@@ -784,11 +1095,12 @@ struct net_device *rtw_init_netdev(_adap
+@@ -784,11 +1095,12 @@ struct net_device *rtw_init_netdev(_adapter *old_padapter)
#ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
pnetdev->features |= NETIF_F_IP_CSUM;
#ifdef WIRELESS_SPY
//priv->wireless_data.spy_data = &priv->spy_data;
-@@ -797,36 +1109,72 @@ struct net_device *rtw_init_netdev(_adap
+@@ -797,36 +1109,72 @@ struct net_device *rtw_init_netdev(_adapter *old_padapter)
//step 2.
loadparam(padapter, pnetdev);
#endif
return _status;
-@@ -835,13 +1183,13 @@ u32 rtw_start_drv_threads(_adapter *pada
+@@ -835,13 +1183,13 @@ u32 rtw_start_drv_threads(_adapter *padapter)
void rtw_stop_drv_threads (_adapter *padapter)
{
}
#ifdef CONFIG_EVENT_THREAD_MODE
-@@ -853,12 +1201,12 @@ void rtw_stop_drv_threads (_adapter *pad
+@@ -853,12 +1201,12 @@ void rtw_stop_drv_threads (_adapter *padapter)
#ifdef CONFIG_XMIT_THREAD_MODE
// Below is to termindate tx_thread...
// Below is to termindate rx_thread...
_rtw_up_sema(&padapter->recvpriv.recv_sema);
_rtw_down_sema(&padapter->recvpriv.terminate_recvthread_sema);
-@@ -868,12 +1216,12 @@ void rtw_stop_drv_threads (_adapter *pad
+@@ -868,12 +1216,12 @@ void rtw_stop_drv_threads (_adapter *padapter)
}
struct mlme_priv *pmlmepriv= &padapter->mlmepriv;
struct security_priv *psecuritypriv = &padapter->securitypriv;
-@@ -883,30 +1231,30 @@ u8 rtw_init_default_value(_adapter *pada
+@@ -883,30 +1231,30 @@ u8 rtw_init_default_value(_adapter *padapter)
pxmitpriv->vcs_type = pregistrypriv->vcs_type;
//pxmitpriv->rts_thresh = pregistrypriv->rts_thresh;
pxmitpriv->frag_len = pregistrypriv->frag_thresh;
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system
psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
-@@ -917,44 +1265,77 @@ u8 rtw_init_default_value(_adapter *pada
+@@ -917,44 +1265,77 @@ u8 rtw_init_default_value(_adapter *padapter)
psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
psecuritypriv->ndisencryptstatus = Ndis802_11WEPDisabled;
padapter->bWritePortCancel = _FALSE;
padapter->bRxRSSIDisplay = 0;
-
+- return ret;
+ padapter->bForceWriteInitGain = 1;
+ padapter->bNotifyChannelChange = 0;
+#ifdef CONFIG_P2P
+ padapter->bShowGetP2PState = 1;
+#endif
- return ret;
- }
-
--u8 rtw_reset_drv_sw(_adapter *padapter)
++ return ret;
++}
++
+struct dvobj_priv *devobj_init(void)
- {
-- u8 ret8=_SUCCESS;
-- struct mlme_priv *pmlmepriv= &padapter->mlmepriv;
++{
+ struct dvobj_priv *pdvobj = NULL;
+
+ if ((pdvobj = (struct dvobj_priv*)rtw_zmalloc(sizeof(*pdvobj))) == NULL)
+ pdvobj->processing_dev_remove = _FALSE;
+
+ return pdvobj;
-+}
-+
+ }
+
+void devobj_deinit(struct dvobj_priv *pdvobj)
+{
+ if(!pdvobj)
+ rtw_mfree((u8*)pdvobj, sizeof(*pdvobj));
+}
+
-+u8 rtw_reset_drv_sw(_adapter *padapter)
-+{
+ u8 rtw_reset_drv_sw(_adapter *padapter)
+ {
+- u8 ret8=_SUCCESS;
+ u8 ret8=_SUCCESS;
-+ struct mlme_priv *pmlmepriv= &padapter->mlmepriv;
+ struct mlme_priv *pmlmepriv= &padapter->mlmepriv;
struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv;
//hal_priv
}
void rtw_cancel_all_timer(_adapter *padapter)
-@@ -1115,13 +1512,13 @@ void rtw_cancel_all_timer(_adapter *pada
+@@ -1115,13 +1512,13 @@ void rtw_cancel_all_timer(_adapter *padapter)
//RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel tkip_timer! \n"));
_cancel_timer_ex(&padapter->mlmepriv.scan_to_timer);
RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel DeInitSwLeds! \n"));
_cancel_timer_ex(&padapter->pwrctrlpriv.pwr_state_check_timer);
-@@ -1134,6 +1531,7 @@ void rtw_cancel_all_timer(_adapter *pada
+@@ -1134,6 +1531,7 @@ void rtw_cancel_all_timer(_adapter *padapter)
#ifdef CONFIG_SET_SCAN_DENY_TIMER
_cancel_timer_ex(&padapter->mlmepriv.set_scan_deny_timer);
RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel set_scan_deny_timer! \n"));
#endif
-@@ -1142,15 +1540,16 @@ void rtw_cancel_all_timer(_adapter *pada
+@@ -1142,15 +1540,16 @@ void rtw_cancel_all_timer(_adapter *padapter)
#endif
// cancel dm timer
RT_TRACE(_module_os_intfs_c_,_drv_info_,("<==rtw_free_drv_sw\n"));
-@@ -1211,267 +1617,1028 @@ u8 rtw_free_drv_sw(_adapter *padapter)
+@@ -1211,265 +1617,1026 @@ u8 rtw_free_drv_sw(_adapter *padapter)
if(padapter->rereg_nd_name_priv.old_pnetdev) {
free_netdev(padapter->rereg_nd_name_priv.old_pnetdev);
padapter->rereg_nd_name_priv.old_pnetdev = NULL;
- netif_wake_queue(pnetdev);
-
-#ifdef CONFIG_BR_EXT
--
++ rtw_netif_wake_queue(pnetdev);
+
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35))
- rcu_read_lock();
-#endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35))
-
- br_netdev = dev_get_by_name(devnet, CONFIG_BR_EXT_BRNAME);
-#endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-+ rtw_netif_wake_queue(pnetdev);
-
+-
- if (br_netdev) {
- memcpy(padapter->br_mac, br_netdev->dev_addr, ETH_ALEN);
- dev_put(br_netdev);
+#endif //CONFIG_IOCTL_CFG80211
- //s5.
-- if(padapter->bSurpriseRemoved == _FALSE)
-- {
+ //set interface_type/chip_type/HardwareType
+ padapter->interface_type = primary_padapter->interface_type;
+ padapter->chip_type = primary_padapter->chip_type;
+ }
+
+ //s5.
-+ if(padapter->bSurpriseRemoved == _FALSE)
-+ {
+ if(padapter->bSurpriseRemoved == _FALSE)
+ {
rtw_hal_deinit(padapter);
- }
-
-@@ -1481,7 +2648,7 @@ int pm_netdev_open(struct net_device *pn
+@@ -1481,7 +2648,7 @@ int pm_netdev_open(struct net_device *pnetdev,u8 bnormal)
{
int status;
if(bnormal)
#ifdef CONFIG_IPS
else
status = (_SUCCESS == ips_netdrv_open((_adapter *)rtw_netdev_priv(pnetdev)))?(0):(-1);
-@@ -1489,16 +2656,16 @@ int pm_netdev_open(struct net_device *pn
+@@ -1489,16 +2656,16 @@ int pm_netdev_open(struct net_device *pnetdev,u8 bnormal)
return status;
}
if(padapter->pwrctrlpriv.rf_pwrstate == rf_off)
padapter->pwrctrlpriv.ps_flag = _TRUE;
}
-@@ -1506,7 +2673,7 @@ static int netdev_close(struct net_devic
+@@ -1506,7 +2673,7 @@ static int netdev_close(struct net_device *pnetdev)
/* if(!padapter->hw_init_completed)
{
padapter->bDriverStopped = _TRUE;
-@@ -1514,22 +2681,22 @@ static int netdev_close(struct net_devic
+@@ -1514,22 +2681,22 @@ static int netdev_close(struct net_device *pnetdev)
}
else*/
if(padapter->pwrctrlpriv.rf_pwrstate == rf_on){
rtw_free_assoc_resources(padapter, 1);
//s2-4.
rtw_free_network_queue(padapter,_TRUE);
-@@ -1539,7 +2706,7 @@ static int netdev_close(struct net_devic
+@@ -1539,7 +2706,7 @@ static int netdev_close(struct net_device *pnetdev)
}
#ifdef CONFIG_BR_EXT
{
//void nat25_db_cleanup(_adapter *priv);
nat25_db_cleanup(padapter);
-@@ -1547,22 +2714,36 @@ static int netdev_close(struct net_devic
+@@ -1547,22 +2714,36 @@ static int netdev_close(struct net_device *pnetdev)
#endif // CONFIG_BR_EXT
#ifdef CONFIG_P2P
+ free_netdev(ndev);
}
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c
+index 0848297..5bf576f 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c
@@ -1,7 +1,7 @@
#include <rtw_version.h>
#ifndef CONFIG_PCI_HCI
-@@ -79,23 +79,21 @@ struct pci_device_id rtw_pci_id_tbl[] =
+@@ -79,23 +79,21 @@ struct pci_device_id rtw_pci_id_tbl[] = {
{},
};
.rtw_pci_drv.suspend = NULL,
.rtw_pci_drv.resume = NULL,
#endif
-@@ -114,7 +112,7 @@ static u16 pcibridge_vendors[PCI_BRIDGE_
+@@ -114,7 +112,7 @@ static u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = {
static u8 rtw_pci_platform_switch_device_pci_aspm(_adapter *padapter, u8 value)
{
u8 bresult = _SUCCESS;
int error;
-@@ -125,18 +123,18 @@ static u8 rtw_pci_platform_switch_device
+@@ -125,18 +123,18 @@ static u8 rtw_pci_platform_switch_device_pci_aspm(_adapter *padapter, u8 value)
if(error != 0)
{
bresult = _FALSE;
u8 buffer, bresult = _SUCCESS;
int error;
-@@ -150,18 +148,18 @@ static u8 rtw_pci_switch_clk_req(_adapte
+@@ -150,18 +148,18 @@ static u8 rtw_pci_switch_clk_req(_adapter *padapter, u8 value)
if(error != 0)
{
bresult = _FALSE;
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct pci_priv *pcipriv = &(pdvobjpriv->pcipriv);
u32 pcicfg_addrport = 0;
-@@ -170,8 +168,8 @@ void rtw_pci_disable_aspm(_adapter *pada
+@@ -170,8 +168,8 @@ void rtw_pci_disable_aspm(_adapter *padapter)
u16 pcibridge_linkctrlreg, aspmlevel = 0;
// When there exists anyone's busnum, devnum, and funcnum that are set to 0xff,
if ((pcipriv->busnumber == 0xff
&& pcipriv->devnumber == 0xff
&& pcipriv->funcnumber == 0xff)
-@@ -179,12 +177,12 @@ void rtw_pci_disable_aspm(_adapter *pada
+@@ -179,12 +177,12 @@ void rtw_pci_disable_aspm(_adapter *padapter)
&& pcipriv->pcibridge_devnum == 0xff
&& pcipriv->pcibridge_funcnum == 0xff))
{
}
if (pwrpriv->reg_rfps_level & RT_RF_OFF_LEVL_CLK_REQ) {
-@@ -224,7 +222,7 @@ void rtw_pci_disable_aspm(_adapter *pada
+@@ -224,7 +222,7 @@ void rtw_pci_disable_aspm(_adapter *padapter)
}
else
{
pcicfg_addrport = (pcipriv->pcibridge_busnum << 16) |
(pcipriv->pcibridge_devnum << 11) |
(pcipriv->pcibridge_funcnum << 8) | (1 << 31);
-@@ -236,9 +234,9 @@ void rtw_pci_disable_aspm(_adapter *pada
+@@ -236,9 +234,9 @@ void rtw_pci_disable_aspm(_adapter *padapter)
// now grab data port with device|vendor 4 byte dword
NdisRawWritePortUchar(PCI_CONF_DATA, pcibridge_linkctrlreg);
(pcipriv->pcibridge_pciehdr_offset+0x10), pcibridge_linkctrlreg);
rtw_udelay_os(50);
-@@ -246,13 +244,13 @@ void rtw_pci_disable_aspm(_adapter *pada
+@@ -246,13 +244,13 @@ void rtw_pci_disable_aspm(_adapter *padapter)
}
//[ASPM]
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct pci_priv *pcipriv = &(pdvobjpriv->pcipriv);
u16 aspmlevel = 0;
-@@ -262,8 +260,8 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -262,8 +260,8 @@ void rtw_pci_enable_aspm(_adapter *padapter)
u8 u_device_aspmsetting = 0;
// When there exists anyone's busnum, devnum, and funcnum that are set to 0xff,
if ((pcipriv->busnumber == 0xff
&& pcipriv->devnumber == 0xff
-@@ -272,12 +270,12 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -272,12 +270,12 @@ void rtw_pci_enable_aspm(_adapter *padapter)
&& pcipriv->pcibridge_devnum == 0xff
&& pcipriv->pcibridge_funcnum == 0xff))
{
| (pcipriv->pcibridge_devnum << 11)
| (pcipriv->pcibridge_funcnum << 8) | (1 << 31);
num4bytes = (pcipriv->pcibridge_pciehdr_offset + 0x10) / 4;
-@@ -293,11 +291,11 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -293,11 +291,11 @@ void rtw_pci_enable_aspm(_adapter *padapter)
NdisRawWritePortUchar(PCI_CONF_DATA, u_pcibridge_aspmsetting);
u_pcibridge_aspmsetting);
rtw_udelay_os(50);
-@@ -318,14 +316,14 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -318,14 +316,14 @@ void rtw_pci_enable_aspm(_adapter *padapter)
}
//
struct pci_priv *pcipriv = &(pdvobjpriv->pcipriv);
struct rt_pci_capabilities_header capability_hdr;
u8 capability_offset, num4bytes;
-@@ -335,7 +333,7 @@ rtw_get_link_control_field(_adapter *pad
+@@ -335,7 +333,7 @@ rtw_get_link_control_field(_adapter *padapter, u8 busnum, u8 devnum,
//If busnum, devnum, funcnum are set to 0xff.
if (busnum == 0xff && devnum == 0xff && funcnum == 0xff) {
return _FALSE;
}
-@@ -351,15 +349,15 @@ rtw_get_link_control_field(_adapter *pad
+@@ -351,15 +349,15 @@ rtw_get_link_control_field(_adapter *padapter, u8 busnum, u8 devnum,
// now grab data port with device|vendor 4 byte dword
NdisRawReadPortUchar(PCI_CONF_DATA, &capability_offset);
// next capability and continue looping.
//4 get capability_hdr
-@@ -397,16 +395,16 @@ rtw_get_link_control_field(_adapter *pad
+@@ -397,16 +395,16 @@ rtw_get_link_control_field(_adapter *padapter, u8 busnum, u8 devnum,
}
else
{
return _FALSE;
}
-@@ -588,7 +586,7 @@ rtw_get_pci_brideg_info(_adapter *padapt
+@@ -588,7 +586,7 @@ rtw_get_pci_brideg_info(_adapter *padapter,
NdisRawWritePortUlong(PCI_CONF_ADDRESS, pcicfg_addrport + (3 << 2));
NdisRawReadPortUlong(PCI_CONF_DATA, &headertype);
headertype = ((headertype >> 16) & 0x0080) >> 7; // address 0x0e[7].
b_singlefunc = _TRUE;
}
else
-@@ -636,7 +634,7 @@ rtw_get_pci_brideg_info(_adapter *padapt
+@@ -636,7 +634,7 @@ rtw_get_pci_brideg_info(_adapter *padapter,
*vendorid = venId;
*deviceid = devId;
venId, devId, busnum_idx, devicenum_idx, functionnum_idx);
return _TRUE;
-@@ -645,18 +643,18 @@ rtw_get_pci_brideg_info(_adapter *padapt
+@@ -645,18 +643,18 @@ rtw_get_pci_brideg_info(_adapter *padapter,
}
}
struct pci_priv *pcipriv = &(pdvobjpriv->pcipriv);
u8 pcibridge_busnum = 0xff;
u8 pcibridge_devnum = 0xff;
-@@ -679,11 +677,11 @@ static void rtw_find_bridge_info(_adapte
+@@ -679,11 +677,11 @@ static void rtw_find_bridge_info(_adapter *padapter)
for (tmp = 0; tmp < PCI_BRIDGE_VENDOR_MAX; tmp++) {
if (pcibridge_vendorid == pcibridge_vendors[tmp]) {
pcipriv->pcibridge_vendor = tmp;
// Update corresponding PCI bus info.
pcipriv->pcibridge_busnum = pcibridge_busnum;
-@@ -726,7 +724,7 @@ rtw_get_amd_l1_patch(_adapter *padapter,
+@@ -726,7 +724,7 @@ rtw_get_amd_l1_patch(_adapter *padapter, u8 busnum, u8 devnum,
/*Disable RTL8192SE ASPM & Disable Pci Bridge ASPM*/
void rtw_pci_disable_aspm(_adapter *padapter)
{
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct pci_dev *pdev = pdvobjpriv->ppcidev;
struct pci_dev *bridge_pdev = pdev->bus->self;
-@@ -762,7 +760,7 @@ void rtw_pci_disable_aspm(_adapter *pada
+@@ -762,7 +760,7 @@ void rtw_pci_disable_aspm(_adapter *padapter)
}
{
u8 tmp_u1b;
pci_read_config_byte(pdev, 0x80, &tmp_u1b);
}
-@@ -779,14 +777,14 @@ void rtw_pci_disable_aspm(_adapter *pada
+@@ -779,14 +777,14 @@ void rtw_pci_disable_aspm(_adapter *padapter)
}
else
{
(pcipriv->pcibridge_pciehdr_offset+0x10), pcibridge_linkctrlreg);
rtw_udelay_os(50);
-@@ -794,18 +792,18 @@ void rtw_pci_disable_aspm(_adapter *pada
+@@ -794,18 +792,18 @@ void rtw_pci_disable_aspm(_adapter *padapter)
}
u8 u_pcibridge_aspmsetting = 0;
u8 u_device_aspmsetting = 0;
u32 u_device_aspmsupportsetting = 0;
-@@ -816,11 +814,11 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -816,11 +814,11 @@ void rtw_pci_enable_aspm(_adapter *padapter)
return;
//When there exists anyone's BusNum, DevNum, and FuncNum that are set to 0xff,
return;
}
-@@ -834,19 +832,19 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -834,19 +832,19 @@ void rtw_pci_enable_aspm(_adapter *padapter)
//NdisRawWritePortUlong((ULONG_PTR)PCI_CONF_ADDRESS , PciCfgAddrPort+(Num4Bytes << 2));
//NdisRawReadPortUlong((ULONG_PTR)PCI_CONF_DATA,&uDeviceASPMSupportSetting);
pci_read_config_dword(bridge_pdev, (pcipriv->pcibridge_pciehdr_offset+0x0C), &u_device_aspmsupportsetting);
return;
}
}
-@@ -854,7 +852,7 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -854,7 +852,7 @@ void rtw_pci_enable_aspm(_adapter *padapter)
{
if((u_device_aspmsupportsetting & BIT(10)) != BIT(10))
{
return;
}
-@@ -862,12 +860,12 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -862,12 +860,12 @@ void rtw_pci_enable_aspm(_adapter *padapter)
}
else
{
//PciCfgAddrPort = (pcipriv->pcibridge_busnum << 16)|(pcipriv->pcibridge_devnum<< 11) |(pcipriv->pcibridge_funcnum << 8)|(1 << 31);
//Num4Bytes = (pcipriv->pcibridge_pciehdr_offset+0x10)/4;
// set up address port at 0xCF8 offset field= 0 (dev|vend)
-@@ -884,14 +882,14 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -884,14 +882,14 @@ void rtw_pci_enable_aspm(_adapter *padapter)
//NdisRawWritePortUchar(PCI_CONF_DATA, u_pcibridge_aspmsetting);
pci_write_config_byte(bridge_pdev, (pcipriv->pcibridge_pciehdr_offset+0x10), u_pcibridge_aspmsetting);
aspmlevel |= pdvobjpriv->const_devicepci_aspm_setting;
u_device_aspmsetting = pcipriv->linkctrl_reg;
u_device_aspmsetting |= aspmlevel; // device 43
-@@ -906,10 +904,9 @@ void rtw_pci_enable_aspm(_adapter *padap
+@@ -906,10 +904,9 @@ void rtw_pci_enable_aspm(_adapter *padapter)
rtw_udelay_os(50);
}
struct pci_dev *bridge_pdev = pdev->bus->self;
u8 status = _FALSE;
u8 offset_e0;
-@@ -934,15 +931,14 @@ static u8 rtw_pci_get_amd_l1_patch(_adap
+@@ -934,15 +931,14 @@ static u8 rtw_pci_get_amd_l1_patch(_adapter *padapter)
return status;
}
/*Read Link Control Register*/
pci_read_config_byte(bridge_pdev, capabilityoffset + PCI_EXP_LNKCTL, &linkctrl_reg);
-@@ -950,10 +946,10 @@ static void rtw_pci_get_linkcontrol_fiel
+@@ -950,10 +946,10 @@ static void rtw_pci_get_linkcontrol_field(_adapter *padapter)
}
#endif
u8 tmp;
int pos;
u8 linkctrl_reg;
-@@ -963,7 +959,7 @@ static void rtw_pci_parse_configuration(
+@@ -963,7 +959,7 @@ static void rtw_pci_parse_configuration(struct pci_dev *pdev, _adapter *padapter
pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &linkctrl_reg);
pcipriv->linkctrl_reg = linkctrl_reg;
pci_read_config_byte(pdev, 0x98, &tmp);
tmp |= BIT(4);
-@@ -978,7 +974,7 @@ static void rtw_pci_parse_configuration(
+@@ -978,7 +974,7 @@ static void rtw_pci_parse_configuration(struct pci_dev *pdev, _adapter *padapter
//
static void rtw_pci_update_default_setting(_adapter *padapter)
{
struct pci_priv *pcipriv = &(pdvobjpriv->pcipriv);
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
-@@ -986,8 +982,8 @@ static void rtw_pci_update_default_setti
+@@ -986,8 +982,8 @@ static void rtw_pci_update_default_setting(_adapter *padapter)
pwrpriv->reg_rfps_level = 0;
pwrpriv->b_support_aspm = 0;
// Update PCI ASPM setting
pwrpriv->const_amdpci_aspm = pdvobjpriv->const_amdpci_aspm;
-@@ -1056,7 +1052,7 @@ static void rtw_pci_update_default_setti
+@@ -1056,7 +1052,7 @@ static void rtw_pci_update_default_setting(_adapter *padapter)
pwrpriv->b_support_aspm = b_support_aspm;
/*if(pAdapter->MgntInfo.CustomerID == RT_CID_TOSHIBA &&
!pcipriv->amd_l1_patch)
b_support_backdoor = _FALSE;*/
-@@ -1065,7 +1061,7 @@ static void rtw_pci_update_default_setti
+@@ -1065,7 +1061,7 @@ static void rtw_pci_update_default_setting(_adapter *padapter)
break;
case 2: // Set by Chipset.
if (pcipriv->pcibridge_vendor == PCI_BRIDGE_VENDOR_INTEL) {
u8 b_support_aspm = _TRUE;
pwrpriv->b_support_aspm = b_support_aspm;
-@@ -1098,32 +1094,119 @@ static void rtw_pci_initialize_adapter_c
+@@ -1098,32 +1094,119 @@ static void rtw_pci_initialize_adapter_common(_adapter *padapter)
static irqreturn_t rtw_pci_interrupt(int irq, void *priv, struct pt_regs *regs)
{
- _adapter *padapter = (_adapter *)priv;
- struct dvobj_priv *pdvobjpriv = &padapter->dvobjpriv;
--
+ struct dvobj_priv *dvobj = (struct dvobj_priv *)priv;
+ _adapter *adapter = dvobj->if1;
+-
- if (pdvobjpriv->irq_enabled == 0) {
+ if (dvobj->irq_enabled == 0) {
return IRQ_HANDLED;
venderid = pdev->vendor;
-@@ -1261,13 +1367,13 @@ static void decide_chip_type_by_pci_devi
+@@ -1261,13 +1367,13 @@ static void decide_chip_type_by_pci_device_id(_adapter *padapter, struct pci_dev
//
padapter->HardwareType=HARDWARE_TYPE_RTL8185;
}
else if (deviceid == HAL_HW_PCI_8190_DEVICE_ID ||
-@@ -1275,7 +1381,7 @@ static void decide_chip_type_by_pci_devi
+@@ -1275,7 +1381,7 @@ static void decide_chip_type_by_pci_device_id(_adapter *padapter, struct pci_dev
deviceid == HAL_HW_PCI_0046_DEVICE_ID ||
deviceid == HAL_HW_PCI_DLINK_DEVICE_ID)
{
padapter->HardwareType = HARDWARE_TYPE_RTL8190P;
}
else if (deviceid == HAL_HW_PCI_8192_DEVICE_ID ||
-@@ -1292,19 +1398,19 @@ static void decide_chip_type_by_pci_devi
+@@ -1292,19 +1398,19 @@ static void decide_chip_type_by_pci_device_id(_adapter *padapter, struct pci_dev
// Added for 92DE. We deferentiate it from SVID,SDID.
if( pdev->subsystem_vendor == 0x10EC && pdev->subsystem_device == 0xE020){
padapter->HardwareType = HARDWARE_TYPE_RTL8192DE;
padapter->HardwareType = HARDWARE_TYPE_RTL8192SE;
break;
}
-@@ -1312,25 +1418,25 @@ static void decide_chip_type_by_pci_devi
+@@ -1312,25 +1418,25 @@ static void decide_chip_type_by_pci_device_id(_adapter *padapter, struct pci_dev
}
else if(deviceid==HAL_HW_PCI_8723E_DEVICE_ID )
{//RTL8723E may have the same device ID with RTL8192CET
//padapter->HardwareType = HAL_DEFAULT_HARDWARE_TYPE;
}
-@@ -1355,13 +1461,16 @@ static void pci_intf_start(_adapter *pad
+@@ -1355,13 +1461,16 @@ static void pci_intf_start(_adapter *padapter)
{
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+pci_intf_start\n"));
}
static void pci_intf_stop(_adapter *padapter)
-@@ -1373,13 +1482,27 @@ static void pci_intf_stop(_adapter *pada
+@@ -1373,13 +1482,27 @@ static void pci_intf_stop(_adapter *padapter)
if(padapter->bSurpriseRemoved == _FALSE)
{
//device still exists, so driver can do i/o operation
}
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-pci_intf_stop\n"));
-@@ -1395,25 +1518,13 @@ static void rtw_dev_unload(_adapter *pad
+@@ -1395,25 +1518,13 @@ static void rtw_dev_unload(_adapter *padapter)
if(padapter->bup == _TRUE)
{
//s3.
if(padapter->intf_stop)
-@@ -1428,7 +1539,7 @@ static void rtw_dev_unload(_adapter *pad
+@@ -1428,7 +1539,7 @@ static void rtw_dev_unload(_adapter *padapter)
//s5.
if(padapter->bSurpriseRemoved == _FALSE)
{
rtw_hal_deinit(padapter);
padapter->bSurpriseRemoved = _TRUE;
-@@ -1442,7 +1553,7 @@ static void rtw_dev_unload(_adapter *pad
+@@ -1442,7 +1553,7 @@ static void rtw_dev_unload(_adapter *padapter)
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("r871x_dev_unload():padapter->bup == _FALSE\n" ));
}
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-rtw_dev_unload\n"));
-@@ -1475,7 +1586,7 @@ static void disable_ht_for_spec_devid(co
+@@ -1475,7 +1586,7 @@ static void disable_ht_for_spec_devid(const struct pci_device_id *pdid)
#ifdef CONFIG_PM
static int rtw_suspend(struct pci_dev *pdev, pm_message_t state)
_func_enter_;
-@@ -1489,270 +1600,291 @@ static int rtw_resume(struct pci_dev *pd
+@@ -1489,270 +1600,291 @@ static int rtw_resume(struct pci_dev *pdev)
_func_exit_;
- }
- bdma64 = _TRUE;
- } else
-+ padapter->bDriverStopped=_TRUE;
-+
-+ dvobj->padapters[dvobj->iface_nums++] = padapter;
-+ padapter->iface_id = IFACE_ID0;
-+
-+#if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_DUALMAC_CONCURRENT)
-+ //set adapter_type/iface type for primary padapter
-+ padapter->isprimary = _TRUE;
-+ padapter->adapter_type = PRIMARY_ADAPTER;
-+ #ifndef CONFIG_HWPORT_SWAP
-+ padapter->iface_type = IFACE_PORT0;
-+ #else
-+ padapter->iface_type = IFACE_PORT1;
-+ #endif
- #endif
+-#endif
- {
- if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
- if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
- }
- }
- }
--
++ padapter->bDriverStopped=_TRUE;
+
- pci_set_master(pdev);
--
++ dvobj->padapters[dvobj->iface_nums++] = padapter;
++ padapter->iface_id = IFACE_ID0;
+
- //step 0.
- disable_ht_for_spec_devid(pdid);
++#if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_DUALMAC_CONCURRENT)
++ //set adapter_type/iface type for primary padapter
++ padapter->isprimary = _TRUE;
++ padapter->adapter_type = PRIMARY_ADAPTER;
++ #ifndef CONFIG_HWPORT_SWAP
++ padapter->iface_type = IFACE_PORT0;
++ #else
++ padapter->iface_type = IFACE_PORT1;
++ #endif
++#endif
+ //step 1-1., decide the chip_type via vid/pid
+ padapter->interface_type = RTW_PCIE;
- pci_write_config_byte(pdev, 0x04, 0x06);
- pci_write_config_byte(pdev, 0x04, 0x07);
-
-
+-
- //set interface_type to usb
- padapter->interface_type = RTW_PCIE;
--
+
- //step 1-1., decide the chip_type via vid/pid
- decide_chip_type_by_pci_device_id(padapter, pdev);
-
- if (register_netdev(pnetdev) != 0) {
- RT_TRACE(_module_hci_intfs_c_,_drv_err_,("register_netdev() failed\n"));
- goto error;
+- }
+ DBG_871X("bDriverStopped:%d, bSurpriseRemoved:%d, bup:%d, hw_init_completed:%d\n"
+ ,padapter->bDriverStopped
+ ,padapter->bSurpriseRemoved
+ else if (padapter)
+ rtw_vmfree((u8*)padapter, sizeof(*padapter));
+ padapter = NULL;
- }
++ }
+exit:
+ return padapter;
+}
+
+ //step 0.
+ disable_ht_for_spec_devid(did);
-
-- if (pdvobjpriv->irq_alloc) {
-- free_irq(pdev->irq, padapter);
-- pdvobjpriv->irq_alloc = 0;
++
+ /* Initialize dvobj_priv */
+ if ((dvobj = pci_dvobj_init(pdev)) == NULL) {
+ RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("initialize device object priv Failed!\n"));
+ goto exit;
- }
++ }
-- if (pdvobjpriv->pci_mem_start != 0) {
-- pci_iounmap(pdev, (void *)pdvobjpriv->pci_mem_start);
+- if (pdvobjpriv->irq_alloc) {
+- free_irq(pdev->irq, padapter);
+- pdvobjpriv->irq_alloc = 0;
+ /* Initialize if1 */
+ if ((if1 = rtw_pci_if1_init(dvobj, pdev, did)) == NULL) {
+ DBG_871X("rtw_pci_if1_init Failed!\n");
+ goto free_dvobj;
}
-- pci_dvobj_deinit(padapter);
+- if (pdvobjpriv->pci_mem_start != 0) {
+- pci_iounmap(pdev, (void *)pdvobjpriv->pci_mem_start);
+ /* Initialize if2 */
+#ifdef CONFIG_CONCURRENT_MODE
+ if((if2 = rtw_drv_if2_init(if1, pci_set_intf_ops)) == NULL) {
+ goto free_if1;
-+ }
+ }
+#endif
-- if (pnetdev)
-- {
-- //unregister_netdev(pnetdev);
-- rtw_free_netdev(pnetdev);
+- pci_dvobj_deinit(padapter);
+#ifdef CONFIG_GLOBAL_UI_PID
+ if (ui_pid[1]!=0) {
+ DBG_871X("ui_pid[1]:%d\n",ui_pid[1]);
+ rtw_signal_process(ui_pid[1], SIGUSR2);
+ }
+#endif
-+
+
+- if (pnetdev)
+- {
+- //unregister_netdev(pnetdev);
+- rtw_free_netdev(pnetdev);
+ //dev_alloc_name && register_netdev
+ if((status = rtw_drv_register_netdev(if1)) != _SUCCESS) {
+ goto free_if1;
+ DBG_871X("wlan link up\n");
+ rtd2885_wlan_netlink_sendMsg("linkup", "8712");
+#endif
-
-- DBG_8192C("-871x_pci - drv_init, fail!\n");
++
+#ifdef RTK_DMP_PLATFORM
+ rtw_proc_init_one(if1->pnetdev);
+#endif
-+
-+
+
+- DBG_8192C("-871x_pci - drv_init, fail!\n");
+
+- return err;
+ /* alloc irq */
+ if (pci_alloc_irq(dvobj) != _SUCCESS)
+ goto free_if2;
+
+ RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-871x_drv - drv_init, success!\n"));
+ //DBG_871X("-871x_drv - drv_init, success!\n");
-
-- return err;
++
+ status = _SUCCESS;
+
+free_if2:
}
- DBG_8192C("+rtw_dev_remove\n");
--
++ rtw_unregister_netdevs(pdvobjpriv);
+
-#if defined(CONFIG_HAS_EARLYSUSPEND ) || defined(CONFIG_ANDROID_POWER)
- rtw_unregister_early_suspend(&padapter->pwrctrlpriv);
-#endif
-+ rtw_unregister_netdevs(pdvobjpriv);
-
+-
- LeaveAllPowerSaveMode(padapter);
-
-#ifdef RTK_DMP_PLATFORM
}
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c
+new file mode 100644
+index 0000000..7d671df
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c
@@ -0,0 +1,24 @@
+
+
+
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c
+index 4a76c3f..9c92019 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c
@@ -1,7 +1,7 @@
int res=_SUCCESS;
return res;
-@@ -43,7 +43,7 @@ int rtw_os_recv_resource_init(struct rec
+@@ -43,7 +43,7 @@ int rtw_os_recv_resource_init(struct recv_priv *precvpriv, _adapter *padapter)
//alloc os related resource in union recv_frame
int rtw_os_recv_resource_alloc(_adapter *padapter, union recv_frame *precvframe)
int res=_SUCCESS;
precvframe->u.hdr.pkt_newalloc = precvframe->u.hdr.pkt = NULL;
-@@ -64,8 +64,8 @@ int rtw_os_recvbuf_resource_alloc(_adapt
+@@ -64,8 +64,8 @@ int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf)
{
int res=_SUCCESS;
struct usb_device *pusbd = pdvobjpriv->pusbdev;
precvbuf->irp_pending = _FALSE;
-@@ -85,9 +85,9 @@ int rtw_os_recvbuf_resource_alloc(_adapt
+@@ -85,9 +85,9 @@ int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf)
precvbuf->transfer_len = 0;
precvbuf->len = 0;
precvbuf->pbuf = precvbuf->pallocated_buf;
if(precvbuf->pallocated_buf == NULL)
return _FAIL;
-@@ -95,18 +95,7 @@ int rtw_os_recvbuf_resource_alloc(_adapt
+@@ -95,18 +95,7 @@ int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf)
#endif //CONFIG_USB_HCI
}
//free os related resource in struct recv_buf
-@@ -118,7 +107,7 @@ int rtw_os_recvbuf_resource_free(_adapte
+@@ -118,7 +107,7 @@ int rtw_os_recvbuf_resource_free(_adapter *padapter, struct recv_buf *precvbuf)
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
struct usb_device *pusbd = pdvobjpriv->pusbdev;
rtw_usb_buffer_free(pusbd, (size_t)precvbuf->alloc_sz, precvbuf->pallocated_buf, precvbuf->dma_transfer_addr);
-@@ -132,13 +121,13 @@ int rtw_os_recvbuf_resource_free(_adapte
+@@ -132,13 +121,13 @@ int rtw_os_recvbuf_resource_free(_adapter *padapter, struct recv_buf *precvbuf)
//usb_kill_urb(precvbuf->purb);
usb_free_urb(precvbuf->purb);
}
return ret;
-@@ -151,10 +140,10 @@ void rtw_handle_tkip_mic_err(_adapter *p
+@@ -151,10 +140,10 @@ void rtw_handle_tkip_mic_err(_adapter *padapter,u8 bgroup)
#endif
union iwreq_data wrqu;
struct iw_michaelmicfailure ev;
if( psecuritypriv->last_mic_err_time == 0 )
{
psecuritypriv->last_mic_err_time = rtw_get_current_time();
-@@ -192,11 +181,11 @@ void rtw_handle_tkip_mic_err(_adapter *p
+@@ -192,11 +181,11 @@ void rtw_handle_tkip_mic_err(_adapter *padapter,u8 bgroup)
_rtw_memset( &ev, 0x00, sizeof( ev ) );
if ( bgroup )
{
}
ev.src_addr.sa_family = ARPHRD_ETHER;
-@@ -210,47 +199,47 @@ void rtw_handle_tkip_mic_err(_adapter *p
+@@ -210,47 +199,47 @@ void rtw_handle_tkip_mic_err(_adapter *padapter,u8 bgroup)
void rtw_hostapd_mlme_rx(_adapter *padapter, union recv_frame *precv_frame)
{
struct recv_priv *precvpriv;
_queue *pfree_recv_queue;
_pkt *skb;
-@@ -265,20 +254,20 @@ int rtw_recv_indicatepkt(_adapter *padap
+@@ -265,20 +254,20 @@ int rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame)
_func_enter_;
struct recv_priv *precvpriv = &padapter->recvpriv;
#ifdef CONFIG_USB_HCI
-@@ -428,7 +414,7 @@ void rtw_os_read_port(_adapter *padapter
+@@ -428,7 +414,7 @@ void rtw_os_read_port(_adapter *padapter, struct recv_buf *precvbuf)
precvbuf->ref_cnt--;
//free skb in recv_buf
precvbuf->pskb = NULL;
precvbuf->reuse = _FALSE;
-@@ -436,8 +422,8 @@ void rtw_os_read_port(_adapter *padapter
+@@ -436,8 +422,8 @@ void rtw_os_read_port(_adapter *padapter, struct recv_buf *precvbuf)
if(precvbuf->irp_pending == _FALSE)
{
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
#endif
#ifdef CONFIG_SDIO_HCI
-@@ -457,6 +443,6 @@ void rtw_init_recv_timer(struct recv_reo
+@@ -457,6 +443,6 @@ void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
_adapter *padapter = preorder_ctrl->padapter;
_init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl);
+
}
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c
+index aceaaa7..a4bb073 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c
@@ -27,15 +27,14 @@
const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = {
"START",
-@@ -71,7 +70,11 @@ const char *android_wifi_cmd_str[ANDROID
+@@ -71,7 +70,11 @@ const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = {
"MACADDR",
"BLOCK",
/**
* Local (static) functions and variables
*/
-@@ -147,7 +155,7 @@ static int wl_android_set_pno_setup(stru
+@@ -147,7 +155,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
DHD_INFO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len));
if (total_len < (strlen(CMD_PNOSETUP_SET) + sizeof(cmd_tlv_t))) {
goto exit_proc;
}
-@@ -174,12 +182,12 @@ static int wl_android_set_pno_setup(stru
+@@ -174,12 +182,12 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
if ((nssid = wl_iw_parse_ssid_list_tlv(&str_ptr, ssids_local,
MAX_PFN_LIST_COUNT, &tlv_size_left)) <= 0) {
goto exit_proc;
}
str_ptr++;
-@@ -188,16 +196,16 @@ static int wl_android_set_pno_setup(stru
+@@ -188,16 +196,16 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
if (str_ptr[0] != 0) {
if ((str_ptr[0] != PNO_TLV_FREQ_REPEAT)) {
goto exit_proc;
}
str_ptr++;
-@@ -207,7 +215,7 @@ static int wl_android_set_pno_setup(stru
+@@ -207,7 +215,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
}
}
} else {
goto exit_proc;
}
-@@ -251,7 +259,7 @@ int rtw_android_get_link_speed(struct ne
+@@ -251,7 +259,7 @@ int rtw_android_get_link_speed(struct net_device *net, char *command, int total_
int bytes_written = 0;
u16 link_speed = 0;
bytes_written = snprintf(command, total_len, "LinkSpeed %d", link_speed);
return bytes_written;
-@@ -270,7 +278,7 @@ int rtw_android_set_country(struct net_d
+@@ -270,7 +278,7 @@ int rtw_android_set_country(struct net_device *net, char *command, int total_len
{
_adapter *adapter = (_adapter *)rtw_netdev_priv(net);
char *country_code = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_COUNTRY]) + 1;
ret = rtw_set_country(adapter, country_code);
-@@ -279,7 +287,6 @@ int rtw_android_set_country(struct net_d
+@@ -279,7 +287,6 @@ int rtw_android_set_country(struct net_device *net, char *command, int total_len
int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int total_len)
{
int bytes_written = 0;
//We use the same address as our HW MAC address
-@@ -291,7 +298,6 @@ int rtw_android_get_p2p_dev_addr(struct
+@@ -291,7 +298,6 @@ int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int tota
int rtw_android_set_block(struct net_device *net, char *command, int total_len)
{
_adapter *adapter = (_adapter *)rtw_netdev_priv(net);
char *block_value = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_BLOCK]) + 1;
-@@ -302,6 +308,45 @@ int rtw_android_set_block(struct net_dev
+@@ -302,6 +308,45 @@ int rtw_android_set_block(struct net_device *net, char *command, int total_len)
return 0;
}
int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
{
int ret = 0;
-@@ -320,14 +365,21 @@ int rtw_android_priv_cmd(struct net_devi
+@@ -320,14 +365,21 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
ret = -EFAULT;
goto exit;
}
ret = -EFAULT;
goto exit;
}
-@@ -359,10 +411,15 @@ int rtw_android_priv_cmd(struct net_devi
+@@ -359,10 +411,15 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
break;
case ANDROID_WIFI_CMD_SCAN_ACTIVE:
break;
case ANDROID_WIFI_CMD_RSSI:
-@@ -419,11 +476,11 @@ int rtw_android_priv_cmd(struct net_devi
+@@ -419,11 +476,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
break;
case ANDROID_WIFI_CMD_SETBAND:
break;
case ANDROID_WIFI_CMD_COUNTRY:
-@@ -467,6 +524,74 @@ int rtw_android_priv_cmd(struct net_devi
+@@ -467,6 +524,74 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
}
#endif //CONFIG_IOCTL_CFG80211
static int g_wifidev_registered = 0;
static struct semaphore wifi_control_sem;
-@@ -516,14 +641,14 @@ static struct resource *wifi_irqres = NU
+@@ -516,14 +641,14 @@ static struct resource *wifi_irqres = NULL;
static int wifi_add_dev(void);
static void wifi_del_dev(void);
{
if (g_wifidev_registered)
{
-@@ -552,14 +677,14 @@ void *wl_android_prealloc(int section, u
+@@ -552,14 +677,14 @@ void *wl_android_prealloc(int section, unsigned long size)
if (wifi_control_data && wifi_control_data->mem_prealloc) {
alloc_ptr = wifi_control_data->mem_prealloc(section, size);
if (alloc_ptr) {
return NULL;
}
-@@ -578,7 +703,7 @@ int wifi_get_irq_number(unsigned long *i
+@@ -578,7 +703,7 @@ int wifi_get_irq_number(unsigned long *irq_flags_ptr)
int wifi_set_power(int on, unsigned long msec)
{
if (wifi_control_data && wifi_control_data->set_power) {
wifi_control_data->set_power(on);
}
-@@ -590,7 +715,7 @@ int wifi_set_power(int on, unsigned long
+@@ -590,7 +715,7 @@ int wifi_set_power(int on, unsigned long msec)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
int wifi_get_mac_addr(unsigned char *buf)
{
if (!buf)
return -EINVAL;
if (wifi_control_data && wifi_control_data->get_mac_addr) {
-@@ -600,10 +725,10 @@ int wifi_get_mac_addr(unsigned char *buf
+@@ -600,10 +725,10 @@ int wifi_get_mac_addr(unsigned char *buf)
}
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) */
if (wifi_control_data && wifi_control_data->set_carddetect) {
wifi_control_data->set_carddetect(on);
}
-@@ -627,7 +752,7 @@ static int wifi_probe(struct platform_de
+@@ -627,7 +752,7 @@ static int wifi_probe(struct platform_device *pdev)
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcmdhd_wlan_irq");
if (wifi_irqres == NULL)
wifi_irqres = platform_get_resource_byname(pdev,
-@@ -646,7 +771,7 @@ static int wifi_remove(struct platform_d
+@@ -646,7 +771,7 @@ static int wifi_remove(struct platform_device *pdev)
struct wifi_platform_data *wifi_ctrl =
(struct wifi_platform_data *)(pdev->dev.platform_data);
wifi_control_data = wifi_ctrl;
wifi_set_power(0, 0); /* Power Off */
-@@ -658,7 +783,7 @@ static int wifi_remove(struct platform_d
+@@ -658,7 +783,7 @@ static int wifi_remove(struct platform_device *pdev)
static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
{
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY)
bcmsdh_oob_intr_set(0);
#endif
-@@ -667,7 +792,7 @@ static int wifi_suspend(struct platform_
+@@ -667,7 +792,7 @@ static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
static int wifi_resume(struct platform_device *pdev)
{
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY)
if (dhd_os_check_if_up(bcmsdh_get_drvdata()))
bcmsdh_oob_intr_set(1);
-@@ -675,6 +800,7 @@ static int wifi_resume(struct platform_d
+@@ -675,6 +800,7 @@ static int wifi_resume(struct platform_device *pdev)
return 0;
}
static struct platform_driver wifi_device = {
.probe = wifi_probe,
.remove = wifi_remove,
-@@ -697,7 +823,7 @@ static struct platform_driver wifi_devic
+@@ -697,7 +823,7 @@ static struct platform_driver wifi_device_legacy = {
static int wifi_add_dev(void)
{
-#endif /* defined(CONFIG_WIFI_CONTROL_FUNC) */
+#endif /* defined(RTW_ENABLE_WIFI_CONTROL_FUNC) */
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/sdio_intf.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/sdio_intf.c
+deleted file mode 100644
+index 52faefc..0000000
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/sdio_intf.c
+++ /dev/null
@@ -1,922 +0,0 @@
-
-module_init(r8712s_drv_entry);
-module_exit(r8712s_drv_halt);
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c
+index 2e54e74..4c1089a 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c
@@ -1,7 +1,7 @@
static int rtw_drv_init(struct usb_interface *pusb_intf,const struct usb_device_id *pdid);
-@@ -70,117 +69,142 @@ static void rtw_dev_remove(struct usb_in
+@@ -70,117 +69,142 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf);
#define USB_VENDER_ID_REALTEK 0x0BDA
+#ifndef CONFIG_RTL8192C
+ #undef RTL8192C_USB_IDS
+ #define RTL8192C_USB_IDS
-+#endif
-+#ifndef CONFIG_RTL8192D
-+ #undef RTL8192D_USB_IDS
-+ #define RTL8192D_USB_IDS
#endif
-#ifdef CONFIG_RTL8192D
- /*=== Realtek demoboard ===*/
-
- /****** 8192DU-VS ********/
- {USB_DEVICE(0x20F4, 0x664B)},//TRENDnet
-
+-
- /****** 8192DU-WiFi Display Dongle ********/
- {USB_DEVICE(0x2019, 0xAB2D)},//Planex - Abocom ,5G dongle for WiFi Display
--#endif
++#ifndef CONFIG_RTL8192D
++ #undef RTL8192D_USB_IDS
++ #define RTL8192D_USB_IDS
+ #endif
++
+
+static struct usb_device_id rtw_usb_id_tbl[] ={
+ RTL8192C_USB_IDS
int const rtw_usb_id_len = sizeof(rtw_usb_id_tbl) / sizeof(struct usb_device_id);
-@@ -189,7 +213,7 @@ static struct specific_device_id specifi
+@@ -189,7 +213,7 @@ static struct specific_device_id specific_device_id_tbl[] = {
{.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x817E, .flags=SPEC_DEV_ID_DISABLE_HT},//8188CE-VAU USB minCard (b/g mode only)
{.idVendor=0x0b05, .idProduct=0x1791, .flags=SPEC_DEV_ID_DISABLE_HT},
{.idVendor=0x13D3, .idProduct=0x3311, .flags=SPEC_DEV_ID_DISABLE_HT},
#ifdef RTK_DMP_PLATFORM
{.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x8111, .flags=SPEC_DEV_ID_ASSIGN_IFNAME}, // Realtek 5G dongle for WiFi Display
{.idVendor=0x2019, .idProduct=0xAB2D, .flags=SPEC_DEV_ID_ASSIGN_IFNAME}, // PCI-Abocom 5G dongle for WiFi Display
-@@ -197,31 +221,86 @@ static struct specific_device_id specifi
+@@ -197,31 +221,86 @@ static struct specific_device_id specific_device_id_tbl[] = {
{}
};
+ #ifdef CONFIG_AUTOSUSPEND
+ .usbdrv.supports_autosuspend = 1,
+ #endif
-+
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
+ .usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
+ #else
+ .usbdrv.driver.shutdown = rtw_dev_shutdown,
+ #endif
+};
-
++
+static struct rtw_usb_drv *usb_drv = &rtl8192c_usb_drv;
+#endif /* CONFIG_RTL8192C */
+
static inline int RT_usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
{
-@@ -263,58 +342,54 @@ static inline int RT_usb_endpoint_num(co
+@@ -263,58 +342,54 @@ static inline int RT_usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
}
struct usb_device_descriptor *pdev_desc;
struct usb_host_config *phost_conf;
struct usb_config_descriptor *pconf_desc;
-@@ -322,78 +397,78 @@ static u32 usb_dvobj_init(_adapter *pada
+@@ -322,78 +397,78 @@ static u32 usb_dvobj_init(_adapter *padapter)
struct usb_interface_descriptor *piface_desc;
struct usb_host_endpoint *phost_endp;
struct usb_endpoint_descriptor *pendp_desc;
//.3 misc
- _rtw_init_sema(&(padapter->dvobjpriv.usb_suspend_sema), 0);
+ _rtw_init_sema(&(pdvobjpriv->usb_suspend_sema), 0);
++
++ rtw_reset_continual_urb_error(pdvobjpriv);
- intf_read_chip_version(padapter);
-+ rtw_reset_continual_urb_error(pdvobjpriv);
++ usb_get_dev(pusbd);
- //.4 usb endpoint mapping
- intf_chip_configure(padapter);
-+ usb_get_dev(pusbd);
++ //DBG_871X("%s %d\n", __func__, ATOMIC_READ(&usb_intf->dev.kobj.kref.refcount));
- rtw_reset_continual_urb_error(pdvobjpriv);
-
-_func_exit_;
-+ //DBG_871X("%s %d\n", __func__, ATOMIC_READ(&usb_intf->dev.kobj.kref.refcount));
++ status = _SUCCESS;
- return status;
-+ status = _SUCCESS;
-+
+free_dvobj:
+ if (status != _SUCCESS && pdvobjpriv) {
+ usb_set_intfdata(usb_intf, NULL);
}
static void usb_intf_stop(_adapter *padapter)
-@@ -541,10 +609,7 @@ static void usb_intf_stop(_adapter *pada
+@@ -541,10 +609,7 @@ static void usb_intf_stop(_adapter *padapter)
}
//cancel in irp
//cancel out irp
rtw_write_port_cancel(padapter);
-@@ -563,9 +628,13 @@ static void rtw_dev_unload(_adapter *pad
+@@ -563,9 +628,13 @@ static void rtw_dev_unload(_adapter *padapter)
if(padapter->bup == _TRUE)
{
//s3.
if(padapter->intf_stop)
-@@ -574,20 +643,20 @@ static void rtw_dev_unload(_adapter *pad
+@@ -574,20 +643,20 @@ static void rtw_dev_unload(_adapter *padapter)
}
//s4.
{
rtw_hal_deinit(padapter);
}
-@@ -595,14 +664,16 @@ static void rtw_dev_unload(_adapter *pad
+@@ -595,14 +664,16 @@ static void rtw_dev_unload(_adapter *padapter)
}
padapter->bup = _FALSE;
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-rtw_dev_unload\n"));
-@@ -636,8 +707,8 @@ static void process_spec_devid(const str
+@@ -636,8 +707,8 @@ static void process_spec_devid(const struct usb_device_id *pdid)
if((pdid->idVendor==vid) && (pdid->idProduct==pid) && (flags&SPEC_DEV_ID_ASSIGN_IFNAME))
{
extern char* ifname;
}
#endif /* RTK_DMP_PLATFORM */
-@@ -645,29 +716,26 @@ static void process_spec_devid(const str
+@@ -645,29 +716,26 @@ static void process_spec_devid(const struct usb_device_id *pdid)
}
#ifdef SUPPORT_HW_RFOFF_DETECTED
- padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved);
- return 0;
- }
--
++ DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n",
++ padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved);
++ goto exit;
++ }
+
- DBG_8192C("########### rtw_suspend #################\n");
-
- if(padapter)//system suspend
- {
- if(pwrpriv->bInternalAutoSuspend )
-- {
++ if(pwrpriv->bInternalAutoSuspend )
++ {
++ #ifdef CONFIG_AUTOSUSPEND
++ #ifdef SUPPORT_HW_RFOFF_DETECTED
++ // The FW command register update must after MAC and FW init ready.
++ if((padapter->bFWReady) && ( padapter->pwrctrlpriv.bHWPwrPindetect ) && (padapter->registrypriv.usbss_enable ))
+ {
- #ifdef CONFIG_AUTOSUSPEND
- #ifdef SUPPORT_HW_RFOFF_DETECTED
- // The FW command register update must after MAC and FW init ready.
- }
- #endif
- #endif
-- }
++ u8 bOpen = _TRUE;
++ rtw_interface_ps_func(padapter,HAL_USB_SELECT_SUSPEND,&bOpen);
++ //rtl8192c_set_FwSelectSuspend_cmd(padapter,_TRUE ,500);//note fw to support hw power down ping detect
+ }
- pwrpriv->bInSuspend = _TRUE;
- rtw_cancel_all_timer(padapter);
- LeaveAllPowerSaveMode(padapter);
-+ DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n",
-+ padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved);
-+ goto exit;
++ #endif
++ #endif
+ }
++ pwrpriv->bInSuspend = _TRUE;
++ rtw_cancel_all_timer(padapter);
++ LeaveAllPowerSaveMode(padapter);
- _enter_pwrlock(&pwrpriv->lock);
- //padapter->net_closed = _TRUE;
- //s1.
- if(pnetdev)
-+ if(pwrpriv->bInternalAutoSuspend )
-+ {
-+ #ifdef CONFIG_AUTOSUSPEND
-+ #ifdef SUPPORT_HW_RFOFF_DETECTED
-+ // The FW command register update must after MAC and FW init ready.
-+ if((padapter->bFWReady) && ( padapter->pwrctrlpriv.bHWPwrPindetect ) && (padapter->registrypriv.usbss_enable ))
- {
+- {
- netif_carrier_off(pnetdev);
- netif_stop_queue(pnetdev);
-+ u8 bOpen = _TRUE;
-+ rtw_interface_ps_func(padapter,HAL_USB_SELECT_SUSPEND,&bOpen);
-+ //rtl8192c_set_FwSelectSuspend_cmd(padapter,_TRUE ,500);//note fw to support hw power down ping detect
- }
-+ #endif
-+ #endif
-+ }
-+ pwrpriv->bInSuspend = _TRUE;
-+ rtw_cancel_all_timer(padapter);
-+ LeaveAllPowerSaveMode(padapter);
-+
+- }
+ rtw_stop_cmd_thread(padapter);
+
+ _enter_pwrlock(&pwrpriv->lock);
_adapter *padapter = NULL;
- struct dvobj_priv *pdvobjpriv;
- struct net_device *pnetdev;
--
++ struct net_device *pnetdev = NULL;
++ int status = _FAIL;
+
- RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n"));
- //DBG_8192C("+rtw_drv_init\n");
-
- // 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));
-+ struct net_device *pnetdev = NULL;
-+ int status = _FAIL;
-
+-
- //step 0.
- process_spec_devid(pdid);
-
- pdvobjpriv->padapter = padapter;
- pdvobjpriv->pusbintf = pusb_intf ;
- pdvobjpriv->pusbdev = interface_to_usbdev(pusb_intf);
-
+-
-#ifdef CONFIG_IOCTL_CFG80211
- rtw_wdev_alloc(padapter, &pusb_intf->dev);
-#endif //CONFIG_IOCTL_CFG80211
-
-+ dvobj->padapters[dvobj->iface_nums++] = padapter;
-+ padapter->iface_id = IFACE_ID0;
- // set data
- usb_set_intfdata(pusb_intf, pnetdev);
--
++ dvobj->padapters[dvobj->iface_nums++] = padapter;
++ padapter->iface_id = IFACE_ID0;
+
- //set interface_type to usb
- padapter->interface_type = RTW_USB;
+#if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_DUALMAC_CONCURRENT)
}
#endif
#endif
-@@ -1232,101 +1262,204 @@ static int rtw_drv_init(struct usb_inter
+@@ -1232,101 +1262,204 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device
{
if(padapter->registrypriv.usbss_enable ){ /* autosuspend (2s delay) */
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,38))
+ rtw_wdev_unregister(padapter->rtw_wdev);
+ rtw_wdev_free(padapter->rtw_wdev);
+ #endif
- }
++ }
+handle_dualmac:
+ if (status != _SUCCESS)
+ rtw_handle_dualmac(padapter, 0);
+ else if (padapter)
+ rtw_vmfree((u8*)padapter, sizeof(*padapter));
+ padapter = NULL;
-+ }
+ }
+exit:
+ return padapter;
+}
- rtd2885_wlan_netlink_sendMsg("linkup", "8712");
+ DBG_871X("wlan link down\n");
+ rtd2885_wlan_netlink_sendMsg("linkdown", "8712");
-+#endif
-+
+ #endif
+
+}
+
+/*
+ }
+ }
+#endif //CONFIG_MULTI_VIR_IFACES
- #endif
-
++#endif
++
+#ifdef CONFIG_INTEL_PROXIM
+ rtw_sw_export=if1;
+#endif
_func_exit_;
- usb_set_intfdata(pusb_intf, NULL);
-+ DBG_871X("+rtw_dev_remove\n");
-+ RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+dev_remove()\n"));
-
+-
- if(padapter)
- {
-+ dvobj->processing_dev_remove = _TRUE;
-
+-
-#ifdef CONFIG_IOCTL_CFG80211
- struct wireless_dev *wdev = padapter->rtw_wdev;
-#endif //CONFIG_IOCTL_CFG80211
- rtw_unregister_early_suspend(&padapter->pwrctrlpriv);
-#endif
- LeaveAllPowerSaveMode(padapter);
-+ rtw_unregister_netdevs(dvobj);
++ DBG_871X("+rtw_dev_remove\n");
++ RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+dev_remove()\n"));
- if(check_fwstate(pmlmepriv, _FW_LINKED))
- disconnect_hdl(padapter, NULL);
--
++ dvobj->processing_dev_remove = _TRUE;
+
- if(drvpriv.drv_registered == _TRUE)
- {
- //DBG_8192C("r871xu_dev_remove():padapter->bSurpriseRemoved == _TRUE\n");
- //DBG_8192C("r871xu_dev_remove():module removed\n");
- padapter->hw_init_completed = _FALSE;
- }*/
--
++ rtw_unregister_netdevs(dvobj);
+
-#ifdef CONFIG_AP_MODE
- free_mlme_ap_info(padapter);
-#ifdef CONFIG_HOSTAPD_MLME
tmp |= 0x55;
writel(tmp,(volatile unsigned int*)0xb801a608);//write dummy register for 1055
#endif
--
+#ifdef CONFIG_PLATFORM_ARM_SUNxI
+#ifndef CONFIG_RTL8723A
+ int ret = 0;
+ printk("ERR: script_get_item wifi_usbc_id failed\n");
+ return -ENOMEM;
+ }
-+
+
+ printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
+ wifi_pm_power(1);
+ mdelay(10);
_adapter *rtw_usb_get_sw_pointer(void)
{
return rtw_sw_export;
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c
+new file mode 100644
+index 0000000..f54cfb4
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c
@@ -0,0 +1,649 @@
+ }
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c b/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c
+index 02eec93..9105e29 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c
@@ -16,7 +16,7 @@
#define _XMIT_OSDEP_C_
#include <drv_conf.h>
-@@ -98,11 +98,11 @@ void rtw_set_tx_chksum_offload(_pkt *pkt
+@@ -98,11 +98,11 @@ void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib)
const struct iphdr *ip = ip_hdr(skb);
if (ip->protocol == IPPROTO_TCP) {
// TCP checksum offload by HW
#if 1
skb_checksum_help(skb);
#else
-@@ -111,12 +111,12 @@ void rtw_set_tx_chksum_offload(_pkt *pkt
+@@ -111,12 +111,12 @@ void rtw_set_tx_chksum_offload(_pkt *pkt, struct pkt_attrib *pattrib)
udp->check = 0;
#endif
} else {
skb_checksum_help(skb);
}
}
-@@ -128,11 +128,11 @@ int rtw_os_xmit_resource_alloc(_adapter
+@@ -128,11 +128,11 @@ int rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_buf *pxmitbuf,u32
{
#ifdef CONFIG_USB_HCI
int i;
pxmitbuf->pbuf = pxmitbuf->pallocated_buf;
if(pxmitbuf->pallocated_buf == NULL)
return _FAIL;
-@@ -154,13 +154,13 @@ int rtw_os_xmit_resource_alloc(_adapter
+@@ -154,13 +154,13 @@ int rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_buf *pxmitbuf,u32
pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
if(pxmitbuf->pxmit_urb[i] == NULL)
{
pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
if (pxmitbuf->pallocated_buf == NULL)
{
-@@ -177,7 +177,7 @@ void rtw_os_xmit_resource_free(_adapter
+@@ -177,7 +177,7 @@ void rtw_os_xmit_resource_free(_adapter *padapter, struct xmit_buf *pxmitbuf,u32
{
#ifdef CONFIG_USB_HCI
int i;
struct usb_device *pusbd = pdvobjpriv->pusbdev;
-@@ -193,14 +193,14 @@ void rtw_os_xmit_resource_free(_adapter
+@@ -193,14 +193,14 @@ void rtw_os_xmit_resource_free(_adapter *padapter, struct xmit_buf *pxmitbuf,u32
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_TX
rtw_usb_buffer_free(pusbd, (size_t)free_sz, pxmitbuf->pallocated_buf, pxmitbuf->dma_transfer_addr);
pxmitbuf->pallocated_buf = NULL;
if(pxmitbuf->pallocated_buf)
rtw_mfree(pxmitbuf->pallocated_buf, free_sz);
#endif
-@@ -208,39 +208,58 @@ void rtw_os_xmit_resource_free(_adapter
+@@ -208,39 +208,58 @@ void rtw_os_xmit_resource_free(_adapter *padapter, struct xmit_buf *pxmitbuf,u32
void rtw_os_pkt_complete(_adapter *padapter, _pkt *pkt)
{
}
-@@ -254,6 +273,12 @@ int rtw_mlcst2unicst(_adapter *padapter,
+@@ -254,6 +273,12 @@ int rtw_mlcst2unicst(_adapter *padapter, struct sk_buff *skb)
_list *phead, *plist;
struct sk_buff *newskb;
struct sta_info *psta = NULL;
s32 res;
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-@@ -261,45 +286,54 @@ int rtw_mlcst2unicst(_adapter *padapter,
+@@ -261,45 +286,54 @@ int rtw_mlcst2unicst(_adapter *padapter, struct sk_buff *skb)
plist = get_next(phead);
//free sta asoc_queue
{
_adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev);
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-@@ -308,7 +342,9 @@ int rtw_xmit_entry(_pkt *pkt, _nic_hdl p
+@@ -308,7 +342,9 @@ int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
extern int rtw_mc2u_disable;
#endif // CONFIG_TX_MCAST2UNI
s32 res = 0;
+ return _rtw_xmit_entry(pkt, pnetdev);
+}
+
+diff --git a/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c b/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c
+index 343cd82..e73a068 100644
--- a/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c
+++ b/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c
@@ -25,8 +25,13 @@
#ifdef RTK_DMP_PLATFORM
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
#include <linux/pageremap.h>
-@@ -66,6 +71,27 @@ inline int RTW_STATUS_CODE(int error_cod
+@@ -66,6 +71,27 @@ inline int RTW_STATUS_CODE(int error_code){
}
#endif
#ifdef PLATFORM_WINDOWS
NdisAllocateMemoryWithTag(&pbuf,sz, RT_TAG);
if (pbuf != NULL)
-@@ -113,7 +144,9 @@ inline void _rtw_vmfree(u8 *pbuf, u32 sz
+@@ -113,7 +144,9 @@ inline void _rtw_vmfree(u8 *pbuf, u32 sz)
#ifdef PLATFORM_LINUX
vfree(pbuf);
#endif
+ skb->end = (unsigned char*)data + size;
+ skb->len = 0;
+ //printf("%s()-%d: skb=%p, skb->head = %p\n", __FUNCTION__, __LINE__, skb, skb->head);
-+
+
+-#ifdef DBG_MEM_ALLOC
+out:
+ return skb;
+nodata:
+ return skb_clone(skb);
+#endif /* PLATFORM_FREEBSD */
+}
-+
+
+-struct rtw_dbg_mem_stat {
+- ATOMIC_T vir_alloc; // the memory bytes we allocate now
+- ATOMIC_T vir_peak; // the peak memory bytes we allocate
+- ATOMIC_T vir_alloc_err; // the error times we fail to allocate memory
+inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
+{
+#ifdef PLATFORM_LINUX
+ return usb_buffer_alloc(dev, size, (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL), dma);
+#endif
+#endif /* PLATFORM_LINUX */
-+
+
+- ATOMIC_T phy_alloc;
+- ATOMIC_T phy_peak;
+- ATOMIC_T phy_alloc_err;
+-} rtw_dbg_mem_stat;
+-
+-enum {
+- MEM_STAT_VIR_ALLOC_SUCCESS,
+- MEM_STAT_VIR_ALLOC_FAIL,
+- MEM_STAT_VIR_FREE,
+- MEM_STAT_PHY_ALLOC_SUCCESS,
+- MEM_STAT_PHY_ALLOC_FAIL,
+- MEM_STAT_PHY_FREE
+#ifdef PLATFORM_FREEBSD
+ return (malloc(size, M_USBDEV, M_NOWAIT | M_ZERO));
+#endif /* PLATFORM_FREEBSD */
+#endif /* PLATFORM_FREEBSD */
+}
+#endif /* CONFIG_USB_HCI */
-
- #ifdef DBG_MEM_ALLOC
-
--struct rtw_dbg_mem_stat {
-- ATOMIC_T vir_alloc; // the memory bytes we allocate now
-- ATOMIC_T vir_peak; // the peak memory bytes we allocate
-- ATOMIC_T vir_alloc_err; // the error times we fail to allocate memory
--
-- ATOMIC_T phy_alloc;
-- ATOMIC_T phy_peak;
-- ATOMIC_T phy_alloc_err;
--} rtw_dbg_mem_stat;
--
--enum {
-- MEM_STAT_VIR_ALLOC_SUCCESS,
-- MEM_STAT_VIR_ALLOC_FAIL,
-- MEM_STAT_VIR_FREE,
-- MEM_STAT_PHY_ALLOC_SUCCESS,
-- MEM_STAT_PHY_ALLOC_FAIL,
-- MEM_STAT_PHY_FREE
++
++#ifdef DBG_MEM_ALLOC
++
+struct rtw_mem_stat {
+ ATOMIC_T alloc; // the memory bytes we allocate currently
+ ATOMIC_T peak; // the peak memory bytes we allocate
+ ATOMIC_T alloc_cnt; // the alloc count for alloc currently
+ ATOMIC_T alloc_err_cnt; // the error times we fail to allocate memory
-+};
-+
+ };
+
+-void rtw_dump_mem_stat (void)
+struct rtw_mem_stat rtw_mem_type_stat[mstat_tf_idx(MSTAT_TYPE_MAX)];
+struct rtw_mem_stat rtw_mem_func_stat[mstat_ff_idx(MSTAT_FUNC_MAX)];
+
+ "PHY",
+ "SKB",
+ "USB",
- };
-
--void rtw_dump_mem_stat (void)
++};
++
+char *MSTAT_FUNC_str[] = {
+ "UNSP",
+ "IO",
- vir_alloc=ATOMIC_READ(&rtw_dbg_mem_stat.vir_alloc);
- vir_peak=ATOMIC_READ(&rtw_dbg_mem_stat.vir_peak);
- vir_alloc_err=ATOMIC_READ(&rtw_dbg_mem_stat.vir_alloc_err);
--
++ int vir_alloc, vir_peak, vir_alloc_err, phy_alloc, phy_peak, phy_alloc_err;
++ int tx_alloc, tx_peak, tx_alloc_err, rx_alloc, rx_peak, rx_alloc_err;
+
- phy_alloc=ATOMIC_READ(&rtw_dbg_mem_stat.phy_alloc);
- phy_peak=ATOMIC_READ(&rtw_dbg_mem_stat.phy_peak);
- phy_alloc_err=ATOMIC_READ(&rtw_dbg_mem_stat.phy_alloc_err);
--
-- DBG_871X("vir_alloc:%d, vir_peak:%d,vir_alloc_err:%d, phy_alloc:%d, phy_peak:%d, phy_alloc_err:%d\n"
-- , vir_alloc, vir_peak, vir_alloc_err
-- , phy_alloc, phy_peak, phy_alloc_err
-- );
-+ int vir_alloc, vir_peak, vir_alloc_err, phy_alloc, phy_peak, phy_alloc_err;
-+ int tx_alloc, tx_peak, tx_alloc_err, rx_alloc, rx_peak, rx_alloc_err;
-+
+ for(i=0;i<mstat_tf_idx(MSTAT_TYPE_MAX);i++) {
+ value_t[0][i] = ATOMIC_READ(&(rtw_mem_type_stat[i].alloc));
+ value_t[1][i] = ATOMIC_READ(&(rtw_mem_type_stat[i].peak));
+ value_t[2][i] = ATOMIC_READ(&(rtw_mem_type_stat[i].alloc_cnt));
+ value_t[3][i] = ATOMIC_READ(&(rtw_mem_type_stat[i].alloc_err_cnt));
+ }
-+
+
+- DBG_871X("vir_alloc:%d, vir_peak:%d,vir_alloc_err:%d, phy_alloc:%d, phy_peak:%d, phy_alloc_err:%d\n"
+- , vir_alloc, vir_peak, vir_alloc_err
+- , phy_alloc, phy_peak, phy_alloc_err
+- );
+ #if 0
+ for(i=0;i<mstat_ff_idx(MSTAT_FUNC_MAX);i++) {
+ value_f[0][i] = ATOMIC_READ(&(rtw_mem_func_stat[i].alloc));
+ #endif
+
+ return cnt;
- }
-
--void rtw_update_mem_stat(u8 flag, u32 sz)
++}
++
+void rtw_mstat_dump(void)
+{
+ char buf[768] = {0};
+
+ _rtw_mstat_dump(buf, 768);
+ DBG_871X("\n%s", buf);
-+}
-+
+ }
+
+-void rtw_update_mem_stat(u8 flag, u32 sz)
+void rtw_mstat_update(const enum mstat_f flags, const MSTAT_STATUS status, u32 sz)
{
static u32 update_time = 0;
#ifdef PLATFORM_WINDOWS
NdisMoveMemory(dst, src, sz);
-@@ -417,7 +810,7 @@ void _rtw_memcpy(void* dst, void* src, u
+@@ -417,7 +810,7 @@ void _rtw_memcpy(void* dst, void* src, u32 sz)
int _rtw_memcmp(void *dst, void *src, u32 sz)
{
//under Linux/GNU/GLibc, the return value of memcmp for two same mem. chunk is 0
if (!(memcmp(dst, src, sz)))
-@@ -444,7 +837,7 @@ int _rtw_memcmp(void *dst, void *src, u3
+@@ -444,7 +837,7 @@ int _rtw_memcmp(void *dst, void *src, u32 sz)
void _rtw_memset(void *pbuf, int c, u32 sz)
{
memset(pbuf, c, sz);
-@@ -461,6 +854,16 @@ void _rtw_memset(void *pbuf, int c, u32
+@@ -461,6 +854,16 @@ void _rtw_memset(void *pbuf, int c, u32 sz)
}
void rtw_list_insert_tail(_list *plist, _list *phead)
{
-@@ -518,7 +948,11 @@ void rtw_list_insert_tail(_list *plist,
+@@ -518,7 +948,11 @@ void rtw_list_insert_tail(_list *plist, _list *phead)
list_add_tail(plist, phead);
#endif
#ifdef PLATFORM_WINDOWS
InsertTailList(phead, plist);
-@@ -543,7 +977,9 @@ void _rtw_init_sema(_sema *sema, int ini
+@@ -543,7 +977,9 @@ void _rtw_init_sema(_sema *sema, int init_val)
sema_init(sema, init_val);
#endif
#ifdef PLATFORM_OS_XP
KeInitializeSemaphore(sema, init_val, SEMA_UPBND); // count=0;
-@@ -559,7 +995,9 @@ void _rtw_init_sema(_sema *sema, int ini
+@@ -559,7 +995,9 @@ void _rtw_init_sema(_sema *sema, int init_val)
void _rtw_free_sema(_sema *sema)
{
#endif
}
-@@ -814,7 +1315,9 @@ inline s32 rtw_get_passing_time_ms(u32 s
+@@ -814,7 +1315,9 @@ inline s32 rtw_get_passing_time_ms(u32 start)
#ifdef PLATFORM_LINUX
return rtw_systime_to_ms(jiffies-start);
#endif
#ifdef PLATFORM_WINDOWS
LARGE_INTEGER SystemTime;
NdisGetCurrentSystemTime(&SystemTime);
-@@ -827,7 +1330,9 @@ inline s32 rtw_get_time_interval_ms(u32
+@@ -827,7 +1330,9 @@ inline s32 rtw_get_time_interval_ms(u32 start, u32 end)
#ifdef PLATFORM_LINUX
return rtw_systime_to_ms(end-start);
#endif
#define RTW_SUSPEND_LOCK_NAME "rtw_wifi"
#ifdef CONFIG_WAKELOCK
-@@ -1001,29 +1539,15 @@ static android_suspend_lock_t rtw_suspen
+@@ -1001,29 +1539,15 @@ static android_suspend_lock_t rtw_suspend_lock ={
inline void rtw_suspend_lock_init()
{
inline void ATOMIC_SET(ATOMIC_T *v, int i)
{
-@@ -1074,6 +1588,8 @@ inline void ATOMIC_SET(ATOMIC_T *v, int
+@@ -1074,6 +1588,8 @@ inline void ATOMIC_SET(ATOMIC_T *v, int i)
atomic_set(v,i);
#elif defined(PLATFORM_WINDOWS)
*v=i;// other choice????
#endif
}
-@@ -1092,6 +1610,8 @@ inline void ATOMIC_ADD(ATOMIC_T *v, int
+@@ -1092,6 +1610,8 @@ inline void ATOMIC_ADD(ATOMIC_T *v, int i)
atomic_add(i,v);
#elif defined(PLATFORM_WINDOWS)
InterlockedAdd(v,i);
#endif
}
inline void ATOMIC_SUB(ATOMIC_T *v, int i)
-@@ -1100,6 +1620,8 @@ inline void ATOMIC_SUB(ATOMIC_T *v, int
+@@ -1100,6 +1620,8 @@ inline void ATOMIC_SUB(ATOMIC_T *v, int i)
atomic_sub(i,v);
#elif defined(PLATFORM_WINDOWS)
InterlockedAdd(v,-i);
#endif
}
-@@ -1127,6 +1653,9 @@ inline int ATOMIC_ADD_RETURN(ATOMIC_T *v
+@@ -1127,6 +1653,9 @@ inline int ATOMIC_ADD_RETURN(ATOMIC_T *v, int i)
return atomic_add_return(i,v);
#elif defined(PLATFORM_WINDOWS)
return InterlockedAdd(v,i);
#endif
}
-@@ -1136,6 +1665,9 @@ inline int ATOMIC_SUB_RETURN(ATOMIC_T *v
+@@ -1136,6 +1665,9 @@ inline int ATOMIC_SUB_RETURN(ATOMIC_T *v, int i)
return atomic_sub_return(i,v);
#elif defined(PLATFORM_WINDOWS)
return InterlockedAdd(v,-i);
#endif
}
-@@ -1145,6 +1677,9 @@ inline int ATOMIC_INC_RETURN(ATOMIC_T *v
+@@ -1145,6 +1677,9 @@ inline int ATOMIC_INC_RETURN(ATOMIC_T *v)
return atomic_inc_return(v);
#elif defined(PLATFORM_WINDOWS)
return InterlockedIncrement(v);
#endif
}
-@@ -1154,6 +1689,9 @@ inline int ATOMIC_DEC_RETURN(ATOMIC_T *v
+@@ -1154,6 +1689,9 @@ inline int ATOMIC_DEC_RETURN(ATOMIC_T *v)
return atomic_dec_return(v);
#elif defined(PLATFORM_WINDOWS)
return InterlockedDecrement(v);
#endif
}
-@@ -1278,20 +1816,20 @@ static int retriveFromFile(char *path, u
+@@ -1278,20 +1816,20 @@ static int retriveFromFile(char *path, u8* buf, u32 sz)
if(path && buf) {
if( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){
ret = -EINVAL;
}
return ret;
-@@ -1312,20 +1850,20 @@ static int storeToFile(char *path, u8* b
+@@ -1312,20 +1850,20 @@ static int storeToFile(char *path, u8* buf, u32 sz)
if(path && buf) {
if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) {
ret = -EINVAL;
}
return ret;
-@@ -1392,8 +1930,12 @@ struct net_device *rtw_alloc_etherdev_wi
+@@ -1392,8 +1930,12 @@ struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_p
{
struct net_device *pnetdev;
struct rtw_netdev_priv_indicator *pnpi;
if (!pnetdev)
goto RETURN;
-@@ -1409,8 +1951,12 @@ struct net_device *rtw_alloc_etherdev(in
+@@ -1409,8 +1951,12 @@ struct net_device *rtw_alloc_etherdev(int sizeof_priv)
{
struct net_device *pnetdev;
struct rtw_netdev_priv_indicator *pnpi;
if (!pnetdev)
goto RETURN;
-@@ -1476,9 +2022,7 @@ int rtw_change_ifname(_adapter *padapter
+@@ -1476,9 +2022,7 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname)
#endif
unregister_netdevice(cur_pnetdev);
rereg_priv->old_pnetdev=cur_pnetdev;
-@@ -1488,21 +2032,7 @@ int rtw_change_ifname(_adapter *padapter
+@@ -1488,21 +2032,7 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname)
goto error;
}
rtw_init_netdev_name(pnetdev, ifname);
-@@ -1520,9 +2050,7 @@ int rtw_change_ifname(_adapter *padapter
+@@ -1520,9 +2050,7 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname)
goto error;
}
}
-#endif
+diff --git a/drivers/net/wireless/rtl8192cu/runwpa b/drivers/net/wireless/rtl8192cu/runwpa
+new file mode 100755
+index 0000000..f825e8b
--- /dev/null
+++ b/drivers/net/wireless/rtl8192cu/runwpa
@@ -0,0 +1,20 @@
+fi
+
+
+diff --git a/drivers/net/wireless/rtl8192cu/wlan0dhcp b/drivers/net/wireless/rtl8192cu/wlan0dhcp
+old mode 100644
+new mode 100755
+--
+1.9.1
+