2 ** $Id: @(#) gl_cfg80211.c@@
5 /*! \file gl_cfg80211.c
6 \brief Main routines for supporintg MT6620 cfg80211 control interface
8 This file contains the support routines of Linux driver for MediaTek Inc. 802.11
15 ** $Log: gl_cfg80211.c $
18 ** correct length to pass to wlanoidSetBssid()
24 ** add path for reassociation
26 ** 11 23 2012 yuche.tsai
27 ** [ALPS00398671] [Acer-Tablet] Remove Wi-Fi Direct completely
28 ** Fix bug of WiFi may reboot under user load, when WiFi Direct is removed..
30 ** 09 12 2012 wcpadmin
31 ** [ALPS00276400] Remove MTK copyright and legal header on GPL/LGPL related packages
34 ** 08 30 2012 chinglan.wang
35 ** [ALPS00349664] [6577JB][WIFI] Phone can not connect to AP secured with AES via WPS in 802.11n Only
41 /*******************************************************************************
42 * C O M P I L E R F L A G S
43 ********************************************************************************
46 /*******************************************************************************
47 * E X T E R N A L R E F E R E N C E S
48 ********************************************************************************
55 #include <linux/can/netlink.h>
56 #include <net/netlink.h>
57 #include <net/cfg80211.h>
58 #include "gl_cfg80211.h"
60 /*******************************************************************************
62 ********************************************************************************
65 /*******************************************************************************
67 ********************************************************************************
70 /*******************************************************************************
72 ********************************************************************************
76 extern UINT_8 keyStructBuf
[1024]; /* add/remove key shared buffer */
78 extern UINT_8 keyStructBuf
[100]; /* add/remove key shared buffer */
80 /* workaround for some ANR CRs. if suppliant is blocked longer than 10s, wifi hal will tell wifiMonitor
81 to teminate. for the case which can block supplicant 10s is to del key more than 5 times. the root cause
82 is that there is no resource in TC4, so del key command was not able to set, and then oid
83 timeout was happed. if we found the root cause why fw couldn't release TC resouce, we will remove this
85 static UINT_8 gucKeyIndex
= 255;
87 /*******************************************************************************
88 * P R I V A T E D A T A
89 ********************************************************************************
92 /*******************************************************************************
94 ********************************************************************************
97 /*******************************************************************************
98 * F U N C T I O N D E C L A R A T I O N S
99 ********************************************************************************
101 extern void wlanHandleSystemResume(void);
102 extern void wlanHandleSystemSuspend(void);
103 extern void p2pHandleSystemResume(void);
104 extern void p2pHandleSystemSuspend(void);
106 /*******************************************************************************
108 ********************************************************************************
111 /*----------------------------------------------------------------------------*/
113 * @brief This routine is responsible for change STA type between
114 * 1. Infrastructure Client (Non-AP STA)
119 * @retval 0: successful
122 /*----------------------------------------------------------------------------*/
124 mtk_cfg80211_change_iface (
126 struct net_device
*ndev
,
127 enum nl80211_iftype type
,
129 struct vif_params
*params
132 P_GLUE_INFO_T prGlueInfo
= NULL
;
133 WLAN_STATUS rStatus
= WLAN_STATUS_SUCCESS
;
134 ENUM_PARAM_OP_MODE_T eOpMode
;
137 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
140 if(type
== NL80211_IFTYPE_STATION
) {
141 eOpMode
= NET_TYPE_INFRA
;
143 else if(type
== NL80211_IFTYPE_ADHOC
) {
144 eOpMode
= NET_TYPE_IBSS
;
150 rStatus
= kalIoctl(prGlueInfo
,
151 wlanoidSetInfrastructureMode
,
160 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
161 DBGLOG(REQ
, WARN
, ("set infrastructure mode error:%x\n", rStatus
));
165 prGlueInfo
->rWpaInfo
.u4WpaVersion
= IW_AUTH_WPA_VERSION_DISABLED
;
166 prGlueInfo
->rWpaInfo
.u4KeyMgmt
= 0;
167 prGlueInfo
->rWpaInfo
.u4CipherGroup
= IW_AUTH_CIPHER_NONE
;
168 prGlueInfo
->rWpaInfo
.u4CipherPairwise
= IW_AUTH_CIPHER_NONE
;
169 prGlueInfo
->rWpaInfo
.u4AuthAlg
= IW_AUTH_ALG_OPEN_SYSTEM
;
170 #if CFG_SUPPORT_802_11W
171 prGlueInfo
->rWpaInfo
.u4Mfp
= IW_AUTH_MFP_DISABLED
;
178 /*----------------------------------------------------------------------------*/
180 * @brief This routine is responsible for adding key
184 * @retval 0: successful
187 /*----------------------------------------------------------------------------*/
189 mtk_cfg80211_add_key (
191 struct net_device
*ndev
,
195 struct key_params
*params
199 P_GLUE_INFO_T prGlueInfo
= NULL
;
200 WLAN_STATUS rStatus
= WLAN_STATUS_SUCCESS
;
201 INT_32 i4Rslt
= -EINVAL
;
202 UINT_32 u4BufLen
= 0;
206 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
209 kalMemZero(&rKey
, sizeof(PARAM_KEY_T
));
211 rKey
.u4KeyIndex
= key_index
;
214 COPY_MAC_ADDR(rKey
.arBSSID
, mac_addr
);
215 if ((rKey
.arBSSID
[0] == 0x00) && (rKey
.arBSSID
[1] == 0x00) && (rKey
.arBSSID
[2] == 0x00) &&
216 (rKey
.arBSSID
[3] == 0x00) && (rKey
.arBSSID
[4] == 0x00) && (rKey
.arBSSID
[5] == 0x00)) {
217 rKey
.arBSSID
[0] = 0xff;
218 rKey
.arBSSID
[1] = 0xff;
219 rKey
.arBSSID
[2] = 0xff;
220 rKey
.arBSSID
[3] = 0xff;
221 rKey
.arBSSID
[4] = 0xff;
222 rKey
.arBSSID
[5] = 0xff;
224 if (rKey
.arBSSID
[0] != 0xFF) {
225 rKey
.u4KeyIndex
|= BIT(31);
226 if ((rKey
.arBSSID
[0] != 0x00) || (rKey
.arBSSID
[1] != 0x00) || (rKey
.arBSSID
[2] != 0x00) ||
227 (rKey
.arBSSID
[3] != 0x00) || (rKey
.arBSSID
[4] != 0x00) || (rKey
.arBSSID
[5] != 0x00))
228 rKey
.u4KeyIndex
|= BIT(30);
232 rKey
.arBSSID
[0] = 0xff;
233 rKey
.arBSSID
[1] = 0xff;
234 rKey
.arBSSID
[2] = 0xff;
235 rKey
.arBSSID
[3] = 0xff;
236 rKey
.arBSSID
[4] = 0xff;
237 rKey
.arBSSID
[5] = 0xff;
238 //rKey.u4KeyIndex |= BIT(31); //Enable BIT 31 will make tx use bc key id, should use pairwise key id 0
242 //rKey.aucKeyMaterial[0] = kalMemAlloc(params->key_len, VIR_MEM_TYPE);
243 kalMemCopy(rKey
.aucKeyMaterial
, params
->key
, params
->key_len
);
244 if (params
->key_len
== 32) {
245 kalMemCopy(tmp1
, ¶ms
->key
[16], 8);
246 kalMemCopy(tmp2
, ¶ms
->key
[24], 8);
247 kalMemCopy(&rKey
.aucKeyMaterial
[16], tmp2
, 8);
248 kalMemCopy(&rKey
.aucKeyMaterial
[24], tmp1
, 8);
252 rKey
.u4KeyLength
= params
->key_len
;
253 rKey
.u4Length
= ((ULONG
)&(((P_P2P_PARAM_KEY_T
)0)->aucKeyMaterial
)) + rKey
.u4KeyLength
;
255 rStatus
= kalIoctl(prGlueInfo
,
265 if (rStatus
== WLAN_STATUS_SUCCESS
)
272 /*----------------------------------------------------------------------------*/
274 * @brief This routine is responsible for getting key for specified STA
278 * @retval 0: successful
281 /*----------------------------------------------------------------------------*/
283 mtk_cfg80211_get_key (
285 struct net_device
*ndev
,
290 void (*callback
)(void *cookie
, struct key_params
*)
293 P_GLUE_INFO_T prGlueInfo
= NULL
;
295 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
299 printk("--> %s()\n", __func__
);
302 /* not implemented */
308 /*----------------------------------------------------------------------------*/
310 * @brief This routine is responsible for removing key for specified STA
314 * @retval 0: successful
317 /*----------------------------------------------------------------------------*/
319 mtk_cfg80211_del_key (
321 struct net_device
*ndev
,
327 P_GLUE_INFO_T prGlueInfo
= NULL
;
328 WLAN_STATUS rStatus
= WLAN_STATUS_SUCCESS
;
329 PARAM_REMOVE_KEY_T rRemoveKey
;
330 UINT_32 u4BufLen
= 0;
331 INT_32 i4Rslt
= -EINVAL
;
333 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
336 kalMemZero(&rRemoveKey
, sizeof(PARAM_REMOVE_KEY_T
));
338 COPY_MAC_ADDR(rRemoveKey
.arBSSID
, mac_addr
);
339 else if (key_index
> gucKeyIndex
) {/* bypass the next remove key operation */
340 gucKeyIndex
= key_index
;
343 else /* new operation, reset gucKeyIndex */
345 rRemoveKey
.u4KeyIndex
= key_index
;
346 rRemoveKey
.u4Length
= sizeof(PARAM_REMOVE_KEY_T
);
349 rStatus
= kalIoctl(prGlueInfo
,
359 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
360 DBGLOG(REQ
, WARN
, ("remove key error:%x\n", rStatus
));
361 if (WLAN_STATUS_FAILURE
== rStatus
&& mac_addr
) {
363 gucKeyIndex
= key_index
;
375 /*----------------------------------------------------------------------------*/
377 * @brief This routine is responsible for setting default key on an interface
381 * @retval 0: successful
384 /*----------------------------------------------------------------------------*/
386 mtk_cfg80211_set_default_key (
388 struct net_device
*ndev
,
394 P_GLUE_INFO_T prGlueInfo
= NULL
;
396 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
400 printk("--> %s()\n", __func__
);
403 /* not implemented */
405 return WLAN_STATUS_SUCCESS
;
409 /*----------------------------------------------------------------------------*/
411 * @brief This routine is responsible for setting set_default_mgmt_ke on an interface
415 * @retval 0: successful
418 /*----------------------------------------------------------------------------*/
420 mtk_cfg80211_set_default_mgmt_key(
422 struct net_device
*netdev
,
430 /*----------------------------------------------------------------------------*/
432 * @brief This routine is responsible for getting station information such as RSSI
436 * @retval 0: successful
439 /*----------------------------------------------------------------------------*/
442 mtk_cfg80211_get_station (
444 struct net_device
*ndev
,
446 struct station_info
*sinfo
449 P_GLUE_INFO_T prGlueInfo
= NULL
;
451 PARAM_MAC_ADDRESS arBssid
;
452 UINT_32 u4BufLen
, u4Rate
;
453 UINT_32 u8diffTxBad
,u8diffRetry
;
455 PARAM_802_11_STATISTICS_STRUCT_T rStatistics
;
457 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
460 kalMemZero(arBssid
, MAC_ADDR_LEN
);
461 wlanQueryInformation(prGlueInfo
->prAdapter
,
468 if(UNEQUAL_MAC_ADDR(arBssid
, mac
)) {
469 /* wrong MAC address */
470 DBGLOG(REQ
, WARN
, ("incorrect BSSID: ["MACSTR
"] currently connected BSSID["MACSTR
"]\n",
471 MAC2STR(mac
), MAC2STR(arBssid
)));
475 /* 2. fill TX rate */
476 rStatus
= kalIoctl(prGlueInfo
,
477 wlanoidQueryLinkSpeed
,
486 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
487 DBGLOG(REQ
, WARN
, ("unable to retrieve link speed\n"));
490 sinfo
->filled
|= STATION_INFO_TX_BITRATE
;
491 sinfo
->txrate
.legacy
= u4Rate
/ 1000; /* convert from 100bps to 100kbps */
494 if(prGlueInfo
->eParamMediaStateIndicated
!= PARAM_MEDIA_STATE_CONNECTED
) {
496 DBGLOG(REQ
, WARN
, ("not yet connected\n"));
500 rStatus
= kalIoctl(prGlueInfo
,
510 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
511 DBGLOG(REQ
, WARN
, ("unable to retrieve link speed\n"));
514 sinfo
->filled
|= STATION_INFO_SIGNAL
;
515 //in the cfg80211 layer, the signal is a signed char variable.
517 sinfo
->signal
= -128;
519 sinfo
->signal
= i4Rssi
; /* dBm */
521 sinfo
->rx_packets
= prGlueInfo
->rNetDevStats
.rx_packets
;
523 /* 4. Fill Tx OK and Tx Bad */
525 sinfo
->filled
|= STATION_INFO_TX_PACKETS
;
526 sinfo
->filled
|= STATION_INFO_TX_FAILED
;
529 kalMemZero(&rStatistics
, sizeof(rStatistics
));
530 /* Get Tx OK/Fail cnt from AIS statistic counter */
531 rStatus
= kalIoctl(prGlueInfo
,
532 wlanoidQueryStatisticsPL
,
541 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
542 DBGLOG(REQ
, WARN
, ("unable to retrieive statistic\n"));
543 printk("unable to retrieve statics");
546 INT_32 i4RssiThreshold
= -85; /* set rssi threshold -85dBm */
547 UINT_32 u4LinkspeedThreshold
= 55; /* set link speed threshold 5.5Mbps */
548 BOOLEAN fgWeighted
= 0;
550 /* calculate difference */
551 u8diffTxBad
= rStatistics
.rFailedCount
.QuadPart
- prGlueInfo
->u8Statistic
[0];
552 u8diffRetry
= rStatistics
.rRetryCount
.QuadPart
- prGlueInfo
->u8Statistic
[1];
553 /* restore counters */
554 prGlueInfo
->u8Statistic
[0] = rStatistics
.rFailedCount
.QuadPart
;
555 prGlueInfo
->u8Statistic
[1] = rStatistics
.rRetryCount
.QuadPart
;
557 /* check threshold is valid */
558 if(prGlueInfo
->fgPoorlinkValid
){
559 if(prGlueInfo
->i4RssiThreshold
)
560 i4RssiThreshold
= prGlueInfo
->i4RssiThreshold
;
561 if(prGlueInfo
->u4LinkspeedThreshold
)
562 u4LinkspeedThreshold
= prGlueInfo
->u4LinkspeedThreshold
;
564 /* add weighted to fail counter */
565 if(sinfo
->txrate
.legacy
< u4LinkspeedThreshold
|| sinfo
->signal
< i4RssiThreshold
){
566 prGlueInfo
->u8TotalFailCnt
+= (u8diffTxBad
*16 + u8diffRetry
);
569 prGlueInfo
->u8TotalFailCnt
+= u8diffTxBad
;
571 /* report counters */
572 prGlueInfo
->rNetDevStats
.tx_packets
= rStatistics
.rTransmittedFragmentCount
.QuadPart
;
573 prGlueInfo
->rNetDevStats
.tx_errors
= prGlueInfo
->u8TotalFailCnt
;
575 sinfo
->tx_packets
= prGlueInfo
->rNetDevStats
.tx_packets
;
576 sinfo
->tx_failed
= prGlueInfo
->rNetDevStats
.tx_errors
;
578 printk("poorlink get state G(%d)F(%d)dbad(%d)dretry(%d)LT(%d)RT(%d)W(%d)(%d)\n",
583 sinfo
->txrate
.legacy
,
586 (int)rStatistics
.rMultipleRetryCount
.QuadPart
);
595 /*----------------------------------------------------------------------------*/
597 * @brief This routine is responsible for adding a station information
601 * @retval 0: successful
604 /*----------------------------------------------------------------------------*/
606 mtk_cfg80211_change_station (
608 struct net_device
*ndev
,
610 struct station_parameters
*params
613 #if (CFG_SUPPORT_TDLS == 1)
616 (Supplicant) wpa_tdls_process_tpk_m3() ->
617 (Supplicant) wpa_tdls_enable_link() ->
618 (Supplicant) wpa_sm_tdls_peer_addset() ->
619 (Supplicant) ..tdls_peer_addset() ->
620 (Supplicant) wpa_supplicant_tdls_peer_addset() ->
621 (Supplicant) wpa_drv_sta_add() ->
622 (Supplicant) ..sta_add() ->
623 (Supplicant) wpa_driver_nl80211_sta_add() ->
624 (NL80211) nl80211_set_station() ->
625 (Driver) mtk_cfg80211_change_station()
627 if nl80211_set_station fails, supplicant will tear down the link.
629 P_GLUE_INFO_T prGlueInfo
;
630 TDLS_CMD_PEER_UPDATE_T rCmdUpdate
;
632 UINT_32 u4BufLen
, u4Temp
;
636 if ((wiphy
== NULL
) || (mac
== NULL
) || (params
== NULL
))
639 DBGLOG(TDLS
, INFO
, ("%s: 0x%p 0x%x\n",
640 __FUNCTION__
, params
->supported_rates
, params
->sta_flags_set
));
642 if (!(params
->sta_flags_set
& BIT(NL80211_STA_FLAG_TDLS_PEER
)))
645 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
646 if (prGlueInfo
== NULL
)
649 /* TODO: check if we are station mode, not AP mode */
652 kalMemZero(&rCmdUpdate
, sizeof(rCmdUpdate
));
653 kalMemCopy(rCmdUpdate
.aucPeerMac
, mac
, 6);
655 if (params
->supported_rates
!= NULL
)
657 u4Temp
= params
->supported_rates_len
;
658 if (u4Temp
> TDLS_CMD_PEER_UPDATE_SUP_RATE_MAX
)
660 u4Temp
= TDLS_CMD_PEER_UPDATE_SUP_RATE_MAX
;
661 DBGLOG(TDLS
, ERROR
, ("%s sup rate too long: %d\n",
662 __FUNCTION__
, params
->supported_rates_len
));
664 kalMemCopy(rCmdUpdate
.aucSupRate
, params
->supported_rates
, u4Temp
);
665 rCmdUpdate
.u2SupRateLen
= u4Temp
;
669 In supplicant, only recognize WLAN_EID_QOS 46, not 0xDD WMM
670 So force to support UAPSD here.
672 rCmdUpdate
.UapsdBitmap
= 0x0F; /*params->uapsd_queues;*/
673 rCmdUpdate
.UapsdMaxSp
= 0; /*params->max_sp;*/
675 DBGLOG(TDLS
, INFO
, ("%s: UapsdBitmap=0x%x UapsdMaxSp=%d\n",
676 __FUNCTION__
, rCmdUpdate
.UapsdBitmap
, rCmdUpdate
.UapsdMaxSp
));
678 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
679 rCmdUpdate
.u2Capability
= params
->capability
;
681 if (params
->ext_capab
!= NULL
)
683 u4Temp
= params
->ext_capab_len
;
684 if (u4Temp
> TDLS_CMD_PEER_UPDATE_EXT_CAP_MAXLEN
)
686 u4Temp
= TDLS_CMD_PEER_UPDATE_EXT_CAP_MAXLEN
;
687 DBGLOG(TDLS
, ERROR
, ("%s ext_capab too long: %d\n",
688 __FUNCTION__
, params
->ext_capab_len
));
690 kalMemCopy(rCmdUpdate
.aucExtCap
, params
->ext_capab
, u4Temp
);
691 rCmdUpdate
.u2ExtCapLen
= u4Temp
;
695 if (params
->ht_capa
!= NULL
)
697 DBGLOG(TDLS
, INFO
, ("%s: peer is 11n device\n",
700 rCmdUpdate
.rHtCap
.u2CapInfo
= params
->ht_capa
->cap_info
;
701 rCmdUpdate
.rHtCap
.ucAmpduParamsInfo
= params
->ht_capa
->ampdu_params_info
;
702 rCmdUpdate
.rHtCap
.u2ExtHtCapInfo
= params
->ht_capa
->extended_ht_cap_info
;
703 rCmdUpdate
.rHtCap
.u4TxBfCapInfo
= params
->ht_capa
->tx_BF_cap_info
;
704 rCmdUpdate
.rHtCap
.ucAntennaSelInfo
= params
->ht_capa
->antenna_selection_info
;
705 kalMemCopy(rCmdUpdate
.rHtCap
.rMCS
.arRxMask
,
706 params
->ht_capa
->mcs
.rx_mask
,
707 sizeof(rCmdUpdate
.rHtCap
.rMCS
.arRxMask
));
708 rCmdUpdate
.rHtCap
.rMCS
.u2RxHighest
= params
->ht_capa
->mcs
.rx_highest
;
709 rCmdUpdate
.rHtCap
.rMCS
.ucTxParams
= params
->ht_capa
->mcs
.tx_params
;
710 rCmdUpdate
.fgIsSupHt
= TRUE
;
713 /* update a TDLS peer record */
714 rStatus
= kalIoctl(prGlueInfo
,
717 sizeof(TDLS_CMD_PEER_UPDATE_T
),
724 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
725 DBGLOG(TDLS
, ERROR
, ("%s update error:%x\n", __FUNCTION__
, rStatus
));
728 #endif /* CFG_SUPPORT_TDLS */
734 /*----------------------------------------------------------------------------*/
736 * @brief This routine is responsible for adding a station information
740 * @retval 0: successful
743 /*----------------------------------------------------------------------------*/
745 mtk_cfg80211_add_station (
747 struct net_device
*ndev
,
749 struct station_parameters
*params
752 #if (CFG_SUPPORT_TDLS == 1)
753 /* from supplicant -- wpa_supplicant_tdls_peer_addset() */
754 P_GLUE_INFO_T prGlueInfo
;
755 TDLS_CMD_PEER_ADD_T rCmdCreate
;
760 if ((wiphy
== NULL
) || (mac
== NULL
) || (params
== NULL
))
764 wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL, NULL, 0,
767 wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add,
768 u16 aid, u16 capability, const u8 *supp_rates,
769 size_t supp_rates_len,
770 const struct ieee80211_ht_capabilities *ht_capab,
771 const struct ieee80211_vht_capabilities *vht_capab,
772 u8 qosinfo, const u8 *ext_capab, size_t ext_capab_len)
774 Only MAC address of the peer is valid.
777 DBGLOG(TDLS
, INFO
, ("%s: 0x%p %d\n",
778 __FUNCTION__
, params
->supported_rates
, params
->supported_rates_len
));
781 if (!(params
->sta_flags_set
& BIT(NL80211_STA_FLAG_TDLS_PEER
)))
784 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
785 if (prGlueInfo
== NULL
)
788 /* TODO: check if we are station mode, not AP mode */
791 kalMemZero(&rCmdCreate
, sizeof(rCmdCreate
));
792 kalMemCopy(rCmdCreate
.aucPeerMac
, mac
, 6);
795 rCmdCreate
.eNetTypeIndex
= NETWORK_TYPE_AIS_INDEX
;
797 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
798 rCmdCreate
.u2CapInfo
= params
->capability
;
801 DBGLOG(TDLS
, INFO
, ("<tdls_cmd> %s: capability = 0x%x\n",
802 __FUNCTION__
, rCmdCreate
.u2CapInfo
));
804 if ((params
->supported_rates
!= NULL
) &&
805 (params
->supported_rates_len
!= 0))
809 DBGLOG(TDLS
, INFO
, ("<tdls_cmd> %s: sup rate = 0x",
812 rIeSup
.ucId
= ELEM_ID_SUP_RATES
;
813 rIeSup
.ucLength
= params
->supported_rates_len
;
814 for(u4Idx
=0; u4Idx
<rIeSup
.ucLength
; u4Idx
++)
816 rIeSup
.aucSupportedRates
[u4Idx
] = params
->supported_rates
[u4Idx
];
817 DBGLOG(TDLS
, INFO
, ("%x ", rIeSup
.aucSupportedRates
[u4Idx
]));
819 DBGLOG(TDLS
, INFO
, ("\n"));
821 rateGetRateSetFromIEs(&rIeSup
,
823 &rCmdCreate
.u2OperationalRateSet
,
824 &rCmdCreate
.u2BSSBasicRateSet
,
825 &rCmdCreate
.fgIsUnknownBssBasicRate
);
831 /* create a TDLS peer record */
832 rStatus
= kalIoctl(prGlueInfo
,
835 sizeof(TDLS_CMD_PEER_ADD_T
),
842 if (rStatus
!= WLAN_STATUS_SUCCESS
)
844 DBGLOG(TDLS
, ERROR
, ("%s create error:%x\n", __FUNCTION__
, rStatus
));
847 #endif /* CFG_SUPPORT_TDLS */
853 /*----------------------------------------------------------------------------*/
855 * @brief This routine is responsible for deleting a station information
859 * @retval 0: successful
863 * must implement if you have add_station().
865 /*----------------------------------------------------------------------------*/
867 mtk_cfg80211_del_station (
869 struct net_device
*ndev
,
877 /*----------------------------------------------------------------------------*/
879 * @brief This routine is responsible for requesting to do a scan
883 * @retval 0: successful
886 /*----------------------------------------------------------------------------*/
887 static PARAM_SCAN_REQUEST_EXT_T rScanRequest
;
891 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
892 struct net_device
*ndev
,
893 #endif /* LINUX_VERSION_CODE */
894 struct cfg80211_scan_request
*request
897 P_GLUE_INFO_T prGlueInfo
= NULL
;
900 // PARAM_SCAN_REQUEST_EXT_T rScanRequest;
902 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
905 DBGLOG(REQ
, INFO
, ("mtk_cfg80211_scan\n"));
906 kalMemZero(&rScanRequest
, sizeof(PARAM_SCAN_REQUEST_EXT_T
));
908 /* check if there is any pending scan not yet finished */
909 if(prGlueInfo
->prScanRequest
!= NULL
) {
910 DBGLOG(REQ
, INFO
, ("prGlueInfo->prScanRequest != NULL\n"));
914 if(request
->n_ssids
== 0) {
915 rScanRequest
.rSsid
.u4SsidLen
= 0;
917 else if(request
->n_ssids
== 1) {
918 COPY_SSID(rScanRequest
.rSsid
.aucSsid
, rScanRequest
.rSsid
.u4SsidLen
, request
->ssids
[0].ssid
, request
->ssids
[0].ssid_len
);
921 DBGLOG(REQ
, INFO
, ("request->n_ssids:%d\n", request
->n_ssids
));
925 if(request
->ie_len
> 0) {
926 rScanRequest
.u4IELength
= request
->ie_len
;
927 rScanRequest
.pucIE
= (PUINT_8
)(request
->ie
);
930 rScanRequest
.u4IELength
= 0;
933 prGlueInfo
->prScanRequest
= request
;
935 rStatus
= kalIoctl(prGlueInfo
,
936 wlanoidSetBssidListScanExt
,
938 sizeof(PARAM_SCAN_REQUEST_EXT_T
),
945 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
946 DBGLOG(REQ
, INFO
, ("scan error:%x\n", rStatus
));
947 prGlueInfo
->prScanRequest
= NULL
;
954 static UINT_8 wepBuf
[48];
956 /*----------------------------------------------------------------------------*/
958 * @brief This routine is responsible for requesting to connect to
959 * the ESS with the specified parameters
963 * @retval 0: successful
966 /*----------------------------------------------------------------------------*/
968 mtk_cfg80211_connect (
970 struct net_device
*ndev
,
971 struct cfg80211_connect_params
*sme
974 P_GLUE_INFO_T prGlueInfo
= NULL
;
977 ENUM_PARAM_ENCRYPTION_STATUS_T eEncStatus
;
978 ENUM_PARAM_AUTH_MODE_T eAuthMode
;
980 PARAM_SSID_T rNewSsid
;
981 BOOLEAN fgCarryWPSIE
= FALSE
;
982 ENUM_PARAM_OP_MODE_T eOpMode
;
984 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
987 DBGLOG(REQ
, INFO
, ("[wlan] mtk_cfg80211_connect %p %zu\n",
988 sme
->ie
, sme
->ie_len
));
990 if (prGlueInfo
->prAdapter
->rWifiVar
.rConnSettings
.eOPMode
> NET_TYPE_AUTO_SWITCH
)
991 eOpMode
= NET_TYPE_AUTO_SWITCH
;
993 eOpMode
= prGlueInfo
->prAdapter
->rWifiVar
.rConnSettings
.eOPMode
;
995 rStatus
= kalIoctl(prGlueInfo
,
996 wlanoidSetInfrastructureMode
,
1005 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1006 DBGLOG(INIT
, INFO
, ("wlanoidSetInfrastructureMode fail 0x%x\n", rStatus
));
1010 /* after set operation mode, key table are cleared */
1012 /* reset wpa info */
1013 prGlueInfo
->rWpaInfo
.u4WpaVersion
= IW_AUTH_WPA_VERSION_DISABLED
;
1014 prGlueInfo
->rWpaInfo
.u4KeyMgmt
= 0;
1015 prGlueInfo
->rWpaInfo
.u4CipherGroup
= IW_AUTH_CIPHER_NONE
;
1016 prGlueInfo
->rWpaInfo
.u4CipherPairwise
= IW_AUTH_CIPHER_NONE
;
1017 prGlueInfo
->rWpaInfo
.u4AuthAlg
= IW_AUTH_ALG_OPEN_SYSTEM
;
1018 #if CFG_SUPPORT_802_11W
1019 prGlueInfo
->rWpaInfo
.u4Mfp
= IW_AUTH_MFP_DISABLED
;
1022 if (sme
->crypto
.wpa_versions
& NL80211_WPA_VERSION_1
)
1023 prGlueInfo
->rWpaInfo
.u4WpaVersion
= IW_AUTH_WPA_VERSION_WPA
;
1024 else if (sme
->crypto
.wpa_versions
& NL80211_WPA_VERSION_2
)
1025 prGlueInfo
->rWpaInfo
.u4WpaVersion
= IW_AUTH_WPA_VERSION_WPA2
;
1027 prGlueInfo
->rWpaInfo
.u4WpaVersion
= IW_AUTH_WPA_VERSION_DISABLED
;
1029 switch (sme
->auth_type
) {
1030 case NL80211_AUTHTYPE_OPEN_SYSTEM
:
1031 prGlueInfo
->rWpaInfo
.u4AuthAlg
= IW_AUTH_ALG_OPEN_SYSTEM
;
1033 case NL80211_AUTHTYPE_SHARED_KEY
:
1034 prGlueInfo
->rWpaInfo
.u4AuthAlg
= IW_AUTH_ALG_SHARED_KEY
;
1037 prGlueInfo
->rWpaInfo
.u4AuthAlg
= IW_AUTH_ALG_OPEN_SYSTEM
| IW_AUTH_ALG_SHARED_KEY
;
1041 if (sme
->crypto
.n_ciphers_pairwise
) {
1042 prGlueInfo
->prAdapter
->rWifiVar
.rConnSettings
.rRsnInfo
.au4PairwiseKeyCipherSuite
[0] = sme
->crypto
.ciphers_pairwise
[0];
1043 switch (sme
->crypto
.ciphers_pairwise
[0]) {
1044 case WLAN_CIPHER_SUITE_WEP40
:
1045 prGlueInfo
->rWpaInfo
.u4CipherPairwise
= IW_AUTH_CIPHER_WEP40
;
1047 case WLAN_CIPHER_SUITE_WEP104
:
1048 prGlueInfo
->rWpaInfo
.u4CipherPairwise
= IW_AUTH_CIPHER_WEP104
;
1050 case WLAN_CIPHER_SUITE_TKIP
:
1051 prGlueInfo
->rWpaInfo
.u4CipherPairwise
= IW_AUTH_CIPHER_TKIP
;
1053 case WLAN_CIPHER_SUITE_CCMP
:
1054 prGlueInfo
->rWpaInfo
.u4CipherPairwise
= IW_AUTH_CIPHER_CCMP
;
1056 case WLAN_CIPHER_SUITE_AES_CMAC
:
1057 prGlueInfo
->rWpaInfo
.u4CipherPairwise
= IW_AUTH_CIPHER_CCMP
;
1060 DBGLOG(REQ
, WARN
, ("invalid cipher pairwise (%d)\n",
1061 sme
->crypto
.ciphers_pairwise
[0]));
1066 if (sme
->crypto
.cipher_group
) {
1067 prGlueInfo
->prAdapter
->rWifiVar
.rConnSettings
.rRsnInfo
.u4GroupKeyCipherSuite
= sme
->crypto
.cipher_group
;
1068 switch (sme
->crypto
.cipher_group
) {
1069 case WLAN_CIPHER_SUITE_WEP40
:
1070 prGlueInfo
->rWpaInfo
.u4CipherGroup
= IW_AUTH_CIPHER_WEP40
;
1072 case WLAN_CIPHER_SUITE_WEP104
:
1073 prGlueInfo
->rWpaInfo
.u4CipherGroup
= IW_AUTH_CIPHER_WEP104
;
1075 case WLAN_CIPHER_SUITE_TKIP
:
1076 prGlueInfo
->rWpaInfo
.u4CipherGroup
= IW_AUTH_CIPHER_TKIP
;
1078 case WLAN_CIPHER_SUITE_CCMP
:
1079 prGlueInfo
->rWpaInfo
.u4CipherGroup
= IW_AUTH_CIPHER_CCMP
;
1081 case WLAN_CIPHER_SUITE_AES_CMAC
:
1082 prGlueInfo
->rWpaInfo
.u4CipherGroup
= IW_AUTH_CIPHER_CCMP
;
1085 DBGLOG(REQ
, WARN
, ("invalid cipher group (%d)\n",
1086 sme
->crypto
.cipher_group
));
1091 if (sme
->crypto
.n_akm_suites
) {
1092 prGlueInfo
->prAdapter
->rWifiVar
.rConnSettings
.rRsnInfo
.au4AuthKeyMgtSuite
[0] = sme
->crypto
.akm_suites
[0];
1093 if (prGlueInfo
->rWpaInfo
.u4WpaVersion
== IW_AUTH_WPA_VERSION_WPA
) {
1094 switch (sme
->crypto
.akm_suites
[0]) {
1095 case WLAN_AKM_SUITE_8021X
:
1096 eAuthMode
= AUTH_MODE_WPA
;
1098 case WLAN_AKM_SUITE_PSK
:
1099 eAuthMode
= AUTH_MODE_WPA_PSK
;
1102 DBGLOG(REQ
, WARN
, ("invalid cipher group (%d)\n",
1103 sme
->crypto
.cipher_group
));
1106 } else if (prGlueInfo
->rWpaInfo
.u4WpaVersion
== IW_AUTH_WPA_VERSION_WPA2
) {
1107 switch (sme
->crypto
.akm_suites
[0]) {
1108 case WLAN_AKM_SUITE_8021X
:
1109 eAuthMode
= AUTH_MODE_WPA2
;
1111 case WLAN_AKM_SUITE_PSK
:
1112 eAuthMode
= AUTH_MODE_WPA2_PSK
;
1115 DBGLOG(REQ
, WARN
, ("invalid cipher group (%d)\n",
1116 sme
->crypto
.cipher_group
));
1122 if (prGlueInfo
->rWpaInfo
.u4WpaVersion
== IW_AUTH_WPA_VERSION_DISABLED
) {
1123 eAuthMode
= (prGlueInfo
->rWpaInfo
.u4AuthAlg
== IW_AUTH_ALG_OPEN_SYSTEM
) ?
1124 AUTH_MODE_OPEN
: AUTH_MODE_AUTO_SWITCH
;
1127 prGlueInfo
->rWpaInfo
.fgPrivacyInvoke
= sme
->privacy
;
1129 prGlueInfo
->fgWpsActive
= FALSE
;
1130 #if CFG_SUPPORT_HOTSPOT_2_0
1131 prGlueInfo
->fgConnectHS20AP
= FALSE
;
1134 if (sme
->ie
&& sme
->ie_len
> 0) {
1135 WLAN_STATUS rStatus
;
1137 PUINT_8 prDesiredIE
= NULL
;
1139 #if CFG_SUPPORT_WAPI
1140 if (wextSrchDesiredWAPIIE(sme
->ie
,
1141 sme
->ie_len
, (PUINT_8
*)&prDesiredIE
)){
1142 rStatus
= kalIoctl(prGlueInfo
,
1143 wlanoidSetWapiAssocInfo
,
1145 IE_SIZE(prDesiredIE
),
1152 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1153 DBGLOG(SEC
, WARN
, ("[wapi] set wapi assoc info error:%x\n", rStatus
));
1158 DBGLOG(REQ
, INFO
, ("[wlan] wlanoidSetWapiAssocInfo: .fgWapiMode = %d\n",
1159 prGlueInfo
->prAdapter
->rWifiVar
.rConnSettings
.fgWapiMode
));
1161 #if CFG_SUPPORT_WPS2
1162 if (wextSrchDesiredWPSIE(sme
->ie
,
1165 (PUINT_8
*)&prDesiredIE
)) {
1166 prGlueInfo
->fgWpsActive
= TRUE
;
1167 fgCarryWPSIE
= TRUE
;
1169 rStatus
= kalIoctl(prGlueInfo
,
1170 wlanoidSetWSCAssocInfo
,
1172 IE_SIZE(prDesiredIE
),
1178 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1179 DBGLOG(SEC
, WARN
, ("WSC] set WSC assoc info error:%x\n", rStatus
));
1184 #if CFG_SUPPORT_HOTSPOT_2_0
1185 if (wextSrchDesiredHS20IE(sme
->ie
,
1187 (PUINT_8
*)&prDesiredIE
)) {
1188 rStatus
= kalIoctl(prGlueInfo
,
1191 IE_SIZE(prDesiredIE
),
1197 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1198 //printk(KERN_INFO "[HS20] set HS20 assoc info error:%lx\n", rStatus);
1201 if (wextSrchDesiredInterworkingIE(sme
->ie
,
1203 (PUINT_8
*)&prDesiredIE
)) {
1204 rStatus
= kalIoctl(prGlueInfo
,
1205 wlanoidSetInterworkingInfo
,
1207 IE_SIZE(prDesiredIE
),
1213 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1214 //printk(KERN_INFO "[HS20] set Interworking assoc info error:%lx\n", rStatus);
1217 if (wextSrchDesiredRoamingConsortiumIE(sme
->ie
,
1219 (PUINT_8
*)&prDesiredIE
)) {
1220 rStatus
= kalIoctl(prGlueInfo
,
1221 wlanoidSetRoamingConsortiumIEInfo
,
1223 IE_SIZE(prDesiredIE
),
1229 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1230 //printk(KERN_INFO "[HS20] set RoamingConsortium assoc info error:%lx\n", rStatus);
1236 /* clear WSC Assoc IE buffer in case WPS IE is not detected */
1237 if(fgCarryWPSIE
== FALSE
) {
1238 kalMemZero(&prGlueInfo
->aucWSCAssocInfoIE
, 200);
1239 prGlueInfo
->u2WSCAssocInfoIELen
= 0;
1242 rStatus
= kalIoctl(prGlueInfo
,
1251 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1252 DBGLOG(REQ
, WARN
, ("set auth mode error:%x\n", rStatus
));
1255 cipher
= prGlueInfo
->rWpaInfo
.u4CipherGroup
| prGlueInfo
->rWpaInfo
.u4CipherPairwise
;
1257 if (prGlueInfo
->rWpaInfo
.fgPrivacyInvoke
) {
1258 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1259 eEncStatus
= ENUM_ENCRYPTION3_ENABLED
;
1261 else if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1262 eEncStatus
= ENUM_ENCRYPTION2_ENABLED
;
1264 else if (cipher
& (IW_AUTH_CIPHER_WEP104
| IW_AUTH_CIPHER_WEP40
)) {
1265 eEncStatus
= ENUM_ENCRYPTION1_ENABLED
;
1267 else if (cipher
& IW_AUTH_CIPHER_NONE
){
1268 if (prGlueInfo
->rWpaInfo
.fgPrivacyInvoke
)
1269 eEncStatus
= ENUM_ENCRYPTION1_ENABLED
;
1271 eEncStatus
= ENUM_ENCRYPTION_DISABLED
;
1274 eEncStatus
= ENUM_ENCRYPTION_DISABLED
;
1278 eEncStatus
= ENUM_ENCRYPTION_DISABLED
;
1281 rStatus
= kalIoctl(prGlueInfo
,
1282 wlanoidSetEncryptionStatus
,
1290 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1291 DBGLOG(REQ
, WARN
, ("set encryption mode error:%x\n", rStatus
));
1294 if (sme
->key_len
!= 0 && prGlueInfo
->rWpaInfo
.u4WpaVersion
== IW_AUTH_WPA_VERSION_DISABLED
) {
1295 P_PARAM_WEP_T prWepKey
= (P_PARAM_WEP_T
) wepBuf
;
1297 prWepKey
->u4Length
= 12 + sme
->key_len
;
1298 prWepKey
->u4KeyLength
= (UINT_32
) sme
->key_len
;
1299 prWepKey
->u4KeyIndex
= (UINT_32
) sme
->key_idx
;
1300 prWepKey
->u4KeyIndex
|= BIT(31);
1301 if (prWepKey
->u4KeyLength
> 32) {
1302 DBGLOG(REQ
, WARN
, ("Too long key length (%u)\n", prWepKey
->u4KeyLength
));
1305 kalMemCopy(prWepKey
->aucKeyMaterial
, sme
->key
, prWepKey
->u4KeyLength
);
1307 rStatus
= kalIoctl(prGlueInfo
,
1317 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1318 DBGLOG(INIT
, INFO
, ("wlanoidSetAddWep fail 0x%x\n", rStatus
));
1323 if(sme
->ssid_len
> 0) {
1324 /* connect by SSID */
1325 COPY_SSID(rNewSsid
.aucSsid
, rNewSsid
.u4SsidLen
, sme
->ssid
, sme
->ssid_len
);
1327 rStatus
= kalIoctl(prGlueInfo
,
1330 sizeof(PARAM_SSID_T
),
1337 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1338 DBGLOG(REQ
, WARN
, ("set SSID:%x\n", rStatus
));
1343 /* connect by BSSID */
1344 rStatus
= kalIoctl(prGlueInfo
,
1354 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1355 DBGLOG(REQ
, WARN
, ("set BSSID:%x\n", rStatus
));
1364 /*----------------------------------------------------------------------------*/
1366 * @brief This routine is responsible for requesting to disconnect from
1367 * currently connected ESS
1371 * @retval 0: successful
1374 /*----------------------------------------------------------------------------*/
1376 mtk_cfg80211_disconnect (
1377 struct wiphy
*wiphy
,
1378 struct net_device
*ndev
,
1382 P_GLUE_INFO_T prGlueInfo
= NULL
;
1383 WLAN_STATUS rStatus
;
1386 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1389 rStatus
= kalIoctl(prGlueInfo
,
1390 wlanoidSetDisassociate
,
1399 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1400 DBGLOG(REQ
, WARN
, ("disassociate error:%x\n", rStatus
));
1408 /*----------------------------------------------------------------------------*/
1410 * @brief This routine is responsible for requesting to join an IBSS group
1414 * @retval 0: successful
1417 /*----------------------------------------------------------------------------*/
1419 mtk_cfg80211_join_ibss (
1420 struct wiphy
*wiphy
,
1421 struct net_device
*ndev
,
1422 struct cfg80211_ibss_params
*params
1425 PARAM_SSID_T rNewSsid
;
1426 P_GLUE_INFO_T prGlueInfo
= NULL
;
1427 UINT_32 u4ChnlFreq
; /* Store channel or frequency information */
1428 UINT_32 u4BufLen
= 0;
1429 WLAN_STATUS rStatus
;
1430 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
1431 struct ieee80211_channel
*channel
= NULL
;
1434 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1438 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
1439 if(params
->chandef
.chan
)
1440 channel
= params
->chandef
.chan
;
1442 u4ChnlFreq
= nicChannelNum2Freq(channel
->hw_value
);
1445 if(params
->channel
) {
1446 u4ChnlFreq
= nicChannelNum2Freq(params
->channel
->hw_value
);
1448 rStatus
= kalIoctl(prGlueInfo
,
1449 wlanoidSetFrequency
,
1457 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1463 kalMemCopy(rNewSsid
.aucSsid
, params
->ssid
, params
->ssid_len
);
1464 rStatus
= kalIoctl(prGlueInfo
,
1467 sizeof(PARAM_SSID_T
),
1474 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1475 DBGLOG(REQ
, WARN
, ("set SSID:%x\n", rStatus
));
1486 /*----------------------------------------------------------------------------*/
1488 * @brief This routine is responsible for requesting to leave from IBSS group
1492 * @retval 0: successful
1495 /*----------------------------------------------------------------------------*/
1497 mtk_cfg80211_leave_ibss (
1498 struct wiphy
*wiphy
,
1499 struct net_device
*ndev
1502 P_GLUE_INFO_T prGlueInfo
= NULL
;
1503 WLAN_STATUS rStatus
;
1506 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1509 rStatus
= kalIoctl(prGlueInfo
,
1510 wlanoidSetDisassociate
,
1519 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1520 DBGLOG(REQ
, WARN
, ("disassociate error:%x\n", rStatus
));
1528 /*----------------------------------------------------------------------------*/
1530 * @brief This routine is responsible for requesting to configure
1531 * WLAN power managemenet
1535 * @retval 0: successful
1538 /*----------------------------------------------------------------------------*/
1540 mtk_cfg80211_set_power_mgmt (
1541 struct wiphy
*wiphy
,
1542 struct net_device
*ndev
,
1547 P_GLUE_INFO_T prGlueInfo
= NULL
;
1548 WLAN_STATUS rStatus
;
1550 PARAM_POWER_MODE ePowerMode
;
1552 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1557 ePowerMode
= Param_PowerModeFast_PSP
;
1560 ePowerMode
= Param_PowerModeMAX_PSP
;
1564 ePowerMode
= Param_PowerModeCAM
;
1567 rStatus
= kalIoctl(prGlueInfo
,
1568 wlanoidSet802dot11PowerSaveProfile
,
1577 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1578 DBGLOG(REQ
, WARN
, ("set_power_mgmt error:%x\n", rStatus
));
1586 /*----------------------------------------------------------------------------*/
1588 * @brief This routine is responsible for requesting to cache
1589 * a PMKID for a BSSID
1593 * @retval 0: successful
1596 /*----------------------------------------------------------------------------*/
1598 mtk_cfg80211_set_pmksa (
1599 struct wiphy
*wiphy
,
1600 struct net_device
*ndev
,
1601 struct cfg80211_pmksa
*pmksa
1604 P_GLUE_INFO_T prGlueInfo
= NULL
;
1605 WLAN_STATUS rStatus
;
1607 P_PARAM_PMKID_T prPmkid
;
1609 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1612 prPmkid
=(P_PARAM_PMKID_T
)kalMemAlloc(8 + sizeof(PARAM_BSSID_INFO_T
), VIR_MEM_TYPE
);
1614 DBGLOG(INIT
, INFO
, ("Can not alloc memory for IW_PMKSA_ADD\n"));
1618 prPmkid
->u4Length
= 8 + sizeof(PARAM_BSSID_INFO_T
);
1619 prPmkid
->u4BSSIDInfoCount
= 1;
1620 kalMemCopy(prPmkid
->arBSSIDInfo
->arBSSID
, pmksa
->bssid
, 6);
1621 kalMemCopy(prPmkid
->arBSSIDInfo
->arPMKID
, pmksa
->pmkid
, IW_PMKID_LEN
);
1623 rStatus
= kalIoctl(prGlueInfo
,
1626 sizeof(PARAM_PMKID_T
),
1633 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1634 DBGLOG(INIT
, INFO
, ("add pmkid error:%x\n", rStatus
));
1636 kalMemFree(prPmkid
, VIR_MEM_TYPE
, 8 + sizeof(PARAM_BSSID_INFO_T
));
1642 /*----------------------------------------------------------------------------*/
1644 * @brief This routine is responsible for requesting to remove
1645 * a cached PMKID for a BSSID
1649 * @retval 0: successful
1652 /*----------------------------------------------------------------------------*/
1654 mtk_cfg80211_del_pmksa (
1655 struct wiphy
*wiphy
,
1656 struct net_device
*ndev
,
1657 struct cfg80211_pmksa
*pmksa
1665 /*----------------------------------------------------------------------------*/
1667 * @brief This routine is responsible for requesting to flush
1672 * @retval 0: successful
1675 /*----------------------------------------------------------------------------*/
1677 mtk_cfg80211_flush_pmksa (
1678 struct wiphy
*wiphy
,
1679 struct net_device
*ndev
1682 P_GLUE_INFO_T prGlueInfo
= NULL
;
1683 WLAN_STATUS rStatus
;
1685 P_PARAM_PMKID_T prPmkid
;
1687 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1690 prPmkid
=(P_PARAM_PMKID_T
)kalMemAlloc(8, VIR_MEM_TYPE
);
1692 DBGLOG(INIT
, INFO
, ("Can not alloc memory for IW_PMKSA_FLUSH\n"));
1696 prPmkid
->u4Length
= 8;
1697 prPmkid
->u4BSSIDInfoCount
= 0;
1699 rStatus
= kalIoctl(prGlueInfo
,
1702 sizeof(PARAM_PMKID_T
),
1709 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
1710 DBGLOG(INIT
, INFO
, ("flush pmkid error:%x\n", rStatus
));
1712 kalMemFree(prPmkid
, VIR_MEM_TYPE
, 8);
1719 mtk_cfg80211_mgmt_frame_register (
1720 IN
struct wiphy
*wiphy
,
1721 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
1722 IN
struct net_device
*dev
,
1724 IN
struct wireless_dev
*wdev
,
1731 P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister
= (P_MSG_P2P_MGMT_FRAME_REGISTER_T
)NULL
;
1733 P_GLUE_INFO_T prGlueInfo
= (P_GLUE_INFO_T
)NULL
;
1737 DBGLOG(INIT
, LOUD
, ("mtk_cfg80211_mgmt_frame_register\n"));
1739 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1741 switch (frame_type
) {
1742 case MAC_FRAME_PROBE_REQ
:
1744 prGlueInfo
->u4OsMgmtFrameFilter
|= PARAM_PACKET_FILTER_PROBE_REQ
;
1745 DBGLOG(INIT
, LOUD
, ("Open packet filer probe request\n"));
1748 prGlueInfo
->u4OsMgmtFrameFilter
&= ~PARAM_PACKET_FILTER_PROBE_REQ
;
1749 DBGLOG(INIT
, LOUD
, ("Close packet filer probe request\n"));
1752 case MAC_FRAME_ACTION
:
1754 prGlueInfo
->u4OsMgmtFrameFilter
|= PARAM_PACKET_FILTER_ACTION_FRAME
;
1755 DBGLOG(INIT
, LOUD
, ("Open packet filer action frame.\n"));
1758 prGlueInfo
->u4OsMgmtFrameFilter
&= ~PARAM_PACKET_FILTER_ACTION_FRAME
;
1759 DBGLOG(INIT
, LOUD
, ("Close packet filer action frame.\n"));
1763 printk("Ask frog to add code for mgmt:%x\n", frame_type
);
1767 if (prGlueInfo
->prAdapter
!= NULL
){
1769 /* prGlueInfo->ulFlag |= GLUE_FLAG_FRAME_FILTER_AIS; */
1770 set_bit(GLUE_FLAG_FRAME_FILTER_AIS_BIT
, &prGlueInfo
->ulFlag
);
1772 /* wake up main thread */
1773 wake_up_interruptible(&prGlueInfo
->waitq
);
1775 if (in_interrupt()) {
1776 DBGLOG(INIT
, TRACE
, ("It is in interrupt level\n"));
1783 prMgmtFrameRegister
= (P_MSG_P2P_MGMT_FRAME_REGISTER_T
)cnmMemAlloc(prGlueInfo
->prAdapter
,
1785 sizeof(MSG_P2P_MGMT_FRAME_REGISTER_T
));
1787 if (prMgmtFrameRegister
== NULL
) {
1792 prMgmtFrameRegister
->rMsgHdr
.eMsgId
= MID_MNY_P2P_MGMT_FRAME_REGISTER
;
1794 prMgmtFrameRegister
->u2FrameType
= frame_type
;
1795 prMgmtFrameRegister
->fgIsRegister
= reg
;
1797 mboxSendMsg(prGlueInfo
->prAdapter
,
1799 (P_MSG_HDR_T
)prMgmtFrameRegister
,
1800 MSG_SEND_METHOD_BUF
);
1807 } /* mtk_cfg80211_mgmt_frame_register */
1810 /*----------------------------------------------------------------------------*/
1812 * @brief This routine is responsible for requesting to stay on a
1817 * @retval 0: successful
1820 /*----------------------------------------------------------------------------*/
1822 mtk_cfg80211_remain_on_channel (
1823 struct wiphy
*wiphy
,
1824 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
1825 struct net_device
*ndev
,
1827 struct wireless_dev
*wdev
,
1828 #endif /* LINUX_VERSION_CODE */
1829 struct ieee80211_channel
*chan
,
1830 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
1831 enum nl80211_channel_type channel_type
,
1832 #endif /* LINUX_VERSION_CODE */
1833 unsigned int duration
,
1837 P_GLUE_INFO_T prGlueInfo
= NULL
;
1838 INT_32 i4Rslt
= -EINVAL
;
1839 P_MSG_REMAIN_ON_CHANNEL_T prMsgChnlReq
= (P_MSG_REMAIN_ON_CHANNEL_T
)NULL
;
1842 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
1843 if ((wiphy
== NULL
) ||
1850 if ((wiphy
== NULL
) ||
1858 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1862 printk("--> %s()\n", __func__
);
1865 *cookie
= prGlueInfo
->u8Cookie
++;
1867 prMsgChnlReq
= cnmMemAlloc(prGlueInfo
->prAdapter
, RAM_TYPE_MSG
, sizeof(MSG_REMAIN_ON_CHANNEL_T
));
1869 if (prMsgChnlReq
== NULL
) {
1875 prMsgChnlReq
->rMsgHdr
.eMsgId
= MID_MNY_AIS_REMAIN_ON_CHANNEL
;
1876 prMsgChnlReq
->u8Cookie
= *cookie
;
1877 prMsgChnlReq
->u4DurationMs
= duration
;
1879 prMsgChnlReq
->ucChannelNum
= nicFreq2ChannelNum(chan
->center_freq
* 1000);
1881 switch (chan
->band
) {
1882 case IEEE80211_BAND_2GHZ
:
1883 prMsgChnlReq
->eBand
= BAND_2G4
;
1885 case IEEE80211_BAND_5GHZ
:
1886 prMsgChnlReq
->eBand
= BAND_5G
;
1889 prMsgChnlReq
->eBand
= BAND_2G4
;
1893 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
1894 switch (channel_type
) {
1895 case NL80211_CHAN_NO_HT
:
1896 prMsgChnlReq
->eSco
= CHNL_EXT_SCN
;
1898 case NL80211_CHAN_HT20
:
1899 prMsgChnlReq
->eSco
= CHNL_EXT_SCN
;
1901 case NL80211_CHAN_HT40MINUS
:
1902 prMsgChnlReq
->eSco
= CHNL_EXT_SCA
;
1904 case NL80211_CHAN_HT40PLUS
:
1905 prMsgChnlReq
->eSco
= CHNL_EXT_SCB
;
1909 prMsgChnlReq
->eSco
= CHNL_EXT_SCN
;
1913 mboxSendMsg(prGlueInfo
->prAdapter
,
1915 (P_MSG_HDR_T
)prMsgChnlReq
,
1916 MSG_SEND_METHOD_BUF
);
1925 /*----------------------------------------------------------------------------*/
1927 * @brief This routine is responsible for requesting to cancel staying
1928 * on a specified channel
1932 * @retval 0: successful
1935 /*----------------------------------------------------------------------------*/
1937 mtk_cfg80211_cancel_remain_on_channel (
1938 struct wiphy
*wiphy
,
1939 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
1940 struct net_device
*ndev
,
1942 struct wireless_dev
*wdev
,
1943 #endif /* LINUX_VERSION_CODE */
1947 P_GLUE_INFO_T prGlueInfo
= NULL
;
1948 INT_32 i4Rslt
= -EINVAL
;
1949 P_MSG_CANCEL_REMAIN_ON_CHANNEL_T prMsgChnlAbort
= (P_MSG_CANCEL_REMAIN_ON_CHANNEL_T
)NULL
;
1952 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
1953 if ((wiphy
== NULL
) || (ndev
== NULL
)) {
1957 if ((wiphy
== NULL
) || (wdev
== NULL
)) {
1962 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
1966 printk("--> %s()\n", __func__
);
1969 prMsgChnlAbort
= cnmMemAlloc(prGlueInfo
->prAdapter
, RAM_TYPE_MSG
, sizeof(MSG_CANCEL_REMAIN_ON_CHANNEL_T
));
1971 if (prMsgChnlAbort
== NULL
) {
1977 prMsgChnlAbort
->rMsgHdr
.eMsgId
= MID_MNY_AIS_CANCEL_REMAIN_ON_CHANNEL
;
1978 prMsgChnlAbort
->u8Cookie
= cookie
;
1980 mboxSendMsg(prGlueInfo
->prAdapter
,
1982 (P_MSG_HDR_T
)prMsgChnlAbort
,
1983 MSG_SEND_METHOD_BUF
);
1992 /*----------------------------------------------------------------------------*/
1994 * @brief This routine is responsible for requesting to send a management frame
1998 * @retval 0: successful
2001 /*----------------------------------------------------------------------------*/
2002 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
2004 mtk_cfg80211_mgmt_tx (
2005 struct wiphy
*wiphy
,
2006 struct net_device
*ndev
,
2007 struct ieee80211_channel
*channel
,
2009 enum nl80211_channel_type channel_type
,
2010 bool channel_type_valid
,
2015 bool dont_wait_for_ack
,
2020 mtk_cfg80211_mgmt_tx (
2021 struct wiphy
*wiphy
,
2022 struct wireless_dev
*wdev
,
2023 struct ieee80211_channel
*channel
,
2029 bool dont_wait_for_ack
,
2032 #endif /* LINUX_VERSION_CODE */
2034 P_GLUE_INFO_T prGlueInfo
= NULL
;
2035 INT_32 i4Rslt
= -EINVAL
;
2036 P_MSG_MGMT_TX_REQUEST_T prMsgTxReq
= (P_MSG_MGMT_TX_REQUEST_T
)NULL
;
2037 P_MSDU_INFO_T prMgmtFrame
= (P_MSDU_INFO_T
)NULL
;
2038 PUINT_8 pucFrameBuf
= (PUINT_8
)NULL
;
2042 printk("--> %s()\n", __func__
);
2045 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
2046 if ((wiphy
== NULL
) ||
2054 if ((wiphy
== NULL
) ||
2063 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
2066 *cookie
= prGlueInfo
->u8Cookie
++;
2068 /* Channel & Channel Type & Wait time are ignored. */
2069 prMsgTxReq
= cnmMemAlloc(prGlueInfo
->prAdapter
, RAM_TYPE_MSG
, sizeof(MSG_MGMT_TX_REQUEST_T
));
2071 if (prMsgTxReq
== NULL
) {
2077 prMsgTxReq
->fgNoneCckRate
= FALSE
;
2078 prMsgTxReq
->fgIsWaitRsp
= TRUE
;
2080 prMgmtFrame
= cnmMgtPktAlloc(prGlueInfo
->prAdapter
, (UINT_32
)(len
+ MAC_TX_RESERVED_FIELD
));
2082 if ((prMsgTxReq
->prMgmtMsduInfo
= prMgmtFrame
) == NULL
) {
2088 prMsgTxReq
->u8Cookie
= *cookie
;
2089 prMsgTxReq
->rMsgHdr
.eMsgId
= MID_MNY_AIS_MGMT_TX
;
2091 pucFrameBuf
= (PUINT_8
)((ULONG
)prMgmtFrame
->prPacket
+ MAC_TX_RESERVED_FIELD
);
2093 kalMemCopy(pucFrameBuf
, buf
, len
);
2095 prMgmtFrame
->u2FrameLength
= len
;
2097 mboxSendMsg(prGlueInfo
->prAdapter
,
2099 (P_MSG_HDR_T
)prMsgTxReq
,
2100 MSG_SEND_METHOD_BUF
);
2105 if ((i4Rslt
!= 0) && (prMsgTxReq
!= NULL
)) {
2106 if (prMsgTxReq
->prMgmtMsduInfo
!= NULL
) {
2107 cnmMgtPktFree(prGlueInfo
->prAdapter
, prMsgTxReq
->prMgmtMsduInfo
);
2110 cnmMemFree(prGlueInfo
->prAdapter
, prMsgTxReq
);
2117 /*----------------------------------------------------------------------------*/
2119 * @brief This routine is responsible for requesting to cancel the wait time
2120 * from transmitting a management frame on another channel
2124 * @retval 0: successful
2127 /*----------------------------------------------------------------------------*/
2129 mtk_cfg80211_mgmt_tx_cancel_wait (
2130 struct wiphy
*wiphy
,
2131 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
2132 struct net_device
*ndev
,
2134 struct wireless_dev
*wdev
,
2135 #endif /* LINUX_VERSION_CODE */
2139 P_GLUE_INFO_T prGlueInfo
= NULL
;
2141 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
2145 printk("--> %s()\n", __func__
);
2148 /* not implemented */
2154 /*----------------------------------------------------------------------------*/
2156 * @brief This routine is responsible for handling association request
2160 * @retval 0: successful
2163 /*----------------------------------------------------------------------------*/
2165 mtk_cfg80211_assoc (
2166 struct wiphy
*wiphy
,
2167 struct net_device
*ndev
,
2168 struct cfg80211_assoc_request
*req
2171 P_GLUE_INFO_T prGlueInfo
= NULL
;
2172 PARAM_MAC_ADDRESS arBssid
;
2173 #if CFG_SUPPORT_HOTSPOT_2_0
2174 PUINT_8 prDesiredIE
= NULL
;
2176 WLAN_STATUS rStatus
;
2179 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
2182 kalMemZero(arBssid
, MAC_ADDR_LEN
);
2183 wlanQueryInformation(prGlueInfo
->prAdapter
,
2189 /* 1. check BSSID */
2190 if(UNEQUAL_MAC_ADDR(arBssid
, req
->bss
->bssid
)) {
2191 /* wrong MAC address */
2192 DBGLOG(REQ
, WARN
, ("incorrect BSSID: ["MACSTR
"] currently connected BSSID["MACSTR
"]\n",
2193 MAC2STR(req
->bss
->bssid
), MAC2STR(arBssid
)));
2197 if (req
->ie
&& req
->ie_len
> 0) {
2198 #if CFG_SUPPORT_HOTSPOT_2_0
2199 if (wextSrchDesiredHS20IE((PUINT_8
)req
->ie
,
2201 (PUINT_8
*)&prDesiredIE
)) {
2202 rStatus
= kalIoctl(prGlueInfo
,
2205 IE_SIZE(prDesiredIE
),
2211 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
2212 //printk(KERN_INFO "[HS20] set HS20 assoc info error:%lx\n", rStatus);
2216 if (wextSrchDesiredInterworkingIE((PUINT_8
)req
->ie
,
2218 (PUINT_8
*)&prDesiredIE
)) {
2219 rStatus
= kalIoctl(prGlueInfo
,
2220 wlanoidSetInterworkingInfo
,
2222 IE_SIZE(prDesiredIE
),
2228 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
2229 //printk(KERN_INFO "[HS20] set Interworking assoc info error:%lx\n", rStatus);
2233 if (wextSrchDesiredRoamingConsortiumIE((PUINT_8
)req
->ie
,
2235 (PUINT_8
*)&prDesiredIE
)) {
2236 rStatus
= kalIoctl(prGlueInfo
,
2237 wlanoidSetRoamingConsortiumIEInfo
,
2239 IE_SIZE(prDesiredIE
),
2245 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
2246 //printk(KERN_INFO "[HS20] set RoamingConsortium assoc info error:%lx\n", rStatus);
2252 rStatus
= kalIoctl(prGlueInfo
,
2254 (PVOID
) req
->bss
->bssid
,
2262 if (rStatus
!= WLAN_STATUS_SUCCESS
) {
2263 DBGLOG(REQ
, WARN
, ("set BSSID:%x\n", rStatus
));
2271 #if CONFIG_NL80211_TESTMODE
2272 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
2273 #define NLA_PUT(skb, attrtype, attrlen, data) \
2275 if (unlikely(nla_put(skb, attrtype, attrlen, data) < 0)) \
2276 goto nla_put_failure; \
2279 #define NLA_PUT_TYPE(skb, type, attrtype, value) \
2281 type __tmp = value; \
2282 NLA_PUT(skb, attrtype, sizeof(type), &__tmp); \
2285 #define NLA_PUT_U8(skb, attrtype, value) \
2286 NLA_PUT_TYPE(skb, u8, attrtype, value)
2288 #define NLA_PUT_U16(skb, attrtype, value) \
2289 NLA_PUT_TYPE(skb, u16, attrtype, value)
2291 #define NLA_PUT_U32(skb, attrtype, value) \
2292 NLA_PUT_TYPE(skb, u32, attrtype, value)
2294 #define NLA_PUT_U64(skb, attrtype, value) \
2295 NLA_PUT_TYPE(skb, u64, attrtype, value)
2299 #if CFG_SUPPORT_WAPI
2301 mtk_cfg80211_testmode_set_key_ext(
2302 IN
struct wiphy
*wiphy
,
2306 P_GLUE_INFO_T prGlueInfo
= NULL
;
2307 P_NL80211_DRIVER_SET_KEY_EXTS prParams
= (P_NL80211_DRIVER_SET_KEY_EXTS
)NULL
;
2308 struct iw_encode_exts
*prIWEncExt
= (struct iw_encode_exts
*)NULL
;
2309 WLAN_STATUS rstatus
= WLAN_STATUS_SUCCESS
;
2311 UINT_32 u4BufLen
= 0;
2313 P_PARAM_WPI_KEY_T prWpiKey
= (P_PARAM_WPI_KEY_T
) keyStructBuf
;
2314 memset(keyStructBuf
, 0, sizeof(keyStructBuf
));
2318 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
2321 printk("--> %s()\n", __func__
);
2325 prParams
= (P_NL80211_DRIVER_SET_KEY_EXTS
)data
;
2329 prIWEncExt
= (struct iw_encode_exts
*) &prParams
->ext
;
2332 if (prIWEncExt
->alg
== IW_ENCODE_ALG_SMS4
) {
2334 prWpiKey
->ucKeyID
= prParams
->key_index
;
2335 prWpiKey
->ucKeyID
--;
2336 if (prWpiKey
->ucKeyID
> 1) {
2337 /* key id is out of range */
2338 //printk(KERN_INFO "[wapi] add key error: key_id invalid %d\n", prWpiKey->ucKeyID);
2342 if (prIWEncExt
->key_len
!= 32) {
2343 /* key length not valid */
2344 //printk(KERN_INFO "[wapi] add key error: key_len invalid %d\n", prIWEncExt->key_len);
2348 //printk(KERN_INFO "[wapi] %d ext_flags %d\n", prEnc->flags, prIWEncExt->ext_flags);
2350 if (prIWEncExt
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) {
2351 prWpiKey
->eKeyType
= ENUM_WPI_GROUP_KEY
;
2352 prWpiKey
->eDirection
= ENUM_WPI_RX
;
2354 else if (prIWEncExt
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
) {
2355 prWpiKey
->eKeyType
= ENUM_WPI_PAIRWISE_KEY
;
2356 prWpiKey
->eDirection
= ENUM_WPI_RX_TX
;
2359 //#if CFG_SUPPORT_WAPI
2360 //handle_sec_msg_final(prIWEncExt->key, 32, prIWEncExt->key, NULL);
2363 memcpy(prWpiKey
->aucPN
, prIWEncExt
->tx_seq
, IW_ENCODE_SEQ_MAX_SIZE
* 2);
2366 memcpy(prWpiKey
->aucAddrIndex
, prIWEncExt
->addr
, 6);
2368 memcpy(prWpiKey
->aucWPIEK
, prIWEncExt
->key
, 16);
2369 prWpiKey
->u4LenWPIEK
= 16;
2371 memcpy(prWpiKey
->aucWPICK
, &prIWEncExt
->key
[16], 16);
2372 prWpiKey
->u4LenWPICK
= 16;
2374 rstatus
= kalIoctl(prGlueInfo
,
2377 sizeof(PARAM_WPI_KEY_T
),
2384 if (rstatus
!= WLAN_STATUS_SUCCESS
) {
2385 //printk(KERN_INFO "[wapi] add key error:%lx\n", rStatus);
2386 fgIsValid
= -EFAULT
;
2395 mtk_cfg80211_testmode_get_sta_statistics(
2396 IN
struct wiphy
*wiphy
,
2399 IN P_GLUE_INFO_T prGlueInfo
)
2401 WLAN_STATUS rStatus
= WLAN_STATUS_SUCCESS
;
2402 INT_32 i4Status
= -EINVAL
;
2404 UINT_32 u4LinkScore
;
2405 UINT_32 u4TotalError
;
2406 UINT_32 u4TxExceedThresholdCount
;
2407 UINT_32 u4TxTotalCount
;
2409 P_NL80211_DRIVER_GET_STA_STATISTICS_PARAMS prParams
= NULL
;
2410 PARAM_GET_STA_STA_STATISTICS rQueryStaStatistics
;
2411 struct sk_buff
*skb
;
2417 prParams
= (P_NL80211_DRIVER_GET_STA_STATISTICS_PARAMS
)data
;
2420 if(!prParams
->aucMacAddr
) {
2421 DBGLOG(QM
, TRACE
,("%s MAC Address is NULL\n", __FUNCTION__
));
2425 skb
= cfg80211_testmode_alloc_reply_skb(wiphy
, sizeof(PARAM_GET_STA_STA_STATISTICS
) + 1);
2428 DBGLOG(QM
, TRACE
, ("%s allocate skb failed:%x\n", __FUNCTION__
, rStatus
));
2432 DBGLOG(QM
, TRACE
,("Get ["MACSTR
"] STA statistics\n", MAC2STR(prParams
->aucMacAddr
)));
2434 kalMemZero(&rQueryStaStatistics
, sizeof(rQueryStaStatistics
));
2435 COPY_MAC_ADDR(rQueryStaStatistics
.aucMacAddr
, prParams
->aucMacAddr
);
2437 rStatus
= kalIoctl(prGlueInfo
,
2438 wlanoidQueryStaStatistics
,
2439 &rQueryStaStatistics
,
2440 sizeof(rQueryStaStatistics
),
2447 /* Calcute Link Score */
2448 u4TxExceedThresholdCount
= rQueryStaStatistics
.u4TxExceedThresholdCount
;
2449 u4TxTotalCount
= rQueryStaStatistics
.u4TxTotalCount
;
2450 u4TotalError
= rQueryStaStatistics
.u4TxFailCount
+ rQueryStaStatistics
.u4TxLifeTimeoutCount
;
2452 /* u4LinkScore 10~100 , ExceedThreshold ratio 0~90 only */
2453 /* u4LinkScore 0~9 , Drop packet ratio 0~9 and all packets exceed threshold */
2454 if(u4TxTotalCount
) {
2455 if(u4TxExceedThresholdCount
<= u4TxTotalCount
) {
2456 u4LinkScore
= (90 - ((u4TxExceedThresholdCount
* 90) / u4TxTotalCount
)) ;
2468 if(u4LinkScore
== 10) {
2470 if(u4TotalError
<=u4TxTotalCount
) {
2471 u4LinkScore
= (10 - ((u4TotalError
* 10) / u4TxTotalCount
)) ;
2479 if(u4LinkScore
>100) {
2484 NLA_PUT_U8(skb
, NL80211_TESTMODE_STA_STATISTICS_INVALID
, 0);
2485 NLA_PUT_U8(skb
, NL80211_TESTMODE_STA_STATISTICS_VERSION
, NL80211_DRIVER_TESTMODE_VERSION
);
2486 NLA_PUT(skb
, NL80211_TESTMODE_STA_STATISTICS_MAC
, MAC_ADDR_LEN
, prParams
->aucMacAddr
);
2487 NLA_PUT_U8(skb
, NL80211_TESTMODE_STA_STATISTICS_LINK_SCORE
, u4LinkScore
);
2488 NLA_PUT_U32(skb
, NL80211_TESTMODE_STA_STATISTICS_FLAG
, rQueryStaStatistics
.u4Flag
);
2490 /* FW part STA link status */
2491 NLA_PUT_U8(skb
, NL80211_TESTMODE_STA_STATISTICS_PER
, rQueryStaStatistics
.ucPer
);
2492 NLA_PUT_U8(skb
, NL80211_TESTMODE_STA_STATISTICS_RSSI
, rQueryStaStatistics
.ucRcpi
);
2493 NLA_PUT_U32(skb
, NL80211_TESTMODE_STA_STATISTICS_PHY_MODE
, rQueryStaStatistics
.u4PhyMode
);
2494 NLA_PUT_U16(skb
, NL80211_TESTMODE_STA_STATISTICS_TX_RATE
, rQueryStaStatistics
.u2LinkSpeed
);
2495 NLA_PUT_U32(skb
, NL80211_TESTMODE_STA_STATISTICS_FAIL_CNT
, rQueryStaStatistics
.u4TxFailCount
);
2496 NLA_PUT_U32(skb
, NL80211_TESTMODE_STA_STATISTICS_TIMEOUT_CNT
, rQueryStaStatistics
.u4TxLifeTimeoutCount
);
2497 NLA_PUT_U32(skb
, NL80211_TESTMODE_STA_STATISTICS_AVG_AIR_TIME
, rQueryStaStatistics
.u4TxAverageAirTime
);
2499 /* Driver part link status */
2500 NLA_PUT_U32(skb
, NL80211_TESTMODE_STA_STATISTICS_TOTAL_CNT
, rQueryStaStatistics
.u4TxTotalCount
);
2501 NLA_PUT_U32(skb
, NL80211_TESTMODE_STA_STATISTICS_THRESHOLD_CNT
, rQueryStaStatistics
.u4TxExceedThresholdCount
);
2502 NLA_PUT_U32(skb
, NL80211_TESTMODE_STA_STATISTICS_AVG_PROCESS_TIME
, rQueryStaStatistics
.u4TxAverageProcessTime
);
2504 /* Network counter */
2507 NL80211_TESTMODE_STA_STATISTICS_TC_EMPTY_CNT_ARRAY
,
2508 sizeof(rQueryStaStatistics
.au4TcResourceEmptyCount
),
2509 rQueryStaStatistics
.au4TcResourceEmptyCount
);
2511 /* Sta queue length */
2514 NL80211_TESTMODE_STA_STATISTICS_TC_QUE_LEN_ARRAY
,
2515 sizeof(rQueryStaStatistics
.au4TcQueLen
),
2516 rQueryStaStatistics
.au4TcQueLen
);
2518 /* Global QM counter */
2521 NL80211_TESTMODE_STA_STATISTICS_TC_AVG_QUE_LEN_ARRAY
,
2522 sizeof(rQueryStaStatistics
.au4TcAverageQueLen
),
2523 rQueryStaStatistics
.au4TcAverageQueLen
);
2527 NL80211_TESTMODE_STA_STATISTICS_TC_CUR_QUE_LEN_ARRAY
,
2528 sizeof(rQueryStaStatistics
.au4TcCurrentQueLen
),
2529 rQueryStaStatistics
.au4TcCurrentQueLen
);
2531 /* Reserved field */
2534 NL80211_TESTMODE_STA_STATISTICS_RESERVED_ARRAY
,
2535 sizeof(rQueryStaStatistics
.au4Reserved
),
2536 rQueryStaStatistics
.au4Reserved
);
2538 i4Status
= cfg80211_testmode_reply(skb
);
2545 mtk_cfg80211_testmode_get_link_detection(
2546 IN
struct wiphy
*wiphy
,
2549 IN P_GLUE_INFO_T prGlueInfo
)
2553 WLAN_STATUS rStatus
= WLAN_STATUS_SUCCESS
;
2554 INT_32 i4Status
= -EINVAL
;
2557 PARAM_802_11_STATISTICS_STRUCT_T rStatistics
;
2558 struct sk_buff
*skb
;
2563 skb
= cfg80211_testmode_alloc_reply_skb(wiphy
, sizeof(PARAM_GET_STA_STA_STATISTICS
) + 1);
2566 DBGLOG(QM
, TRACE
, ("%s allocate skb failed:%x\n", __FUNCTION__
, rStatus
));
2570 kalMemZero(&rStatistics
, sizeof(rStatistics
));
2572 rStatus
= kalIoctl(prGlueInfo
,
2573 wlanoidQueryStatistics
,
2575 sizeof(rStatistics
),
2582 NLA_PUT_U8(skb
, NL80211_TESTMODE_STA_STATISTICS_INVALID
, 0);
2583 NLA_PUT_U64(skb
, NL80211_TESTMODE_LINK_TX_FAIL_CNT
, rStatistics
.rFailedCount
.QuadPart
);
2584 NLA_PUT_U64(skb
, NL80211_TESTMODE_LINK_TX_RETRY_CNT
, rStatistics
.rRetryCount
.QuadPart
);
2585 NLA_PUT_U64(skb
, NL80211_TESTMODE_LINK_TX_MULTI_RETRY_CNT
, rStatistics
.rMultipleRetryCount
.QuadPart
);
2586 NLA_PUT_U64(skb
, NL80211_TESTMODE_LINK_ACK_FAIL_CNT
, rStatistics
.rACKFailureCount
.QuadPart
);
2587 NLA_PUT_U64(skb
, NL80211_TESTMODE_LINK_FCS_ERR_CNT
, rStatistics
.rFCSErrorCount
.QuadPart
);
2589 i4Status
= cfg80211_testmode_reply(skb
);
2596 mtk_cfg80211_testmode_sw_cmd(
2597 IN
struct wiphy
*wiphy
,
2601 P_GLUE_INFO_T prGlueInfo
= NULL
;
2602 P_NL80211_DRIVER_SW_CMD_PARAMS prParams
= (P_NL80211_DRIVER_SW_CMD_PARAMS
)NULL
;
2603 WLAN_STATUS rstatus
= WLAN_STATUS_SUCCESS
;
2605 UINT_32 u4SetInfoLen
= 0;
2609 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
2612 printk("--> %s()\n", __func__
);
2616 prParams
= (P_NL80211_DRIVER_SW_CMD_PARAMS
)data
;
2619 if(prParams
->set
== 1){
2620 rstatus
= kalIoctl(prGlueInfo
,
2621 (PFN_OID_HANDLER_FUNC
)wlanoidSetSwCtrlWrite
,
2632 if (WLAN_STATUS_SUCCESS
!= rstatus
) {
2633 fgIsValid
= -EFAULT
;
2640 #if CFG_SUPPORT_HOTSPOT_2_0
2642 mtk_cfg80211_testmode_hs20_cmd(
2643 IN
struct wiphy
*wiphy
,
2647 P_GLUE_INFO_T prGlueInfo
= NULL
;
2648 struct wpa_driver_hs20_data_s
*prParams
= NULL
;
2649 WLAN_STATUS rstatus
= WLAN_STATUS_SUCCESS
;
2651 UINT_32 u4SetInfoLen
= 0;
2655 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
2658 printk("--> %s()\n", __func__
);
2662 prParams
= (struct wpa_driver_hs20_data_s
*)data
;
2664 printk("[%s] Cmd Type (%d)\n", __func__
, prParams
->CmdType
);
2669 switch(prParams
->CmdType
){
2670 case HS20_CMD_ID_SET_BSSID_POOL
:
2671 printk("[%s] fgBssidPoolIsEnable (%d)\n", __func__
, prParams
->hs20_set_bssid_pool
.fgBssidPoolIsEnable
);
2672 printk("[%s] ucNumBssidPool (%d)\n", __func__
, prParams
->hs20_set_bssid_pool
.ucNumBssidPool
);
2674 for(i
=0; i
<prParams
->hs20_set_bssid_pool
.ucNumBssidPool
; i
++){
2675 printk("[%s][%d]["MACSTR
"]\n", __func__
, i
, MAC2STR(prParams
->hs20_set_bssid_pool
.arBssidPool
[i
]));
2677 rstatus
= kalIoctl(prGlueInfo
,
2678 (PFN_OID_HANDLER_FUNC
)wlanoidSetHS20BssidPool
,
2679 &prParams
->hs20_set_bssid_pool
,
2680 sizeof(struct param_hs20_set_bssid_pool
),
2688 printk("[%s] Unknown Cmd Type (%d)\n", __func__
, prParams
->CmdType
);
2689 rstatus
= WLAN_STATUS_FAILURE
;
2695 if (WLAN_STATUS_SUCCESS
!= rstatus
) {
2696 fgIsValid
= -EFAULT
;
2704 mtk_cfg80211_testmode_set_poorlink_param(
2705 IN
struct wiphy
*wiphy
,
2708 IN P_GLUE_INFO_T prGlueInfo
)
2711 P_NL80211_DRIVER_POORLINK_PARAMS prParams
= NULL
;
2717 prParams
= (P_NL80211_DRIVER_POORLINK_PARAMS
)data
;
2719 if(prParams
->ucLinkSpeed
)
2720 prGlueInfo
->u4LinkspeedThreshold
= prParams
->ucLinkSpeed
*10;
2722 prGlueInfo
->i4RssiThreshold
= prParams
->cRssi
;
2723 if(!prGlueInfo
->fgPoorlinkValid
)
2724 prGlueInfo
->fgPoorlinkValid
= 1;
2726 printk("poorlink set param valid(%d)rssi(%d)linkspeed(%d)\n",
2727 prGlueInfo
->fgPoorlinkValid
,
2728 prGlueInfo
->i4RssiThreshold
,
2729 prGlueInfo
->u4LinkspeedThreshold
2737 int mtk_cfg80211_testmode_cmd(
2738 IN
struct wiphy
*wiphy
,
2743 P_GLUE_INFO_T prGlueInfo
= NULL
;
2744 P_NL80211_DRIVER_TEST_MODE_PARAMS prParams
= (P_NL80211_DRIVER_TEST_MODE_PARAMS
)NULL
;
2745 INT_32 i4Status
= -EINVAL
;
2746 #if CFG_SUPPORT_HOTSPOT_2_0
2747 BOOLEAN fgIsValid
= 0;
2752 prGlueInfo
= (P_GLUE_INFO_T
) wiphy_priv(wiphy
);
2755 prParams
= (P_NL80211_DRIVER_TEST_MODE_PARAMS
)data
;
2758 DBGLOG(REQ
, ERROR
, ("mtk_cfg80211_testmode_cmd, data is NULL\n"));
2762 /* Clear the version byte */
2763 prParams
->index
= prParams
->index
& ~ BITS(24,31);
2766 switch(prParams
->index
){
2767 case TESTMODE_CMD_ID_SW_CMD
: /* SW cmd */
2768 i4Status
= mtk_cfg80211_testmode_sw_cmd(wiphy
, data
, len
);
2770 case TESTMODE_CMD_ID_WAPI
: /* WAPI */
2771 #if CFG_SUPPORT_WAPI
2772 i4Status
= mtk_cfg80211_testmode_set_key_ext(wiphy
, data
, len
);
2775 case TESTMODE_CMD_ID_SUSPEND
:
2777 P_NL80211_DRIVER_SUSPEND_PARAMS prParams
= (P_NL80211_DRIVER_SUSPEND_PARAMS
)data
;
2779 if (prParams
->suspend
== 1){
2780 wlanHandleSystemSuspend();
2781 if (prGlueInfo
->prAdapter
->fgIsP2PRegistered
)
2782 p2pHandleSystemSuspend();
2784 } else if (prParams
->suspend
== 0) {
2785 wlanHandleSystemResume();
2786 if (prGlueInfo
->prAdapter
->fgIsP2PRegistered
)
2787 p2pHandleSystemResume();
2792 case TESTMODE_CMD_ID_STATISTICS
:
2793 i4Status
= mtk_cfg80211_testmode_get_sta_statistics(wiphy
, data
, len
, prGlueInfo
);
2795 case TESTMODE_CMD_ID_LINK_DETECT
:
2796 i4Status
= mtk_cfg80211_testmode_get_link_detection(wiphy
, data
, len
, prGlueInfo
);
2798 case TESTMODE_CMD_ID_POORLINK
:
2799 i4Status
= mtk_cfg80211_testmode_set_poorlink_param(wiphy
, data
, len
, prGlueInfo
);
2802 #if CFG_SUPPORT_HOTSPOT_2_0
2803 case TESTMODE_CMD_ID_HS20
:
2804 if(mtk_cfg80211_testmode_hs20_cmd(wiphy
, data
, len
))
2817 mtk_cfg80211_testmode_get_scan_done(
2818 IN
struct wiphy
*wiphy
,
2821 IN P_GLUE_INFO_T prGlueInfo
)
2823 #define NL80211_TESTMODE_P2P_SCANDONE_INVALID 0
2824 #define NL80211_TESTMODE_P2P_SCANDONE_STATUS 1
2825 WLAN_STATUS rStatus
= WLAN_STATUS_SUCCESS
;
2826 INT_32 i4Status
= -EINVAL
,READY_TO_BEAM
=0;
2829 // P_NL80211_DRIVER_GET_STA_STATISTICS_PARAMS prParams = NULL;
2830 struct sk_buff
*skb
;
2835 skb
= cfg80211_testmode_alloc_reply_skb(wiphy
, sizeof(UINT_32
) );
2836 READY_TO_BEAM
=(UINT_32
)(prGlueInfo
->prAdapter
->rWifiVar
.prP2pFsmInfo
->rScanReqInfo
.fgIsGOInitialDone
)&(!prGlueInfo
->prAdapter
->rWifiVar
.prP2pFsmInfo
->rScanReqInfo
.fgIsScanRequest
);
2837 DBGLOG(QM
, TRACE
, ("NFC:GOInitialDone[%d] and P2PScanning[%d]\n",prGlueInfo
->prAdapter
->rWifiVar
.prP2pFsmInfo
->rScanReqInfo
.fgIsGOInitialDone
,prGlueInfo
->prAdapter
->rWifiVar
.prP2pFsmInfo
->rScanReqInfo
.fgIsScanRequest
));
2841 DBGLOG(QM
, TRACE
, ("%s allocate skb failed:%x\n", __FUNCTION__
, rStatus
));
2848 NLA_PUT_U8(skb
, NL80211_TESTMODE_P2P_SCANDONE_INVALID
, 0);
2849 NLA_PUT_U32(skb
, NL80211_TESTMODE_P2P_SCANDONE_STATUS
, READY_TO_BEAM
);
2852 i4Status
= cfg80211_testmode_reply(skb
);
2857 #if CFG_AUTO_CHANNEL_SEL_SUPPORT
2859 mtk_cfg80211_testmode_get_lte_channel(
2860 IN
struct wiphy
*wiphy
,
2863 IN P_GLUE_INFO_T prGlueInfo
)
2866 BOOLEAN fgIsReady
=FALSE
,fgIsFistRecord
=TRUE
;
2870 UINT_8 ucIdx
=0,ucMax_24G_Chn_List
=11 ,i
=0;
2872 INT_32 i4Status
= -EINVAL
;
2874 UINT_32 AcsChnRepot
[4];
2876 struct sk_buff
*skb
;
2878 WLAN_STATUS rStatus
= WLAN_STATUS_SUCCESS
;
2881 P_PARAM_GET_CHN_LOAD prParams
= NULL
;
2882 PARAM_GET_CHN_LOAD rQueryLTEChn
;
2883 PARAM_PREFER_CHN_INFO PreferChannels
[2];
2884 P_PARAM_CHN_LOAD_INFO prChnLoad
;
2887 P_DOMAIN_INFO_ENTRY prDomainInfo
;
2888 P_DOMAIN_SUBBAND_INFO prSubband
;
2889 RF_CHANNEL_INFO_T aucChannelList
[14];
2897 fgIsPureAP
=prGlueInfo
->prAdapter
->rWifiVar
.prP2pFsmInfo
->fgIsApMode
;
2900 prParams
= (P_NL80211_DRIVER_GET_LTE_PARAMS
)data
;
2903 //Prepare Reply skb buffer
2904 skb
= cfg80211_testmode_alloc_reply_skb(wiphy
, sizeof(PARAM_GET_STA_STA_STATISTICS
) + 1);
2906 DBGLOG(QM
, TRACE
, ("%s allocate skb failed:%x\n", __FUNCTION__
, rStatus
));
2910 DBGLOG(P2P
, INFO
,("[Auto Channel]Get LTE Channels\n"));
2912 kalMemZero(&rQueryLTEChn
, sizeof(rQueryLTEChn
));
2914 //Query LTE Safe Channels
2915 rStatus
= kalIoctl(prGlueInfo
,
2916 wlanoidQueryACSChannelList
,
2918 sizeof(rQueryLTEChn
),
2926 fgIsReady
=prGlueInfo
->prAdapter
->rWifiVar
.rChnLoadInfo
.fgDataReadyBit
;
2927 PreferChannels
[0].u2APNum
=0xFFFF;
2928 PreferChannels
[1].u2APNum
=0xFFFF;
2929 //In LTE Mode, Hotspot pick up channels from ch4.
2930 #ifdef CONFIG_MTK_LTE_SUPPORT
2932 ucIdx
=3; //SKIP LTE Channels 1~3
2935 //Get the Maximun channel List in 2.4G Bands
2937 prDomainInfo
= rlmDomainGetDomainInfo(prGlueInfo
->prAdapter
);
2938 ASSERT(prDomainInfo
);
2940 // 2. Get current domain channel list
2941 rlmDomainGetChnlList(prGlueInfo
->prAdapter
,
2944 &ucMax_24G_Chn_List
,
2946 for(ucIdx
;ucIdx
< ucMax_24G_Chn_List
;ucIdx
++) {
2948 prChnLoad
= (P_PARAM_CHN_LOAD_INFO
)&(prGlueInfo
->prAdapter
->rWifiVar
.rChnLoadInfo
.rEachChnLoad
[ucIdx
]);
2949 if (PreferChannels
[0].u2APNum
>= prChnLoad
->u2APNum
) {
2950 PreferChannels
[1].ucChannel
=PreferChannels
[0].ucChannel
;
2951 PreferChannels
[1].u2APNum
=PreferChannels
[0].u2APNum
;
2953 PreferChannels
[0].ucChannel
=ucIdx
;
2954 PreferChannels
[0].u2APNum
=prChnLoad
->u2APNum
;
2957 if (fgIsFistRecord
==1 || PreferChannels
[1].u2APNum
>= prChnLoad
->u2APNum
) {
2958 fgIsFistRecord
=FALSE
;
2959 PreferChannels
[1].ucChannel
=prChnLoad
->ucChannel
;
2960 PreferChannels
[1].u2APNum
=prChnLoad
->u2APNum
;
2963 DBGLOG(P2P
, INFO
,("[Auto Channel] AP Num: Channel[%d]=%d\n",ucIdx
+1,prChnLoad
->u2APNum
));
2965 //AcsChnRepot[NL80211_TESTMODE_AVAILABLE_CHAN_2G_BASE_1-1] =BITS((rQueryLTEChn.rLteSafeChnList.ucChannelLow-1),(rQueryLTEChn.rLteSafeChnList.ucChannelHigh-1));
2966 AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_2G_BASE_1
-1]=fgIsReady
?BIT(31):0;
2967 AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_2G_BASE_1
-1]|=BIT(PreferChannels
[1].ucChannel
) | BIT(PreferChannels
[0].ucChannel
);
2970 //ToDo: Support 5G Channel Selection
2971 AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_34
-1] =0x11223344;
2972 AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_149
-1] =0x55667788;
2973 AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_184
-1] =0x99AABBCC;
2976 NLA_PUT_U8(skb
, NL80211_TESTMODE_AVAILABLE_CHAN_INVALID
, 0);
2977 NLA_PUT_U32(skb
, NL80211_TESTMODE_AVAILABLE_CHAN_2G_BASE_1
, AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_2G_BASE_1
-1]);
2978 NLA_PUT_U32(skb
, NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_34
, AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_34
-1]);
2979 NLA_PUT_U32(skb
, NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_149
, AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_149
-1]);
2980 NLA_PUT_U32(skb
, NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_184
, AcsChnRepot
[NL80211_TESTMODE_AVAILABLE_CHAN_5G_BASE_184
-1]);
2982 DBGLOG(P2P
, INFO
,("[Auto Channel]Relpy AcsChanInfo[%x:%x:%x:%x]\n",AcsChnRepot
[0],AcsChnRepot
[1],AcsChnRepot
[2],AcsChnRepot
[3]));
2984 i4Status
= cfg80211_testmode_reply(skb
);