From patchwork Fri Oct 23 04:50:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yanbo Li X-Patchwork-Id: 7469721 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@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 252DCBEEA4 for ; Fri, 23 Oct 2015 04:50:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2FC2920414 for ; Fri, 23 Oct 2015 04:50:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DD492011E for ; Fri, 23 Oct 2015 04:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751138AbbJWEum (ORCPT ); Fri, 23 Oct 2015 00:50:42 -0400 Received: from sabertooth01.qualcomm.com ([65.197.215.72]:54186 "EHLO sabertooth01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750911AbbJWEul (ORCPT ); Fri, 23 Oct 2015 00:50:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1445575842; x=1477111842; h=from:to:cc:subject:date:message-id:mime-version; bh=vKIMszz27cKNPgA5jLV0bnbultrCZFYDEiExzFch/Ko=; b=bQ8XFBTQE7VFVOy5efaI+pu9M9hrt/yfjw8lS+2P4CM6Jrpz+/76Fbud w3oTz+nTXwOQq8VEfP1ixjlo//e03SuSea6RG5QX3TKLp5dfrYD/Ns+CM J7cnEudYRGFO/zgXTnkEx9/wFLFIs8+NCHFASD/1jXqDoiTeyiu2KGI4+ Y=; X-IronPort-AV: E=McAfee;i="5700,7163,7962"; a="99058006" Received: from unknown (HELO Ironmsg03-R.qualcomm.com) ([10.53.140.107]) by sabertooth01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Oct 2015 21:50:42 -0700 X-IronPort-AV: E=Sophos;i="5.20,185,1444719600"; d="scan'208";a="1020166453" Received: from nasanexm02e.na.qualcomm.com ([10.85.0.86]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 22 Oct 2015 21:50:40 -0700 Received: from buildX11.qca.qualcomm.com (10.80.80.8) by nasanexm02e.na.qualcomm.com (10.85.0.86) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Thu, 22 Oct 2015 21:50:40 -0700 From: Yanbo Li To: CC: , , Subject: [PATCH] ath10k: Adjust the RX packet pad offset at QCA99X0 4addr mode Date: Thu, 22 Oct 2015 21:50:16 -0700 Message-ID: <1445575816-4500-1-git-send-email-yanbol@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01E.na.qualcomm.com (10.85.0.31) To nasanexm02e.na.qualcomm.com (10.85.0.86) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 The QCA99X0 4 addresses RX packets pad 2 bytes at the beginning of MSDU instead the end of ieee80211 header to keep align. The currently RX data path can't parse the header correctly in this case. This patch fixes it for QCA99X0 Signed-off-by: Yanbo Li diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 13de3617d5ab..3c1d07c191d5 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -58,6 +58,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, + .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT, .fw = { .dir = QCA988X_HW_2_0_FW_DIR, .fw = QCA988X_HW_2_0_FW_FILE, @@ -75,6 +76,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, + .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT, .fw = { .dir = QCA6174_HW_2_1_FW_DIR, .fw = QCA6174_HW_2_1_FW_FILE, @@ -92,6 +94,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, + .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT, .fw = { .dir = QCA6174_HW_3_0_FW_DIR, .fw = QCA6174_HW_3_0_FW_FILE, @@ -109,6 +112,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, + .loc_4addr_pad = ATH10K_4ADDR_PAD_AFT, .fw = { /* uses same binaries as hw3.0 */ .dir = QCA6174_HW_3_0_FW_DIR, @@ -128,6 +132,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .continuous_frag_desc = true, .channel_counters_freq_hz = 150000, .max_probe_resp_desc_thres = 24, + .loc_4addr_pad = ATH10K_4ADDR_PAD_PRE, .fw = { .dir = QCA99X0_HW_2_0_FW_DIR, .fw = QCA99X0_HW_2_0_FW_FILE, diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 7cc7cdd56c95..b4db8bbf85ce 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -646,6 +646,9 @@ struct ath10k { */ u32 max_probe_resp_desc_thres; + /* The padding bytes's location is different on various chips */ + enum ath10k_loc_4addr_pad loc_4addr_pad; + struct ath10k_hw_params_fw { const char *dir; const char *fw; diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 6060dda4e910..f25f1d7a3edf 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -1114,7 +1114,19 @@ static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar, */ /* pull decapped header and copy SA & DA */ - hdr = (struct ieee80211_hdr *)msdu->data; + if ((ar->hw_params.loc_4addr_pad == ATH10K_4ADDR_PAD_PRE) && + ieee80211_has_a4(((struct ieee80211_hdr *)first_hdr)->frame_control)) { + /* The QCA99X0 4 address mode pad 2 bytes at the + * beginning of MSDU + */ + hdr = (struct ieee80211_hdr *)(msdu->data + 2); + /* The skb length need be extended 2 as the 2 bytes at the tail + * be excluded due to the padding + */ + skb_put(msdu, 2); + } else + hdr = (struct ieee80211_hdr *)(msdu->data); + hdr_len = ath10k_htt_rx_nwifi_hdrlen(ar, hdr); ether_addr_copy(da, ieee80211_get_DA(hdr)); ether_addr_copy(sa, ieee80211_get_SA(hdr)); diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 2d87737e35ff..efbe6fa1f356 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -282,6 +282,11 @@ enum ath10k_hw_rate_cck { ATH10K_HW_RATE_CCK_SP_2M, }; +enum ath10k_loc_4addr_pad { + ATH10K_4ADDR_PAD_AFT, + ATH10K_4ADDR_PAD_PRE, +}; + /* Target specific defines for MAIN firmware */ #define TARGET_NUM_VDEVS 8 #define TARGET_NUM_PEER_AST 2