Commit efc7144f authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

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: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 96808173
...@@ -824,7 +824,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf, ...@@ -824,7 +824,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
memcpy(ie, pbuf, pbss_network->IELength); 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; return _FAIL;
pbss_network->Rssi = 0; pbss_network->Rssi = 0;
...@@ -1898,7 +1899,7 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter) ...@@ -1898,7 +1899,7 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
struct sta_info *chk_alive_list[NUM_STA]; struct sta_info *chk_alive_list[NUM_STA];
int i; 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); 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, ...@@ -477,11 +477,11 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter,
struct security_priv *psecuritypriv = &padapter->securitypriv; struct security_priv *psecuritypriv = &padapter->securitypriv;
struct registry_priv *pregistrypriv = &padapter->registrypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv; 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_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 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); rtw_led_control(padapter, LED_CTL_START_TO_LINK);
...@@ -505,16 +505,15 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter, ...@@ -505,16 +505,15 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter,
/* for hidden ap to set fw_state here */ /* for hidden ap to set fw_state here */
if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) { if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) {
switch (ndis_network_mode) { switch (ifmode) {
case Ndis802_11IBSS: case NL80211_IFTYPE_ADHOC:
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
break; break;
case Ndis802_11Infrastructure: case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
set_fwstate(pmlmepriv, WIFI_STATION_STATE); set_fwstate(pmlmepriv, WIFI_STATION_STATE);
break; break;
case Ndis802_11APMode: default:
case Ndis802_11AutoUnknown:
case Ndis802_11InfrastructureMax:
break; break;
} }
} }
...@@ -673,7 +672,7 @@ int rtw_disassoc_cmd23a(struct rtw_adapter*padapter, u32 deauth_timeout_ms, ...@@ -673,7 +672,7 @@ int rtw_disassoc_cmd23a(struct rtw_adapter*padapter, u32 deauth_timeout_ms,
} }
int rtw_setopmode_cmd23a(struct rtw_adapter *padapter, int rtw_setopmode_cmd23a(struct rtw_adapter *padapter,
enum ndis_802_11_net_infra networktype) enum nl80211_iftype ifmode)
{ {
struct cmd_obj *ph2c; struct cmd_obj *ph2c;
struct setopmode_parm *psetop; struct setopmode_parm *psetop;
...@@ -694,7 +693,7 @@ int rtw_setopmode_cmd23a(struct rtw_adapter *padapter, ...@@ -694,7 +693,7 @@ int rtw_setopmode_cmd23a(struct rtw_adapter *padapter,
} }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_); init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_);
psetop->mode = (u8)networktype; psetop->mode = ifmode;
res = rtw_enqueue_cmd23a(pcmdpriv, ph2c); res = rtw_enqueue_cmd23a(pcmdpriv, ph2c);
exit: exit:
......
...@@ -279,92 +279,6 @@ int rtw_set_802_11_ssid23a(struct rtw_adapter* padapter, ...@@ -279,92 +279,6 @@ int rtw_set_802_11_ssid23a(struct rtw_adapter* padapter,
return status; 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, int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
struct cfg80211_ssid *pssid, struct cfg80211_ssid *pssid,
int ssid_max_num) int ssid_max_num)
......
...@@ -52,8 +52,7 @@ int rtw_init_mlme_priv23a(struct rtw_adapter *padapter) ...@@ -52,8 +52,7 @@ int rtw_init_mlme_priv23a(struct rtw_adapter *padapter)
pmlmepriv->nic_hdl = padapter; pmlmepriv->nic_hdl = padapter;
pmlmepriv->fw_state = 0; pmlmepriv->fw_state = 0;
pmlmepriv->cur_network.network.InfrastructureMode = pmlmepriv->cur_network.network.ifmode = NL80211_IFTYPE_UNSPECIFIED;
Ndis802_11AutoUnknown;
/* 1: active, 0: pasive. Maybe someday we should rename this /* 1: active, 0: pasive. Maybe someday we should rename this
varable to "active_mode" (Jeff) */ varable to "active_mode" (Jeff) */
pmlmepriv->scan_mode = SCAN_ACTIVE; pmlmepriv->scan_mode = SCAN_ACTIVE;
...@@ -616,8 +615,8 @@ static int rtw_is_desired_network(struct rtw_adapter *adapter, ...@@ -616,8 +615,8 @@ static int rtw_is_desired_network(struct rtw_adapter *adapter,
} }
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
if (pnetwork->network.InfrastructureMode != if (pnetwork->network.ifmode !=
pmlmepriv->cur_network.network.InfrastructureMode) pmlmepriv->cur_network.network.ifmode)
bselected = false; bselected = false;
} }
...@@ -1137,14 +1136,15 @@ rtw_joinbss_update_network23a(struct rtw_adapter *padapter, ...@@ -1137,14 +1136,15 @@ rtw_joinbss_update_network23a(struct rtw_adapter *padapter,
rtw_set_signal_stat_timer(&padapter->recvpriv); rtw_set_signal_stat_timer(&padapter->recvpriv);
/* update fw_state will clr _FW_UNDER_LINKING here indirectly */ /* update fw_state will clr _FW_UNDER_LINKING here indirectly */
switch (pnetwork->network.InfrastructureMode) { switch (pnetwork->network.ifmode) {
case Ndis802_11Infrastructure: case NL80211_IFTYPE_P2P_CLIENT:
if (pmlmepriv->fw_state&WIFI_UNDER_WPS) case NL80211_IFTYPE_STATION:
if (pmlmepriv->fw_state & WIFI_UNDER_WPS)
pmlmepriv->fw_state = WIFI_STATION_STATE|WIFI_UNDER_WPS; pmlmepriv->fw_state = WIFI_STATION_STATE|WIFI_UNDER_WPS;
else else
pmlmepriv->fw_state = WIFI_STATION_STATE; pmlmepriv->fw_state = WIFI_STATION_STATE;
break; break;
case Ndis802_11IBSS: case NL80211_IFTYPE_ADHOC:
pmlmepriv->fw_state = WIFI_ADHOC_STATE; pmlmepriv->fw_state = WIFI_ADHOC_STATE;
break; break;
default: default:
...@@ -2179,11 +2179,10 @@ void rtw_update_registrypriv_dev_network23a(struct rtw_adapter* adapter) ...@@ -2179,11 +2179,10 @@ void rtw_update_registrypriv_dev_network23a(struct rtw_adapter* adapter)
"DSConfig = 0x%x\n", pregistrypriv->channel, "DSConfig = 0x%x\n", pregistrypriv->channel,
pdev_network->Configuration.DSConfig)); 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->Configuration.ATIMWindow = 0;
pdev_network->InfrastructureMode = pdev_network->ifmode = cur_network->network.ifmode;
cur_network->network.InfrastructureMode;
/* 1. Supported rates */ /* 1. Supported rates */
/* 2. IE */ /* 2. IE */
......
...@@ -4596,7 +4596,7 @@ int collect_bss_info23a(struct rtw_adapter *padapter, ...@@ -4596,7 +4596,7 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
if (ieee80211_is_probe_req(mgmt->frame_control)) { if (ieee80211_is_probe_req(mgmt->frame_control)) {
/* FIXME */ /* FIXME */
bssid->InfrastructureMode = Ndis802_11Infrastructure; bssid->ifmode = NL80211_IFTYPE_STATION;
ether_addr_copy(bssid->MacAddress, mgmt->sa); ether_addr_copy(bssid->MacAddress, mgmt->sa);
bssid->Privacy = 1; bssid->Privacy = 1;
return _SUCCESS; return _SUCCESS;
...@@ -4608,10 +4608,10 @@ int collect_bss_info23a(struct rtw_adapter *padapter, ...@@ -4608,10 +4608,10 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
le32_to_cpu(bssid->Configuration.BeaconPeriod); le32_to_cpu(bssid->Configuration.BeaconPeriod);
if (capab_info & BIT(0)) { if (capab_info & BIT(0)) {
bssid->InfrastructureMode = Ndis802_11Infrastructure; bssid->ifmode = NL80211_IFTYPE_STATION;
ether_addr_copy(bssid->MacAddress, mgmt->sa); ether_addr_copy(bssid->MacAddress, mgmt->sa);
} else { } else {
bssid->InfrastructureMode = Ndis802_11IBSS; bssid->ifmode = NL80211_IFTYPE_ADHOC;
ether_addr_copy(bssid->MacAddress, mgmt->bssid); ether_addr_copy(bssid->MacAddress, mgmt->bssid);
} }
...@@ -5814,22 +5814,32 @@ int NULL_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) ...@@ -5814,22 +5814,32 @@ int NULL_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
int setopmode_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) int setopmode_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
{ {
u8 type; enum nl80211_iftype type;
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;
const struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf; 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; pmlmeinfo->state = WIFI_FW_AP_STATE;
type = _HW_STATE_AP_; type = _HW_STATE_AP_;
} else if (psetop->mode == Ndis802_11Infrastructure) { break;
pmlmeinfo->state &= ~(BIT(0)|BIT(1));/* clear state */ case NL80211_IFTYPE_P2P_CLIENT:
pmlmeinfo->state |= WIFI_FW_STATION_STATE;/* set to STATION_STATE */ 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_; type = _HW_STATE_STATION_;
} else if (psetop->mode == Ndis802_11IBSS) break;
case NL80211_IFTYPE_ADHOC:
type = _HW_STATE_ADHOC_; type = _HW_STATE_ADHOC_;
else break;
default:
type = _HW_STATE_NOLINK_; type = _HW_STATE_NOLINK_;
break;
}
hw_var_set_opmode(padapter, type); hw_var_set_opmode(padapter, type);
/* Set_NETYPE0_MSR(padapter, type); */ /* Set_NETYPE0_MSR(padapter, type); */
...@@ -5845,11 +5855,10 @@ int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) ...@@ -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; const struct wlan_bssid_ex *pparm = (struct wlan_bssid_ex *)pbuf;
/* u32 initialgain; */ /* u32 initialgain; */
if (pparm->InfrastructureMode == Ndis802_11APMode) { if (pparm->ifmode == NL80211_IFTYPE_AP ||
pparm->ifmode == NL80211_IFTYPE_P2P_GO) {
#ifdef CONFIG_8723AU_AP_MODE #ifdef CONFIG_8723AU_AP_MODE
if (pmlmeinfo->state == WIFI_FW_AP_STATE) {
if (pmlmeinfo->state == WIFI_FW_AP_STATE)
{
/* todo: */ /* todo: */
return H2C_SUCCESS; return H2C_SUCCESS;
} }
...@@ -5857,7 +5866,7 @@ int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) ...@@ -5857,7 +5866,7 @@ int createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
} }
/* below is for ad-hoc master */ /* below is for ad-hoc master */
if (pparm->InfrastructureMode == Ndis802_11IBSS) { if (pparm->ifmode == NL80211_IFTYPE_ADHOC) {
rtw_joinbss_reset23a(padapter); rtw_joinbss_reset23a(padapter);
pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20; pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;
......
...@@ -126,7 +126,7 @@ static void sreset_restore_network_station(struct rtw_adapter *padapter) ...@@ -126,7 +126,7 @@ static void sreset_restore_network_station(struct rtw_adapter *padapter)
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
u8 threshold; u8 threshold;
rtw_setopmode_cmd23a(padapter, Ndis802_11Infrastructure); rtw_setopmode_cmd23a(padapter, NL80211_IFTYPE_STATION);
/* TH = 1 => means that invalidate usb rx aggregation */ /* TH = 1 => means that invalidate usb rx aggregation */
/* TH = 0 => means that validate usb rx aggregation, use init value. */ /* TH = 0 => means that validate usb rx aggregation, use init value. */
......
...@@ -354,8 +354,9 @@ static void ConstructNullFunctionData( ...@@ -354,8 +354,9 @@ static void ConstructNullFunctionData(
if (bForcePowerSave) if (bForcePowerSave)
SetPwrMgt(fctrl); SetPwrMgt(fctrl);
switch (cur_network->network.InfrastructureMode) { switch (cur_network->network.ifmode) {
case Ndis802_11Infrastructure: case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
SetToDs(fctrl); SetToDs(fctrl);
memcpy(pwlanhdr->addr1, memcpy(pwlanhdr->addr1,
get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN); get_my_bssid23a(&pmlmeinfo->network), ETH_ALEN);
...@@ -363,7 +364,8 @@ static void ConstructNullFunctionData( ...@@ -363,7 +364,8 @@ static void ConstructNullFunctionData(
ETH_ALEN); ETH_ALEN);
memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN); memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN);
break; break;
case Ndis802_11APMode: case NL80211_IFTYPE_P2P_GO:
case NL80211_IFTYPE_AP:
SetFrDs(fctrl); SetFrDs(fctrl);
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
memcpy(pwlanhdr->addr2, memcpy(pwlanhdr->addr2,
...@@ -371,7 +373,7 @@ static void ConstructNullFunctionData( ...@@ -371,7 +373,7 @@ static void ConstructNullFunctionData(
memcpy(pwlanhdr->addr3, myid(&padapter->eeprompriv), memcpy(pwlanhdr->addr3, myid(&padapter->eeprompriv),
ETH_ALEN); ETH_ALEN);
break; break;
case Ndis802_11IBSS: case NL80211_IFTYPE_ADHOC:
default: default:
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN); memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
......
...@@ -170,8 +170,7 @@ struct disconnect_parm { ...@@ -170,8 +170,7 @@ struct disconnect_parm {
}; };
struct setopmode_parm { struct setopmode_parm {
u8 mode; enum nl80211_iftype mode;
u8 rsvd[3];
}; };
/* /*
...@@ -689,7 +688,7 @@ int rtw_setstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 unicast_key ...@@ -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_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_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_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_setdatarate_cmd(struct rtw_adapter *padapter, u8 *rateset);
int rtw_setbasicrate_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); 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, ...@@ -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, int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
struct cfg80211_ssid *pssid, struct cfg80211_ssid *pssid,
int ssid_max_num); 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, int rtw_set_802_11_ssid23a(struct rtw_adapter * padapter,
struct cfg80211_ssid * ssid); struct cfg80211_ssid * ssid);
......
...@@ -50,14 +50,6 @@ struct ndis_802_11_config { ...@@ -50,14 +50,6 @@ struct ndis_802_11_config {
struct ndis_802_11_configuration_fh FHConfig; 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 { struct ndis_802_11_fixed_ies {
u8 Timestamp[8]; u8 Timestamp[8];
u16 BeaconInterval; u16 BeaconInterval;
...@@ -139,10 +131,6 @@ enum NDIS_802_11_STATUS_TYPE { ...@@ -139,10 +131,6 @@ enum NDIS_802_11_STATUS_TYPE {
/* MIC check time, 60 seconds. */ /* MIC check time, 60 seconds. */
#define MIC_CHECK_TIME 60000000 #define MIC_CHECK_TIME 60000000
#ifndef Ndis802_11APMode
#define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
#endif
struct wlan_phy_info { struct wlan_phy_info {
u8 SignalStrength;/* in percentage) */ u8 SignalStrength;/* in percentage) */
u8 SignalQuality;/* in percentage) */ u8 SignalQuality;/* in percentage) */
...@@ -172,7 +160,7 @@ struct wlan_bssid_ex { ...@@ -172,7 +160,7 @@ struct wlan_bssid_ex {
long Rssi;/* in dBM, raw data , get from PHY) */ long Rssi;/* in dBM, raw data , get from PHY) */
enum ndis_802_11_net_type NetworkTypeInUse; enum ndis_802_11_net_type NetworkTypeInUse;
struct ndis_802_11_config Configuration; 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]; unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
struct wlan_phy_info PhyInfo; struct wlan_phy_info PhyInfo;
u32 IELength; u32 IELength;
......
...@@ -1291,18 +1291,103 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, ...@@ -1291,18 +1291,103 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
return ret; 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, static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
enum nl80211_iftype type, u32 *flags, enum nl80211_iftype type, u32 *flags,
struct vif_params *params) struct vif_params *params)
{ {
enum nl80211_iftype old_type; enum nl80211_iftype old_type;
enum ndis_802_11_net_infra networkType;
struct rtw_adapter *padapter = wiphy_to_adapter(wiphy); struct rtw_adapter *padapter = wiphy_to_adapter(wiphy);
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy); struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy);
int ret = 0; int ret = 0;
u8 change = false;
DBG_8723A("%s(%s): call netdev_open23a\n", __func__, ndev->name); DBG_8723A("%s(%s): call netdev_open23a\n", __func__, ndev->name);
if (netdev_open23a(ndev) != 0) { if (netdev_open23a(ndev) != 0) {
...@@ -1320,22 +1405,17 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, ...@@ -1320,22 +1405,17 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
__func__, ndev->name, old_type, type); __func__, ndev->name, old_type, type);
if (old_type != type) { if (old_type != type) {
change = true;
pmlmeext->action_public_rxseq = 0xffff; pmlmeext->action_public_rxseq = 0xffff;
pmlmeext->action_public_dialog_token = 0xff; pmlmeext->action_public_dialog_token = 0xff;
} }
switch (type) { switch (type) {
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
networkType = Ndis802_11IBSS;
break;
case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
networkType = Ndis802_11Infrastructure;
break;
case NL80211_IFTYPE_P2P_GO: case NL80211_IFTYPE_P2P_GO:
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
networkType = Ndis802_11APMode; case NL80211_IFTYPE_UNSPECIFIED:
break; break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1343,14 +1423,13 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, ...@@ -1343,14 +1423,13 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
rtw_wdev->iftype = type; rtw_wdev->iftype = type;
if (rtw_set_802_11_infrastructure_mode23a if (cfg80211_infrastructure_mode(padapter, type) != _SUCCESS) {
(padapter, networkType) != _SUCCESS) {
rtw_wdev->iftype = old_type; rtw_wdev->iftype = old_type;
ret = -EPERM; ret = -EPERM;
goto exit; goto exit;
} }
rtw_setopmode_cmd23a(padapter, networkType); rtw_setopmode_cmd23a(padapter, type);
exit: exit:
return ret; return ret;
...@@ -1982,8 +2061,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1982,8 +2061,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
goto exit; goto exit;
} }
if (rtw_set_802_11_infrastructure_mode23a if (cfg80211_infrastructure_mode(
(padapter, pnetwork->network.InfrastructureMode) != _SUCCESS) { padapter, pnetwork->network.ifmode) != _SUCCESS) {
ret = -EPERM; ret = -EPERM;
goto exit; goto exit;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment