Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3782640ybl; Mon, 27 Jan 2020 10:18:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwyKGWjWXt6po1rqtqVQwpg5GtucMXI1UF4xbMi8vY0nBxA5FbRQwDajDzwrMOrVhzB1h6R X-Received: by 2002:aca:4fc2:: with SMTP id d185mr237835oib.33.1580149116066; Mon, 27 Jan 2020 10:18:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580149116; cv=none; d=google.com; s=arc-20160816; b=a7dKXC248gtrHH+U+27CKcUL+x2r6pqlcIw//FH/WU2pKPJVNNRhXRqZqyEHi7k+s3 5MVfStccHJuMwXcGqGP175TCy2xBO2Q4nKX6MpIgfXt5bvIPhHwnoBbK6Isi2yqekKH2 CEwRCWY1yNn229CPUVya6MCRfWqAYDHN8se4uh2WJ5MhNmsITlEE3Dkgvs4ZPxvn7nf+ l9l0Gboq5OPfq9WrqLKjaWD9d+rd6G9jbGqy+bdeuzXeaeBVetURdgWm5PqVoGKyauHE DkIDrGhB0r2kzUAIka5fNxGZgAJH7l66HINr2XTo4L4wlE3B0NZwp/NEpLWKGCy/E7lW XqfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JbYyoO3rivGUAtL9BlROcTesawaWNKeIr03/mn5nGnI=; b=qyXIL3xIqXCrDzHKmMeW/wJsTtf6QcdZguE01duouCVTbwP3cousyJQLJK0+51w0Dz TB786X/68JoKtkPjWYLDp/p8LPkxCCA1rBI1ZzHNfRjPU3WbRuGas6ABb6EDmbbNeGy9 9n0RA6GP/27b2bHluAf+NW1QI9E05beB9uiWIzCGrW6nf9ItQnkwESJBL4lqP7hrrt7R As8TaGK9zwruqjq06bpAuWKEq9XVIDIWHDI0uOtM2tlBIhMorKMNTp5UB37xBPFppzN9 28c36tjyk7pm0HOkNo+f0ZJ4leXJrOuQLHkphPvKV+hAkKUcyETVDyJ4WRAIQSPgXPpk WCRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=iwT7BlFo; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z16si7435960otk.80.2020.01.27.10.18.25; Mon, 27 Jan 2020 10:18:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=iwT7BlFo; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727166AbgA0SSB (ORCPT + 99 others); Mon, 27 Jan 2020 13:18:01 -0500 Received: from nbd.name ([46.4.11.11]:48210 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727046AbgA0SR5 (ORCPT ); Mon, 27 Jan 2020 13:17:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JbYyoO3rivGUAtL9BlROcTesawaWNKeIr03/mn5nGnI=; b=iwT7BlFojv5pJkV66zhNM+ExDJ TuZIkNAi5Z3M4QjsT3WWTzdWrL6lvc53VB3H/EEMHwI9jyogZ/6HWfoDU3L5/Vtz/XsmxGKB+wxHZ JVoY/bWEFXTV8+9Ie8IJyZmgA1Kg4WOGapsXaGWyGlAK/Sa5HofSLgOUHFs5wC5XteCY=; Received: from [178.162.209.132] (helo=maeck.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iw8xP-0007dd-KD for linux-wireless@vger.kernel.org; Mon, 27 Jan 2020 19:17:55 +0100 Received: by maeck.local (Postfix, from userid 501) id 20C017A566E5; Mon, 27 Jan 2020 19:17:54 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 3/5] mt76: dma: do not write cpu_idx on rx queue reset until after refill Date: Mon, 27 Jan 2020 19:17:52 +0100 Message-Id: <20200127181754.2810-3-nbd@nbd.name> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200127181754.2810-1-nbd@nbd.name> References: <20200127181754.2810-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The hardware should only start processing the ring after at least one buffer has been added Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/dma.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index bcb11bb9aeeb..e5dd7080e88e 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -132,6 +132,11 @@ mt76_dma_sync_idx(struct mt76_dev *dev, struct mt76_queue *q) writel(q->ndesc, &q->regs->ring_size); q->head = readl(&q->regs->dma_idx); q->tail = q->head; +} + +static void +mt76_dma_kick_queue(struct mt76_dev *dev, struct mt76_queue *q) +{ writel(q->head, &q->regs->cpu_idx); } @@ -193,8 +198,10 @@ mt76_dma_tx_cleanup(struct mt76_dev *dev, enum mt76_txq_id qid, bool flush) dev->q_tx[__MT_TXQ_MAX + i].swq_queued -= n_swq_queued[4 + i]; } - if (flush) + if (flush) { mt76_dma_sync_idx(dev, q); + mt76_dma_kick_queue(dev, q); + } wake = wake && q->stopped && qid < IEEE80211_NUM_ACS && q->queued < q->ndesc - 8; @@ -257,12 +264,6 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush, return mt76_dma_get_buf(dev, q, idx, len, info, more); } -static void -mt76_dma_kick_queue(struct mt76_dev *dev, struct mt76_queue *q) -{ - writel(q->head, &q->regs->cpu_idx); -} - static int mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, enum mt76_txq_id qid, struct sk_buff *skb, u32 tx_info) -- 2.24.0