From patchwork Tue May 19 12:09:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 6436591 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3BB6F9F1C1 for ; Tue, 19 May 2015 12:10:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3E2D620453 for ; Tue, 19 May 2015 12:10:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 533E020383 for ; Tue, 19 May 2015 12:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754560AbbESMKK (ORCPT ); Tue, 19 May 2015 08:10:10 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:34491 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754122AbbESMKJ (ORCPT ); Tue, 19 May 2015 08:10:09 -0400 Received: by wicmc15 with SMTP id mc15so114392420wic.1 for ; Tue, 19 May 2015 05:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=Pt8zrfVKR/IKXZTMF5CEMSAaX3USILeagwK+VgQDQas=; b=wK14dzVGDazD90DS/Kl3VI3j7DgkgRxbGeBukAqFFTqJwm4GYJiMeqjaPWXSTtR00g BfzhRjbPetPA68w+ZgEtfm21EVrcgnKNz24Ojkdq3kW6QSA8g3fcDMbBBeSNfJQf21mI lE2itZOa6Rt1mUhvZSzEv9UvcJ+woCcOM2dSE= 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; bh=Pt8zrfVKR/IKXZTMF5CEMSAaX3USILeagwK+VgQDQas=; b=RIj3H+5QmoikkXO+yjCaQBjQM+fgmxS6NvCBFcsfZ4Xf47wqKG/wTorTtTIcrZxxbJ nCn7Vz6If/fWyVtUNJkIriSmkeonwKoPvQNFRsOeXf+lia9m99uwTBaGhxYW61b7j1/9 iWfei+BICTvWneG1kwoQE/bC11yclGQ9ibgNlLNSWXz3EqoudwGBg2UuDDop2sXRkTpm F6uTtgk/3UrE7v9toBatJixt0oYqXX9D2q0udUk9jjUFadW2SvOQv+gAaulTq5h5qbTq 33XcyEh7/1CjusyC+1s9F7JympL2jkf53LdAtYJSCeZXOu9zoXYUQIaJTVX9yVypqake sJNA== X-Gm-Message-State: ALoCoQkcrytQAAlovqpEyRPhAycoShLWUJYY/Zzqzg5LFY69tFxm1H+un5rQGzo+3e1O42d5WK9XZK8pWmtA/5a0TfJmBTSmZU6UMP4B7rE6Jp3gzxYV/t/5gqAG9AA67ofXscuU8FNq X-Received: by 10.180.188.100 with SMTP id fz4mr28952135wic.91.1432037407661; Tue, 19 May 2015 05:10:07 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id m2sm17090986wiy.7.2015.05.19.05.10.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 May 2015 05:10:06 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH] ath10k: add new 4addr related fw_feature Date: Tue, 19 May 2015 14:09:34 +0200 Message-Id: <1432037374-26339-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 X-DomainID: tieto.com 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,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 Some firmware revisions pad 4th hw address in Native Wifi Rx decap. This is the case with 10.x and it was assumed that this is true for all firmware images. However QCA988X with 999.999.0.636 and QCA61X4 with WLAN.RM.2.0-00088 don't have the padding. Hence add a feature flag indicating that the padding isn't present so firmware images can advertise it appropriately. This way driver will behave as it was before with old firmware blobs and doesn't cause any regressions from user perspective. Effectively this patch enables QCA988X with 999.999.0.636 and QCA61X4 with WLAN.RM.2.0-00088 to set up client bridging provided user has an updated firmware blob. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/core.h | 5 +++++ drivers/net/wireless/ath/ath10k/htt_rx.c | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 827b3d79ed0c..70fcdc9c2758 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -463,6 +463,11 @@ enum ath10k_fw_features { /* Don't trust error code from otp.bin */ ATH10K_FW_FEATURE_IGNORE_OTP_RESULT, + /* Some firmware revisions pad 4th hw address to 4 byte boundary making + * it 8 bytes long in Native Wifi Rx decap. + */ + ATH10K_FW_FEATURE_NO_NWIFI_DECAP_4ADDR_PADDING, + /* keep last */ ATH10K_FW_FEATURE_COUNT, }; diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index b26e32f42656..89eb16b30fc4 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -965,10 +965,16 @@ static void ath10k_process_rx(struct ath10k *ar, ieee80211_rx(ar->hw, skb); } -static int ath10k_htt_rx_nwifi_hdrlen(struct ieee80211_hdr *hdr) +static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar, + struct ieee80211_hdr *hdr) { - /* nwifi header is padded to 4 bytes. this fixes 4addr rx */ - return round_up(ieee80211_hdrlen(hdr->frame_control), 4); + int len = ieee80211_hdrlen(hdr->frame_control); + + if (!test_bit(ATH10K_FW_FEATURE_NO_NWIFI_DECAP_4ADDR_PADDING, + ar->fw_features)) + len = round_up(len, 4); + + return len; } static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar, @@ -1067,7 +1073,7 @@ static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar, /* pull decapped header and copy SA & DA */ hdr = (struct ieee80211_hdr *)msdu->data; - hdr_len = ath10k_htt_rx_nwifi_hdrlen(hdr); + 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)); skb_pull(msdu, hdr_len);