|
@@ -398,13 +398,9 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
|
|
int ret = 0;
|
|
int ret = 0;
|
|
int status = 0;
|
|
int status = 0;
|
|
struct mwifiex_ds_band_cfg band_cfg;
|
|
struct mwifiex_ds_band_cfg band_cfg;
|
|
- int mode;
|
|
|
|
- u8 wait_option = MWIFIEX_IOCTL_WAIT;
|
|
|
|
u32 config_bands = 0;
|
|
u32 config_bands = 0;
|
|
struct wiphy *wiphy = priv->wdev->wiphy;
|
|
struct wiphy *wiphy = priv->wdev->wiphy;
|
|
|
|
|
|
- mode = mwifiex_drv_get_mode(priv, wait_option);
|
|
|
|
-
|
|
|
|
if (chan) {
|
|
if (chan) {
|
|
memset(&band_cfg, 0, sizeof(band_cfg));
|
|
memset(&band_cfg, 0, sizeof(band_cfg));
|
|
/* Set appropriate bands */
|
|
/* Set appropriate bands */
|
|
@@ -412,10 +408,10 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
|
|
config_bands = BAND_B | BAND_G | BAND_GN;
|
|
config_bands = BAND_B | BAND_G | BAND_GN;
|
|
else
|
|
else
|
|
config_bands = BAND_AN | BAND_A;
|
|
config_bands = BAND_AN | BAND_A;
|
|
- if (mode == MWIFIEX_BSS_MODE_INFRA
|
|
|
|
- || mode == MWIFIEX_BSS_MODE_AUTO) {
|
|
|
|
|
|
+ if (priv->bss_mode == NL80211_IFTYPE_STATION
|
|
|
|
+ || priv->bss_mode == NL80211_IFTYPE_UNSPECIFIED) {
|
|
band_cfg.config_bands = config_bands;
|
|
band_cfg.config_bands = config_bands;
|
|
- } else if (mode == MWIFIEX_BSS_MODE_IBSS) {
|
|
|
|
|
|
+ } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
|
|
band_cfg.config_bands = config_bands;
|
|
band_cfg.config_bands = config_bands;
|
|
band_cfg.adhoc_start_band = config_bands;
|
|
band_cfg.adhoc_start_band = config_bands;
|
|
}
|
|
}
|
|
@@ -432,7 +428,8 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
|
|
}
|
|
}
|
|
|
|
|
|
wiphy_dbg(wiphy, "info: setting band %d, channel offset %d and "
|
|
wiphy_dbg(wiphy, "info: setting band %d, channel offset %d and "
|
|
- "mode %d\n", config_bands, band_cfg.sec_chan_offset, mode);
|
|
|
|
|
|
+ "mode %d\n", config_bands, band_cfg.sec_chan_offset,
|
|
|
|
+ priv->bss_mode);
|
|
if (!chan)
|
|
if (!chan)
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
@@ -561,14 +558,6 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
|
|
|
|
|
|
/*
|
|
/*
|
|
* CFG802.11 operation handler to change interface type.
|
|
* CFG802.11 operation handler to change interface type.
|
|
- *
|
|
|
|
- * This function creates an IOCTL request, populates it accordingly
|
|
|
|
- * and issues an IOCTL.
|
|
|
|
- *
|
|
|
|
- * The function also maps the CFG802.11 mode type into driver mode type.
|
|
|
|
- * NL80211_IFTYPE_ADHOC -> MWIFIEX_BSS_MODE_IBSS
|
|
|
|
- * NL80211_IFTYPE_STATION -> MWIFIEX_BSS_MODE_INFRA
|
|
|
|
- * NL80211_IFTYPE_UNSPECIFIED -> MWIFIEX_BSS_MODE_AUTO
|
|
|
|
*/
|
|
*/
|
|
static int
|
|
static int
|
|
mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
@@ -578,41 +567,50 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
{
|
|
{
|
|
int ret = 0;
|
|
int ret = 0;
|
|
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
|
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
|
- int mode = -1;
|
|
|
|
struct mwifiex_wait_queue *wait = NULL;
|
|
struct mwifiex_wait_queue *wait = NULL;
|
|
- int status = 0;
|
|
|
|
|
|
|
|
- wait = mwifiex_alloc_fill_wait_queue(priv, MWIFIEX_IOCTL_WAIT);
|
|
|
|
- if (!wait)
|
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ if (priv->bss_mode == type) {
|
|
|
|
+ wiphy_warn(wiphy, "already set to required type\n");
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ priv->bss_mode = type;
|
|
|
|
|
|
switch (type) {
|
|
switch (type) {
|
|
case NL80211_IFTYPE_ADHOC:
|
|
case NL80211_IFTYPE_ADHOC:
|
|
- mode = MWIFIEX_BSS_MODE_IBSS;
|
|
|
|
dev->ieee80211_ptr->iftype = NL80211_IFTYPE_ADHOC;
|
|
dev->ieee80211_ptr->iftype = NL80211_IFTYPE_ADHOC;
|
|
wiphy_dbg(wiphy, "info: setting interface type to adhoc\n");
|
|
wiphy_dbg(wiphy, "info: setting interface type to adhoc\n");
|
|
break;
|
|
break;
|
|
case NL80211_IFTYPE_STATION:
|
|
case NL80211_IFTYPE_STATION:
|
|
- mode = MWIFIEX_BSS_MODE_INFRA;
|
|
|
|
dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
|
|
dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
|
|
- wiphy_dbg(wiphy, "info: Setting interface type to managed\n");
|
|
|
|
|
|
+ wiphy_dbg(wiphy, "info: setting interface type to managed\n");
|
|
break;
|
|
break;
|
|
case NL80211_IFTYPE_UNSPECIFIED:
|
|
case NL80211_IFTYPE_UNSPECIFIED:
|
|
- mode = MWIFIEX_BSS_MODE_AUTO;
|
|
|
|
dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
|
|
dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
|
|
wiphy_dbg(wiphy, "info: setting interface type to auto\n");
|
|
wiphy_dbg(wiphy, "info: setting interface type to auto\n");
|
|
- break;
|
|
|
|
|
|
+ return 0;
|
|
default:
|
|
default:
|
|
- ret = -EINVAL;
|
|
|
|
|
|
+ wiphy_err(wiphy, "unknown interface type: %d\n", type);
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
- if (ret)
|
|
|
|
- goto done;
|
|
|
|
- status = mwifiex_bss_ioctl_mode(priv, wait, HostCmd_ACT_GEN_SET, &mode);
|
|
|
|
|
|
|
|
- if (mwifiex_request_ioctl(priv, wait, status, MWIFIEX_IOCTL_WAIT))
|
|
|
|
|
|
+ wait = mwifiex_alloc_fill_wait_queue(priv, MWIFIEX_IOCTL_WAIT);
|
|
|
|
+ if (!wait)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ mwifiex_deauthenticate(priv, wait, NULL);
|
|
|
|
+
|
|
|
|
+ priv->sec_info.authentication_mode = MWIFIEX_AUTH_MODE_OPEN;
|
|
|
|
+
|
|
|
|
+ ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
|
|
|
|
+ HostCmd_ACT_GEN_SET, 0, wait, NULL);
|
|
|
|
+ if (!ret)
|
|
|
|
+ ret = -EINPROGRESS;
|
|
|
|
+
|
|
|
|
+ ret = mwifiex_request_ioctl(priv, wait, ret, MWIFIEX_IOCTL_WAIT);
|
|
|
|
+ if (ret)
|
|
ret = -EFAULT;
|
|
ret = -EFAULT;
|
|
|
|
|
|
-done:
|
|
|
|
kfree(wait);
|
|
kfree(wait);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -1046,7 +1044,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
|
|
|
|
|
|
ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */
|
|
ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */
|
|
|
|
|
|
- if (mode == MWIFIEX_BSS_MODE_IBSS) {
|
|
|
|
|
|
+ if (mode == NL80211_IFTYPE_ADHOC) {
|
|
/* "privacy" is set only for ad-hoc mode */
|
|
/* "privacy" is set only for ad-hoc mode */
|
|
if (privacy) {
|
|
if (privacy) {
|
|
/*
|
|
/*
|
|
@@ -1108,7 +1106,7 @@ done:
|
|
|
|
|
|
memcpy(&ssid_bssid.ssid, &req_ssid, sizeof(struct mwifiex_802_11_ssid));
|
|
memcpy(&ssid_bssid.ssid, &req_ssid, sizeof(struct mwifiex_802_11_ssid));
|
|
|
|
|
|
- if (mode != MWIFIEX_BSS_MODE_IBSS) {
|
|
|
|
|
|
+ if (mode != NL80211_IFTYPE_ADHOC) {
|
|
if (mwifiex_find_best_bss(priv, MWIFIEX_IOCTL_WAIT,
|
|
if (mwifiex_find_best_bss(priv, MWIFIEX_IOCTL_WAIT,
|
|
&ssid_bssid))
|
|
&ssid_bssid))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
@@ -1129,7 +1127,7 @@ done:
|
|
if (mwifiex_bss_start(priv, MWIFIEX_IOCTL_WAIT, &ssid_bssid))
|
|
if (mwifiex_bss_start(priv, MWIFIEX_IOCTL_WAIT, &ssid_bssid))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
|
|
|
|
- if (mode == MWIFIEX_BSS_MODE_IBSS) {
|
|
|
|
|
|
+ if (mode == NL80211_IFTYPE_ADHOC) {
|
|
/* Inform the BSS information to kernel, otherwise
|
|
/* Inform the BSS information to kernel, otherwise
|
|
* kernel will give a panic after successful assoc */
|
|
* kernel will give a panic after successful assoc */
|
|
if (mwifiex_cfg80211_inform_ibss_bss(priv))
|
|
if (mwifiex_cfg80211_inform_ibss_bss(priv))
|
|
@@ -1152,14 +1150,11 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
|
|
{
|
|
{
|
|
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
|
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
|
int ret = 0;
|
|
int ret = 0;
|
|
- int mode = 0;
|
|
|
|
|
|
|
|
if (priv->assoc_request)
|
|
if (priv->assoc_request)
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
- mode = mwifiex_drv_get_mode(priv, MWIFIEX_IOCTL_WAIT);
|
|
|
|
-
|
|
|
|
- if (mode == MWIFIEX_BSS_MODE_IBSS) {
|
|
|
|
|
|
+ if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
|
|
wiphy_err(wiphy, "received infra assoc request "
|
|
wiphy_err(wiphy, "received infra assoc request "
|
|
"when station is in ibss mode\n");
|
|
"when station is in ibss mode\n");
|
|
goto done;
|
|
goto done;
|
|
@@ -1171,7 +1166,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
|
|
(char *) sme->ssid, sme->bssid);
|
|
(char *) sme->ssid, sme->bssid);
|
|
|
|
|
|
ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid,
|
|
ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid,
|
|
- mode, sme->channel, sme, 0);
|
|
|
|
|
|
+ priv->bss_mode, sme->channel, sme, 0);
|
|
|
|
|
|
done:
|
|
done:
|
|
priv->assoc_result = ret;
|
|
priv->assoc_result = ret;
|
|
@@ -1191,13 +1186,11 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
|
|
{
|
|
{
|
|
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
|
|
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
|
|
int ret = 0;
|
|
int ret = 0;
|
|
- int mode = 0;
|
|
|
|
|
|
|
|
if (priv->ibss_join_request)
|
|
if (priv->ibss_join_request)
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
- mode = mwifiex_drv_get_mode(priv, MWIFIEX_IOCTL_WAIT);
|
|
|
|
- if (mode != MWIFIEX_BSS_MODE_IBSS) {
|
|
|
|
|
|
+ if (priv->bss_mode != NL80211_IFTYPE_ADHOC) {
|
|
wiphy_err(wiphy, "request to join ibss received "
|
|
wiphy_err(wiphy, "request to join ibss received "
|
|
"when station is not in ibss mode\n");
|
|
"when station is not in ibss mode\n");
|
|
goto done;
|
|
goto done;
|
|
@@ -1209,8 +1202,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
|
|
(char *) params->ssid, params->bssid);
|
|
(char *) params->ssid, params->bssid);
|
|
|
|
|
|
ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid,
|
|
ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid,
|
|
- params->bssid, mode, params->channel, NULL,
|
|
|
|
- params->privacy);
|
|
|
|
|
|
+ params->bssid, priv->bss_mode,
|
|
|
|
+ params->channel, NULL, params->privacy);
|
|
done:
|
|
done:
|
|
priv->ibss_join_result = ret;
|
|
priv->ibss_join_result = ret;
|
|
queue_work(priv->workqueue, &priv->cfg_workqueue);
|
|
queue_work(priv->workqueue, &priv->cfg_workqueue);
|
|
@@ -1301,7 +1294,7 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
|
|
/* Clear all the other values */
|
|
/* Clear all the other values */
|
|
memset(&mcs[rx_mcs_supp], 0,
|
|
memset(&mcs[rx_mcs_supp], 0,
|
|
sizeof(struct ieee80211_mcs_info) - rx_mcs_supp);
|
|
sizeof(struct ieee80211_mcs_info) - rx_mcs_supp);
|
|
- if (priv->bss_mode == MWIFIEX_BSS_MODE_INFRA ||
|
|
|
|
|
|
+ if (priv->bss_mode == NL80211_IFTYPE_STATION ||
|
|
ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap))
|
|
ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap))
|
|
/* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */
|
|
/* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */
|
|
SETHT_MCS32(mcs_set.rx_mask);
|
|
SETHT_MCS32(mcs_set.rx_mask);
|