From patchwork Tue Nov 10 13:10:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 7590401 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 29796C05CA for ; Tue, 10 Nov 2015 13:13:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3766C20747 for ; Tue, 10 Nov 2015 13:13:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3248207B6 for ; Tue, 10 Nov 2015 13:13:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zw8k0-0008UE-MM; Tue, 10 Nov 2015 13:13:40 +0000 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zw8jt-0008Nh-0d for ath10k@lists.infradead.org; Tue, 10 Nov 2015 13:13:34 +0000 Received: by lffu14 with SMTP id u14so27452437lff.1 for ; Tue, 10 Nov 2015 05:13:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NTa0lqcE194ZVfcZdDQbxcejtxsp492atn4lLVAkzCk=; b=xBics674sUAW9uM03uO+z2GME4usiVUrUKWa+RJgzHvaFHu4uDjYQxScQIU3u2EPMY minhVIahugFQc7c/ZEN0eYT3lmUQeBH0bdZzIznp8bgzyV7MbI+9TAYLAIItDdYhXsod hR5QWXIjiO/Pymr2ik1nlVPgJ0PP0fCP8mLLI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NTa0lqcE194ZVfcZdDQbxcejtxsp492atn4lLVAkzCk=; b=hAUX7uQsjZ8WIcEkGMFOk8vPFmBW0do5zHATDKilNN3+ILp8QDsKIsp2ttLYzn8yYt cVo2gwVrRdRxEHcS/yx+pb2UWTY6YUMVygHZxlnOCLsX5l7VG0bEb/qFyNmmcKn6pxHG y3IGA2TXangBLSTcD1x/n7KMKJoc1tD4HYqINaIYfTBsjhmJkrVoL+YYs5dlXHcKF1zg 8qaL/3tBh6aDbV4Um6imwnbJhuI4Pel6Qc0u9EqwmhaDcCSZ8oqtHbg8wKVxTsni2HIv OPwJ4wTiyuYjp73R6QrdksuhkWrMJnyKhTyHRGSFFlZ7Ek4E0syCAQSthdt/JgdcX6Dv pIiA== X-Gm-Message-State: ALoCoQnezDqScLIVuCz3NAIJX82w2msyQA79TwDAHNCvoViarvEEhwBiLwJ4Br3XP0Pf3AxSsro4K+/kzxep4cf8cHWeasEArhwJrsibgdU3/EiIAz0LYR0OMVRjejZkrK1p/M+CG213OQ1fGagTfjaYNX2AEYrmofA8tMSK+9fxu0bHD2pbYW/a1/Tj87bSs6pf+Zx1JNXQ X-Received: by 10.25.89.9 with SMTP id n9mr1636225lfb.9.1447161191117; Tue, 10 Nov 2015 05:13:11 -0800 (PST) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id e63sm513167lfe.5.2015.11.10.05.13.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 05:13:10 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH v2 7/9] ath10k: fix tx header parsing Date: Tue, 10 Nov 2015 14:10:53 +0100 Message-Id: <1447161055-2283-8-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447161055-2283-1-git-send-email-michal.kazior@tieto.com> References: <1446472988-2603-1-git-send-email-michal.kazior@tieto.com> <1447161055-2283-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151110_051333_378525_81E7DDC3 X-CRM114-Status: GOOD ( 13.81 ) X-Spam-Score: -2.7 (--) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, Michal Kazior MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Frames are not guaranteed to be 802.11 frames in ath10k_htt_tx() and the tx completion handler. In some cases, like TDLS, they can be Ethernet. Hence checking, e.g. frame_control could yield bogus results and behavior. Fortunately this wasn't a real problem so far because there's no FW/HW combination to encounter this problem. However it is good to fix this in advance. Fixes: 75d85fd9993c ("ath10k: introduce basic tdls functionality") Fixes: eebc67fef3ee ("ath10k: fix pmf for wmi-tlv on qca6174") Fixes: 7b7da0a02192 ("ath10k: drop probe responses when too many are queued") Signed-off-by: Michal Kazior --- Notes: v2: * introduced drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/mac.c | 3 +++ drivers/net/wireless/ath/ath10k/txrx.c | 8 ++------ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 1e8b5adeac37..b9137b1f76d1 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -85,6 +85,7 @@ enum ath10k_skb_flags { ATH10K_SKB_F_NO_HWCRYPT = BIT(0), ATH10K_SKB_F_DTIM_ZERO = BIT(1), ATH10K_SKB_F_DELIVER_CAB = BIT(2), + ATH10K_SKB_F_MGMT = BIT(3), }; struct ath10k_skb_cb { diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 07b67c9132f6..2f99552acad4 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3685,6 +3685,9 @@ static void ath10k_tx(struct ieee80211_hw *hw, if (!ath10k_tx_h_use_hwcrypto(vif, skb)) skb_cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; + if (ieee80211_is_mgmt(hdr->frame_control)) + skb_cb->flags |= ATH10K_SKB_F_MGMT; + skb_cb->htt.tid = ath10k_tx_h_get_tid(hdr); skb_cb->vdev_id = ath10k_tx_h_get_vdev_id(ar, vif); diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index 655947bef6cc..f3bbe41f3ff7 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -57,8 +57,6 @@ void ath10k_txrx_tx_unref(struct ath10k_htt *htt, struct ieee80211_tx_info *info; struct ath10k_skb_cb *skb_cb; struct sk_buff *msdu; - struct ieee80211_hdr *hdr; - __le16 fc; bool limit_mgmt_desc = false; ath10k_dbg(ar, ATH10K_DBG_HTT, @@ -81,10 +79,9 @@ void ath10k_txrx_tx_unref(struct ath10k_htt *htt, return; } - hdr = (struct ieee80211_hdr *)msdu->data; - fc = hdr->frame_control; + skb_cb = ATH10K_SKB_CB(msdu); - if (unlikely(ieee80211_is_mgmt(fc)) && + if (unlikely(skb_cb->flags & ATH10K_SKB_F_MGMT) && ar->hw_params.max_probe_resp_desc_thres) limit_mgmt_desc = true; @@ -94,7 +91,6 @@ void ath10k_txrx_tx_unref(struct ath10k_htt *htt, wake_up(&htt->empty_tx_wq); spin_unlock_bh(&htt->tx_lock); - skb_cb = ATH10K_SKB_CB(msdu); dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); ath10k_report_offchan_tx(htt->ar, msdu);