mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-13 22:14:20 +08:00
staging: rtl8723au: Use nl80211_iftype instead of driver's own custom types
In addition move rtw_set_802_11_infrastructure_mode23a() to ioctl_cfg80211.c and declare it static. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9680817362
commit
efc7144ff1
@ -824,7 +824,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
|
||||
|
||||
memcpy(ie, pbuf, pbss_network->IELength);
|
||||
|
||||
if (pbss_network->InfrastructureMode!= Ndis802_11APMode)
|
||||
if (pbss_network->ifmode != NL80211_IFTYPE_AP &&
|
||||
pbss_network->ifmode != NL80211_IFTYPE_P2P_GO)
|
||||
return _FAIL;
|
||||
|
||||
pbss_network->Rssi = 0;
|
||||
@ -1898,7 +1899,7 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
|
||||
struct sta_info *chk_alive_list[NUM_STA];
|
||||
int i;
|
||||
|
||||
rtw_setopmode_cmd23a(padapter, Ndis802_11APMode);
|
||||
rtw_setopmode_cmd23a(padapter, NL80211_IFTYPE_AP);
|
||||
|
||||
set_channel_bwmode23a(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
|
||||
|
||||
|
@ -477,11 +477,11 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter,
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct registry_priv *pregistrypriv = &padapter->registrypriv;
|
||||
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
|
||||
enum ndis_802_11_net_infra ndis_network_mode;
|
||||
enum nl80211_iftype ifmode;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
ndis_network_mode = pnetwork->network.InfrastructureMode;
|
||||
ifmode = pnetwork->network.ifmode;
|
||||
|
||||
rtw_led_control(padapter, LED_CTL_START_TO_LINK);
|
||||
|
||||
@ -505,16 +505,15 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter,
|
||||
|
||||
/* for hidden ap to set fw_state here */
|
||||
if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) {
|
||||
switch (ndis_network_mode) {
|
||||
case Ndis802_11IBSS:
|
||||
switch (ifmode) {
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
|
||||
break;
|
||||
case Ndis802_11Infrastructure:
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
set_fwstate(pmlmepriv, WIFI_STATION_STATE);
|
||||
break;
|
||||
case Ndis802_11APMode:
|
||||
case Ndis802_11AutoUnknown:
|
||||
case Ndis802_11InfrastructureMax:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -673,7 +672,7 @@ exit:
|
||||
}
|
||||
|
||||
int rtw_setopmode_cmd23a(struct rtw_adapter *padapter,
|
||||
enum ndis_802_11_net_infra networktype)
|
||||
enum nl80211_iftype ifmode)
|
||||
{
|
||||
struct cmd_obj *ph2c;
|
||||
struct setopmode_parm *psetop;
|
||||
@ -694,7 +693,7 @@ int rtw_setopmode_cmd23a(struct rtw_adapter *padapter,
|
||||
}
|
||||
|
||||
init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_);
|
||||
psetop->mode = (u8)networktype;
|
||||
psetop->mode = ifmode;
|
||||
|
||||
res = rtw_enqueue_cmd23a(pcmdpriv, ph2c);
|
||||
exit:
|
||||
|
@ -279,92 +279,6 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
int rtw_set_802_11_infrastructure_mode23a(struct rtw_adapter* padapter,
|
||||
enum ndis_802_11_net_infra networktype)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct wlan_network *cur_network = &pmlmepriv->cur_network;
|
||||
enum ndis_802_11_net_infra* pold_state;
|
||||
|
||||
pold_state = &cur_network->network.InfrastructureMode;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_notice_,
|
||||
("+rtw_set_802_11_infrastructure_mode23a: old =%d new =%d "
|
||||
"fw_state = 0x%08x\n",
|
||||
*pold_state, networktype, get_fwstate(pmlmepriv)));
|
||||
|
||||
if (*pold_state != networktype) {
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
(" change mode!"));
|
||||
|
||||
if (*pold_state == Ndis802_11APMode) {
|
||||
/* change to other mode from Ndis802_11APMode */
|
||||
cur_network->join_res = -1;
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
stop_ap_mode23a(padapter);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) ||
|
||||
*pold_state == Ndis802_11IBSS)
|
||||
rtw_disassoc_cmd23a(padapter, 0, true);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) ||
|
||||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
|
||||
rtw_free_assoc_resources23a(padapter, 1);
|
||||
|
||||
if (*pold_state == Ndis802_11Infrastructure ||
|
||||
*pold_state == Ndis802_11IBSS) {
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
/* will clr Linked_state; before this function,
|
||||
we must have chked whether issue
|
||||
dis-assoc_cmd or not */
|
||||
rtw_indicate_disconnect23a(padapter);
|
||||
}
|
||||
}
|
||||
|
||||
*pold_state = networktype;
|
||||
|
||||
_clr_fwstate_(pmlmepriv, ~WIFI_NULL_STATE);
|
||||
|
||||
switch (networktype)
|
||||
{
|
||||
case Ndis802_11IBSS:
|
||||
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
|
||||
break;
|
||||
|
||||
case Ndis802_11Infrastructure:
|
||||
set_fwstate(pmlmepriv, WIFI_STATION_STATE);
|
||||
break;
|
||||
|
||||
case Ndis802_11APMode:
|
||||
set_fwstate(pmlmepriv, WIFI_AP_STATE);
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
start_ap_mode23a(padapter);
|
||||
/* rtw_indicate_connect23a(padapter); */
|
||||
#endif
|
||||
break;
|
||||
|
||||
case Ndis802_11AutoUnknown:
|
||||
case Ndis802_11InfrastructureMax:
|
||||
break;
|
||||
}
|
||||
|
||||
/* SecClearAllKeys(adapter); */
|
||||
|
||||
/* RT_TRACE(COMP_OID_SET, DBG_LOUD,
|
||||
("set_infrastructure: fw_state:%x after changing mode\n", */
|
||||
/* get_fwstate(pmlmepriv))); */
|
||||
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
}
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
|
||||
struct cfg80211_ssid *pssid,
|
||||
int ssid_max_num)
|
||||
|
@ -52,8 +52,7 @@ int rtw_init_mlme_priv23a(struct rtw_adapter *padapter)
|
||||
pmlmepriv->nic_hdl = padapter;
|
||||
|
||||
pmlmepriv->fw_state = 0;
|
||||
pmlmepriv->cur_network.network.InfrastructureMode =
|
||||
Ndis802_11AutoUnknown;
|
||||
pmlmepriv->cur_network.network.ifmode = NL80211_IFTYPE_UNSPECIFIED;
|
||||
/* 1: active, 0: pasive. Maybe someday we should rename this
|
||||
varable to "active_mode" (Jeff) */
|
||||
pmlmepriv->scan_mode = SCAN_ACTIVE;
|
||||
@ -616,8 +615,8 @@ static int rtw_is_desired_network(struct rtw_adapter *adapter,
|
||||
}
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
|
||||
if (pnetwork->network.InfrastructureMode !=
|
||||
pmlmepriv->cur_network.network.InfrastructureMode)
|
||||
if (pnetwork->network.ifmode !=
|
||||
pmlmepriv->cur_network.network.ifmode)
|
||||
bselected = false;
|
||||
}
|
||||
|
||||
@ -1137,14 +1136,15 @@ rtw_joinbss_update_network23a(struct rtw_adapter *padapter,
|
||||
rtw_set_signal_stat_timer(&padapter->recvpriv);
|
||||
|
||||
/* update fw_state will clr _FW_UNDER_LINKING here indirectly */
|
||||
switch (pnetwork->network.InfrastructureMode) {
|
||||
case Ndis802_11Infrastructure:
|
||||
if (pmlmepriv->fw_state&WIFI_UNDER_WPS)
|
||||
switch (pnetwork->network.ifmode) {
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
if (pmlmepriv->fw_state & WIFI_UNDER_WPS)
|
||||
pmlmepriv->fw_state = WIFI_STATION_STATE|WIFI_UNDER_WPS;
|
||||
else
|
||||
pmlmepriv->fw_state = WIFI_STATION_STATE;
|
||||
break;
|
||||
case Ndis802_11IBSS:
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
pmlmepriv->fw_state = WIFI_ADHOC_STATE;
|
||||
break;
|
||||
default:
|
||||
@ -2179,11 +2179,10 @@ void rtw_update_registrypriv_dev_network23a(struct rtw_adapter* adapter)
|
||||
"DSConfig = 0x%x\n", pregistrypriv->channel,
|
||||
pdev_network->Configuration.DSConfig));
|
||||
|
||||
if (cur_network->network.InfrastructureMode == Ndis802_11IBSS)
|
||||
if (cur_network->network.ifmode == NL80211_IFTYPE_ADHOC)
|
||||
pdev_network->Configuration.ATIMWindow = 0;
|
||||
|
||||
pdev_network->InfrastructureMode =
|
||||
cur_network->network.InfrastructureMode;
|
||||
pdev_network->ifmode = cur_network->network.ifmode;
|
||||
|
||||
/* 1. Supported rates */
|
||||
/* 2. IE */
|
||||
|
@ -4596,7 +4596,7 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
|
||||
|
||||
if (ieee80211_is_probe_req(mgmt->frame_control)) {
|
||||
/* FIXME */
|
||||
bssid->InfrastructureMode = Ndis802_11Infrastructure;
|
||||
bssid->ifmode = NL80211_IFTYPE_STATION;
|
||||
ether_addr_copy(bssid->MacAddress, mgmt->sa);
|
||||
bssid->Privacy = 1;
|
||||
return _SUCCESS;
|
||||
@ -4608,10 +4608,10 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
|
||||
le32_to_cpu(bssid->Configuration.BeaconPeriod);
|
||||
|
||||
if (capab_info & BIT(0)) {
|
||||
bssid->InfrastructureMode = Ndis802_11Infrastructure;
|
||||
bssid->ifmode = NL80211_IFTYPE_STATION;
|
||||
ether_addr_copy(bssid->MacAddress, mgmt->sa);
|
||||
} else {
|
||||
bssid->InfrastructureMode = Ndis802_11IBSS;
|
||||
bssid->ifmode = NL80211_IFTYPE_ADHOC;
|
||||
ether_addr_copy(bssid->MacAddress, mgmt->bssid);
|
||||
}
|
||||
|
||||
@ -5814,22 +5814,32 @@ int NULL_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
|
||||
|
||||
int setopmode_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
|
||||
{
|
||||
u8 type;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
enum nl80211_iftype type;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
const struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf;
|
||||
|
||||
if (psetop->mode == Ndis802_11APMode) {
|
||||
switch (psetop->mode) {
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
case NL80211_IFTYPE_AP:
|
||||
pmlmeinfo->state = WIFI_FW_AP_STATE;
|
||||
type = _HW_STATE_AP_;
|
||||
} else if (psetop->mode == Ndis802_11Infrastructure) {
|
||||
pmlmeinfo->state &= ~(BIT(0)|BIT(1));/* clear state */
|
||||
pmlmeinfo->state |= WIFI_FW_STATION_STATE;/* set to STATION_STATE */
|
||||
break;
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
/* clear state */
|
||||
pmlmeinfo->state &= ~(BIT(0)|BIT(1));
|
||||
/* set to STATION_STATE */
|
||||
pmlmeinfo->state |= WIFI_FW_STATION_STATE;
|
||||
type = _HW_STATE_STATION_;
|
||||
} else if (psetop->mode == Ndis802_11IBSS)
|
||||
break;
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
type = _HW_STATE_ADHOC_;
|
||||
else
|
||||
break;
|
||||
default:
|
||||
type = _HW_STATE_NOLINK_;
|
||||
break;
|
||||
}
|
||||
|
||||
hw_var_set_opmode(padapter, type);
|
||||
/* Set_NETYPE0_MSR(padapter, type); */
|
||||
@ -5845,11 +5855,10 @@ int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
|
||||
const struct wlan_bssid_ex *pparm = (struct wlan_bssid_ex *)pbuf;
|
||||
/* u32 initialgain; */
|
||||
|
||||
if (pparm->InfrastructureMode == Ndis802_11APMode) {
|
||||
if (pparm->ifmode == NL80211_IFTYPE_AP ||
|
||||
pparm->ifmode == NL80211_IFTYPE_P2P_GO) {
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
|
||||
if (pmlmeinfo->state == WIFI_FW_AP_STATE)
|
||||
{
|
||||
if (pmlmeinfo->state == WIFI_FW_AP_STATE) {
|
||||
/* todo: */
|
||||
return H2C_SUCCESS;
|
||||
}
|
||||
@ -5857,7 +5866,7 @@ int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
|
||||
}
|
||||
|
||||
/* below is for ad-hoc master */
|
||||
if (pparm->InfrastructureMode == Ndis802_11IBSS) {
|
||||
if (pparm->ifmode == NL80211_IFTYPE_ADHOC) {
|
||||
rtw_joinbss_reset23a(padapter);
|
||||
|
||||
pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
|
||||
|
@ -126,7 +126,7 @@ static void sreset_restore_network_station(struct rtw_adapter *padapter)
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
u8 threshold;
|
||||
|
||||
rtw_setopmode_cmd23a(padapter, Ndis802_11Infrastructure);
|
||||
rtw_setopmode_cmd23a(padapter, NL80211_IFTYPE_STATION);
|
||||
|
||||
/* TH = 1 => means that invalidate usb rx aggregation */
|
||||
/* TH = 0 => means that validate usb rx aggregation, use init value. */
|
||||
|
@ -354,8 +354,9 @@ static void ConstructNullFunctionData(
|
||||
if (bForcePowerSave)
|
||||
SetPwrMgt(fctrl);
|
||||
|
||||
switch (cur_network->network.InfrastructureMode) {
|
||||
case Ndis802_11Infrastructure:
|
||||
switch (cur_network->network.ifmode) {
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
SetToDs(fctrl);
|
||||
memcpy(pwlanhdr->addr1,
|
||||
get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN);
|
||||
@ -363,7 +364,8 @@ static void ConstructNullFunctionData(
|
||||
ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN);
|
||||
break;
|
||||
case Ndis802_11APMode:
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
case NL80211_IFTYPE_AP:
|
||||
SetFrDs(fctrl);
|
||||
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr2,
|
||||
@ -371,7 +373,7 @@ static void ConstructNullFunctionData(
|
||||
memcpy(pwlanhdr->addr3, myid(&padapter->eeprompriv),
|
||||
ETH_ALEN);
|
||||
break;
|
||||
case Ndis802_11IBSS:
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
default:
|
||||
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
|
||||
memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
|
||||
|
@ -170,8 +170,7 @@ struct disconnect_parm {
|
||||
};
|
||||
|
||||
struct setopmode_parm {
|
||||
u8 mode;
|
||||
u8 rsvd[3];
|
||||
enum nl80211_iftype mode;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -689,7 +688,7 @@ int rtw_setstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 unicast_key
|
||||
int rtw_clearstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 entry, u8 enqueue);
|
||||
int rtw_joinbss_cmd23a(struct rtw_adapter *padapter, struct wlan_network* pnetwork);
|
||||
int rtw_disassoc_cmd23a(struct rtw_adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
|
||||
int rtw_setopmode_cmd23a(struct rtw_adapter *padapter, enum ndis_802_11_net_infra networktype);
|
||||
int rtw_setopmode_cmd23a(struct rtw_adapter *padapter, enum nl80211_iftype ifmode);
|
||||
int rtw_setdatarate_cmd(struct rtw_adapter *padapter, u8 *rateset);
|
||||
int rtw_setbasicrate_cmd(struct rtw_adapter *padapter, u8 *rateset);
|
||||
int rtw_setbbreg_cmd(struct rtw_adapter * padapter, u8 offset, u8 val);
|
||||
|
@ -24,8 +24,6 @@ int rtw_set_802_11_add_wep23a(struct rtw_adapter * padapter,
|
||||
int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
|
||||
struct cfg80211_ssid *pssid,
|
||||
int ssid_max_num);
|
||||
int rtw_set_802_11_infrastructure_mode23a(struct rtw_adapter *padapter,
|
||||
enum ndis_802_11_net_infra networktype);
|
||||
int rtw_set_802_11_ssid23a(struct rtw_adapter * padapter,
|
||||
struct cfg80211_ssid * ssid);
|
||||
|
||||
|
@ -50,14 +50,6 @@ struct ndis_802_11_config {
|
||||
struct ndis_802_11_configuration_fh FHConfig;
|
||||
};
|
||||
|
||||
enum ndis_802_11_net_infra {
|
||||
Ndis802_11IBSS,
|
||||
Ndis802_11Infrastructure,
|
||||
Ndis802_11AutoUnknown,
|
||||
Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */
|
||||
Ndis802_11APMode
|
||||
};
|
||||
|
||||
struct ndis_802_11_fixed_ies {
|
||||
u8 Timestamp[8];
|
||||
u16 BeaconInterval;
|
||||
@ -139,10 +131,6 @@ enum NDIS_802_11_STATUS_TYPE {
|
||||
/* MIC check time, 60 seconds. */
|
||||
#define MIC_CHECK_TIME 60000000
|
||||
|
||||
#ifndef Ndis802_11APMode
|
||||
#define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
|
||||
#endif
|
||||
|
||||
struct wlan_phy_info {
|
||||
u8 SignalStrength;/* in percentage) */
|
||||
u8 SignalQuality;/* in percentage) */
|
||||
@ -172,7 +160,7 @@ struct wlan_bssid_ex {
|
||||
long Rssi;/* in dBM, raw data , get from PHY) */
|
||||
enum ndis_802_11_net_type NetworkTypeInUse;
|
||||
struct ndis_802_11_config Configuration;
|
||||
enum ndis_802_11_net_infra InfrastructureMode;
|
||||
enum nl80211_iftype ifmode;
|
||||
unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
|
||||
struct wlan_phy_info PhyInfo;
|
||||
u32 IELength;
|
||||
|
@ -1291,18 +1291,103 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int cfg80211_infrastructure_mode(struct rtw_adapter* padapter,
|
||||
enum nl80211_iftype ifmode)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct wlan_network *cur_network = &pmlmepriv->cur_network;
|
||||
enum nl80211_iftype old_mode;
|
||||
|
||||
old_mode = cur_network->network.ifmode;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_notice_,
|
||||
("+%s: old =%d new =%d fw_state = 0x%08x\n", __func__,
|
||||
old_mode, ifmode, get_fwstate(pmlmepriv)));
|
||||
|
||||
if (old_mode != ifmode) {
|
||||
spin_lock_bh(&pmlmepriv->lock);
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
(" change mode!"));
|
||||
|
||||
if (old_mode == NL80211_IFTYPE_AP ||
|
||||
old_mode == NL80211_IFTYPE_P2P_GO) {
|
||||
/* change to other mode from Ndis802_11APMode */
|
||||
cur_network->join_res = -1;
|
||||
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
stop_ap_mode23a(padapter);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) ||
|
||||
old_mode == NL80211_IFTYPE_ADHOC)
|
||||
rtw_disassoc_cmd23a(padapter, 0, true);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) ||
|
||||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
|
||||
rtw_free_assoc_resources23a(padapter, 1);
|
||||
|
||||
if (old_mode == NL80211_IFTYPE_STATION ||
|
||||
old_mode == NL80211_IFTYPE_P2P_CLIENT ||
|
||||
old_mode == NL80211_IFTYPE_ADHOC) {
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
/* will clr Linked_state; before this function,
|
||||
we must have chked whether issue
|
||||
dis-assoc_cmd or not */
|
||||
rtw_indicate_disconnect23a(padapter);
|
||||
}
|
||||
}
|
||||
|
||||
cur_network->network.ifmode = ifmode;
|
||||
|
||||
_clr_fwstate_(pmlmepriv, ~WIFI_NULL_STATE);
|
||||
|
||||
switch (ifmode) {
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
|
||||
break;
|
||||
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
set_fwstate(pmlmepriv, WIFI_STATION_STATE);
|
||||
break;
|
||||
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
case NL80211_IFTYPE_AP:
|
||||
set_fwstate(pmlmepriv, WIFI_AP_STATE);
|
||||
#ifdef CONFIG_8723AU_AP_MODE
|
||||
start_ap_mode23a(padapter);
|
||||
/* rtw_indicate_connect23a(padapter); */
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* SecClearAllKeys(adapter); */
|
||||
|
||||
/* RT_TRACE(COMP_OID_SET, DBG_LOUD,
|
||||
("set_infrastructure: fw_state:%x after changing mode\n", */
|
||||
/* get_fwstate(pmlmepriv))); */
|
||||
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
}
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
|
||||
struct net_device *ndev,
|
||||
enum nl80211_iftype type, u32 *flags,
|
||||
struct vif_params *params)
|
||||
{
|
||||
enum nl80211_iftype old_type;
|
||||
enum ndis_802_11_net_infra networkType;
|
||||
struct rtw_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy);
|
||||
int ret = 0;
|
||||
u8 change = false;
|
||||
|
||||
DBG_8723A("%s(%s): call netdev_open23a\n", __func__, ndev->name);
|
||||
if (netdev_open23a(ndev) != 0) {
|
||||
@ -1320,22 +1405,17 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
|
||||
__func__, ndev->name, old_type, type);
|
||||
|
||||
if (old_type != type) {
|
||||
change = true;
|
||||
pmlmeext->action_public_rxseq = 0xffff;
|
||||
pmlmeext->action_public_dialog_token = 0xff;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
networkType = Ndis802_11IBSS;
|
||||
break;
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
networkType = Ndis802_11Infrastructure;
|
||||
break;
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
case NL80211_IFTYPE_AP:
|
||||
networkType = Ndis802_11APMode;
|
||||
case NL80211_IFTYPE_UNSPECIFIED:
|
||||
break;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
@ -1343,14 +1423,13 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
|
||||
|
||||
rtw_wdev->iftype = type;
|
||||
|
||||
if (rtw_set_802_11_infrastructure_mode23a
|
||||
(padapter, networkType) != _SUCCESS) {
|
||||
if (cfg80211_infrastructure_mode(padapter, type) != _SUCCESS) {
|
||||
rtw_wdev->iftype = old_type;
|
||||
ret = -EPERM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
rtw_setopmode_cmd23a(padapter, networkType);
|
||||
rtw_setopmode_cmd23a(padapter, type);
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
@ -1982,8 +2061,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (rtw_set_802_11_infrastructure_mode23a
|
||||
(padapter, pnetwork->network.InfrastructureMode) != _SUCCESS) {
|
||||
if (cfg80211_infrastructure_mode(
|
||||
padapter, pnetwork->network.ifmode) != _SUCCESS) {
|
||||
ret = -EPERM;
|
||||
goto exit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user