From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Neel Patel <neel@pensando.io>,
Shannon Nelson <snelson@pensando.io>,
Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>,
shannon.nelson@amd.com, brett.creeley@amd.com,
drivers@pensando.io, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, allen.hubbe@amd.com, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.15 01/12] ionic: refactor use of ionic_rx_fill()
Date: Wed, 15 Feb 2023 15:46:23 -0500 [thread overview]
Message-ID: <20230215204637.2761073-1-sashal@kernel.org> (raw)
From: Neel Patel <neel@pensando.io>
[ Upstream commit e55f0f5befc26e2ba6bb8c1f945ea8e37ee0e334 ]
The same pre-work code is used before each call to
ionic_rx_fill(), so bring it in and make it a part of
the routine.
Signed-off-by: Neel Patel <neel@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/pensando/ionic/ionic_txrx.c | 23 ++++++++++---------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
index 37c39581b6599..376f97b4008bb 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
@@ -353,16 +353,25 @@ void ionic_rx_fill(struct ionic_queue *q)
struct ionic_rxq_sg_desc *sg_desc;
struct ionic_rxq_sg_elem *sg_elem;
struct ionic_buf_info *buf_info;
+ unsigned int fill_threshold;
struct ionic_rxq_desc *desc;
unsigned int remain_len;
unsigned int frag_len;
unsigned int nfrags;
+ unsigned int n_fill;
unsigned int i, j;
unsigned int len;
+ n_fill = ionic_q_space_avail(q);
+
+ fill_threshold = min_t(unsigned int, IONIC_RX_FILL_THRESHOLD,
+ q->num_descs / IONIC_RX_FILL_DIV);
+ if (n_fill < fill_threshold)
+ return;
+
len = netdev->mtu + ETH_HLEN + VLAN_HLEN;
- for (i = ionic_q_space_avail(q); i; i--) {
+ for (i = n_fill; i; i--) {
nfrags = 0;
remain_len = len;
desc_info = &q->info[q->head_idx];
@@ -518,7 +527,6 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
struct ionic_cq *cq = napi_to_cq(napi);
struct ionic_dev *idev;
struct ionic_lif *lif;
- u16 rx_fill_threshold;
u32 work_done = 0;
u32 flags = 0;
@@ -528,10 +536,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
work_done = ionic_cq_service(cq, budget,
ionic_rx_service, NULL, NULL);
- rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD,
- cq->num_descs / IONIC_RX_FILL_DIV);
- if (work_done && ionic_q_space_avail(cq->bound_q) >= rx_fill_threshold)
- ionic_rx_fill(cq->bound_q);
+ ionic_rx_fill(cq->bound_q);
if (work_done < budget && napi_complete_done(napi, work_done)) {
ionic_dim_update(qcq, IONIC_LIF_F_RX_DIM_INTR);
@@ -559,7 +564,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
struct ionic_dev *idev;
struct ionic_lif *lif;
struct ionic_cq *txcq;
- u16 rx_fill_threshold;
u32 rx_work_done = 0;
u32 tx_work_done = 0;
u32 flags = 0;
@@ -574,10 +578,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
rx_work_done = ionic_cq_service(rxcq, budget,
ionic_rx_service, NULL, NULL);
- rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD,
- rxcq->num_descs / IONIC_RX_FILL_DIV);
- if (rx_work_done && ionic_q_space_avail(rxcq->bound_q) >= rx_fill_threshold)
- ionic_rx_fill(rxcq->bound_q);
+ ionic_rx_fill(rxcq->bound_q);
if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) {
ionic_dim_update(qcq, 0);
--
2.39.0
next reply other threads:[~2023-02-15 20:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 20:46 Sasha Levin [this message]
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 02/12] Fix XFRM-I support for nested ESP tunnels Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 03/12] arm64: dts: rockchip: drop unused LED mode property from rk3328-roc-cc Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 04/12] ARM: dts: rockchip: add power-domains property to dp node on rk3288 Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 05/12] HID: elecom: add support for TrackBall 056E:011C Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 06/12] ACPI: NFIT: fix a potential deadlock during NFIT teardown Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 07/12] btrfs: send: limit number of clones and allocated memory size Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 08/12] ASoC: rt715-sdca: fix clock stop prepare timeout issue Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 09/12] IB/hfi1: Assign npages earlier Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 10/12] neigh: make sure used and confirmed times are valid Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 11/12] HID: core: Fix deadloop in hid_apply_multiplier Sasha Levin
2023-02-15 20:46 ` [PATCH AUTOSEL 5.15 12/12] x86/cpu: Add Lunar Lake M Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230215204637.2761073-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=allen.hubbe@amd.com \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=drivers@pensando.io \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neel@pensando.io \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shannon.nelson@amd.com \
--cc=snelson@pensando.io \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox