From patchwork Thu Jan 21 13:46:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 8081291 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 2B065BEEE5 for ; Thu, 21 Jan 2016 13:46:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4638820502 for ; Thu, 21 Jan 2016 13:46:19 +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 B5D1E2050E for ; Thu, 21 Jan 2016 13:46:12 +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 1aMFYq-0000Rc-NI; Thu, 21 Jan 2016 13:46:04 +0000 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aMFYm-0000ME-G9 for ath10k@lists.infradead.org; Thu, 21 Jan 2016 13:46:01 +0000 Received: by mail-lf0-x22b.google.com with SMTP id m198so26893461lfm.0 for ; Thu, 21 Jan 2016 05:45:40 -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=k3D7OxWwU0kIxduaQ5z2U7fBGPqldxQSSwpplavuCsQ=; b=0/7JtHqmOKWHVYUk6vvUyyUD6F7pL30UjlAb63nQmKSEMv3zqm07+J8lS/YyNDCU1W NaT+Vf77eClV65bDl4ZBh+byyO40K1P261/0R7Wyj6bqv1VaKEocTHtyQrxqe24Jbk8J YsTX4l/fVN9qRQlxH9HnJE35WSZqmJtn86RRU= 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=k3D7OxWwU0kIxduaQ5z2U7fBGPqldxQSSwpplavuCsQ=; b=mwj3ubFJ4P/TavJmxGfJ6UB7lwEGp5ipv+E1akWdDdAqfn1AhGPinXYWnmv45oY61D JbzbX82qjMweScGY2sBPj9wrgfYJu9X/rKHBe64zBwVRJb5A3WBHPxiYB+NT2wvJsPWv 9NtT6n5bD5eF7IIFF0KlNLuR4pedDbJeOpPAxmRHCWFiLYIEhfh2VNpX4gQ8ej3q656R qruyTzWWWbXEt6J90mj/18coPH0FQgCxBY1VSNkVAuputoDNc8Lv1VnUD1IOOIckia36 1LqnJjtynmTOtDkf9IULMikbeswOF5q1yuPdq37iBUj2lDhEUlnCvXOHXF0XGu8Y67Ms Cl7Q== X-Gm-Message-State: ALoCoQmC2pSfK85UHba1QtKt6tUbClmaxyT2EBp7BRCEeITZ7MZPKhRie20Z+MV3fFQVPWVdLY+5DuM/pqtxGaom+clziMuLRiuy8N3KLjzGkd7+MESCqiyD4UJeJVJGvo9Fuytty/ofsuSU3GwkSd/DLl644xBK9VVBrLsDKrAC2HZpNuSeilCseKCHam2rsV5r3aRGHO+DfxLjiHRN4w5p3hME2xNzdQ== X-Received: by 10.25.166.65 with SMTP id p62mr16887983lfe.51.1453383938652; Thu, 21 Jan 2016 05:45:38 -0800 (PST) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id c192sm207382lfb.16.2016.01.21.05.45.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Jan 2016 05:45:37 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH 02/13] ath10k: unify txpath decision Date: Thu, 21 Jan 2016 14:46:35 +0100 Message-Id: <1453384006-31907-3-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453384006-31907-1-git-send-email-michal.kazior@tieto.com> References: <1453384006-31907-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-20160121_054600_809816_BACA6E46 X-CRM114-Status: GOOD ( 11.70 ) 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 a684718f6389..9abb52924432 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2997,6 +2997,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); @@ -3330,27 +3337,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; }