From patchwork Fri Apr 20 13:57:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Pubbisetty X-Patchwork-Id: 10352797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 42A0C60365 for ; Fri, 20 Apr 2018 13:58:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 324A828733 for ; Fri, 20 Apr 2018 13:58:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26CA62873C; Fri, 20 Apr 2018 13:58:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5F04628733 for ; Fri, 20 Apr 2018 13:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=ChdSH6fm00luWlx2PYIsrv+0rtCgmtGDUWJFhJ8Jiv8=; b=iEG +vqbWaFHvXArvYC7rGCnjlMXJt7o1F++mZ2F9un+v7I7zVe+0EHWM5ka9doQs61rkuS+ETtVKFJCr LE72Umx5klXdn5J9KK/9pu+McYsCeMwFucihYTq8omUYSzv5Ss/s7uQN2boDbP89sWW7OyRvFVlA+ qMGF7SYjGgHSTLu1gFMhbo8rmFPMvvOquBGUdVbKtF7J1tA0Ke3Y08GtWrT/1uOlYmg52bvckUxxX MK8DwF2gai7U9ZjE6iDksb8kB9RgLC34+v+c2JPpDHpbOxVwQ5N5TmnU0wZqHM5ba3xV742qPQb0b qch/BnzqBg4frMEaIKAGZz6YuixSSHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9WYL-0002uL-U4; Fri, 20 Apr 2018 13:58:18 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9WY6-0002hf-AE for ath10k@lists.infradead.org; Fri, 20 Apr 2018 13:58:04 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 09B4B60C64; Fri, 20 Apr 2018 13:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524232671; bh=MWdt8A2AN4Ed5615Omo3RaNPCUiea3u5dFloc6EOo7M=; h=From:To:Cc:Subject:Date:From; b=NhwqK55lB0j33IShpELnJEkL60HSLaKnTCP362SHIxJa0AETtFWgECavgMwXCBCbK kB7LET4ecIa2d46HS5tvpdMW0GeNF5IVVZVFgHOmCZfroY/ZlgcTHczvVLKEElRbzE Q4c1yuSMdXg7KrJnSLbHcnqqTmJ6J2Sr6dbJ5gNU= Received: from tejas.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mpubbise@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 361106030D; Fri, 20 Apr 2018 13:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524232670; bh=MWdt8A2AN4Ed5615Omo3RaNPCUiea3u5dFloc6EOo7M=; h=From:To:Cc:Subject:Date:From; b=eiS6SxrmxmNRzguGt+kiETf9dRM+f/ZqswSc4kvNScIkWUM+RRIwP3wzAC8ZwDJNV mDUdk9FyvcFGzIBGzZwawFeKsINrfckQk4nXb4wV9OJlg20taD2H+zDzYJpRTGVs1z /IDecgtVCiBes+vWNSrLxdtevu5FzWjJf7iiGJe8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 361106030D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mpubbise@codeaurora.org From: Manikanta Pubbisetty To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: add dynamic vlan support Date: Fri, 20 Apr 2018 19:27:33 +0530 Message-Id: <1524232653-22573-1-git-send-email-mpubbise@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180420_065802_436780_50C823DF X-CRM114-Status: GOOD ( 14.14 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Manikanta Pubbisetty , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Mutlicast/broadcast traffic destined for a particular vlan group will always be encrypted in software. To enable dynamic VLANs, it requires driver support for sending software encrypted packets. In ath10k, sending sw encrypted frames is allowed only when we insmod the driver with cryptmode param set to 1, this configuration disables hardware crypto and enables RAW mode implicitly. Since, enabling raw mode has performance impact, this cannot be considered as an ideal solution for supporting VLANs in the driver. As an alternative take, in this approach, cryptographic keys for unicast traffic(per peer PTKs) and keys for non-vlan group traffic will be configured in hardware, allowing hardware encryption for unicast and non-vlan group traffic. Only vlan group traffic will be encrypted in software and pushed to the target with encap mode set to RAW in the TX descriptors. Not all firmwares can support this type of key configuration(having few keys installed in hardware and few only in software); for this purpose a new WMI service flag "WMI_SERVICE_PER_PACKET_SW_ENCRYPT" is introduced to advertise this support. Also, adding the logic required to send sw encrypted frames in raw mode. Tested this change on QCA9984(firmware version 10.4-3.5.3-00057). Signed-off-by: Manikanta Pubbisetty --- drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/mac.c | 26 ++++++++++++++++++++++++-- drivers/net/wireless/ath/ath10k/wmi.h | 21 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index e4ac8f2..105438d 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -122,6 +122,7 @@ enum ath10k_skb_flags { ATH10K_SKB_F_DELIVER_CAB = BIT(2), ATH10K_SKB_F_MGMT = BIT(3), ATH10K_SKB_F_QOS = BIT(4), + ATH10K_SKB_F_RAW_TX = BIT(5), }; struct ath10k_skb_cb { diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index fc3320f..694c0aa 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3362,6 +3362,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k *ar, struct sk_buff *skb) { const struct ieee80211_hdr *hdr = (void *)skb->data; + const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); __le16 fc = hdr->frame_control; if (!vif || vif->type == NL80211_IFTYPE_MONITOR) @@ -3403,7 +3404,8 @@ ath10k_mac_tx_h_get_txmode(struct ath10k *ar, if (ieee80211_is_data_present(fc) && sta && sta->tdls) return ATH10K_HW_TXRX_ETHERNET; - if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) + if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) || + skb_cb->flags & ATH10K_SKB_F_RAW_TX) return ATH10K_HW_TXRX_RAW; return ATH10K_HW_TXRX_NATIVE_WIFI; @@ -3513,6 +3515,9 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar, { struct ieee80211_hdr *hdr = (void *)skb->data; struct ath10k_skb_cb *cb = ATH10K_SKB_CB(skb); + const struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + bool is_data = ieee80211_is_data(hdr->frame_control) || + ieee80211_is_data_qos(hdr->frame_control); cb->flags = 0; if (!ath10k_tx_h_use_hwcrypto(vif, skb)) @@ -3524,6 +3529,16 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar, if (ieee80211_is_data_qos(hdr->frame_control)) cb->flags |= ATH10K_SKB_F_QOS; + /* Data frames encrypted in software will be posted to firmware + * with tx encap mode set to RAW. One such case would be the + * multicast traffic generated for a VLAN group. + */ + if (is_data && ieee80211_has_protected(hdr->frame_control) && + !info->control.hw_key) { + cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; + cb->flags |= ATH10K_SKB_F_RAW_TX; + } + cb->vif = vif; cb->txq = txq; } @@ -3632,6 +3647,7 @@ static int ath10k_mac_tx(struct ath10k *ar, { struct ieee80211_hw *hw = ar->hw; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); int ret; /* We should disable CCK RATE due to P2P */ @@ -3649,7 +3665,8 @@ static int ath10k_mac_tx(struct ath10k *ar, ath10k_tx_h_8023(skb); break; case ATH10K_HW_TXRX_RAW: - if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { + if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && + !(skb_cb->flags & ATH10K_SKB_F_RAW_TX)) { WARN_ON_ONCE(1); ieee80211_free_txskb(hw, skb); return -ENOTSUPP; @@ -8455,6 +8472,11 @@ int ath10k_mac_register(struct ath10k *ar) goto err_dfs_detector_exit; } + if (test_bit(WMI_SERVICE_PER_PACKET_SW_ENCRYPT, ar->wmi.svc_map)) { + ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); + ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); + } + if (!ath_is_world_regd(&ar->ath_common.regulatory)) { ret = regulatory_hint(ar->hw->wiphy, ar->ath_common.regulatory.alpha2); diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 3cc129d..e359b6af 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -202,6 +202,10 @@ enum wmi_service { WMI_SERVICE_HOST_DFS_CHECK_SUPPORT, WMI_SERVICE_TPC_STATS_FINAL, WMI_SERVICE_RESET_CHIP, + WMI_SERVICE_CFR_CAPTURE_SUPPORT, + WMI_SERVICE_TX_DATA_ACK_RSSI, + WMI_SERVICE_CFR_CAPTURE_IND_MSG_TYPE_1, + WMI_SERVICE_PER_PACKET_SW_ENCRYPT, /* keep last */ WMI_SERVICE_MAX, @@ -349,6 +353,10 @@ enum wmi_10_4_service { WMI_10_4_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, WMI_10_4_SERVICE_HOST_DFS_CHECK_SUPPORT, WMI_10_4_SERVICE_TPC_STATS_FINAL, + WMI_10_4_SERVICE_CFR_CAPTURE_SUPPORT, + WMI_10_4_SERVICE_TX_DATA_ACK_RSSI, + WMI_10_4_SERVICE_CFR_CAPTURE_IND_MSG_TYPE_1, + WMI_10_4_SERVICE_PER_PACKET_SW_ENCRYPT, }; static inline char *wmi_service_name(int service_id) @@ -461,6 +469,11 @@ static inline char *wmi_service_name(int service_id) SVCSTR(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS); SVCSTR(WMI_SERVICE_HOST_DFS_CHECK_SUPPORT); SVCSTR(WMI_SERVICE_TPC_STATS_FINAL); + SVCSTR(WMI_SERVICE_CFR_CAPTURE_SUPPORT); + SVCSTR(WMI_SERVICE_TX_DATA_ACK_RSSI); + SVCSTR(WMI_SERVICE_CFR_CAPTURE_IND_MSG_TYPE_1); + SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT); + default: return NULL; } @@ -769,6 +782,14 @@ static inline void wmi_10_4_svc_map(const __le32 *in, unsigned long *out, WMI_SERVICE_HOST_DFS_CHECK_SUPPORT, len); SVCMAP(WMI_10_4_SERVICE_TPC_STATS_FINAL, WMI_SERVICE_TPC_STATS_FINAL, len); + SVCMAP(WMI_10_4_SERVICE_CFR_CAPTURE_SUPPORT, + WMI_SERVICE_CFR_CAPTURE_SUPPORT, len); + SVCMAP(WMI_10_4_SERVICE_TX_DATA_ACK_RSSI, + WMI_SERVICE_TX_DATA_ACK_RSSI, len); + SVCMAP(WMI_10_4_SERVICE_CFR_CAPTURE_IND_MSG_TYPE_1, + WMI_SERVICE_CFR_CAPTURE_IND_MSG_TYPE_1, len); + SVCMAP(WMI_10_4_SERVICE_PER_PACKET_SW_ENCRYPT, + WMI_SERVICE_PER_PACKET_SW_ENCRYPT, len); } #undef SVCMAP