From patchwork Wed Jan 24 15:19:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 10182707 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D11336037F for ; Wed, 24 Jan 2018 15:19:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1385285C5 for ; Wed, 24 Jan 2018 15:19:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B64A5288D0; Wed, 24 Jan 2018 15:19: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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 6AC26285C5 for ; Wed, 24 Jan 2018 15:19:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934178AbeAXPTW (ORCPT ); Wed, 24 Jan 2018 10:19:22 -0500 Received: from nbd.name ([46.4.11.11]:48644 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934010AbeAXPTU (ORCPT ); Wed, 24 Jan 2018 10:19:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uTa0uYBj6aqCQjfYY3uc61rLOvOUZusJrJRGzJOoS9Q=; b=MZKqyBHZ51rBKLzbOJnYRbX+uB ehaA5dX2W4l5GOjfDYuNl6odWbrqvxK2wkuoQK/8E8762iNmBUULk3iNRJxfBW6uyJuwLJmd9XQHu V6GwYHwnjbH4KoiBD3SVkEcD4xxb9nMHUPaiEFDoPKfCCvmwHiNqNeRv+WYgGmh7O8IU=; Received: by maeck.local (Postfix, from userid 501) id 49484E3D141; Wed, 24 Jan 2018 16:19:17 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: kvalo@codeaurora.org Subject: [PATCH 1/8] mt76: retry rx polling as long as there is budget left Date: Wed, 24 Jan 2018 16:19:10 +0100 Message-Id: <20180124151917.70962-1-nbd@nbd.name> X-Mailer: git-send-email 2.14.2 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 Sending frames to mac80211 needs time, which could allow for more rx packets to end up in the DMA ring. Retry polling until there are no more frames left. Improves rx latency under load. Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/dma.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index ecd409a4a89b..e539b3838b94 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -387,17 +387,21 @@ static int mt76_dma_rx_poll(struct napi_struct *napi, int budget) { struct mt76_dev *dev; - int qid, done; + int qid, done = 0, cur; dev = container_of(napi->dev, struct mt76_dev, napi_dev); qid = napi - dev->napi; - done = mt76_dma_rx_process(dev, &dev->q_rx[qid], budget); + do { + cur = mt76_dma_rx_process(dev, &dev->q_rx[qid], budget - done); + mt76_rx_complete(dev, qid); + done += cur; + } while (cur && done < budget); + if (done < budget) { napi_complete(napi); dev->drv->rx_poll_complete(dev, qid); } - mt76_rx_complete(dev, qid); return done; }