From: Alex Elder <elder@linaro•org>
To: davem@davemloft•net, kuba@kernel•org
Cc: jponduru@codeaurora•org, avuyyuru@codeaurora•org,
bjorn.andersson@linaro•org, agross@kernel•org,
cpratapa@codeaurora•org, subashab@codeaurora•org,
mka@chromium•org, evgreen@chromium•org, elder@kernel•org,
netdev@vger•kernel.org, linux-arm-msm@vger•kernel.org,
linux-kernel@vger•kernel.org
Subject: [PATCH net v2 2/3] net: ipa: use a bitmap for endpoint replenish_enabled
Date: Wed, 12 Jan 2022 07:30:11 -0600 [thread overview]
Message-ID: <20220112133012.778148-3-elder@linaro.org> (raw)
In-Reply-To: <20220112133012.778148-1-elder@linaro.org>
Define a new replenish_flags bitmap to contain Boolean flags
associated with an endpoint's replenishing state. Replace the
replenish_enabled field with a flag in that bitmap. This is to
prepare for the next patch, which adds another flag.
Signed-off-by: Alex Elder <elder@linaro•org>
---
v2: This change was not present in version 1
drivers/net/ipa/ipa_endpoint.c | 8 ++++----
drivers/net/ipa/ipa_endpoint.h | 15 +++++++++++++--
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index 8b055885cf3cf..cddddcedaf72b 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -1082,7 +1082,7 @@ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one)
u32 backlog;
int delta;
- if (!endpoint->replenish_enabled) {
+ if (!test_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags)) {
if (add_one)
atomic_inc(&endpoint->replenish_saved);
return;
@@ -1119,7 +1119,7 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint)
u32 max_backlog;
u32 saved;
- endpoint->replenish_enabled = true;
+ set_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
while ((saved = atomic_xchg(&endpoint->replenish_saved, 0)))
atomic_add(saved, &endpoint->replenish_backlog);
@@ -1133,7 +1133,7 @@ static void ipa_endpoint_replenish_disable(struct ipa_endpoint *endpoint)
{
u32 backlog;
- endpoint->replenish_enabled = false;
+ clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
while ((backlog = atomic_xchg(&endpoint->replenish_backlog, 0)))
atomic_add(backlog, &endpoint->replenish_saved);
}
@@ -1690,7 +1690,7 @@ static void ipa_endpoint_setup_one(struct ipa_endpoint *endpoint)
/* RX transactions require a single TRE, so the maximum
* backlog is the same as the maximum outstanding TREs.
*/
- endpoint->replenish_enabled = false;
+ clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
atomic_set(&endpoint->replenish_saved,
gsi_channel_tre_max(gsi, endpoint->channel_id));
atomic_set(&endpoint->replenish_backlog, 0);
diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h
index 0a859d10312dc..07d5c20e5f000 100644
--- a/drivers/net/ipa/ipa_endpoint.h
+++ b/drivers/net/ipa/ipa_endpoint.h
@@ -40,6 +40,17 @@ enum ipa_endpoint_name {
#define IPA_ENDPOINT_MAX 32 /* Max supported by driver */
+/**
+ * enum ipa_replenish_flag: RX buffer replenish flags
+ *
+ * @IPA_REPLENISH_ENABLED: Whether receive buffer replenishing is enabled
+ * @IPA_REPLENISH_COUNT: Number of defined replenish flags
+ */
+enum ipa_replenish_flag {
+ IPA_REPLENISH_ENABLED,
+ IPA_REPLENISH_COUNT, /* Number of flags (must be last) */
+};
+
/**
* struct ipa_endpoint - IPA endpoint information
* @ipa: IPA pointer
@@ -51,7 +62,7 @@ enum ipa_endpoint_name {
* @trans_tre_max: Maximum number of TRE descriptors per transaction
* @evt_ring_id: GSI event ring used by the endpoint
* @netdev: Network device pointer, if endpoint uses one
- * @replenish_enabled: Whether receive buffer replenishing is enabled
+ * @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
@@ -72,7 +83,7 @@ struct ipa_endpoint {
struct net_device *netdev;
/* Receive buffer replenishing for RX endpoints */
- bool replenish_enabled;
+ DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT);
u32 replenish_ready;
atomic_t replenish_saved;
atomic_t replenish_backlog;
--
2.32.0
next prev parent reply other threads:[~2022-01-12 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-12 13:30 [PATCH net v2 0/3] net: ipa: fix two replenish bugs Alex Elder
2022-01-12 13:30 ` [PATCH net v2 1/3] net: ipa: fix atomic update in ipa_endpoint_replenish() Alex Elder
2022-01-12 13:30 ` Alex Elder [this message]
2022-01-12 13:30 ` [PATCH net v2 3/3] net: ipa: prevent concurrent replenish Alex Elder
2022-01-12 14:50 ` [PATCH net v2 0/3] net: ipa: fix two replenish bugs 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=20220112133012.778148-3-elder@linaro.org \
--to=elder@linaro$(echo .)org \
--cc=agross@kernel$(echo .)org \
--cc=avuyyuru@codeaurora$(echo .)org \
--cc=bjorn.andersson@linaro$(echo .)org \
--cc=cpratapa@codeaurora$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=elder@kernel$(echo .)org \
--cc=evgreen@chromium$(echo .)org \
--cc=jponduru@codeaurora$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=linux-arm-msm@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=mka@chromium$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=subashab@codeaurora$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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