Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp485475ybg; Sat, 26 Oct 2019 01:53:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/GvmdZIsrOjFNsQ7/ZRWGrRO0p4/m6twGGw/gmyexv/Uxbx7bOPtaABnufIxif1DwQPt4 X-Received: by 2002:a17:906:4d4f:: with SMTP id b15mr7158340ejv.81.1572079998218; Sat, 26 Oct 2019 01:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572079998; cv=none; d=google.com; s=arc-20160816; b=CFrmBsTf6O2Lnc2ldVjaZ3D4NoGMlqednja71somdDhWZVr06vafPBHCQuOalfbT7K siwJTnlgRrN8oMM4ZKb10nWZ+NMWr3gqUerkY+lYP2aGjiAsxiOsWebKGByG1g9RNaX0 raOQObFr19cha8PmjYFyrRcKRqrq56uptTXFXBWgstmVz6XpwjQ4KqDKAxIWOtO6wbKd +ZyR/2Eprc5XwU0mVkAeUXUP3IGPzQdx8aaIQ0QWzbLIybI6WdYj0wID1EiJ/A/ky4hm BItzjcAehQ9HzkNKgDGJciVY2X+AFcDnFGubaHez54JgHKEDDZMnblGJ89tWJ30OOsRn cMfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=5EvKnnJZKgLGs/RC6AakCYv22wuMW6SF5PEa4Q6xGSQ=; b=lWYRZrdfGgqyXwaFs5RDtwxvGgjok4u+x9b8iDkEr4EECz4AF2oezCLlXB5uf+Cwiw 3DEXg4Ig9Uv3YixVdRmsGdov00zSHXh0Vin9iB83Ivl+skPDUCrB7dpFwjLwxFYChlDA zis4mxpxLTHE9rpP5C0IX477N4hZ7z7TR/Y+8CteMzGVyxaOMWd8+v+vG9l3HdHd4OUe ieBzMJf6wI+dGuLm2t8JI/lWMB2Mvc0NvUYcKoTajN4Q0RRQnYv8WCnH/13Nkhb1fWQ5 WMg1BmXstJdcYlnkLEnwccPNPV+AC7V5VSj5ff39WeXWqN06C7gaX2uHPrbzrOxz/uQ/ 25cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 h21si3177107edb.20.2019.10.26.01.52.24; Sat, 26 Oct 2019 01:53:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726139AbfJZIt6 (ORCPT + 99 others); Sat, 26 Oct 2019 04:49:58 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:54492 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726057AbfJZIt6 (ORCPT ); Sat, 26 Oct 2019 04:49:58 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2D1B4FC900DF94AB1320; Sat, 26 Oct 2019 16:49:54 +0800 (CST) Received: from huawei.com (10.67.189.167) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Sat, 26 Oct 2019 16:49:46 +0800 From: Jiangfeng Xiao To: , , , CC: , , , , , , Subject: [PATCH] net: hisilicon: Fix ping latency when deal with high throughput Date: Sat, 26 Oct 2019 16:49:39 +0800 Message-ID: <1572079779-76449-1-git-send-email-xiaojiangfeng@huawei.com> X-Mailer: git-send-email 1.8.5.6 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.189.167] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is due to error in over budget processing. When dealing with high throughput, the used buffers that exceeds the budget is not cleaned up. In addition, it takes a lot of cycles to clean up the used buffer, and then the buffer where the valid data is located can take effect. Signed-off-by: Jiangfeng Xiao --- drivers/net/ethernet/hisilicon/hip04_eth.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c index ad6d912..78f338a 100644 --- a/drivers/net/ethernet/hisilicon/hip04_eth.c +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c @@ -575,7 +575,7 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi); struct net_device *ndev = priv->ndev; struct net_device_stats *stats = &ndev->stats; - unsigned int cnt = hip04_recv_cnt(priv); + static unsigned int cnt_remaining; struct rx_desc *desc; struct sk_buff *skb; unsigned char *buf; @@ -588,8 +588,8 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) /* clean up tx descriptors */ tx_remaining = hip04_tx_reclaim(ndev, false); - - while (cnt && !last) { + cnt_remaining += hip04_recv_cnt(priv); + while (cnt_remaining && !last) { buf = priv->rx_buf[priv->rx_head]; skb = build_skb(buf, priv->rx_buf_size); if (unlikely(!skb)) { @@ -635,11 +635,13 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) hip04_set_recv_desc(priv, phys); priv->rx_head = RX_NEXT(priv->rx_head); - if (rx >= budget) + if (rx >= budget) { + --cnt_remaining; goto done; + } - if (--cnt == 0) - cnt = hip04_recv_cnt(priv); + if (--cnt_remaining == 0) + cnt_remaining += hip04_recv_cnt(priv); } if (!(priv->reg_inten & RCV_INT)) { -- 1.8.5.6