From patchwork Mon Aug 19 22:11:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dann frazier X-Patchwork-Id: 1149643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46C7VL4H8fz9sND; Tue, 20 Aug 2019 08:13:30 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hzpu2-0003tJ-Nr; Mon, 19 Aug 2019 22:13:26 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hzpu0-0003sc-Lh for kernel-team@lists.ubuntu.com; Mon, 19 Aug 2019 22:13:24 +0000 Received: from mail-io1-f69.google.com ([209.85.166.69]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hzpu0-0008AV-87 for kernel-team@lists.ubuntu.com; Mon, 19 Aug 2019 22:13:24 +0000 Received: by mail-io1-f69.google.com with SMTP id a13so5544635ioh.18 for ; Mon, 19 Aug 2019 15:13:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0GG6ivBceU5aeuH4t5N/gaJMx/j4he3i0SFehuL99us=; b=m+DvnVRmQv0zEpxF0XQCswQniHBF7aM4puIoR9dcpWf+tdCw2o9gCDhQC4+n6OrhUG nrlBNTYNNWYnuIe4T9a1foFxdGzqhbV98C/q3c+hYAsnZOPGh+k4aOuQKPE8QY/Zml7p 7yo1D1umr7u1nZfKK/mawUNQ1GKn5B6F7ajdpe0Ww6L9pAoXsZhfBeBOz7dUgg24cFvt 3/tZosCrXGP8QoConrqSDppexKwRrDNi82P2WCvaJM5/ajMS6Q/Mpy/lIUjfwhGLph2Q vhu+UZ/8WNFQ98rb931BgJkr9PNapC3AFocNNEimaeYqlGP4B38V8LryXSjU0aVdNbuj 1xRg== X-Gm-Message-State: APjAAAXDaYAvHbwRYg2voDUdDFSqkDv75UcLhBTHxWWFuVsffMcxxMTx K2Gq5ggRK6q/dWbo1hHhHeRgt5kj2fWr6FhcgQDFG8iLeL2D94rfRvQ8jeRUjduh8HgDN1SJUHb y26Uq2H4KLcHR37IZfepb9uhveCic/MbdF6ZiJ8SEGw== X-Received: by 2002:a6b:5901:: with SMTP id n1mr4049235iob.179.1566252803101; Mon, 19 Aug 2019 15:13:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRAm381blz9ErS4bUCOTqfv3yRkOVAs7lYK5U3CYw6hkc/c88Tl8BaZBY5O2dwQ4TdWqZcSg== X-Received: by 2002:a6b:5901:: with SMTP id n1mr4049211iob.179.1566252802831; Mon, 19 Aug 2019 15:13:22 -0700 (PDT) Received: from xps13.canonical.com (c-71-56-235-36.hsd1.co.comcast.net. [71.56.235.36]) by smtp.gmail.com with ESMTPSA id s12sm7823272ios.31.2019.08.19.15.13.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 15:13:22 -0700 (PDT) From: dann frazier To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/3][SRU Bionic] net: hns3: minor optimization for ring_space Date: Mon, 19 Aug 2019 16:11:09 -0600 Message-Id: <20190819221111.18733-2-dann.frazier@canonical.com> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190819221111.18733-1-dann.frazier@canonical.com> References: <20190819221111.18733-1-dann.frazier@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Yunsheng Lin BugLink: https://bugs.launchpad.net/bugs/1840717 This patch optimizes the ring_space by calculating the ring space without calling ring_dist. Also ring_dist is only used by ring_space, so this patch removes it when it is no longer used. Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller (cherry picked from commit 0aa3d88a9197fd7176dbaf5db769837be6afdf46) Signed-off-by: dann frazier --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index e55995e93bb08..77f6e6cf3fead 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -570,18 +570,13 @@ union l4_hdr_info { unsigned char *hdr; }; -/* the distance between [begin, end) in a ring buffer - * note: there is a unuse slot between the begin and the end - */ -static inline int ring_dist(struct hns3_enet_ring *ring, int begin, int end) -{ - return (end - begin + ring->desc_num) % ring->desc_num; -} - static inline int ring_space(struct hns3_enet_ring *ring) { - return ring->desc_num - - ring_dist(ring, ring->next_to_clean, ring->next_to_use) - 1; + int begin = ring->next_to_clean; + int end = ring->next_to_use; + + return ((end >= begin) ? (ring->desc_num - end + begin) : + (begin - end)) - 1; } static inline int is_ring_empty(struct hns3_enet_ring *ring) From patchwork Mon Aug 19 22:11:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dann frazier X-Patchwork-Id: 1149644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46C7VP503yz9sN6; Tue, 20 Aug 2019 08:13:33 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hzpu5-0003u6-TG; Mon, 19 Aug 2019 22:13:29 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hzpu2-0003t6-2a for kernel-team@lists.ubuntu.com; Mon, 19 Aug 2019 22:13:26 +0000 Received: from mail-io1-f70.google.com ([209.85.166.70]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hzpu1-0008Ac-LY for kernel-team@lists.ubuntu.com; Mon, 19 Aug 2019 22:13:25 +0000 Received: by mail-io1-f70.google.com with SMTP id e17so5590598ioh.13 for ; Mon, 19 Aug 2019 15:13:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fe2X4DaZncxw0pODkKlJSOU5aCP5Tg1rfRd2jeTxK4I=; b=NxXUppcXCXaM59ijPpYsN4KtvqsXVHqISRzUJTAfds9A5wniSW6sW7zTPYGEJffl8c E7wou5geRjVWF6ziIlQOf0l2/zsIJdiLzaxbTdQLup9GRkpQqEmaD2MAOu5+LY+cDKno yH/V+AIwYkeLV7fkSjE+yWXEE5Ecuk7VVIfSpIsxN8scrXXn41HCwOk6+lvXmCIPjz07 TB7dltWHCM79f0hYkHPYqO+/6Ao9T238nXVxAx+IA+QX3qP94PQki5iAk5ykzznEuPvr gnpr9DiasEcRG8kOGJBi/Ou8fVtFh0NOojKqjbIpNWZvGKADxNFDGAHvdJfGILFvHRgG mlyw== X-Gm-Message-State: APjAAAVGDMq/lWWYIlwz5D7dfFejnr00ucoG9cr3i2/oC5oCcPv1KZzk qFvykrGqMQHwRPJwIQuwXabUIODwgfO/wG0R1hmCXiv5n1CMS2Ff07gy6axx1y3/CSFZqCeuku7 5oG20QY7/VdPwQ4gcfZ+uqfGcWmqeiR6lwHMVqole6g== X-Received: by 2002:a6b:b4c5:: with SMTP id d188mr26577326iof.96.1566252804464; Mon, 19 Aug 2019 15:13:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzc7MCxXNYrz5rJXwkZgW/6i+15Mo0dOPThqedotpUEy058wOwKMqW3ja47iZx3rkm3isORCw== X-Received: by 2002:a6b:b4c5:: with SMTP id d188mr26577303iof.96.1566252804164; Mon, 19 Aug 2019 15:13:24 -0700 (PDT) Received: from xps13.canonical.com (c-71-56-235-36.hsd1.co.comcast.net. [71.56.235.36]) by smtp.gmail.com with ESMTPSA id y5sm16125334ioc.86.2019.08.19.15.13.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 15:13:23 -0700 (PDT) From: dann frazier To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/3][SRU Bionic] net: hns3: fix data race between ring->next_to_clean Date: Mon, 19 Aug 2019 16:11:10 -0600 Message-Id: <20190819221111.18733-3-dann.frazier@canonical.com> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190819221111.18733-1-dann.frazier@canonical.com> References: <20190819221111.18733-1-dann.frazier@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Yunsheng Lin BugLink: https://bugs.launchpad.net/bugs/1840717 hns3_clean_tx_ring calls hns3_nic_reclaim_one_desc to clean buffers and set ring->next_to_clean, then hns3_nic_net_xmit reuses the cleaned buffers. But there are no memory barriers when buffers gets recycled, so the recycled buffers can be corrupted. This patch uses smp_store_release to update ring->next_to_clean and smp_load_acquire to read ring->next_to_clean to properly hand off buffers from hns3_clean_tx_ring to hns3_nic_net_xmit. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller (cherry picked from commit 26cda2f1613878d9bde11325559f4fca92fff395) Signed-off-by: dann frazier --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 14 +++++++++++--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 7 +++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 08718f9093dc5..99815c45c9a8f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2112,14 +2112,22 @@ static void hns3_reuse_buffer(struct hns3_enet_ring *ring, int i) static void hns3_nic_reclaim_one_desc(struct hns3_enet_ring *ring, int *bytes, int *pkts) { - struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_clean]; + int ntc = ring->next_to_clean; + struct hns3_desc_cb *desc_cb; + desc_cb = &ring->desc_cb[ntc]; (*pkts) += (desc_cb->type == DESC_TYPE_SKB); (*bytes) += desc_cb->length; /* desc_cb will be cleaned, after hnae3_free_buffer_detach*/ - hns3_free_buffer_detach(ring, ring->next_to_clean); + hns3_free_buffer_detach(ring, ntc); - ring_ptr_move_fw(ring, next_to_clean); + if (++ntc == ring->desc_num) + ntc = 0; + + /* This smp_store_release() pairs with smp_load_acquire() in + * ring_space called by hns3_nic_net_xmit. + */ + smp_store_release(&ring->next_to_clean, ntc); } static int is_valid_clean_head(struct hns3_enet_ring *ring, int h) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index 77f6e6cf3fead..0553022ad6db4 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -572,8 +572,11 @@ union l4_hdr_info { static inline int ring_space(struct hns3_enet_ring *ring) { - int begin = ring->next_to_clean; - int end = ring->next_to_use; + /* This smp_load_acquire() pairs with smp_store_release() in + * hns3_nic_reclaim_one_desc called by hns3_clean_tx_ring. + */ + int begin = smp_load_acquire(&ring->next_to_clean); + int end = READ_ONCE(ring->next_to_use); return ((end >= begin) ? (ring->desc_num - end + begin) : (begin - end)) - 1; From patchwork Mon Aug 19 22:11:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dann frazier X-Patchwork-Id: 1149645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46C7VQ04yKz9sN1; Tue, 20 Aug 2019 08:13:34 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hzpu6-0003uR-2I; Mon, 19 Aug 2019 22:13:30 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hzpu4-0003tn-5q for kernel-team@lists.ubuntu.com; Mon, 19 Aug 2019 22:13:28 +0000 Received: from mail-io1-f72.google.com ([209.85.166.72]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hzpu3-0008Ah-OP for kernel-team@lists.ubuntu.com; Mon, 19 Aug 2019 22:13:27 +0000 Received: by mail-io1-f72.google.com with SMTP id v16so5594161ioh.7 for ; Mon, 19 Aug 2019 15:13:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kuEICQbwJEsU0BSCwHqLI4JZ9PO7zxJbE7Q83soHG6E=; b=khtwgsgrRJrqS1g5hNyYyIFRlubpPnjWdoPPyBz5VXPe1lCwx7GGb29QuGpn8C8/lr MAEQE31p4Jkz+uCYIRQ/eY9Fof2AovN6zedCcU+7QJXCBuX9eYzBn5Mn3nVpPszA1y0R MNy/tWGyYWaEjOPUXSz6zKg7TparAWUG5p+fO2GGL07DDhKvIjCZ0oPDoU9FdBH4Sd8R Xh2nyDKIR3Sw6vey82/5CAJ9sdTDXN1rolRGFS2my28ueAWHY3QXHGv/vSHpFmcp9RLN VKlmolLfNij9OLHYMGLCM6hsAXIDb554UKPWnuD5qFBZ2G4vjBGDaDFA12gcDb66vX9c mMhA== X-Gm-Message-State: APjAAAU2PFopX/YEG5XS7OFUNil+oHGhDXbDdnBVDVFNBUyQ9rLT0M4x +qYq2GDVDcIsPzEcSK8zK1RZ8ed0BX3rFXZyDffF8Qtn/3U4dkepnS2ad1lyUjJ49Okr/fsBMy2 aMJ6gc/2qjDwJ/vD84VkVvI2v5knzO94V0EjZzVMAPA== X-Received: by 2002:a05:6638:517:: with SMTP id i23mr16227jar.71.1566252806297; Mon, 19 Aug 2019 15:13:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxGHSnV6cSkVkKpkUwiqMw//PVDVswNooCsodFbUZLI+13eseTfQ39aw5Fyz1oQiD83ngF5Q== X-Received: by 2002:a05:6638:517:: with SMTP id i23mr16162jar.71.1566252805490; Mon, 19 Aug 2019 15:13:25 -0700 (PDT) Received: from xps13.canonical.com (c-71-56-235-36.hsd1.co.comcast.net. [71.56.235.36]) by smtp.gmail.com with ESMTPSA id d6sm17263261iod.17.2019.08.19.15.13.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 15:13:25 -0700 (PDT) From: dann frazier To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/3][SRU Bionic] net: hns3: optimize the barrier using when cleaning TX BD Date: Mon, 19 Aug 2019 16:11:11 -0600 Message-Id: <20190819221111.18733-4-dann.frazier@canonical.com> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190819221111.18733-1-dann.frazier@canonical.com> References: <20190819221111.18733-1-dann.frazier@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Yunsheng Lin BugLink: https://bugs.launchpad.net/bugs/1840717 Currently, a barrier is used when cleaning each TX BD, which may cause performance degradation. This patch optimizes it to use one barrier when cleaning TX BD each round. Signed-off-by: Yunsheng Lin Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller (cherry picked from commit ce74370c2ce9a90c16167131f837e14b5e3c57ed) Signed-off-by: dann frazier --- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 99815c45c9a8f..a7fe58f020d12 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2109,20 +2109,25 @@ static void hns3_reuse_buffer(struct hns3_enet_ring *ring, int i) ring->desc[i].rx.bd_base_info = 0; } -static void hns3_nic_reclaim_one_desc(struct hns3_enet_ring *ring, int *bytes, - int *pkts) +static void hns3_nic_reclaim_desc(struct hns3_enet_ring *ring, int head, + int *bytes, int *pkts) { int ntc = ring->next_to_clean; struct hns3_desc_cb *desc_cb; - desc_cb = &ring->desc_cb[ntc]; - (*pkts) += (desc_cb->type == DESC_TYPE_SKB); - (*bytes) += desc_cb->length; - /* desc_cb will be cleaned, after hnae3_free_buffer_detach*/ - hns3_free_buffer_detach(ring, ntc); + while (head != ntc) { + desc_cb = &ring->desc_cb[ntc]; + (*pkts) += (desc_cb->type == DESC_TYPE_SKB); + (*bytes) += desc_cb->length; + /* desc_cb will be cleaned, after hnae3_free_buffer_detach */ + hns3_free_buffer_detach(ring, ntc); - if (++ntc == ring->desc_num) - ntc = 0; + if (++ntc == ring->desc_num) + ntc = 0; + + /* Issue prefetch for next Tx descriptor */ + prefetch(&ring->desc_cb[ntc]); + } /* This smp_store_release() pairs with smp_load_acquire() in * ring_space called by hns3_nic_net_xmit. @@ -2167,11 +2172,7 @@ void hns3_clean_tx_ring(struct hns3_enet_ring *ring) bytes = 0; pkts = 0; - while (head != ring->next_to_clean) { - hns3_nic_reclaim_one_desc(ring, &bytes, &pkts); - /* Issue prefetch for next Tx descriptor */ - prefetch(&ring->desc_cb[ring->next_to_clean]); - } + hns3_nic_reclaim_desc(ring, head, &bytes, &pkts); ring->tqp_vector->tx_group.total_bytes += bytes; ring->tqp_vector->tx_group.total_packets += pkts;