cfg80211: remove 80+80 MHz rate reporting
[deliverable/linux.git] / drivers / net / wireless / mwifiex / cfg80211.c
index 0dd672954ad10316bec599a0f2eeb56b70e66c75..71312ff527034a6e51a3e8dccaaf8559af17cde2 100644 (file)
@@ -194,10 +194,17 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
        tx_info->pkt_len = pkt_len;
 
        mwifiex_form_mgmt_frame(skb, buf, len);
-       mwifiex_queue_tx_pkt(priv, skb);
-
        *cookie = prandom_u32() | 1;
-       cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, true, GFP_ATOMIC);
+
+       if (ieee80211_is_action(mgmt->frame_control))
+               skb = mwifiex_clone_skb_for_tx_status(priv,
+                                                     skb,
+                               MWIFIEX_BUF_FLAG_ACTION_TX_STATUS, cookie);
+       else
+               cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, true,
+                                       GFP_ATOMIC);
+
+       mwifiex_queue_tx_pkt(priv, skb);
 
        wiphy_dbg(wiphy, "info: management frame transmitted\n");
        return 0;
@@ -903,10 +910,10 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
 {
        u32 rate;
 
-       sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES |
-                       STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS |
-                       STATION_INFO_TX_BITRATE |
-                       STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
+       sinfo->filled = BIT(NL80211_STA_INFO_RX_BYTES) | BIT(NL80211_STA_INFO_TX_BYTES) |
+                       BIT(NL80211_STA_INFO_RX_PACKETS) | BIT(NL80211_STA_INFO_TX_PACKETS) |
+                       BIT(NL80211_STA_INFO_TX_BITRATE) |
+                       BIT(NL80211_STA_INFO_SIGNAL) | BIT(NL80211_STA_INFO_SIGNAL_AVG);
 
        /* Get signal information from the firmware */
        if (mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
@@ -937,7 +944,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
        sinfo->txrate.legacy = rate * 5;
 
        if (priv->bss_mode == NL80211_IFTYPE_STATION) {
-               sinfo->filled |= STATION_INFO_BSS_PARAM;
+               sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
                sinfo->bss_param.flags = 0;
                if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap &
                                                WLAN_CAPABILITY_SHORT_PREAMBLE)
@@ -992,6 +999,53 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
        return mwifiex_dump_station_info(priv, sinfo);
 }
 
+static int
+mwifiex_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
+                            int idx, struct survey_info *survey)
+{
+       struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
+       struct mwifiex_chan_stats *pchan_stats = priv->adapter->chan_stats;
+       enum ieee80211_band band;
+
+       dev_dbg(priv->adapter->dev, "dump_survey idx=%d\n", idx);
+
+       memset(survey, 0, sizeof(struct survey_info));
+
+       if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
+           priv->media_connected && idx == 0) {
+                       u8 curr_bss_band = priv->curr_bss_params.band;
+                       u32 chan = priv->curr_bss_params.bss_descriptor.channel;
+
+                       band = mwifiex_band_to_radio_type(curr_bss_band);
+                       survey->channel = ieee80211_get_channel(wiphy,
+                               ieee80211_channel_to_frequency(chan, band));
+
+                       if (priv->bcn_nf_last) {
+                               survey->filled = SURVEY_INFO_NOISE_DBM;
+                               survey->noise = priv->bcn_nf_last;
+                       }
+                       return 0;
+       }
+
+       if (idx >= priv->adapter->num_in_chan_stats)
+               return -ENOENT;
+
+       if (!pchan_stats[idx].cca_scan_dur)
+               return 0;
+
+       band = pchan_stats[idx].bandcfg;
+       survey->channel = ieee80211_get_channel(wiphy,
+           ieee80211_channel_to_frequency(pchan_stats[idx].chan_num, band));
+       survey->filled = SURVEY_INFO_NOISE_DBM |
+                        SURVEY_INFO_TIME |
+                        SURVEY_INFO_TIME_BUSY;
+       survey->noise = pchan_stats[idx].noise;
+       survey->time = pchan_stats[idx].cca_scan_dur;
+       survey->time_busy = pchan_stats[idx].cca_busy_dur;
+
+       return 0;
+}
+
 /* Supported rates to be advertised to the cfg80211 */
 static struct ieee80211_rate mwifiex_rates[] = {
        {.bitrate = 10, .hw_value = 2, },
@@ -1239,36 +1293,34 @@ static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy,
  */
 static int
 mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
-                            const u8 *mac)
+                            struct station_del_parameters *params)
 {
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
        struct mwifiex_sta_node *sta_node;
+       u8 deauth_mac[ETH_ALEN];
        unsigned long flags;
 
        if (list_empty(&priv->sta_list) || !priv->bss_started)
                return 0;
 
-       if (!mac || is_broadcast_ether_addr(mac)) {
-               wiphy_dbg(wiphy, "%s: NULL/broadcast mac address\n", __func__);
-               list_for_each_entry(sta_node, &priv->sta_list, list) {
-                       if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH,
-                                            HostCmd_ACT_GEN_SET, 0,
-                                            sta_node->mac_addr, true))
-                               return -1;
-                       mwifiex_uap_del_sta_data(priv, sta_node);
-               }
-       } else {
-               wiphy_dbg(wiphy, "%s: mac address %pM\n", __func__, mac);
-               spin_lock_irqsave(&priv->sta_list_spinlock, flags);
-               sta_node = mwifiex_get_sta_entry(priv, mac);
-               spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
-               if (sta_node) {
-                       if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH,
-                                            HostCmd_ACT_GEN_SET, 0,
-                                            sta_node->mac_addr, true))
-                               return -1;
-                       mwifiex_uap_del_sta_data(priv, sta_node);
-               }
+       if (!params->mac || is_broadcast_ether_addr(params->mac))
+               return 0;
+
+       wiphy_dbg(wiphy, "%s: mac address %pM\n", __func__, params->mac);
+
+       memset(deauth_mac, 0, ETH_ALEN);
+
+       spin_lock_irqsave(&priv->sta_list_spinlock, flags);
+       sta_node = mwifiex_get_sta_entry(priv, params->mac);
+       if (sta_node)
+               ether_addr_copy(deauth_mac, params->mac);
+       spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
+
+       if (is_valid_ether_addr(deauth_mac)) {
+               if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH,
+                                    HostCmd_ACT_GEN_SET, 0,
+                                    deauth_mac, true))
+                       return -1;
        }
 
        return 0;
@@ -1759,6 +1811,10 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
                dev_dbg(priv->adapter->dev,
                        "info: associated to bssid %pM successfully\n",
                        priv->cfg_bssid);
+               if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
+                   priv->adapter->auto_tdls &&
+                   priv->bss_type == MWIFIEX_BSS_TYPE_STA)
+                       mwifiex_setup_auto_tdls_timer(priv);
        } else {
                dev_dbg(priv->adapter->dev,
                        "info: association to bssid %pM failed\n",
@@ -2630,11 +2686,13 @@ mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
                dev_dbg(priv->adapter->dev,
                        "Send TDLS Setup Request to %pM status_code=%d\n", peer,
                         status_code);
+               mwifiex_add_auto_tdls_peer(priv, peer);
                ret = mwifiex_send_tdls_data_frame(priv, peer, action_code,
                                                   dialog_token, status_code,
                                                   extra_ies, extra_ies_len);
                break;
        case WLAN_TDLS_SETUP_RESPONSE:
+               mwifiex_add_auto_tdls_peer(priv, peer);
                dev_dbg(priv->adapter->dev,
                        "Send TDLS Setup Response to %pM status_code=%d\n",
                        peer, status_code);
@@ -2779,6 +2837,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = {
        .disconnect = mwifiex_cfg80211_disconnect,
        .get_station = mwifiex_cfg80211_get_station,
        .dump_station = mwifiex_cfg80211_dump_station,
+       .dump_survey = mwifiex_cfg80211_dump_survey,
        .set_wiphy_params = mwifiex_cfg80211_set_wiphy_params,
        .join_ibss = mwifiex_cfg80211_join_ibss,
        .leave_ibss = mwifiex_cfg80211_leave_ibss,
@@ -2840,6 +2899,25 @@ static const struct wiphy_coalesce_support mwifiex_coalesce_support = {
        .max_pkt_offset = MWIFIEX_MAX_OFFSET_LEN,
 };
 
+int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter)
+{
+       u32 n_channels_bg, n_channels_a = 0;
+
+       n_channels_bg = mwifiex_band_2ghz.n_channels;
+
+       if (adapter->config_bands & BAND_A)
+               n_channels_a = mwifiex_band_5ghz.n_channels;
+
+       adapter->num_in_chan_stats = max_t(u32, n_channels_bg, n_channels_a);
+       adapter->chan_stats = vmalloc(sizeof(*adapter->chan_stats) *
+                                     adapter->num_in_chan_stats);
+
+       if (!adapter->chan_stats)
+               return -ENOMEM;
+
+       return 0;
+}
+
 /*
  * This function registers the device with CFG802.11 subsystem.
  *
@@ -2915,6 +2993,9 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
                           NL80211_FEATURE_INACTIVITY_TIMER |
                           NL80211_FEATURE_NEED_OBSS_SCAN;
 
+       if (adapter->fw_api_ver == MWIFIEX_FW_V15)
+               wiphy->features |= NL80211_FEATURE_SK_TX_STATUS;
+
        /* Reserve space for mwifiex specific private data for BSS */
        wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv);
 
This page took 0.029896 seconds and 5 git commands to generate.