]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/net/wireless/ath/ath10k/mac.c
ath10k: use vif->type and vif->p2p for P2P_GO check
[mirror_ubuntu-zesty-kernel.git] / drivers / net / wireless / ath / ath10k / mac.c
index 8ae5216fd188ca808d772577e27f9cb8e7ff2c8e..addf3cb3aeb108d14361bbee8aac7307bd86ecd1 100644 (file)
@@ -250,7 +250,8 @@ static int ath10k_install_peer_wep_keys(struct ath10k_vif *arvif,
        lockdep_assert_held(&ar->conf_mutex);
 
        if (WARN_ON(arvif->vif->type != NL80211_IFTYPE_AP &&
-                   arvif->vif->type != NL80211_IFTYPE_ADHOC))
+                   arvif->vif->type != NL80211_IFTYPE_ADHOC &&
+                   arvif->vif->type != NL80211_IFTYPE_MESH_POINT))
                return -EINVAL;
 
        spin_lock_bh(&ar->data_lock);
@@ -1357,10 +1358,7 @@ static int ath10k_mac_setup_bcn_p2p_ie(struct ath10k_vif *arvif,
        const u8 *p2p_ie;
        int ret;
 
-       if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
-               return 0;
-
-       if (arvif->vdev_subtype != WMI_VDEV_SUBTYPE_P2P_GO)
+       if (arvif->vif->type != NL80211_IFTYPE_AP || !arvif->vif->p2p)
                return 0;
 
        mgmt = (void *)bcn->data;
@@ -3258,8 +3256,7 @@ static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar,
        struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 
        /* This is case only for P2P_GO */
-       if (arvif->vdev_type != WMI_VDEV_TYPE_AP ||
-           arvif->vdev_subtype != WMI_VDEV_SUBTYPE_P2P_GO)
+       if (vif->type != NL80211_IFTYPE_AP || !vif->p2p)
                return;
 
        if (unlikely(ieee80211_is_probe_resp(hdr->frame_control))) {
@@ -3859,7 +3856,8 @@ static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
        ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
        ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
        ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
-       ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
+       ht_cap.cap |=
+               WLAN_HT_CAP_SM_PS_DISABLED << IEEE80211_HT_CAP_SM_PS_SHIFT;
 
        if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI)
                ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
@@ -3986,7 +3984,7 @@ static int ath10k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
 static int ath10k_start(struct ieee80211_hw *hw)
 {
        struct ath10k *ar = hw->priv;
-       u32 burst_enable;
+       u32 param;
        int ret = 0;
 
        /*
@@ -4029,13 +4027,15 @@ static int ath10k_start(struct ieee80211_hw *hw)
                goto err_power_down;
        }
 
-       ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pmf_qos, 1);
+       param = ar->wmi.pdev_param->pmf_qos;
+       ret = ath10k_wmi_pdev_set_param(ar, param, 1);
        if (ret) {
                ath10k_warn(ar, "failed to enable PMF QOS: %d\n", ret);
                goto err_core_stop;
        }
 
-       ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->dynamic_bw, 1);
+       param = ar->wmi.pdev_param->dynamic_bw;
+       ret = ath10k_wmi_pdev_set_param(ar, param, 1);
        if (ret) {
                ath10k_warn(ar, "failed to enable dynamic BW: %d\n", ret);
                goto err_core_stop;
@@ -4051,8 +4051,8 @@ static int ath10k_start(struct ieee80211_hw *hw)
        }
 
        if (test_bit(WMI_SERVICE_BURST, ar->wmi.svc_map)) {
-               burst_enable = ar->wmi.pdev_param->burst_enable;
-               ret = ath10k_wmi_pdev_set_param(ar, burst_enable, 0);
+               param = ar->wmi.pdev_param->burst_enable;
+               ret = ath10k_wmi_pdev_set_param(ar, param, 0);
                if (ret) {
                        ath10k_warn(ar, "failed to disable burst: %d\n", ret);
                        goto err_core_stop;
@@ -4070,8 +4070,8 @@ static int ath10k_start(struct ieee80211_hw *hw)
         * this problem.
         */
 
-       ret = ath10k_wmi_pdev_set_param(ar,
-                                       ar->wmi.pdev_param->arp_ac_override, 0);
+       param = ar->wmi.pdev_param->arp_ac_override;
+       ret = ath10k_wmi_pdev_set_param(ar, param, 0);
        if (ret) {
                ath10k_warn(ar, "failed to set arp ac override parameter: %d\n",
                            ret);
@@ -4090,8 +4090,8 @@ static int ath10k_start(struct ieee80211_hw *hw)
                }
        }
 
-       ret = ath10k_wmi_pdev_set_param(ar,
-                                       ar->wmi.pdev_param->ani_enable, 1);
+       param = ar->wmi.pdev_param->ani_enable;
+       ret = ath10k_wmi_pdev_set_param(ar, param, 1);
        if (ret) {
                ath10k_warn(ar, "failed to enable ani by default: %d\n",
                            ret);
@@ -4100,6 +4100,18 @@ static int ath10k_start(struct ieee80211_hw *hw)
 
        ar->ani_enabled = true;
 
+       if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) {
+               param = ar->wmi.pdev_param->peer_stats_update_period;
+               ret = ath10k_wmi_pdev_set_param(ar, param,
+                                               PEER_DEFAULT_STATS_UPDATE_PERIOD);
+               if (ret) {
+                       ath10k_warn(ar,
+                                   "failed to set peer stats period : %d\n",
+                                   ret);
+                       goto err_core_stop;
+               }
+       }
+
        ar->num_started_vdevs = 0;
        ath10k_regd_update(ar);
 
@@ -4239,7 +4251,7 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 
 static u32 get_nss_from_chainmask(u16 chain_mask)
 {
-       if ((chain_mask & 0x15) == 0x15)
+       if ((chain_mask & 0xf) == 0xf)
                return 4;
        else if ((chain_mask & 0x7) == 0x7)
                return 3;
@@ -4364,8 +4376,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
                arvif->vdev_type = WMI_VDEV_TYPE_IBSS;
                break;
        case NL80211_IFTYPE_MESH_POINT:
-               if (test_bit(WMI_SERVICE_MESH, ar->wmi.svc_map)) {
-                       arvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH;
+               if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) {
+                       arvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH_11S;
                } else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) {
                        ret = -EINVAL;
                        ath10k_warn(ar, "must load driver with rawmode=1 to add mesh interfaces\n");