From patchwork Tue Mar 12 15:05:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 10849351 X-Patchwork-Delegate: nbd@nbd.name 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 F35D71390 for ; Tue, 12 Mar 2019 15:06:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEB66295C4 for ; Tue, 12 Mar 2019 15:06:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D33ED2960F; Tue, 12 Mar 2019 15:06:25 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EDB6295C4 for ; Tue, 12 Mar 2019 15:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726910AbfCLPGZ (ORCPT ); Tue, 12 Mar 2019 11:06:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35678 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726556AbfCLPGY (ORCPT ); Tue, 12 Mar 2019 11:06:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8D43307CB3B; Tue, 12 Mar 2019 15:06:24 +0000 (UTC) Received: from localhost (unknown [10.43.2.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8252127C46; Tue, 12 Mar 2019 15:06:21 +0000 (UTC) From: Stanislaw Gruszka To: linux-wireless@vger.kernel.org Cc: Felix Fietkau , Lorenzo Bianconi , Stanislaw Gruszka Subject: [RFC 02/12] mt76: remove rx_page_lock Date: Tue, 12 Mar 2019 16:05:56 +0100 Message-Id: <1552403166-3821-3-git-send-email-sgruszka@redhat.com> In-Reply-To: <1552403166-3821-1-git-send-email-sgruszka@redhat.com> References: <1552403166-3821-1-git-send-email-sgruszka@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 12 Mar 2019 15:06:24 +0000 (UTC) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We can not run mt76u_alloc_buf() concurently, rx_tasklet is stooped when mt76u_submit_rx_buffers(). We can remove rx_page_lock. Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 - drivers/net/wireless/mediatek/mt76/usb.c | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 3d3f0a5fc426..424f9090680d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -132,7 +132,6 @@ struct mt76_queue { dma_addr_t desc_dma; struct sk_buff *rx_head; struct page_frag_cache rx_page; - spinlock_t rx_page_lock; }; struct mt76_sw_queue { diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index 661a65cb9c35..883e8a2b519f 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -292,7 +292,6 @@ static bool mt76u_check_sg(struct mt76_dev *dev) struct urb *urb = buf->urb; int i; - spin_lock_bh(&q->rx_page_lock); for (i = 0; i < nsgs; i++) { struct page *page; void *data; @@ -306,7 +305,6 @@ static bool mt76u_check_sg(struct mt76_dev *dev) offset = data - page_address(page); sg_set_page(&urb->sg[i], page, sglen, offset); } - spin_unlock_bh(&q->rx_page_lock); if (i < nsgs) { int j; @@ -569,7 +567,6 @@ static int mt76u_alloc_rx(struct mt76_dev *dev) if (!usb->mcu.data) return -ENOMEM; - spin_lock_init(&q->rx_page_lock); spin_lock_init(&q->lock); q->entry = devm_kcalloc(dev->dev, MT_NUM_RX_ENTRIES, sizeof(*q->entry), @@ -597,15 +594,12 @@ static void mt76u_free_rx(struct mt76_dev *dev) for (i = 0; i < q->ndesc; i++) mt76u_buf_free(&q->entry[i].ubuf); - spin_lock_bh(&q->rx_page_lock); if (!q->rx_page.va) - goto out; + return; page = virt_to_page(q->rx_page.va); __page_frag_cache_drain(page, q->rx_page.pagecnt_bias); memset(&q->rx_page, 0, sizeof(q->rx_page)); -out: - spin_unlock_bh(&q->rx_page_lock); } static void mt76u_stop_rx(struct mt76_dev *dev)