|
@@ -496,169 +496,6 @@ int mwifiex_disable_auto_ds(struct mwifiex_private *priv)
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(mwifiex_disable_auto_ds);
|
|
|
|
|
|
-/*
|
|
|
- * IOCTL request handler to set/get active channel.
|
|
|
- *
|
|
|
- * This function performs validity checking on channel/frequency
|
|
|
- * compatibility and returns failure if not valid.
|
|
|
- */
|
|
|
-int mwifiex_bss_set_channel(struct mwifiex_private *priv,
|
|
|
- struct mwifiex_chan_freq_power *chan)
|
|
|
-{
|
|
|
- struct mwifiex_adapter *adapter = priv->adapter;
|
|
|
- struct mwifiex_chan_freq_power *cfp = NULL;
|
|
|
-
|
|
|
- if (!chan)
|
|
|
- return -1;
|
|
|
-
|
|
|
- if (!chan->channel && !chan->freq)
|
|
|
- return -1;
|
|
|
- if (adapter->adhoc_start_band & BAND_AN)
|
|
|
- adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN;
|
|
|
- else if (adapter->adhoc_start_band & BAND_A)
|
|
|
- adapter->adhoc_start_band = BAND_G | BAND_B;
|
|
|
- if (chan->channel) {
|
|
|
- if (chan->channel <= MAX_CHANNEL_BAND_BG)
|
|
|
- cfp = mwifiex_get_cfp(priv, 0, (u16) chan->channel, 0);
|
|
|
- if (!cfp) {
|
|
|
- cfp = mwifiex_get_cfp(priv, BAND_A,
|
|
|
- (u16) chan->channel, 0);
|
|
|
- if (cfp) {
|
|
|
- if (adapter->adhoc_11n_enabled)
|
|
|
- adapter->adhoc_start_band = BAND_A
|
|
|
- | BAND_AN;
|
|
|
- else
|
|
|
- adapter->adhoc_start_band = BAND_A;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (chan->freq <= MAX_FREQUENCY_BAND_BG)
|
|
|
- cfp = mwifiex_get_cfp(priv, 0, 0, chan->freq);
|
|
|
- if (!cfp) {
|
|
|
- cfp = mwifiex_get_cfp(priv, BAND_A, 0, chan->freq);
|
|
|
- if (cfp) {
|
|
|
- if (adapter->adhoc_11n_enabled)
|
|
|
- adapter->adhoc_start_band = BAND_A
|
|
|
- | BAND_AN;
|
|
|
- else
|
|
|
- adapter->adhoc_start_band = BAND_A;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (!cfp || !cfp->channel) {
|
|
|
- dev_err(adapter->dev, "invalid channel/freq\n");
|
|
|
- return -1;
|
|
|
- }
|
|
|
- priv->adhoc_channel = (u8) cfp->channel;
|
|
|
- chan->channel = cfp->channel;
|
|
|
- chan->freq = cfp->freq;
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-/*
|
|
|
- * IOCTL request handler to set/get Ad-Hoc channel.
|
|
|
- *
|
|
|
- * This function prepares the correct firmware command and
|
|
|
- * issues it to set or get the ad-hoc channel.
|
|
|
- */
|
|
|
-static int mwifiex_bss_ioctl_ibss_channel(struct mwifiex_private *priv,
|
|
|
- u16 action, u16 *channel)
|
|
|
-{
|
|
|
- if (action == HostCmd_ACT_GEN_GET) {
|
|
|
- if (!priv->media_connected) {
|
|
|
- *channel = priv->adhoc_channel;
|
|
|
- return 0;
|
|
|
- }
|
|
|
- } else {
|
|
|
- priv->adhoc_channel = (u8) *channel;
|
|
|
- }
|
|
|
-
|
|
|
- return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_RF_CHANNEL,
|
|
|
- action, 0, channel);
|
|
|
-}
|
|
|
-
|
|
|
-/*
|
|
|
- * IOCTL request handler to change Ad-Hoc channel.
|
|
|
- *
|
|
|
- * This function allocates the IOCTL request buffer, fills it
|
|
|
- * with requisite parameters and calls the IOCTL handler.
|
|
|
- *
|
|
|
- * The function follows the following steps to perform the change -
|
|
|
- * - Get current IBSS information
|
|
|
- * - Get current channel
|
|
|
- * - If no change is required, return
|
|
|
- * - If not connected, change channel and return
|
|
|
- * - If connected,
|
|
|
- * - Disconnect
|
|
|
- * - Change channel
|
|
|
- * - Perform specific SSID scan with same SSID
|
|
|
- * - Start/Join the IBSS
|
|
|
- */
|
|
|
-int
|
|
|
-mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, u16 channel)
|
|
|
-{
|
|
|
- int ret;
|
|
|
- struct mwifiex_bss_info bss_info;
|
|
|
- struct mwifiex_ssid_bssid ssid_bssid;
|
|
|
- u16 curr_chan = 0;
|
|
|
- struct cfg80211_bss *bss = NULL;
|
|
|
- struct ieee80211_channel *chan;
|
|
|
- enum ieee80211_band band;
|
|
|
-
|
|
|
- memset(&bss_info, 0, sizeof(bss_info));
|
|
|
-
|
|
|
- /* Get BSS information */
|
|
|
- if (mwifiex_get_bss_info(priv, &bss_info))
|
|
|
- return -1;
|
|
|
-
|
|
|
- /* Get current channel */
|
|
|
- ret = mwifiex_bss_ioctl_ibss_channel(priv, HostCmd_ACT_GEN_GET,
|
|
|
- &curr_chan);
|
|
|
-
|
|
|
- if (curr_chan == channel) {
|
|
|
- ret = 0;
|
|
|
- goto done;
|
|
|
- }
|
|
|
- dev_dbg(priv->adapter->dev, "cmd: updating channel from %d to %d\n",
|
|
|
- curr_chan, channel);
|
|
|
-
|
|
|
- if (!bss_info.media_connected) {
|
|
|
- ret = 0;
|
|
|
- goto done;
|
|
|
- }
|
|
|
-
|
|
|
- /* Do disonnect */
|
|
|
- memset(&ssid_bssid, 0, ETH_ALEN);
|
|
|
- ret = mwifiex_deauthenticate(priv, ssid_bssid.bssid);
|
|
|
-
|
|
|
- ret = mwifiex_bss_ioctl_ibss_channel(priv, HostCmd_ACT_GEN_SET,
|
|
|
- &channel);
|
|
|
-
|
|
|
- /* Do specific SSID scanning */
|
|
|
- if (mwifiex_request_scan(priv, &bss_info.ssid)) {
|
|
|
- ret = -1;
|
|
|
- goto done;
|
|
|
- }
|
|
|
-
|
|
|
- band = mwifiex_band_to_radio_type(priv->curr_bss_params.band);
|
|
|
- chan = __ieee80211_get_channel(priv->wdev->wiphy,
|
|
|
- ieee80211_channel_to_frequency(channel,
|
|
|
- band));
|
|
|
-
|
|
|
- /* Find the BSS we want using available scan results */
|
|
|
- bss = cfg80211_get_bss(priv->wdev->wiphy, chan, bss_info.bssid,
|
|
|
- bss_info.ssid.ssid, bss_info.ssid.ssid_len,
|
|
|
- WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
|
|
|
- if (!bss)
|
|
|
- wiphy_warn(priv->wdev->wiphy, "assoc: bss %pM not in scan results\n",
|
|
|
- bss_info.bssid);
|
|
|
-
|
|
|
- ret = mwifiex_bss_start(priv, bss, &bss_info.ssid);
|
|
|
-done:
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
/*
|
|
|
* IOCTL request handler to get rate.
|
|
|
*
|