From: Alex Elder <elder@linaro.org>
To: davem@davemloft.net, kuba@kernel.org
Cc: bjorn.andersson@linaro.org, mka@chromium.org,
evgreen@chromium.org, cpratapa@codeaurora.org,
avuyyuru@codeaurora.org, jponduru@codeaurora.org,
subashab@codeaurora.org, elder@kernel.org,
netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH net-next 01/10] net: ipa: kill replenish_saved
Date: Thu, 3 Feb 2022 11:09:18 -0600 [thread overview]
Message-ID: <20220203170927.770572-2-elder@linaro.org> (raw)
In-Reply-To: <20220203170927.770572-1-elder@linaro.org>
The replenish_saved field keeps track of the number of times a new
buffer is added to the backlog when replenishing is disabled. We
don't really use it though, so there's no need for us to track it
separately. Whether replenishing is enabled or not, we can simply
increment the backlog.
Get rid of replenish_saved, and initialize and increment the backlog
where it would have otherwise been used.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_endpoint.c | 17 ++++-------------
drivers/net/ipa/ipa_endpoint.h | 2 --
2 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index fffd0a784ef2c..a9f6d4083f869 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -1090,9 +1090,8 @@ static int ipa_endpoint_replenish_one(struct ipa_endpoint *endpoint)
* endpoint, based on the number of entries in the underlying channel ring
* buffer. If an endpoint's "backlog" is non-zero, it indicates how many
* more receive buffers can be supplied to the hardware. Replenishing for
- * an endpoint can be disabled, in which case requests to replenish a
- * buffer are "saved", and transferred to the backlog once it is re-enabled
- * again.
+ * an endpoint can be disabled, in which case buffers are not queued to
+ * the hardware.
*/
static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one)
{
@@ -1102,7 +1101,7 @@ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one)
if (!test_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags)) {
if (add_one)
- atomic_inc(&endpoint->replenish_saved);
+ atomic_inc(&endpoint->replenish_backlog);
return;
}
@@ -1147,11 +1146,8 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint)
{
struct gsi *gsi = &endpoint->ipa->gsi;
u32 max_backlog;
- u32 saved;
set_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
- while ((saved = atomic_xchg(&endpoint->replenish_saved, 0)))
- atomic_add(saved, &endpoint->replenish_backlog);
/* Start replenishing if hardware currently has no buffers */
max_backlog = gsi_channel_tre_max(gsi, endpoint->channel_id);
@@ -1161,11 +1157,7 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint)
static void ipa_endpoint_replenish_disable(struct ipa_endpoint *endpoint)
{
- u32 backlog;
-
clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
- while ((backlog = atomic_xchg(&endpoint->replenish_backlog, 0)))
- atomic_add(backlog, &endpoint->replenish_saved);
}
static void ipa_endpoint_replenish_work(struct work_struct *work)
@@ -1727,9 +1719,8 @@ static void ipa_endpoint_setup_one(struct ipa_endpoint *endpoint)
*/
clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
clear_bit(IPA_REPLENISH_ACTIVE, endpoint->replenish_flags);
- atomic_set(&endpoint->replenish_saved,
+ atomic_set(&endpoint->replenish_backlog,
gsi_channel_tre_max(gsi, endpoint->channel_id));
- atomic_set(&endpoint->replenish_backlog, 0);
INIT_DELAYED_WORK(&endpoint->replenish_work,
ipa_endpoint_replenish_work);
}
diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h
index 0313cdc607de3..c95816d882a74 100644
--- a/drivers/net/ipa/ipa_endpoint.h
+++ b/drivers/net/ipa/ipa_endpoint.h
@@ -66,7 +66,6 @@ enum ipa_replenish_flag {
* @netdev: Network device pointer, if endpoint uses one
* @replenish_flags: Replenishing state flags
* @replenish_ready: Number of replenish transactions without doorbell
- * @replenish_saved: Replenish requests held while disabled
* @replenish_backlog: Number of buffers needed to fill hardware queue
* @replenish_work: Work item used for repeated replenish failures
*/
@@ -87,7 +86,6 @@ struct ipa_endpoint {
/* Receive buffer replenishing for RX endpoints */
DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT);
u32 replenish_ready;
- atomic_t replenish_saved;
atomic_t replenish_backlog;
struct delayed_work replenish_work; /* global wq */
};
--
2.32.0
next prev parent reply other threads:[~2022-02-03 17:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 17:09 [PATCH net-next 00/10] net: ipa: improve RX buffer replenishing Alex Elder
2022-02-03 17:09 ` Alex Elder [this message]
2022-02-03 17:09 ` [PATCH net-next 02/10] net: ipa: allocate transaction before pages when replenishing Alex Elder
2022-02-03 17:09 ` [PATCH net-next 03/10] net: ipa: increment backlog in replenish caller Alex Elder
2022-02-03 17:09 ` [PATCH net-next 04/10] net: ipa: decide on doorbell in replenish loop Alex Elder
2022-02-03 17:09 ` [PATCH net-next 05/10] net: ipa: allocate transaction " Alex Elder
2022-02-03 17:09 ` [PATCH net-next 06/10] net: ipa: don't use replenish_backlog Alex Elder
2022-02-03 17:09 ` [PATCH net-next 07/10] net: ipa: introduce gsi_channel_trans_idle() Alex Elder
2022-02-03 17:09 ` [PATCH net-next 08/10] net: ipa: kill replenish_backlog Alex Elder
2022-02-03 17:09 ` [PATCH net-next 09/10] net: ipa: replenish after delivering payload Alex Elder
2022-02-03 17:09 ` [PATCH net-next 10/10] net: ipa: determine replenish doorbell differently Alex Elder
2022-02-04 10:40 ` [PATCH net-next 00/10] net: ipa: improve RX buffer replenishing patchwork-bot+netdevbpf
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=20220203170927.770572-2-elder@linaro.org \
--to=elder@linaro.org \
--cc=avuyyuru@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=cpratapa@codeaurora.org \
--cc=davem@davemloft.net \
--cc=elder@kernel.org \
--cc=evgreen@chromium.org \
--cc=jponduru@codeaurora.org \
--cc=kuba@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mka@chromium.org \
--cc=netdev@vger.kernel.org \
--cc=subashab@codeaurora.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