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,