From patchwork Mon Nov 18 12:12:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 11249691 X-Patchwork-Delegate: kvalo@adurom.com 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 CE76E913 for ; Mon, 18 Nov 2019 12:12:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A5028206D4 for ; Mon, 18 Nov 2019 12:12:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Fz+e07JM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5028206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org 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: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:In-Reply-To:References: List-Owner; bh=bsBZuw0lTsyrUcYJKKbH3npVq5bPGUSdI3imeA/c50E=; b=Fz+e07JMbrxL/n a1vxvRV1CSPLWV73+BOHIGpYKEXht20cnRWusjmwsVlCiL8vbyYgvMNG4T4Q0nSQMJgy0uh87sFJJ EyPap8+r8VjeGTf4RdTIR8ut+6ZqiOo38VlpJzGsE84Zm1Oi9DFEH2FOwE+BPuyhTQTRCMbm7sj3b UoAhhJnzmHi4yyQ/aj6fQ3Vb15mAW2xnk+FEcJ2L6kGJ9TC9PEwFCHenYyPGhxWqKP6GLcYTOY3Gd o+jRFQv+rVZc7/ppl1/g3RWGB8Jf7EqAwplGI+UVMXkiW+77ri4MliuKwbpKVKaz6gnnNQQJKZq3d DMTqYTp2YMHnhwUfdquA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iWftU-0002HJ-FR; Mon, 18 Nov 2019 12:12:36 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iWftR-0002GU-Q2 for ath11k@lists.infradead.org; Mon, 18 Nov 2019 12:12:35 +0000 Received: from p5dcfbb96.dip0.t-ipconnect.de ([93.207.187.150] helo=bertha.datto.lan) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1iWftP-0001dJ-AX; Mon, 18 Nov 2019 13:12:31 +0100 From: John Crispin To: Kalle Valo Subject: [PATCH 1/3] ath11k: remove superflous memset Date: Mon, 18 Nov 2019 13:12:22 +0100 Message-Id: <20191118121224.26351-1-john@phrozen.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191118_041234_012556_5E68FB30 X-CRM114-Status: UNSURE ( 7.55 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ath11k@lists.infradead.org, John Crispin Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org We set all values inside the struct making the memset pointless. Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/dp_tx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c index 670e253476a3..2d6255888cfb 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -463,7 +463,6 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id) spin_lock_bh(&tx_ring->tx_status_lock); while (kfifo_get(&tx_ring->tx_status_fifo, &tx_status)) { - memset(&ts, 0, sizeof(ts)); ath11k_hal_tx_status_parse(ab, &tx_status, &ts); mac_id = FIELD_GET(DP_TX_DESC_ID_MAC_ID, ts.desc_id); From patchwork Mon Nov 18 12:12:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 11249693 X-Patchwork-Delegate: kvalo@adurom.com 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 748A8184E for ; Mon, 18 Nov 2019 12:12:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 5256C206D4 for ; Mon, 18 Nov 2019 12:12:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dbRvBW//" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5256C206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org 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=4weqEzeAcbbkh1F7nojiN5FydarFJ1fE0ZU2i14Gtjo=; b=dbRvBW//H2MHw3 BsNhMocmLYt9toyg7GQlVYy2is2uWKJ1xu1LYHrJAaNujgyujXi2FLtkGku7sKrcjRCWopMDZihs0 FJOxT2y2Vaw+zYhvF899npaY9b73zU+uBv1kHh0hWhwwKjbXj1cfLVpToSvdHVEP23jTsdIXIljS8 0mUtkkKJ1RamQH1T9zmtaI+/figOwE7TNOcUvP80yJZttS3MiINkP0Is0Tu3u4BpOLNxDNEv4km3c 4CpI2Q/m3yHyrxxUszRWrrlyvZ5cGhX+psNCMaPKzbkFQZB7chyaMHekRBeD7vrT/JrZGQvtoqAzj Fhgyg02pGLf3Jqosqdeg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iWftU-0002Hf-Nv; Mon, 18 Nov 2019 12:12:36 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iWftS-0002GV-0u for ath11k@lists.infradead.org; Mon, 18 Nov 2019 12:12:35 +0000 Received: from p5dcfbb96.dip0.t-ipconnect.de ([93.207.187.150] helo=bertha.datto.lan) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1iWftP-0001dJ-R8; Mon, 18 Nov 2019 13:12:32 +0100 From: John Crispin To: Kalle Valo Subject: [PATCH 2/3] ath11k: remove superflous locking Date: Mon, 18 Nov 2019 13:12:23 +0100 Message-Id: <20191118121224.26351-2-john@phrozen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191118121224.26351-1-john@phrozen.org> References: <20191118121224.26351-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191118_041234_222788_580DB875 X-CRM114-Status: UNSURE ( 8.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ath11k@lists.infradead.org, John Crispin Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org The access to the fifo happens inside a napi context, which is an atomic operation. Locking is therefore not required. Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/dp.c | 4 ---- drivers/net/wireless/ath/ath11k/dp.h | 4 ---- drivers/net/wireless/ath/ath11k/dp_tx.c | 8 -------- 3 files changed, 16 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c index 72c21cf6a352..d62115e9b41b 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -822,10 +822,7 @@ void ath11k_dp_free(struct ath11k_base *ab) ath11k_dp_tx_pending_cleanup, ab); idr_destroy(&dp->tx_ring[i].txbuf_idr); spin_unlock_bh(&dp->tx_ring[i].tx_idr_lock); - - spin_lock_bh(&dp->tx_ring[i].tx_status_lock); kfifo_free(&dp->tx_ring[i].tx_status_fifo); - spin_unlock_bh(&dp->tx_ring[i].tx_status_lock); } /* Deinit any SOC level resource */ @@ -872,7 +869,6 @@ int ath11k_dp_alloc(struct ath11k_base *ab) spin_lock_init(&dp->tx_ring[i].tx_idr_lock); dp->tx_ring[i].tcl_data_ring_id = i; - spin_lock_init(&dp->tx_ring[i].tx_status_lock); ret = kfifo_alloc(&dp->tx_ring[i].tx_status_fifo, size, GFP_KERNEL); if (ret) diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/ath/ath11k/dp.h index db216f055c42..5f98c5a49791 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -66,10 +66,6 @@ struct dp_tx_ring { /* Protects txbuf_idr and num_pending */ spinlock_t tx_idr_lock; DECLARE_KFIFO_PTR(tx_status_fifo, struct hal_wbm_release_ring); - /* lock to protect tx_status_fifo because tx_status_fifo can be - * accessed concurrently. - */ - spinlock_t tx_status_lock; }; struct ath11k_pdev_mon_stats { diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c index 2d6255888cfb..8005ad60fda1 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -445,7 +445,6 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id) ath11k_hal_srng_access_begin(ab, status_ring); - spin_lock_bh(&tx_ring->tx_status_lock); while (!kfifo_is_full(&tx_ring->tx_status_fifo) && (desc = ath11k_hal_srng_dst_get_next_entry(ab, status_ring))) kfifo_in(&tx_ring->tx_status_fifo, (void *)desc, sizeof(struct hal_wbm_release_ring)); @@ -456,12 +455,9 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id) ath11k_warn(ab, "Unable to process some of the tx_status ring desc because status_fifo is full\n"); } - spin_unlock_bh(&tx_ring->tx_status_lock); - ath11k_hal_srng_access_end(ab, status_ring); spin_unlock_bh(&status_ring->lock); - spin_lock_bh(&tx_ring->tx_status_lock); while (kfifo_get(&tx_ring->tx_status_fifo, &tx_status)) { ath11k_hal_tx_status_parse(ab, &tx_status, &ts); @@ -492,12 +488,8 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id) if (atomic_dec_and_test(&ar->dp.num_tx_pending)) wake_up(&ar->dp.tx_empty_waitq); - /* TODO: Locking optimization so that tx_completion for an msdu - * is not called with tx_status_lock acquired - */ ath11k_dp_tx_complete_msdu(ar, msdu, &ts); } - spin_unlock_bh(&tx_ring->tx_status_lock); } int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx_tid, From patchwork Mon Nov 18 12:12:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 11249695 X-Patchwork-Delegate: kvalo@adurom.com 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 06CEB913 for ; Mon, 18 Nov 2019 12:12:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D9803206D4 for ; Mon, 18 Nov 2019 12:12:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="T+83UDiy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9803206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org 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=mafY3n1RXILv87arpxMbahvuvWD8f0nnL5447ZgaFJY=; b=T+83UDiy/2W2aS 7u1dNZ9RVxiCVAxEkAIjclGN6qEqSXEnCUlhBHGf23AAmTio5owSJMGXaVMQnXeGJYyShhaqlVzLf Y+Rv2XPal/1hvypIjQ6ATsIUSkKn7b/O3HaBRf6ugj2zLXuMdCHU0Q31Jrau0te1Iyv2g4pAGye6c +bZLqO3e9cCexkbZJxBYdpui5Oa9wMEwT9Txy6cUecoL6vKO3rnbnbrz5plZJXKa9xfrMvHtQODP6 ugGoa8BEGLU8l8zgfeG+Mz/vtW4dLQLyiC8IQaBDnx8b9IUac2tZSYcK6//CYy70UNlQVLof2aAmY JnWLsTb6QQ1Xria2eClw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iWftW-0002J3-6b; Mon, 18 Nov 2019 12:12:38 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iWftS-0002GW-DQ for ath11k@lists.infradead.org; Mon, 18 Nov 2019 12:12:36 +0000 Received: from p5dcfbb96.dip0.t-ipconnect.de ([93.207.187.150] helo=bertha.datto.lan) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1iWftQ-0001dJ-Fa; Mon, 18 Nov 2019 13:12:32 +0100 From: John Crispin To: Kalle Valo Subject: [PATCH 3/3] ath11k: drop memset when setting up a tx cmd desc Date: Mon, 18 Nov 2019 13:12:24 +0100 Message-Id: <20191118121224.26351-3-john@phrozen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191118121224.26351-1-john@phrozen.org> References: <20191118121224.26351-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191118_041234_608155_0C747946 X-CRM114-Status: GOOD ( 11.00 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ath11k@lists.infradead.org, John Crispin Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org There is no point in zero'ing out the structure if we set all values in the following line. Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/dp_tx.c | 2 -- drivers/net/wireless/ath/ath11k/hal_tx.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c index 8005ad60fda1..18ede21f3cbc 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -167,8 +167,6 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif, skb_cb->vif = arvif->vif; skb_cb->ar = ar; - memset(cached_desc, 0, HAL_TCL_DESC_LEN); - ath11k_hal_tx_cmd_desc_setup(ab, cached_desc, &ti); hal_ring_id = tx_ring->tcl_data_ring.ring_id; diff --git a/drivers/net/wireless/ath/ath11k/hal_tx.c b/drivers/net/wireless/ath/ath11k/hal_tx.c index b1aa716610b9..3813edaadd40 100644 --- a/drivers/net/wireless/ath/ath11k/hal_tx.c +++ b/drivers/net/wireless/ath/ath11k/hal_tx.c @@ -71,6 +71,7 @@ void ath11k_hal_tx_cmd_desc_setup(struct ath11k_base *ab, void *cmd, ti->dscp_tid_tbl_idx) | FIELD_PREP(HAL_TCL_DATA_CMD_INFO3_SEARCH_INDEX, ti->bss_ast_hash); + tcl_cmd->info4 = 0; } /* Commit the descriptor to hardware */