]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/mwifiex/cfg80211.c
cfg80211: Convert del_station() callback to use a param struct
[karo-tx-linux.git] / drivers / net / wireless / mwifiex / cfg80211.c
index b511613bba2d8608f057fd15223c2af33c3be962..71e29c7055de3d29a00559861d391a1700a54536 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Marvell Wireless LAN device driver: CFG80211
  *
- * Copyright (C) 2011, Marvell International Ltd.
+ * Copyright (C) 2011-2014, Marvell International Ltd.
  *
  * This software file (the "File") is distributed by Marvell International
  * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -42,36 +42,6 @@ static const struct ieee80211_iface_combination mwifiex_iface_comb_ap_sta = {
        .beacon_int_infra_match = true,
 };
 
-static const struct ieee80211_regdomain mwifiex_world_regdom_custom = {
-       .n_reg_rules = 7,
-       .alpha2 =  "99",
-       .reg_rules = {
-               /* Channel 1 - 11 */
-               REG_RULE(2412-10, 2462+10, 40, 3, 20, 0),
-               /* Channel 12 - 13 */
-               REG_RULE(2467-10, 2472+10, 20, 3, 20,
-                        NL80211_RRF_NO_IR),
-               /* Channel 14 */
-               REG_RULE(2484-10, 2484+10, 20, 3, 20,
-                        NL80211_RRF_NO_IR |
-                        NL80211_RRF_NO_OFDM),
-               /* Channel 36 - 48 */
-               REG_RULE(5180-10, 5240+10, 40, 3, 20,
-                        NL80211_RRF_NO_IR),
-               /* Channel 149 - 165 */
-               REG_RULE(5745-10, 5825+10, 40, 3, 20,
-                        NL80211_RRF_NO_IR),
-               /* Channel 52 - 64 */
-               REG_RULE(5260-10, 5320+10, 40, 3, 30,
-                        NL80211_RRF_NO_IR |
-                        NL80211_RRF_DFS),
-               /* Channel 100 - 140 */
-               REG_RULE(5500-10, 5700+10, 40, 3, 30,
-                        NL80211_RRF_NO_IR |
-                        NL80211_RRF_DFS),
-       }
-};
-
 /*
  * This function maps the nl802.11 channel type into driver channel type.
  *
@@ -151,7 +121,6 @@ mwifiex_form_mgmt_frame(struct sk_buff *skb, const u8 *buf, size_t len)
        u8 addr[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
        u16 pkt_len;
        u32 tx_control = 0, pkt_type = PKT_TYPE_MGMT;
-       struct timeval tv;
 
        pkt_len = len + ETH_ALEN;
 
@@ -173,8 +142,7 @@ mwifiex_form_mgmt_frame(struct sk_buff *skb, const u8 *buf, size_t len)
               len - sizeof(struct ieee80211_hdr_3addr));
 
        skb->priority = LOW_PRIO_TID;
-       do_gettimeofday(&tv);
-       skb->tstamp = timeval_to_ktime(tv);
+       __net_timestamp(skb);
 
        return 0;
 }
@@ -278,7 +246,7 @@ mwifiex_cfg80211_remain_on_channel(struct wiphy *wiphy,
        }
 
        if (priv->roc_cfg.cookie) {
-               wiphy_dbg(wiphy, "info: ongoing ROC, cookie = 0x%llu\n",
+               wiphy_dbg(wiphy, "info: ongoing ROC, cookie = 0x%llx\n",
                          priv->roc_cfg.cookie);
                return -EBUSY;
        }
@@ -1271,7 +1239,7 @@ 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;
@@ -1280,7 +1248,7 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
        if (list_empty(&priv->sta_list) || !priv->bss_started)
                return 0;
 
-       if (!mac || is_broadcast_ether_addr(mac)) {
+       if (!params->mac || is_broadcast_ether_addr(params->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,
@@ -1290,9 +1258,10 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
                        mwifiex_uap_del_sta_data(priv, sta_node);
                }
        } else {
-               wiphy_dbg(wiphy, "%s: mac address %pM\n", __func__, mac);
+               wiphy_dbg(wiphy, "%s: mac address %pM\n", __func__,
+                         params->mac);
                spin_lock_irqsave(&priv->sta_list_spinlock, flags);
-               sta_node = mwifiex_get_sta_entry(priv, mac);
+               sta_node = mwifiex_get_sta_entry(priv, params->mac);
                spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                if (sta_node) {
                        if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH,
@@ -1589,6 +1558,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
                                                       band));
 
        bss = cfg80211_inform_bss(priv->wdev->wiphy, chan,
+                                 CFG80211_BSS_FTYPE_UNKNOWN,
                                  bss_info.bssid, 0, WLAN_CAPABILITY_IBSS,
                                  0, ie_buf, ie_len, 0, GFP_KERNEL);
        cfg80211_put_bss(priv->wdev->wiphy, bss);
@@ -1636,9 +1606,6 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len,
                return -EINVAL;
        }
 
-       /* disconnect before try to associate */
-       mwifiex_deauthenticate(priv, NULL);
-
        /* As this is new association, clear locally stored
         * keys and security related flags */
        priv->sec_info.wpa_enabled = false;
@@ -1776,6 +1743,11 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
                return -EINVAL;
        }
 
+       if (priv->wdev && priv->wdev->current_bss) {
+               wiphy_warn(wiphy, "%s: already connected\n", dev->name);
+               return -EALREADY;
+       }
+
        wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n",
                  (char *) sme->ssid, sme->bssid);
 
@@ -1965,13 +1937,6 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 
        wiphy_dbg(wiphy, "info: received scan request on %s\n", dev->name);
 
-       if ((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
-           atomic_read(&priv->wmm.tx_pkts_queued) >=
-           MWIFIEX_MIN_TX_PENDING_TO_CANCEL_SCAN) {
-               dev_dbg(priv->adapter->dev, "scan rejected due to traffic\n");
-               return -EBUSY;
-       }
-
        /* Block scan request if scan operation or scan cleanup when interface
         * is disabled is in process
         */
@@ -2010,7 +1975,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
                user_scan_cfg->chan_list[i].chan_number = chan->hw_value;
                user_scan_cfg->chan_list[i].radio_type = chan->band;
 
-               if (chan->flags & IEEE80211_CHAN_NO_IR)
+               if ((chan->flags & IEEE80211_CHAN_NO_IR) || !request->n_ssids)
                        user_scan_cfg->chan_list[i].scan_type =
                                                MWIFIEX_SCAN_TYPE_PASSIVE;
                else
@@ -2020,6 +1985,11 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
                user_scan_cfg->chan_list[i].scan_time = 0;
        }
 
+       if (priv->adapter->scan_chan_gap_enabled &&
+           mwifiex_is_any_intf_active(priv))
+               user_scan_cfg->scan_chan_gap =
+                                             priv->adapter->scan_chan_gap_time;
+
        ret = mwifiex_scan_networks(priv, user_scan_cfg);
        kfree(user_scan_cfg);
        if (ret) {
@@ -2264,7 +2234,8 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
        }
 
        dev = alloc_netdev_mqs(sizeof(struct mwifiex_private *), name,
-                              ether_setup, IEEE80211_NUM_ACS, 1);
+                              NET_NAME_UNKNOWN, ether_setup,
+                              IEEE80211_NUM_ACS, 1);
        if (!dev) {
                wiphy_err(wiphy, "no memory available for netdevice\n");
                priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
@@ -2484,6 +2455,16 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
                mef_entry->filter[filt_num].filt_type = TYPE_EQ;
                if (filt_num)
                        mef_entry->filter[filt_num].filt_action = TYPE_OR;
+
+               filt_num++;
+               mef_entry->filter[filt_num].repeat = 16;
+               memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr,
+                      ETH_ALEN);
+               mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] =
+                                                               ETH_ALEN;
+               mef_entry->filter[filt_num].offset = 56;
+               mef_entry->filter[filt_num].filt_type = TYPE_EQ;
+               mef_entry->filter[filt_num].filt_action = TYPE_OR;
        }
 
        if (!mef_cfg.criteria)
@@ -2632,7 +2613,8 @@ static int
 mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
                           const u8 *peer, u8 action_code, u8 dialog_token,
                           u16 status_code, u32 peer_capability,
-                          const u8 *extra_ies, size_t extra_ies_len)
+                          bool initiator, const u8 *extra_ies,
+                          size_t extra_ies_len)
 {
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
        int ret;
@@ -2917,12 +2899,6 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
                wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
                                WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
 
-       wiphy->regulatory_flags |=
-                       REGULATORY_CUSTOM_REG |
-                       REGULATORY_STRICT_REG;
-
-       wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom);
-
 #ifdef CONFIG_PM
        wiphy->wowlan = &mwifiex_wowlan_support;
 #endif
@@ -2938,7 +2914,6 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 
        wiphy->features |= NL80211_FEATURE_HT_IBSS |
                           NL80211_FEATURE_INACTIVITY_TIMER |
-                          NL80211_FEATURE_LOW_PRIORITY_SCAN |
                           NL80211_FEATURE_NEED_OBSS_SCAN;
 
        /* Reserve space for mwifiex specific private data for BSS */