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: 8081301 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 425E59F440 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 65FEE20504 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 78615203A9 for ; Thu, 21 Jan 2016 13:46:18 +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 1aMFYy-0000Vt-Ly; Thu, 21 Jan 2016 13:46:12 +0000 Received: from mail-lb0-x22a.google.com ([2a00:1450:4010:c04::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aMFYt-0000NA-BH for ath10k@lists.infradead.org; Thu, 21 Jan 2016 13:46:10 +0000 Received: by mail-lb0-x22a.google.com with SMTP id x4so23776975lbm.0 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=HBNbj8ZNAV9LCjGpKSTn6l95fE/laSnx9Iqdfa++IoaHxMtbUNRwTcncRjs9wAyPgt hV7azlTkoAVZEg3JLJtuuExaqx0Zspawil3pxNXwFxNVyQqPPwdm2y0zvHf53fOowA3a 30qJ3My/yGag2feEQFph6Q+hOg+lHZWMQ9v01l7XNru/t5+DUIpUO6l0Q6+VFk/BBJmD 13Z4cpe9QIntMx+E3WV14Y2klT+RgsI/KVf2HXQZVrwlIqP5lLl1IyTBav6MJIMwA8T6 WBkzDQmk73X9OVNOdONsz/D8RLd/1CJaGCh9cERp/BqhD/X52MWaHBvJ4PnVqBQUE9rk Lwqw== X-Gm-Message-State: ALoCoQlYldeuXToEaHzI32UCfISkKOIbrpU2qVFdBis/QP9yZZFtErfUHo3fbMMuhp4GcBcDvYsfkFTHQbpx6XR65tdHzynwA3STKebpZzi+0BLkG2LUWOhodOkeRtpULGusxODsg1f76sQyrnr1WbQt1+VShlkPUD2dAs33PFQ+s5+rGMaTc76iKdW51ohLujKNPWnmniRSNZyYSyt9dIWSneGhqoeWLQ== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160121_054607_716681_E727C1F8 X-CRM114-Status: GOOD ( 11.09 ) 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 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,