From patchwork Thu Jan 21 13:46:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 8081161 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 8AD64BEEE5 for ; Thu, 21 Jan 2016 13:45:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1953203A9 for ; Thu, 21 Jan 2016 13:45:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B244520502 for ; Thu, 21 Jan 2016 13:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965320AbcAUNpu (ORCPT ); Thu, 21 Jan 2016 08:45:50 -0500 Received: from mail-lb0-f173.google.com ([209.85.217.173]:34853 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965307AbcAUNpr (ORCPT ); Thu, 21 Jan 2016 08:45:47 -0500 Received: by mail-lb0-f173.google.com with SMTP id bc4so23434475lbc.2 for ; Thu, 21 Jan 2016 05:45:46 -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=MqKBR+M2/KLqGu6OFpE7H/D5Kk/6BWgdW/7rW0p8gYs=; b=iwBs+NLvhaLZ3EM1SR9WIFZZjRZTxuNY7E0xzRyODorc1nrhk401o7bzNcss9+/AaU POhks0LZEjpl3Rxf1WlCQ7qtdohxpSOil7rhMpn8ffV60Bef08t36vXPeE6WiqXyZbaC YhuoriEjq9ymBWEP2wZh5NBcFbQoTGAQcEH3U= 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=MqKBR+M2/KLqGu6OFpE7H/D5Kk/6BWgdW/7rW0p8gYs=; b=BuSr/Q7M71ZduGN5J5GjapApJ9Qv63c++N3Fjz/sKOtJSUKjMzhpiAOXY2rxQZh7hY AaUJAlYY3lUBVJdV/worzFtZ+D2O5fZ+S+YDz7ybYeV/Vs5Q9rnj6HYBUL4LgLeVvxn+ qOGrZeJao6crBE039Jyk+ccwzwAcqg72hKQlyNgeXDI5HB7O2JWVlc/caUZ5UYa9Xsi5 VDFuFdYTpGwaK7zN3+GL0To2pqTwwbgxxxxvUG1crUhMuLIl0zwjLquJOKBdyw/6MjtP k1l/0l1KgLRW7UuQghyQl2CcM6uZbmPJeIIu8fu2cIfJhVZjubjIuAO0ahaIrGtzEVPI rpPQ== X-Gm-Message-State: ALoCoQmMO0V0yCYoYTaLkoUubf3C0VR4u82qUQqcvHP95RB27YeEU0+DVJMhPCOnGwrPScJM+IizBA67wCDJrKXUcm1lNlw0nJ5emmxvMu0lT0R+HM1kPdpcjjVfDVhpLlgAXw46N6NzglXAJw1yMYWAHZfeFjPutg== X-Received: by 10.112.143.163 with SMTP id sf3mr14907720lbb.117.1453383945549; Thu, 21 Jan 2016 05:45:45 -0800 (PST) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id c192sm207382lfb.16.2016.01.21.05.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Jan 2016 05:45:44 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH 07/13] ath10k: implement wake_tx_queue Date: Thu, 21 Jan 2016 14:46:40 +0100 Message-Id: <1453384006-31907-8-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 This actually prepares a few knobs for new firmware supporting pull-push Tx model where firmware asks host to submit frames for given stations and tids. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 89 +++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 00789afa5dec..111baa104f8e 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3624,6 +3624,85 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) } } +static bool ath10k_mac_tx_can_push(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + return 1; /* TBD */ +} + +static int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + const bool is_mgmt = false; + const bool is_presp = false; + struct ath10k *ar = hw->priv; + struct ath10k_htt *htt = &ar->htt; + struct ieee80211_vif *vif = txq->vif; + struct ieee80211_sta *sta = txq->sta; + enum ath10k_hw_txrx_mode txmode; + enum ath10k_mac_tx_path txpath; + struct sk_buff *skb; + int ret; + + spin_lock_bh(&ar->htt.tx_lock); + ret = ath10k_htt_tx_inc_pending(htt, is_mgmt, is_presp); + spin_unlock_bh(&ar->htt.tx_lock); + + if (ret) + return ret; + + skb = ieee80211_tx_dequeue(hw, txq); + if (!skb) { + spin_lock_bh(&ar->htt.tx_lock); + ath10k_htt_tx_dec_pending(htt, is_mgmt); + spin_unlock_bh(&ar->htt.tx_lock); + + return -ENOENT; + } + + ath10k_mac_tx_h_fill_cb(ar, vif, skb); + + txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb); + txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode); + + ret = ath10k_mac_tx(ar, vif, sta, txmode, txpath, skb); + if (unlikely(ret)) { + ath10k_warn(ar, "failed to push frame: %d\n", ret); + + spin_lock_bh(&ar->htt.tx_lock); + ath10k_htt_tx_dec_pending(htt, is_mgmt); + spin_unlock_bh(&ar->htt.tx_lock); + + return ret; + } + + return 0; +} + +static void ath10k_mac_tx_push(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + struct ath10k *ar = hw->priv; + int ret; + + ret = ath10k_mac_tx_push_txq(hw, txq); + if (unlikely(ret)) { + if (txq->sta) + ath10k_warn(ar, "failed to push tx to station %pM tid %hhu: %d\n", + txq->sta->addr, txq->tid, ret); + else + ath10k_warn(ar, "failed to push tx to interface %pM: %d\n", + txq->vif->addr, ret); + return; + } +} + +static void ath10k_mac_tx_wake(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + WARN_ON(1); /* TBD */ +} + /************/ /* Scanning */ /************/ @@ -3840,6 +3919,15 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw, } } +static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + if (ath10k_mac_tx_can_push(hw, txq)) + ath10k_mac_tx_push(hw, txq); + else + ath10k_mac_tx_wake(hw, txq); +} + /* Must not be called with conf_mutex held as workers can use that also. */ void ath10k_drain_tx(struct ath10k *ar) { @@ -6998,6 +7086,7 @@ ath10k_mac_op_switch_vif_chanctx(struct ieee80211_hw *hw, static const struct ieee80211_ops ath10k_ops = { .tx = ath10k_mac_op_tx, + .wake_tx_queue = ath10k_mac_op_wake_tx_queue, .start = ath10k_start, .stop = ath10k_stop, .config = ath10k_config,