ath10k: set peer MFP flag in peer assoc command
authorTamizh chelvam <c_traja@qti.qualcomm.com>
Thu, 29 Oct 2015 12:27:42 +0000 (14:27 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Wed, 4 Nov 2015 17:30:20 +0000 (19:30 +0200)
Set peer's management frame protection flag in peer assoc command,
this setting will enable/disable encrytion of management frames in fw.

Setting of this flag is based on whether MFP is enabled/disabled at STA
and a firmware feature flag ATH10K_FW_FEATURE_MFP_SUPPORT. This is because
only firmwares 10.1.561 and above have support for MFP.

Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
Signed-off-by: Manikanta pubbisetty <c_mpubbi@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/core.c
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/htt_tx.c
drivers/net/wireless/ath/ath10k/mac.c

index aa9bd92ac4edf7e5b78229a136ca499f8f7c15e3..dc4fc4e8d5eff6ac213a5c5f56421c779ddbf9e2 100644 (file)
@@ -167,6 +167,7 @@ static const char *const ath10k_core_fw_feature_str[] = {
        [ATH10K_FW_FEATURE_SUPPORTS_SKIP_CLOCK_INIT] = "skip-clock-init",
        [ATH10K_FW_FEATURE_RAW_MODE_SUPPORT] = "raw-mode",
        [ATH10K_FW_FEATURE_SUPPORTS_ADAPTIVE_CCA] = "adaptive-cca",
+       [ATH10K_FW_FEATURE_MFP_SUPPORT] = "mfp",
 };
 
 static unsigned int ath10k_core_get_fw_feature_str(char *buf,
index 01a41730214939980fd65ac9f8a7dad652d2774a..c26f84ee80ea72a746e122855011cdbaf4a7e445 100644 (file)
@@ -513,6 +513,9 @@ enum ath10k_fw_features {
        /* Firmware Supports Adaptive CCA*/
        ATH10K_FW_FEATURE_SUPPORTS_ADAPTIVE_CCA = 11,
 
+       /* Firmware supports management frame protection */
+       ATH10K_FW_FEATURE_MFP_SUPPORT = 12,
+
        /* keep last */
        ATH10K_FW_FEATURE_COUNT,
 };
index 16823970dbfd33608486b6854b0ed9d1142b8576..bd8f264ed8cdf5a873a8a0f8f944b75b3d881fde 100644 (file)
@@ -477,6 +477,13 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 
        msdu_id = res;
 
+       if ((ieee80211_is_action(hdr->frame_control) ||
+            ieee80211_is_deauth(hdr->frame_control) ||
+            ieee80211_is_disassoc(hdr->frame_control)) &&
+            ieee80211_has_protected(hdr->frame_control)) {
+               skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+       }
+
        txdesc = ath10k_htc_alloc_skb(ar, len);
        if (!txdesc) {
                res = -ENOMEM;
index 2ccda0ed91fa59f541b08fc16d9cefff7e0a7946..a53e213387a2859a2c991610136f33d0645015e3 100644 (file)
@@ -1968,6 +1968,7 @@ static void ath10k_peer_assoc_h_basic(struct ath10k *ar,
 
 static void ath10k_peer_assoc_h_crypto(struct ath10k *ar,
                                       struct ieee80211_vif *vif,
+                                      struct ieee80211_sta *sta,
                                       struct wmi_peer_assoc_complete_arg *arg)
 {
        struct ieee80211_bss_conf *info = &vif->bss_conf;
@@ -2009,6 +2010,11 @@ static void ath10k_peer_assoc_h_crypto(struct ath10k *ar,
                ath10k_dbg(ar, ATH10K_DBG_WMI, "%s: wpa ie found\n", __func__);
                arg->peer_flags |= ar->wmi.peer_flags->need_gtk_2_way;
        }
+
+       if (sta->mfp &&
+           test_bit(ATH10K_FW_FEATURE_MFP_SUPPORT, ar->fw_features)) {
+               arg->peer_flags |= ar->wmi.peer_flags->pmf;
+       }
 }
 
 static void ath10k_peer_assoc_h_rates(struct ath10k *ar,
@@ -2480,7 +2486,7 @@ static int ath10k_peer_assoc_prepare(struct ath10k *ar,
        memset(arg, 0, sizeof(*arg));
 
        ath10k_peer_assoc_h_basic(ar, vif, sta, arg);
-       ath10k_peer_assoc_h_crypto(ar, vif, arg);
+       ath10k_peer_assoc_h_crypto(ar, vif, sta, arg);
        ath10k_peer_assoc_h_rates(ar, vif, sta, arg);
        ath10k_peer_assoc_h_ht(ar, vif, sta, arg);
        ath10k_peer_assoc_h_vht(ar, vif, sta, arg);