From patchwork Tue Jul 21 17:14:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11676295 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D85086C1 for ; Tue, 21 Jul 2020 17:15:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AFE2D20717 for ; Tue, 21 Jul 2020 17:15:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KxEwCbhW"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="DaG7p7NP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFE2D20717 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=t4GYpZLJSvaQQNptXA8UFety3Sx/jh3OvPhe84US/ss=; b=KxEwCbhWflh3E7YKdmXb2H0dud QfifO4ZMPuyKny4+nJZADi67qnOseIEngvRPks5M1HXJQgs6K8Mqzztn2qtHsNitOkgxm1e42NcfQ TyZnHsFV/w+M22TwRuqYHNdtYTOcDgwMhFc/84MAnlVG3JoA57sYjXg86KjMNZSxSPMXV+BHuXUlR ROZ0BbdnuDYWUdrcm9BKQwcQ7Lp1iBmDahndSwWTjKJ7GF5yx+tRScHQH4hkuyYoZ7A4Rsyn9eUrR YwFvLvbs9Lp+dwQS1xqeyuA0wDk0Pn+/F/L3lYOmhivO+1JUd6oUk4ElPzlm6+jQ40E2pKbbWaTju XQvOe3Vg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvrf-0000m8-Lr; Tue, 21 Jul 2020 17:15:39 +0000 Received: from m43-7.mailgun.net ([69.72.43.7]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvra-0000Ul-46 for ath10k@lists.infradead.org; Tue, 21 Jul 2020 17:15:38 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595351737; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=k+XAw9X2vHW5qNsF1IEl1DDQaBasaYhVfkIaTJygYog=; b=DaG7p7NPqOgV6c/YCPbDxz42g+AxHUiF8URrdWo/EsWZTPYJwS2vYf/I+9Xe5RJIm7DcIDjM JTETb7/t3VtJdwpokKD03+v7A4WKFw7CH555ypqnfgHxODtLoEGujJP3oauVWEOBACJbaEWj 8AeNeVF5F3R+YJx3JgY91ZXfGSA= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 5f172287d50c36e7292bd0d4 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 21 Jul 2020 17:14:47 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id AE9D4C433A0; Tue, 21 Jul 2020 17:14:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id 263A8C4339C; Tue, 21 Jul 2020 17:14:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 263A8C4339C Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [RFC 1/7] mac80211: Add check for napi handle before WARN_ON Date: Tue, 21 Jul 2020 22:44:20 +0530 Message-Id: <1595351666-28193-2-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> References: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_131537_825384_833AFF39 X-CRM114-Status: GOOD ( 12.23 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [69.72.43.7 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [69.72.43.7 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org, Rakesh Pillai , kuba@kernel.org, johannes@sipsolutions.net, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org The function ieee80211_rx_napi can be now called from a thread context as well, with napi context being NULL. Hence add the napi context check before giving out a warning for softirq count being 0. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index a88ab6f..1e703f1 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4652,7 +4652,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, struct ieee80211_supported_band *sband; struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - WARN_ON_ONCE(softirq_count() == 0); + WARN_ON_ONCE(napi && softirq_count() == 0); if (WARN_ON(status->band >= NUM_NL80211_BANDS)) goto drop; From patchwork Tue Jul 21 17:14:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11676281 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1763013A4 for ; Tue, 21 Jul 2020 17:15:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DB0A920717 for ; Tue, 21 Jul 2020 17:15:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NxuBEvUs"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="NwEZRQ7m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB0A920717 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=86vB6OqPW8KSmEBk+p3X+bb4WePWqq8T28UME1NHE88=; b=NxuBEvUsJ+S8063YGFMXsjkOXA /x4JgGKGyh0FXfQQMW8PqrC5a0aouCGIq63GZaXzmRIvTfPyhAE1D2j5cAVTKFb9xkU/9szGhnVvb w/f/ckX7wLwWJ1v/moW5Pj1/Ay8NhsL3vaXBk22Ai+ieXj24wSLE3zIjA7Ch3D0wCT3wrd6Pqtsi9 0olI/gpXr9c6DfXiCQHjiOrMVU3lNhO8mdqYkHlMWVzzUjWVdlQLbtLm7TIAB3sj3q3g5hc82fAH+ FsE40g+ef6l8DAnW++/bzgEO0CJVFSGVK62XXDBAqcSqBiETRfHv8Txom9TtiUehPeFwin5jT/ffh nfwsRNaw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvqw-0000W5-Vo; Tue, 21 Jul 2020 17:14:55 +0000 Received: from m43-7.mailgun.net ([69.72.43.7]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvqu-0000Ux-A0 for ath10k@lists.infradead.org; Tue, 21 Jul 2020 17:14:53 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595351690; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=h4XrQmS1jTUM0qC0Ip95PyLtIHFfuNdHLgMI5cV20Ck=; b=NwEZRQ7mfxhRbMZJ1DUCxNiU5nZUzG90VjeJntoUhHW1L6A3dZDwwNGh6VVZ3aIZUAcoODLg JpTC7dRGuju6D6O9hs1DGEZTAuEWr+SPGWf4dUowLbvGFQIq0JUxv6VFmb0Pteuom9Bbj9I+ sdzHzZGx6RS0jqhUFJOBrOe3BZs= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n20.prod.us-west-2.postgun.com with SMTP id 5f17228ae32d449b31ed6c57 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 21 Jul 2020 17:14:50 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 36E70C433C9; Tue, 21 Jul 2020 17:14:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id B2DBEC43395; Tue, 21 Jul 2020 17:14:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B2DBEC43395 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [RFC 2/7] ath10k: Add support to process rx packet in thread Date: Tue, 21 Jul 2020 22:44:21 +0530 Message-Id: <1595351666-28193-3-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> References: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_131452_388202_8D11F2D3 X-CRM114-Status: GOOD ( 17.22 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [69.72.43.7 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [69.72.43.7 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org, Rakesh Pillai , kuba@kernel.org, johannes@sipsolutions.net, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org NAPI instance gets scheduled on a CPU core on which the IRQ was triggered. The processing of rx packets can be CPU intensive and since NAPI cannot be moved to a different CPU core, to get better performance, its better to move the gist of rx packet processing in a high priority thread. Add the init/deinit part for a thread to process the receive packets. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/core.c | 33 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/core.h | 23 +++++++++++++++++++ drivers/net/wireless/ath/ath10k/snoc.c | 41 ++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 9104496..2b520a0 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -668,6 +668,39 @@ static unsigned int ath10k_core_get_fw_feature_str(char *buf, return scnprintf(buf, buf_len, "%s", ath10k_core_fw_feature_str[feat]); } +int ath10k_core_thread_shutdown(struct ath10k *ar, + struct ath10k_thread *thread) +{ + ath10k_dbg(ar, ATH10K_DBG_BOOT, "shutting down %s\n", thread->name); + set_bit(ATH10K_THREAD_EVENT_SHUTDOWN, thread->event_flags); + wake_up_process(thread->task); + wait_for_completion(&thread->shutdown); + ath10k_info(ar, "thread %s exited\n", thread->name); + + return 0; +} +EXPORT_SYMBOL(ath10k_core_thread_shutdown); + +int ath10k_core_thread_init(struct ath10k *ar, + struct ath10k_thread *thread, + int (*handler)(void *data), + char *thread_name) +{ + thread->task = kthread_create(handler, thread, thread_name); + if (IS_ERR(thread->task)) + return -EINVAL; + + init_waitqueue_head(&thread->wait_q); + init_completion(&thread->shutdown); + memcpy(thread->name, thread_name, ATH10K_THREAD_NAME_SIZE_MAX); + clear_bit(ATH10K_THREAD_EVENT_SHUTDOWN, thread->event_flags); + ath10k_info(ar, "Starting thread %s\n", thread_name); + wake_up_process(thread->task); + + return 0; +} +EXPORT_SYMBOL(ath10k_core_thread_init); + void ath10k_core_get_fw_features_str(struct ath10k *ar, char *buf, size_t buf_len) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 5c18f6c..96919e8 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -970,6 +970,22 @@ struct ath10k_bus_params { bool hl_msdu_ids; }; +#define ATH10K_THREAD_NAME_SIZE_MAX 32 + +enum ath10k_thread_events { + ATH10K_THREAD_EVENT_SHUTDOWN, + ATH10K_THREAD_EVENT_MAX, +}; + +struct ath10k_thread { + struct ath10k *ar; + struct task_struct *task; + struct completion shutdown; + wait_queue_head_t wait_q; + DECLARE_BITMAP(event_flags, ATH10K_THREAD_EVENT_MAX); + char name[ATH10K_THREAD_NAME_SIZE_MAX]; +}; + struct ath10k { struct ath_common ath_common; struct ieee80211_hw *hw; @@ -982,6 +998,7 @@ struct ath10k { } msa; u8 mac_addr[ETH_ALEN]; + struct ath10k_thread rx_thread; enum ath10k_hw_rev hw_rev; u16 dev_id; u32 chip_id; @@ -1276,6 +1293,12 @@ static inline bool ath10k_peer_stats_enabled(struct ath10k *ar) extern unsigned long ath10k_coredump_mask; +int ath10k_core_thread_shutdown(struct ath10k *ar, + struct ath10k_thread *thread); +int ath10k_core_thread_init(struct ath10k *ar, + struct ath10k_thread *thread, + int (*handler)(void *data), + char *thread_name); struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, enum ath10k_bus bus, enum ath10k_hw_rev hw_rev, diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 1ef5fdb..463c34e 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -909,6 +909,31 @@ static void ath10k_snoc_buffer_cleanup(struct ath10k *ar) } } +int ath10k_snoc_rx_thread_loop(void *data) +{ + struct ath10k_thread *rx_thread = data; + struct ath10k *ar = rx_thread->ar; + bool shutdown = false; + + ath10k_dbg(ar, ATH10K_DBG_SNOC, "rx thread started\n"); + set_user_nice(current, -1); + + while (!shutdown) { + wait_event_interruptible( + rx_thread->wait_q, + (test_bit(ATH10K_THREAD_EVENT_SHUTDOWN, + rx_thread->event_flags))); + if (test_and_clear_bit(ATH10K_THREAD_EVENT_SHUTDOWN, + rx_thread->event_flags)) + shutdown = true; + } + + ath10k_dbg(ar, ATH10K_DBG_SNOC, "rx thread exiting\n"); + complete(&rx_thread->shutdown); + + do_exit(0); +} + static void ath10k_snoc_hif_stop(struct ath10k *ar) { if (!test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) @@ -916,6 +941,7 @@ static void ath10k_snoc_hif_stop(struct ath10k *ar) napi_synchronize(&ar->napi); napi_disable(&ar->napi); + ath10k_core_thread_shutdown(ar, &ar->rx_thread); ath10k_snoc_buffer_cleanup(ar); ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n"); } @@ -923,9 +949,19 @@ static void ath10k_snoc_hif_stop(struct ath10k *ar) static int ath10k_snoc_hif_start(struct ath10k *ar) { struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); + int ret; bitmap_clear(ar_snoc->pending_ce_irqs, 0, CE_COUNT_MAX); napi_enable(&ar->napi); + + ret = ath10k_core_thread_init(ar, &ar->rx_thread, + ath10k_snoc_rx_thread_loop, + "ath10k_rx_thread"); + if (ret) { + ath10k_err(ar, "failed to start rx thread\n"); + goto rx_thread_fail; + } + ath10k_snoc_irq_enable(ar); ath10k_snoc_rx_post(ar); @@ -934,6 +970,10 @@ static int ath10k_snoc_hif_start(struct ath10k *ar) ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif start\n"); return 0; + +rx_thread_fail: + napi_disable(&ar->napi); + return ret; } static int ath10k_snoc_init_pipes(struct ath10k *ar) @@ -1652,6 +1692,7 @@ static int ath10k_snoc_probe(struct platform_device *pdev) return -ENOMEM; } + ar->rx_thread.ar = ar; ar_snoc = ath10k_snoc_priv(ar); ar_snoc->dev = pdev; platform_set_drvdata(pdev, ar); From patchwork Tue Jul 21 17:14:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11676279 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14BAC1667 for ; Tue, 21 Jul 2020 17:15:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAB73206E9 for ; Tue, 21 Jul 2020 17:15:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MZGKXvAO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="wRNEHw42" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAB73206E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=PGqYDSJTrMWnRU69VClNzlNwvCVMm1HXeOgYlu9On54=; b=MZGKXvAOlekOW/KOag16/gWk62 RI3FrByIGnc5w0fh5gGAxIY1yd8E8+YyKaeUhYu3Rr62Ww+5VEBw4/4riQdKiDeGEcgD0/i6j5JSI 7nVG1VpDa4Y+zwH34CdRLmblzbuocxlYW5/VzuzC9vQWjMEkhnjmHtbEj0Abz5dpmjyJfWP43wGq4 8X6JbJMTh3ZWVGiT6Oy7T0oILg1nraUxCCsvUsu9ZQ05Df4WR2dial8XPEyBgErAWSpEDsL05lnrT z1bXMd1kTsLuFJ1EtpP5Gwpu7bvac8JTDXlcmvLTaW0plh81YT46qFMniif2bhX5/wW+GrdGXTLkR yyyGyzJQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvr9-0000Zz-CP; Tue, 21 Jul 2020 17:15:07 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvr2-0000XH-AY for ath10k@lists.infradead.org; Tue, 21 Jul 2020 17:15:05 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595351705; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=PigUcyn1h95S9+H6bcv2J1xVFlRM+Wlov9hyYKxTijY=; b=wRNEHw42pRaBfRlBehY/KCzUSuNwajKU84v6eXatoRUYkpVeDtUxPyyiWFPPkyljCwoff46h Tvq81l0dXfYKbcuCjppAtmbLjSrpgKwez42DhzSpl4u8Lj7UydB4+WEgA/2EC/BKKITqp+cb EFUq+mjH+yg05LD2rQFTjlF7khk= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n11.prod.us-west-2.postgun.com with SMTP id 5f17228e0cb8533c3be74490 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 21 Jul 2020 17:14:54 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0BF1BC43395; Tue, 21 Jul 2020 17:14:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4650CC43391; Tue, 21 Jul 2020 17:14:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4650CC43391 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [RFC 3/7] ath10k: Add module param to enable rx thread Date: Tue, 21 Jul 2020 22:44:22 +0530 Message-Id: <1595351666-28193-4-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> References: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_131505_247516_695EE039 X-CRM114-Status: GOOD ( 15.82 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [104.130.122.29 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [104.130.122.29 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org, Rakesh Pillai , kuba@kernel.org, johannes@sipsolutions.net, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org Add a module parameter to enable or disable the processing of received packets in rx thread. To enable rx packet processing in a thread context, use the belo command to load driver: insmod ath10k_snoc.ko rx_thread_enable=1 Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/snoc.c | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 96919e8..59bdf11 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -998,6 +998,7 @@ struct ath10k { } msa; u8 mac_addr[ETH_ALEN]; + bool rx_thread_enable; struct ath10k_thread rx_thread; enum ath10k_hw_rev hw_rev; u16 dev_id; diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 463c34e..f01725b 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -26,6 +26,12 @@ #define CE_POLL_PIPE 4 #define ATH10K_SNOC_WAKE_IRQ 2 +static bool ath10k_rx_thread_enable; + +module_param_named(rx_thread_enable, ath10k_rx_thread_enable, bool, 0644); + +MODULE_PARM_DESC(rx_thread_enable, "Receive packet processing in thread"); + static char *const ce_name[] = { "WLAN_CE_0", "WLAN_CE_1", @@ -941,7 +947,8 @@ static void ath10k_snoc_hif_stop(struct ath10k *ar) napi_synchronize(&ar->napi); napi_disable(&ar->napi); - ath10k_core_thread_shutdown(ar, &ar->rx_thread); + if (ar->rx_thread_enable) + ath10k_core_thread_shutdown(ar, &ar->rx_thread); ath10k_snoc_buffer_cleanup(ar); ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n"); } @@ -954,12 +961,14 @@ static int ath10k_snoc_hif_start(struct ath10k *ar) bitmap_clear(ar_snoc->pending_ce_irqs, 0, CE_COUNT_MAX); napi_enable(&ar->napi); - ret = ath10k_core_thread_init(ar, &ar->rx_thread, - ath10k_snoc_rx_thread_loop, - "ath10k_rx_thread"); - if (ret) { - ath10k_err(ar, "failed to start rx thread\n"); - goto rx_thread_fail; + if (ar->rx_thread_enable) { + ret = ath10k_core_thread_init(ar, &ar->rx_thread, + ath10k_snoc_rx_thread_loop, + "ath10k_rx_thread"); + if (ret) { + ath10k_err(ar, "failed to start rx thread\n"); + goto rx_thread_fail; + } } ath10k_snoc_irq_enable(ar); @@ -1693,6 +1702,7 @@ static int ath10k_snoc_probe(struct platform_device *pdev) } ar->rx_thread.ar = ar; + ar->rx_thread_enable = ath10k_rx_thread_enable; ar_snoc = ath10k_snoc_priv(ar); ar_snoc->dev = pdev; platform_set_drvdata(pdev, ar); From patchwork Tue Jul 21 17:14:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11676283 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 11DEC13B4 for ; Tue, 21 Jul 2020 17:15:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDBA322CE3 for ; Tue, 21 Jul 2020 17:15:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TooyPz6u"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="du9P5YWr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDBA322CE3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=dgkeaPYZtdnsxL9xAd5VgwNI/frsVpYiJOOZyj3T/QU=; b=TooyPz6ugzvzPZ0Iwn05X6ykO6 DpqKFll0nvvAD6ihY9/YOHJw+yyNlE2lH4s/fpzcc52Zygc84vegDNlzr5HuCvN+NErx8LvGgOv1o oYzKg2/UdCO/fxpqPMwPa+VmNY8luqyGsGIGGVHG/BRHjTUUkX31gImKCVxovdEvmdCmQVHjk0oyD c6JsPeuvBGYXETticBQS+ljaesp+8sisR8SVfF9JBQF0o4VvAEolSh+YmxcPcckH7A1mRSemf3WCH u2/e5aa6MGGGriwgo4Ysq5bdwWtlPpPRQeGmeg93L3hfv29NVBQMeA8hu0kXtlQSVV7va/pF+dD1i G2/IiLGg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvr4-0000Yd-Nq; Tue, 21 Jul 2020 17:15:02 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvr2-0000XM-Aa for ath10k@lists.infradead.org; Tue, 21 Jul 2020 17:15:01 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595351699; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=wMU4DbU33JbajyG3cP1sY2UVCv9Nr6xvONZ479ljK6o=; b=du9P5YWr7w/pm1rtRaXZh7apkQq+BtD4NWzb8maegqCgt7cPdXMSBz5iYb8//XYDFAwT2aU6 aRYGLIWnae44zCg8GltbVP9x1FCmKwisJY4SIFM3olaVx5f8IHTAMsKKPHGxa02pZGVLOijg OxXKqYiArHLbQsQn1gKIBNx1Wqo= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 5f172292d3d6508422c4f3bc (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 21 Jul 2020 17:14:58 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id EFFF7C433A0; Tue, 21 Jul 2020 17:14:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id DB20FC433C6; Tue, 21 Jul 2020 17:14:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DB20FC433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [RFC 4/7] ath10k: Do not exhaust budget on process tx completion Date: Tue, 21 Jul 2020 22:44:23 +0530 Message-Id: <1595351666-28193-5-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> References: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_131500_395140_C657011E X-CRM114-Status: GOOD ( 11.07 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [104.130.122.29 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [104.130.122.29 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org, Rakesh Pillai , kuba@kernel.org, johannes@sipsolutions.net, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org Currently the entire NAPI budget is marked as exhausted if any tx completion is processed. In scenarios of bi-directional traffic, this leads to a situation where the irqs are never enabled and the NAPI is rescheuled again and again. Increase the work done quota by the number of tx completions which are processed in the NAPI context. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/htt_rx.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index cac05e7..a4a6618 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -4077,21 +4077,18 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget) /* Deliver received data after processing data from hardware */ quota = ath10k_htt_rx_deliver_msdu(ar, quota, budget); - /* From NAPI documentation: - * The napi poll() function may also process TX completions, in which - * case if it processes the entire TX ring then it should count that - * work as the rest of the budget. - */ - if ((quota < budget) && !kfifo_is_empty(&htt->txdone_fifo)) - quota = budget; - /* kfifo_get: called only within txrx_tasklet so it's neatly serialized. * From kfifo_get() documentation: * Note that with only one concurrent reader and one concurrent writer, * you don't need extra locking to use these macro. */ - while (kfifo_get(&htt->txdone_fifo, &tx_done)) + while (kfifo_get(&htt->txdone_fifo, &tx_done)) { ath10k_txrx_tx_unref(htt, &tx_done); + quota++; + } + + if (quota > budget) + resched_napi = true; ath10k_mac_tx_push_pending(ar); From patchwork Tue Jul 21 17:14:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11676293 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6192F6C1 for ; Tue, 21 Jul 2020 17:15:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 38F1F20717 for ; Tue, 21 Jul 2020 17:15:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OC8foV5V"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="Nm3O6HAq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38F1F20717 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=iMXqqsni4yI0BzwD4cR2PBd8aZF2oqD12uRfIPKjdY8=; b=OC8foV5VdGphoikx8qIbfw+OwZ /kJYsJzy6USirhCVojowBhq4DIRTuD92ykmcjTDWeXs9ze8nOmxvhKB7OkV1DJPox97kgOslS9clC E18oQSf2wp/j0/ZfrO1fhSpQL4ebVb6D/XubXVzeh4MJXl2ENE+NxDyh8WL5xQI0+4ehEfL6n6Dig /KCgTYhkw2K4Yl/13SgLnh2v2eYkaKy+rVtaJPPNqsrnjuMz9ALR5xGN7VhjxmDkFJ8xoiQb+aAjW TLYnxc3pWwqgWKudMgNfKuuA18SSVazzKnsXpkxt2Z7CSBiZiIdAkaWvbXeYUrqNEdz8JkWc8vrY4 NsNvXQUQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvrb-0000kO-TR; Tue, 21 Jul 2020 17:15:35 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvrY-0000XM-Al for ath10k@lists.infradead.org; Tue, 21 Jul 2020 17:15:35 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595351733; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=z+QV2LXb5rbvImIDmNfj9kPQzvqQTO89wCls0vl+oAI=; b=Nm3O6HAqXzfbJLZGmzXs5myb8n6oyu34S6nt18KTAh3KzWD/QXbK55MIy927NMTg8uT2I/tK q9jlYTtMrLJ8CH91tBA2dWrgPqbPG9M/pNA7WUobM8NErhiMT35JXKWX0anVQlncYVkq0Fbl n3FM0XrdatywOtReOOng7k7ljnY= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-west-2.postgun.com with SMTP id 5f172297eef925b694dc1562 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 21 Jul 2020 17:15:03 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0AD13C433C9; Tue, 21 Jul 2020 17:15:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id BB288C4339C; Tue, 21 Jul 2020 17:14:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BB288C4339C Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [RFC 5/7] ath10k: Handle the rx packet processing in thread Date: Tue, 21 Jul 2020 22:44:24 +0530 Message-Id: <1595351666-28193-6-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> References: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_131534_100089_A5AD31C8 X-CRM114-Status: GOOD ( 19.46 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [104.130.122.29 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [104.130.122.29 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org, Rakesh Pillai , kuba@kernel.org, johannes@sipsolutions.net, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org Add the support to handle the receive packet and the tx completion processing in a thread context if the feature has been enabled via module parameter. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/core.c | 8 ++++++ drivers/net/wireless/ath/ath10k/core.h | 4 +++ drivers/net/wireless/ath/ath10k/htt.h | 2 ++ drivers/net/wireless/ath/ath10k/htt_rx.c | 46 +++++++++++++++++++++++++++----- drivers/net/wireless/ath/ath10k/snoc.c | 12 +++++++-- 5 files changed, 64 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 2b520a0..4064fa2 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -668,6 +668,14 @@ static unsigned int ath10k_core_get_fw_feature_str(char *buf, return scnprintf(buf, buf_len, "%s", ath10k_core_fw_feature_str[feat]); } +void ath10k_core_thread_post_event(struct ath10k_thread *thread, + enum ath10k_thread_events event) +{ + set_bit(event, thread->event_flags); + wake_up(&thread->wait_q); +} +EXPORT_SYMBOL(ath10k_core_thread_post_event); + int ath10k_core_thread_shutdown(struct ath10k *ar, struct ath10k_thread *thread) { diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 59bdf11..596d31b 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -974,6 +974,8 @@ struct ath10k_bus_params { enum ath10k_thread_events { ATH10K_THREAD_EVENT_SHUTDOWN, + ATH10K_THREAD_EVENT_RX_POST, + ATH10K_THREAD_EVENT_TX_POST, ATH10K_THREAD_EVENT_MAX, }; @@ -1294,6 +1296,8 @@ static inline bool ath10k_peer_stats_enabled(struct ath10k *ar) extern unsigned long ath10k_coredump_mask; +void ath10k_core_thread_post_event(struct ath10k_thread *thread, + enum ath10k_thread_events event); int ath10k_core_thread_shutdown(struct ath10k *ar, struct ath10k_thread *thread); int ath10k_core_thread_init(struct ath10k *ar, diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index cad5949..e3cb723 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -1970,6 +1970,8 @@ struct ath10k_htt { spinlock_t lock; } rx_ring; + /* Protects access to in order indication queue */ + spinlock_t rx_in_ord_q_lock; unsigned int prefetch_len; /* Protects access to pending_tx, num_pending_tx */ diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index a4a6618..becbd56 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -796,6 +796,7 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt) timer_setup(timer, ath10k_htt_rx_ring_refill_retry, 0); spin_lock_init(&htt->rx_ring.lock); + spin_lock_init(&htt->rx_in_ord_q_lock); htt->rx_ring.fill_cnt = 0; htt->rx_ring.sw_rd_idx.msdu_payld = 0; @@ -2702,10 +2703,17 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar, */ if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) { ath10k_txrx_tx_unref(htt, &tx_done); - } else if (!kfifo_put(&htt->txdone_fifo, tx_done)) { - ath10k_warn(ar, "txdone fifo overrun, msdu_id %d status %d\n", - tx_done.msdu_id, tx_done.status); - ath10k_txrx_tx_unref(htt, &tx_done); + } else { + if (!kfifo_put(&htt->txdone_fifo, tx_done)) { + ath10k_warn(ar, "txdone fifo overrun, msdu_id %d status %d\n", + tx_done.msdu_id, tx_done.status); + ath10k_txrx_tx_unref(htt, &tx_done); + continue; + } + if (ar->rx_thread_enable) + ath10k_core_thread_post_event( + &ar->rx_thread, + ATH10K_THREAD_EVENT_TX_POST); } } @@ -3903,7 +3911,16 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) break; } case HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND: { - skb_queue_tail(&htt->rx_in_ord_compl_q, skb); + if (!ar->rx_thread_enable) { + skb_queue_tail(&htt->rx_in_ord_compl_q, skb); + } else { + spin_lock_bh(&htt->rx_in_ord_q_lock); + skb_queue_tail(&htt->rx_in_ord_compl_q, skb); + spin_unlock_bh(&htt->rx_in_ord_q_lock); + ath10k_core_thread_post_event( + &ar->rx_thread, + ATH10K_THREAD_EVENT_RX_POST); + } return false; } case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND: { @@ -4032,6 +4049,23 @@ int ath10k_htt_rx_hl_indication(struct ath10k *ar, int budget) } EXPORT_SYMBOL(ath10k_htt_rx_hl_indication); +static inline struct sk_buff * +ath10k_htt_dequeue_in_ord_q(struct ath10k_htt *htt) +{ + struct ath10k *ar = htt->ar; + struct sk_buff *skb = NULL; + + if (ar->rx_thread_enable) { + spin_lock_bh(&htt->rx_in_ord_q_lock); + skb = skb_dequeue(&htt->rx_in_ord_compl_q); + spin_unlock_bh(&htt->rx_in_ord_q_lock); + } else { + skb = skb_dequeue(&htt->rx_in_ord_compl_q); + } + + return skb; +} + int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget) { struct ath10k_htt *htt = &ar->htt; @@ -4053,7 +4087,7 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget) goto exit; } - while ((skb = skb_dequeue(&htt->rx_in_ord_compl_q))) { + while ((skb = ath10k_htt_dequeue_in_ord_q(htt))) { spin_lock_bh(&htt->rx_ring.lock); ret = ath10k_htt_rx_in_ord_ind(ar, skb); spin_unlock_bh(&htt->rx_ring.lock); diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index f01725b..3eb5eac 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -920,6 +920,7 @@ int ath10k_snoc_rx_thread_loop(void *data) struct ath10k_thread *rx_thread = data; struct ath10k *ar = rx_thread->ar; bool shutdown = false; + u32 thread_budget = 8192; ath10k_dbg(ar, ATH10K_DBG_SNOC, "rx thread started\n"); set_user_nice(current, -1); @@ -927,8 +928,14 @@ int ath10k_snoc_rx_thread_loop(void *data) while (!shutdown) { wait_event_interruptible( rx_thread->wait_q, - (test_bit(ATH10K_THREAD_EVENT_SHUTDOWN, + (test_and_clear_bit(ATH10K_THREAD_EVENT_RX_POST, + rx_thread->event_flags) || + test_and_clear_bit(ATH10K_THREAD_EVENT_TX_POST, + rx_thread->event_flags) || + test_bit(ATH10K_THREAD_EVENT_SHUTDOWN, rx_thread->event_flags))); + + ath10k_htt_txrx_compl_task(ar, thread_budget); if (test_and_clear_bit(ATH10K_THREAD_EVENT_SHUTDOWN, rx_thread->event_flags)) shutdown = true; @@ -1235,7 +1242,8 @@ static int ath10k_snoc_napi_poll(struct napi_struct *ctx, int budget) ath10k_ce_enable_interrupt(ar, ce_id); } - done = ath10k_htt_txrx_compl_task(ar, budget); + if (!ar->rx_thread_enable) + done = ath10k_htt_txrx_compl_task(ar, budget); if (done < budget) napi_complete(ctx); From patchwork Tue Jul 21 17:14:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11676297 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2287813A4 for ; Tue, 21 Jul 2020 17:16:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0D8D2065D for ; Tue, 21 Jul 2020 17:16:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ykA6JSil"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="K8mc4KKT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0D8D2065D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=OhKm4p1+URJZ2rlpfPCOpjqHdlI8NQ6nsM8TM0FQ+xg=; b=ykA6JSilPtV4hNvgifooPHVAUf jNoGO6hiWYJCyHvfhog/UG+H9Nqtmktr81t/XlC1TgAiHWnQO2Jk5zQ9hXCnaVaMSG4IGQIV01My4 NZgvrK66qxRAIIrC6AYwt4X/PQVvvJ5A+SS2WUSZ5pZq+pDQP1lF6pcwfNUaYiJPrs6VpTJNTf2t0 YcROuMLVpE3p++q6m5vKKzh0RY4nSYH1ItKAfX7l8zXatIEPP7lDajRAt+0dW7l+pTiqpWuH2vs4h H4rj4N1M6wj/sqrJiTb7u6hDyq6I7IfPfabUuHI4vz60t/en57VegTaoEo9o6WmD6AgtJKxvU5zUa kVWFiwCg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvrk-0000o8-Gx; Tue, 21 Jul 2020 17:15:44 +0000 Received: from m43-7.mailgun.net ([69.72.43.7]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvrX-0000Ux-Fj for ath10k@lists.infradead.org; Tue, 21 Jul 2020 17:15:41 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595351740; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=PuxwKGt35tpiRMfDgkpJSCtxDJb7QR6bGP5l0QXwvfc=; b=K8mc4KKT7Wy2x6MsT9+SISQp/urcxxoPcpz6vpSphTZndTaaTTlyTJl0zB9LnEGl+hZGk0Tf MsbkRp2fRPa08RCyPyboZ0deXYofF4eeXOasTLeRJu+XubiytQBtby/MefZIPMd4LjEnQ3lI MoA6cC8f8fNOfuk2iCrq8bZRdFM= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n16.prod.us-west-2.postgun.com with SMTP id 5f17229bd50c36e7292c1307 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 21 Jul 2020 17:15:07 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 52ECBC433C6; Tue, 21 Jul 2020 17:15:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id 71AECC433CA; Tue, 21 Jul 2020 17:15:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 71AECC433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [RFC 6/7] ath10k: Add deliver to stack from thread context Date: Tue, 21 Jul 2020 22:44:25 +0530 Message-Id: <1595351666-28193-7-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> References: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_131540_768122_DC115E41 X-CRM114-Status: GOOD ( 11.55 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [69.72.43.7 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [69.72.43.7 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org, Rakesh Pillai , kuba@kernel.org, johannes@sipsolutions.net, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org When the receive packets are submitted to the stack from a thread context, the NAPI handle should be passed as NULL to the function ieee80211_rx_napi. This will make sure that the packets are submitted to stack via non-napi method Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/htt_rx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index becbd56..85c169c 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -1321,7 +1321,10 @@ static void ath10k_process_rx(struct ath10k *ar, struct sk_buff *skb) trace_ath10k_rx_hdr(ar, skb->data, skb->len); trace_ath10k_rx_payload(ar, skb->data, skb->len); - ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi); + if (in_serving_softirq()) + ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi); + else + ieee80211_rx_napi(ar->hw, NULL, skb, NULL); } static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar, From patchwork Tue Jul 21 17:14:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11676287 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF0D36C1 for ; Tue, 21 Jul 2020 17:15:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5343206E9 for ; Tue, 21 Jul 2020 17:15:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qheHpHEM"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="cGar04Da" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5343206E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=HnlITiAWdea1zbM+P0sqd0vaX+sAmO8m081H83dREhQ=; b=qheHpHEMCUv5eN8w0yd/fhx4Qc +ac0zk9buRAhba6pLpbqUZf5dzRO87EBpubI0kUh6CBPOnCW+zh/SWJNavD12RiqmJBLEc1frm3bQ tdU8aEIPbfGhKlEf0QI9f/gye7444+iswkGjuILgHLiKX4vnXQbhcigDxynPPBVdtFJU0mvQ+JFMO Nw1thnsgzSXqfmkdX2dxIz5MF7TxY/YuQfywKUhwhBux683MFB0ZBj6IoXwK2ApuwSglWtzbfgDka X45qCwoFW1md0LGZ15dhjeGSu8XF41DaWypHjOfwU8AljizILHT/23HOIUuoma3pZ3v+zddy10R+s g6cyGs9Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvrQ-0000fQ-Ez; Tue, 21 Jul 2020 17:15:24 +0000 Received: from m43-7.mailgun.net ([69.72.43.7]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvrH-0000Ux-VG for ath10k@lists.infradead.org; Tue, 21 Jul 2020 17:15:21 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595351720; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=gBDtbC3k7fmgMEBji3WDa1vS2HhVYXF0ZlougiQfyKI=; b=cGar04DazMg9qeJllWPJUh3ObIfxlJIfVgB83cpZOfC9EWw+GNtUzDZtzxNw2FEBGO7f8wSy jV3riTbVpQ9r3TZSJQrk5Sv8x7x3y4wgfdr6IfSQiy6ajBMzJGehMYx2gGj3FuGjt/pnvh9j YjDz1t2fzv+v3dR5644E/DgojY0= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 5f1722a0427cd55766853894 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 21 Jul 2020 17:15:12 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id D53F5C433CB; Tue, 21 Jul 2020 17:15:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7D497C433A1; Tue, 21 Jul 2020 17:15:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7D497C433A1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [RFC 7/7] ath10k: Handle rx thread suspend and resume Date: Tue, 21 Jul 2020 22:44:26 +0530 Message-Id: <1595351666-28193-8-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> References: <1595351666-28193-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_131520_639444_62E0B5BD X-CRM114-Status: GOOD ( 16.44 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [69.72.43.7 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [69.72.43.7 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org, Rakesh Pillai , kuba@kernel.org, johannes@sipsolutions.net, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org During the system suspend or resume, the rx thread also needs to be suspended or resume respectively. Handle the rx thread as well during the system suspend and resume. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/core.c | 23 ++++++++++++++++++ drivers/net/wireless/ath/ath10k/core.h | 5 ++++ drivers/net/wireless/ath/ath10k/snoc.c | 44 +++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 4064fa2..b82b355 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -668,6 +668,27 @@ static unsigned int ath10k_core_get_fw_feature_str(char *buf, return scnprintf(buf, buf_len, "%s", ath10k_core_fw_feature_str[feat]); } +int ath10k_core_thread_suspend(struct ath10k_thread *thread) +{ + ath10k_dbg(thread->ar, ATH10K_DBG_BOOT, "Suspending thread %s\n", + thread->name); + set_bit(ATH10K_THREAD_EVENT_SUSPEND, thread->event_flags); + wait_for_completion(&thread->suspend); + + return 0; +} +EXPORT_SYMBOL(ath10k_core_thread_suspend); + +int ath10k_core_thread_resume(struct ath10k_thread *thread) +{ + ath10k_dbg(thread->ar, ATH10K_DBG_BOOT, "Resuming thread %s\n", + thread->name); + complete(&thread->resume); + + return 0; +} +EXPORT_SYMBOL(ath10k_core_thread_resume); + void ath10k_core_thread_post_event(struct ath10k_thread *thread, enum ath10k_thread_events event) { @@ -700,6 +721,8 @@ int ath10k_core_thread_init(struct ath10k *ar, init_waitqueue_head(&thread->wait_q); init_completion(&thread->shutdown); + init_completion(&thread->suspend); + init_completion(&thread->resume); memcpy(thread->name, thread_name, ATH10K_THREAD_NAME_SIZE_MAX); clear_bit(ATH10K_THREAD_EVENT_SHUTDOWN, thread->event_flags); ath10k_info(ar, "Starting thread %s\n", thread_name); diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 596d31b..df65e75 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -976,6 +976,7 @@ enum ath10k_thread_events { ATH10K_THREAD_EVENT_SHUTDOWN, ATH10K_THREAD_EVENT_RX_POST, ATH10K_THREAD_EVENT_TX_POST, + ATH10K_THREAD_EVENT_SUSPEND, ATH10K_THREAD_EVENT_MAX, }; @@ -983,6 +984,8 @@ struct ath10k_thread { struct ath10k *ar; struct task_struct *task; struct completion shutdown; + struct completion suspend; + struct completion resume; wait_queue_head_t wait_q; DECLARE_BITMAP(event_flags, ATH10K_THREAD_EVENT_MAX); char name[ATH10K_THREAD_NAME_SIZE_MAX]; @@ -1296,6 +1299,8 @@ static inline bool ath10k_peer_stats_enabled(struct ath10k *ar) extern unsigned long ath10k_coredump_mask; +int ath10k_core_thread_suspend(struct ath10k_thread *thread); +int ath10k_core_thread_resume(struct ath10k_thread *thread); void ath10k_core_thread_post_event(struct ath10k_thread *thread, enum ath10k_thread_events event); int ath10k_core_thread_shutdown(struct ath10k *ar, diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 3eb5eac..a373b2b 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -932,13 +932,31 @@ int ath10k_snoc_rx_thread_loop(void *data) rx_thread->event_flags) || test_and_clear_bit(ATH10K_THREAD_EVENT_TX_POST, rx_thread->event_flags) || + test_bit(ATH10K_THREAD_EVENT_SUSPEND, + rx_thread->event_flags) || test_bit(ATH10K_THREAD_EVENT_SHUTDOWN, rx_thread->event_flags))); + if (test_and_clear_bit(ATH10K_THREAD_EVENT_SUSPEND, + rx_thread->event_flags)) { + complete(&rx_thread->suspend); + ath10k_info(ar, "rx thread suspend\n"); + wait_for_completion(&rx_thread->resume); + ath10k_info(ar, "rx thread resume\n"); + } + ath10k_htt_txrx_compl_task(ar, thread_budget); if (test_and_clear_bit(ATH10K_THREAD_EVENT_SHUTDOWN, rx_thread->event_flags)) shutdown = true; + + if (test_and_clear_bit(ATH10K_THREAD_EVENT_SUSPEND, + rx_thread->event_flags)) { + complete(&rx_thread->suspend); + ath10k_info(ar, "rx thread suspend\n"); + wait_for_completion(&rx_thread->resume); + ath10k_info(ar, "rx thread resume\n"); + } } ath10k_dbg(ar, ATH10K_DBG_SNOC, "rx thread exiting\n"); @@ -1133,15 +1151,30 @@ static int ath10k_snoc_hif_suspend(struct ath10k *ar) if (!device_may_wakeup(ar->dev)) return -EPERM; + if (ar->rx_thread_enable) { + ret = ath10k_core_thread_suspend(&ar->rx_thread); + if (ret) { + ath10k_err(ar, "failed to suspend rx_thread, %d\n", + ret); + return ret; + } + } + ret = enable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line); if (ret) { ath10k_err(ar, "failed to enable wakeup irq :%d\n", ret); - return ret; + goto fail; } ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device suspended\n"); return ret; + +fail: + if (ar->rx_thread_enable) + ath10k_core_thread_resume(&ar->rx_thread); + + return ret; } static int ath10k_snoc_hif_resume(struct ath10k *ar) @@ -1158,6 +1191,15 @@ static int ath10k_snoc_hif_resume(struct ath10k *ar) return ret; } + if (ar->rx_thread_enable) { + ret = ath10k_core_thread_resume(&ar->rx_thread); + if (ret) { + ath10k_err(ar, "failed to suspend rx_thread, %d\n", + ret); + return ret; + } + } + ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device resumed\n"); return ret;