From patchwork Tue Jan 22 14:20:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 10775545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED884139A for ; Tue, 22 Jan 2019 14:21:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDA6F2A9BE for ; Tue, 22 Jan 2019 14:21:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC0092AC75; Tue, 22 Jan 2019 14:21:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6E4822AC6E for ; Tue, 22 Jan 2019 14:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jQyXmYpTrVVHtMG/yvMDxiRhLoh6fVCem2AQwAjipys=; b=Xm8t5qUnUROegF fpNdlUx1NYq6OsbFEZee1KQfarq2wAU9dn1+8inCzjDLGvlcDkSYzCbrCLCsBR4MGT6kyn/JoGjY8 J4lxBmoGfp2CDPHT1ejrhc/EtpFGfKH6+FmMGLP1qGDvUx0C1CX1XaeeztmBave05y/5OEWmT7uB2 exyGoaS+uZFq5GOAUxqPddsBGHU029tOuhWt9hEPn5UvgzVH5+wvKaqV4CzMcOod57RUGnR+xfLIY zY+M7LRUkUvFkGO6y8ITX0qz8uS2/j7Ex2N2hyXPhnIYReKj5LEeHyD553QItZvHAxeqsBr/1v2LR 35z7q48v3FCYp3Poh8Ow==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glwvo-0004wQ-Hw; Tue, 22 Jan 2019 14:21:36 +0000 Received: from mail-ed1-f65.google.com ([209.85.208.65]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glwvl-0004vb-7g for ath10k@lists.infradead.org; Tue, 22 Jan 2019 14:21:34 +0000 Received: by mail-ed1-f65.google.com with SMTP id b3so19532961ede.1 for ; Tue, 22 Jan 2019 06:21:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3IHpxwscK74GPH/OmYTacZuNvfvt+rhFlghjd4c8vPM=; b=XjhCnxoY6oryUiy7IGDma9j5qNMXTtMHZlItqzwJyR8EUdW1xc9aErqUUud2bIA/JV +07RviP9IBPDOy6T0jEKXjz8684VZAcB3a5UP193fZJYQ6sRBEQmcQz0NWXFLOsiCxDI H5MOe2XtRsbLOLNkGez3+ODTztjBPkK0FUOrUOeXsimCResihoctrDtpdPWSVpFYcOML pQ4nw7iNXgxDHvf1AkFVf9TOndAsILEbItIHNH9eiQ4ytTIuBz+vqoyaI/ZFSbC18s9d Rfv5w2WXYQRH8UEpInTEH5N6s7ym79wJBH0Kt320FgPyuXPUTdmYrQgL8u46Dm9/CRwC kC6Q== X-Gm-Message-State: AJcUukcTHSl4ki4xgCOdKw5/iKlDw2gFi9pC+6uaGavBtvcJqiNwLFBE PizXkXKxsw3k2GxHIqrppEfNyqxpF9w= X-Google-Smtp-Source: ALg8bN5nPdEKK/oeg5eB/dxboG3zFhcM4QpFSGhjxptEtLRC+3dfDDkXEJc2faOXxMp/gPj4rHnxFw== X-Received: by 2002:a50:f5af:: with SMTP id u44mr32009323edm.172.1548166891402; Tue, 22 Jan 2019 06:21:31 -0800 (PST) Received: from tohojo-x1-rh.localdomain (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id h8sm9462898edb.95.2019.01.22.06.21.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Jan 2019 06:21:30 -0800 (PST) Received: by tohojo-x1-rh.localdomain (Postfix, from userid 1000) id 5E7621833C1; Tue, 22 Jan 2019 15:21:29 +0100 (CET) From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: linux-wireless@vger.kernel.org Subject: [PATCH v7 1/4] mac80211: Expose ieee80211_schedule_txq() function Date: Tue, 22 Jan 2019 15:20:16 +0100 Message-Id: <20190122142019.21417-2-toke@redhat.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190122142019.21417-1-toke@redhat.com> References: <20190122142019.21417-1-toke@redhat.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190122_062133_268759_C9F58162 X-CRM114-Status: GOOD ( 11.04 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: make-wifi-fast@lists.bufferbloat.net, =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?q?=C3=B8rgensen?= , ath10k@lists.infradead.org, Rajkumar Manoharan Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since we reworked ieee80211_return_txq() so it assumes that the caller takes care of logging, we need another function that can be called without holding any locks. Introduce ieee80211_schedule_txq() which serves this purpose. Signed-off-by: Toke Høiland-Jørgensen --- include/net/mac80211.h | 13 +++++++++++++ net/mac80211/driver-ops.h | 4 +--- net/mac80211/tx.c | 13 +++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index a285c2bfd14e..294a8a36012a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -6209,6 +6209,19 @@ void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) __releases(txq_lock); +/** + * ieee80211_schedule_txq - schedule a TXQ for transmission + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @txq: pointer obtained from station or virtual interface + * + * Schedules a TXQ for transmission if it is not already scheduled. Takes a + * lock, which means it must *not* be called between + * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end() + */ +void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) + __acquires(txq_lock) __releases(txq_lock); + /** * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit * diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 1aab1734b26f..ba3c07b10cd0 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1176,9 +1176,7 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, static inline void schedule_and_wake_txq(struct ieee80211_local *local, struct txq_info *txqi) { - spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); - ieee80211_return_txq(&local->hw, &txqi->txq); - spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); + ieee80211_schedule_txq(&local->hw, &txqi->txq); drv_wake_tx_queue(local, txqi); } diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index f46d8d822f86..17744be84b34 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3703,6 +3703,19 @@ void ieee80211_return_txq(struct ieee80211_hw *hw, } EXPORT_SYMBOL(ieee80211_return_txq); +void ieee80211_schedule_txq(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + __acquires(txq_lock) __releases(txq_lock) +{ + struct ieee80211_local *local = hw_to_local(hw); + struct txq_info *txqi = to_txq_info(txq); + + spin_lock_bh(&local->active_txq_lock[txq->ac]); + ieee80211_return_txq(hw, txq); + spin_unlock_bh(&local->active_txq_lock[ac]); +} +EXPORT_SYMBOL(ieee80211_schedule_txq); + bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) {