From patchwork Tue Mar 1 10:32:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 8464011 Return-Path: X-Original-To: patchwork-ath10k@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 DCC309F9A0 for ; Tue, 1 Mar 2016 10:32:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1077D20306 for ; Tue, 1 Mar 2016 10:32:45 +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 5A4E320295 for ; Tue, 1 Mar 2016 10:32:43 +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 1aahbT-0000bU-Hf; Tue, 01 Mar 2016 10:32:31 +0000 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aahbQ-0000QC-30 for ath10k@lists.infradead.org; Tue, 01 Mar 2016 10:32:29 +0000 Received: by mail-lf0-x22c.google.com with SMTP id l83so62919048lfd.3 for ; Tue, 01 Mar 2016 02:32:10 -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=wH1YA2UzqpdRQNFLZbZN/kIg0mstykay/ZGAe5kCz7Y=; b=HVokt71kzv6a39bSO3czL8elK9ya7IiegHOk3Dmbbcv+iN2w0Wf6qGkzbget2LGZB7 BEW7RmUBNpsFz4AfvkWMmBndN5zcV5iEyBGMRqeFKLVdbANabgAM8nkWejtXdLWmFE9C l+V+v2kgxssAANvH+3bT2hxrVfAEXHPIjKP/s= 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=wH1YA2UzqpdRQNFLZbZN/kIg0mstykay/ZGAe5kCz7Y=; b=RdO3MSc9VPnUdOsDECzv1E8J90a7sVX22+T05iL1y61Jwchl1ibY7icD+VoA1VyO23 WB/mDLp9BKjp5WSoRU40hlbH2DEXHAyJgtpbzkam6y0X1+NNKqn7ErqTNC0cSifx7Ybt 0yyhZp4ynYMDeru+vGJDel2mipn4LYAIjNcyTSS1P9B8nt00VoYYDK3W/ZkrrnjFb/vW l/qTumikEArMtCdtOAdrGyDx94HNeURJ+rnKopFHGnXc7EdAcBEY/W3VXh138zfSIK4L NYcMV36h1x4qVVi8VePBq7bTAd0AhD7HqbvBIn98JYoCzGpPy5CrWt8vRHUJGi6G2Aaj qhTA== X-Gm-Message-State: AD7BkJItbnRcaB7ECUlHwgB4nUvBHLrH5W2cI5u4PlxTKTG3eMUP3nxDDunm0uNhyc3UqfAxTTC14Ys3bdB/hIAdrWNeJcfGpKCS7Kf2PjmhbzcW4VFmvjf6EuQ9cQtHd1xA+/HjvOGM4VNGL9Bd1LAe6N7hIain+ZwIUgqwsduFIM6qCLkYhn4WCDwRepXmYg== X-Received: by 10.25.31.193 with SMTP id f184mr7686534lff.5.1456828329172; Tue, 01 Mar 2016 02:32:09 -0800 (PST) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id i2sm4644857lfd.43.2016.03.01.02.32.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Mar 2016 02:32:08 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH v2 02/11] ath10k: unify txpath decision Date: Tue, 1 Mar 2016 11:32:47 +0100 Message-Id: <1456828376-2795-3-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456828376-2795-1-git-send-email-michal.kazior@tieto.com> References: <1453384006-31907-1-git-send-email-michal.kazior@tieto.com> <1456828376-2795-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-20160301_023228_325464_F3041E5E X-CRM114-Status: GOOD ( 12.33 ) 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.1 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 Some future changes will need to determine final tx method early on. Prepare the code. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 58 +++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index b3a790addb0a..67a50a61afb4 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2994,6 +2994,13 @@ static void ath10k_reg_notifier(struct wiphy *wiphy, /* TX handlers */ /***************/ +enum ath10k_mac_tx_path { + ATH10K_MAC_TX_HTT, + ATH10K_MAC_TX_HTT_MGMT, + ATH10K_MAC_TX_WMI_MGMT, + ATH10K_MAC_TX_UNKNOWN, +}; + void ath10k_mac_tx_lock(struct ath10k *ar, int reason) { lockdep_assert_held(&ar->htt.tx_lock); @@ -3326,27 +3333,52 @@ unlock: return ret; } +static enum ath10k_mac_tx_path +ath10k_mac_tx_h_get_txpath(struct ath10k *ar, + struct sk_buff *skb, + enum ath10k_hw_txrx_mode txmode) +{ + switch (txmode) { + case ATH10K_HW_TXRX_RAW: + case ATH10K_HW_TXRX_NATIVE_WIFI: + case ATH10K_HW_TXRX_ETHERNET: + return ATH10K_MAC_TX_HTT; + case ATH10K_HW_TXRX_MGMT: + if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX, + ar->fw_features)) + return ATH10K_MAC_TX_WMI_MGMT; + else if (ar->htt.target_version_major >= 3) + return ATH10K_MAC_TX_HTT; + else + return ATH10K_MAC_TX_HTT_MGMT; + } + + return ATH10K_MAC_TX_UNKNOWN; +} + static int ath10k_mac_tx_submit(struct ath10k *ar, enum ath10k_hw_txrx_mode txmode, struct sk_buff *skb) { struct ath10k_htt *htt = &ar->htt; - int ret = 0; + enum ath10k_mac_tx_path txpath; + int ret; - switch (txmode) { - case ATH10K_HW_TXRX_RAW: - case ATH10K_HW_TXRX_NATIVE_WIFI: - case ATH10K_HW_TXRX_ETHERNET: + txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode); + + switch (txpath) { + case ATH10K_MAC_TX_HTT: ret = ath10k_htt_tx(htt, txmode, skb); break; - case ATH10K_HW_TXRX_MGMT: - if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX, - ar->fw_features)) - ret = ath10k_mac_tx_wmi_mgmt(ar, skb); - else if (ar->htt.target_version_major >= 3) - ret = ath10k_htt_tx(htt, txmode, skb); - else - ret = ath10k_htt_mgmt_tx(htt, skb); + case ATH10K_MAC_TX_HTT_MGMT: + ret = ath10k_htt_mgmt_tx(htt, skb); + break; + case ATH10K_MAC_TX_WMI_MGMT: + ret = ath10k_mac_tx_wmi_mgmt(ar, skb); + break; + case ATH10K_MAC_TX_UNKNOWN: + WARN_ON_ONCE(1); + ret = -EINVAL; break; }