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: 8081121 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 EF472BEEE5 for ; Thu, 21 Jan 2016 13:45:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21B61203A9 for ; Thu, 21 Jan 2016 13:45:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D8E920502 for ; Thu, 21 Jan 2016 13:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759504AbcAUNpm (ORCPT ); Thu, 21 Jan 2016 08:45:42 -0500 Received: from mail-lf0-f44.google.com ([209.85.215.44]:34993 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759368AbcAUNpk (ORCPT ); Thu, 21 Jan 2016 08:45:40 -0500 Received: by mail-lf0-f44.google.com with SMTP id c192so26816973lfe.2 for ; Thu, 21 Jan 2016 05:45:39 -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=UZXaSzSlp7H3LZSVK6VO5p9DRKnlqj7OKkNQYRuLk1hFA+6cyizgMdOHGicHYZ5kLj wctqPjz0mKI8GQWhoAq4hXZuvgSsHOvWbgxjJWvOR2NXf2lTNKeU4kmo1A26M41dwier 8HNKUHdcqNzVX4VAFKFQ9PHvZ+oOMXiJk6aLDh8kcb96JZJYB8un//V0qtX09cQIsT0M OvqrL1ThfSsnYlJzcpUzrxJv3neESKc80htygLnqMBDqDpQvI9oeuIJenXGA1SD9bIf1 9XY7mt/4tkkdQqbWFlmvoSUy3xoCFpXeE50StZzj2fl2X34nQ5B50+TGTKEz23FSyheJ Sp9w== X-Gm-Message-State: ALoCoQmnE67hVYIQkEA9bgfrVsMkvvW7Irp58JNhQ6ofz61U9rWnliiskfEAz7kPVsZrw3xyjNMQzeAom058L5Ssh4QJ2V/gUqQAy8F7FaaGdfe9HWM/yfyd42+SHEQ7vsqhJk70KoOaNtoqckK4yyc2RzSdywVEsA== 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 Cc: linux-wireless@vger.kernel.org, Michal Kazior 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 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=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 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; }