From: Alex Elder <elder@linaro.org>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: mka@chromium.org, evgreen@chromium.org, andersson@kernel.org,
quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com,
quic_jponduru@quicinc.com, quic_subashab@quicinc.com,
elder@kernel.org, netdev@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 8/9] net: ipa: use a bitmap for set-up endpoints
Date: Sat, 29 Oct 2022 19:18:27 -0500 [thread overview]
Message-ID: <20221030001828.754010-9-elder@linaro.org> (raw)
In-Reply-To: <20221030001828.754010-1-elder@linaro.org>
Replace the 32-bit unsigned used to track endpoints that have
completed setup with a Linux bitmap, to allow an arbitrary number
of endpoints to be represented.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa.h | 4 ++--
drivers/net/ipa/ipa_endpoint.c | 24 +++++++++++-------------
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h
index 557101c2d5838..f14d1bd34e7e5 100644
--- a/drivers/net/ipa/ipa.h
+++ b/drivers/net/ipa/ipa.h
@@ -66,7 +66,7 @@ struct ipa_interrupt;
* @defined: Bitmap of endpoints defined in config data
* @available: Bitmap of endpoints supported by hardware
* @filtered: Bitmap of endpoints that support filtering
- * @set_up: Bit mask indicating endpoints set up
+ * @set_up: Bitmap of endpoints that are set up for use
* @enabled: Bit mask indicating endpoints enabled
* @modem_tx_count: Number of defined modem TX endoints
* @endpoint: Array of endpoint information
@@ -124,7 +124,7 @@ struct ipa {
unsigned long *defined; /* Defined in configuration data */
unsigned long *available; /* Supported by hardware */
u64 filtered; /* Support filtering (AP and modem) */
- u32 set_up;
+ unsigned long *set_up;
u32 enabled;
u32 modem_tx_count;
diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index 923299cc46fe5..564a209f75a0f 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -1802,12 +1802,12 @@ static void ipa_endpoint_setup_one(struct ipa_endpoint *endpoint)
ipa_endpoint_program(endpoint);
- endpoint->ipa->set_up |= BIT(endpoint->endpoint_id);
+ __set_bit(endpoint->endpoint_id, endpoint->ipa->set_up);
}
static void ipa_endpoint_teardown_one(struct ipa_endpoint *endpoint)
{
- endpoint->ipa->set_up &= ~BIT(endpoint->endpoint_id);
+ __clear_bit(endpoint->endpoint_id, endpoint->ipa->set_up);
if (!endpoint->toward_ipa)
cancel_delayed_work_sync(&endpoint->replenish_work);
@@ -1819,23 +1819,16 @@ void ipa_endpoint_setup(struct ipa *ipa)
{
u32 endpoint_id;
- ipa->set_up = 0;
for_each_set_bit(endpoint_id, ipa->defined, ipa->endpoint_count)
ipa_endpoint_setup_one(&ipa->endpoint[endpoint_id]);
}
void ipa_endpoint_teardown(struct ipa *ipa)
{
- u32 set_up = ipa->set_up;
-
- while (set_up) {
- u32 endpoint_id = __fls(set_up);
-
- set_up ^= BIT(endpoint_id);
+ u32 endpoint_id;
+ for_each_set_bit(endpoint_id, ipa->set_up, ipa->endpoint_count)
ipa_endpoint_teardown_one(&ipa->endpoint[endpoint_id]);
- }
- ipa->set_up = 0;
}
int ipa_endpoint_config(struct ipa *ipa)
@@ -1977,7 +1970,9 @@ void ipa_endpoint_exit(struct ipa *ipa)
for_each_set_bit(endpoint_id, ipa->defined, ipa->endpoint_count)
ipa_endpoint_exit_one(&ipa->endpoint[endpoint_id]);
+ bitmap_free(ipa->set_up);
bitmap_free(ipa->defined);
+ ipa->set_up = NULL;
ipa->defined = NULL;
memset(ipa->name_map, 0, sizeof(ipa->name_map));
@@ -2001,8 +1996,11 @@ int ipa_endpoint_init(struct ipa *ipa, u32 count,
/* Set up the defined endpoint bitmap */
ipa->defined = bitmap_zalloc(ipa->endpoint_count, GFP_KERNEL);
- if (!ipa->defined) {
- dev_err(dev, "unable to allocate defined endpoint bitmap\n");
+ ipa->set_up = bitmap_zalloc(ipa->endpoint_count, GFP_KERNEL);
+ if (!ipa->defined || !ipa->set_up) {
+ dev_err(dev, "unable to allocate endpoint bitmaps\n");
+ bitmap_free(ipa->defined);
+ ipa->defined = NULL;
return -ENOMEM;
}
--
2.34.1
next prev parent reply other threads:[~2022-10-30 0:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-30 0:18 [PATCH net-next 0/9] net: ipa: support more endpoints Alex Elder
2022-10-30 0:18 ` [PATCH net-next 1/9] net: ipa: reduce arguments to ipa_table_init_add() Alex Elder
2022-10-30 0:18 ` [PATCH net-next 2/9] net: ipa: use ipa_table_mem() in ipa_table_reset_add() Alex Elder
2022-10-30 0:18 ` [PATCH net-next 3/9] net: ipa: add a parameter to aggregation registers Alex Elder
2022-10-30 0:18 ` [PATCH net-next 4/9] net: ipa: add a parameter to suspend registers Alex Elder
2022-10-30 0:18 ` [PATCH net-next 5/9] net: ipa: use a bitmap for defined endpoints Alex Elder
2022-10-30 0:18 ` [PATCH net-next 6/9] net: ipa: use a bitmap for available endpoints Alex Elder
2022-10-30 0:18 ` [PATCH net-next 7/9] net: ipa: support more filtering endpoints Alex Elder
2022-10-30 0:18 ` Alex Elder [this message]
2022-10-30 0:18 ` [PATCH net-next 9/9] net: ipa: use a bitmap for enabled endpoints Alex Elder
2022-11-02 4:34 ` Jakub Kicinski
2022-11-02 12:44 ` Alex Elder
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=20221030001828.754010-9-elder@linaro.org \
--to=elder@linaro.org \
--cc=andersson@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=elder@kernel.org \
--cc=evgreen@chromium.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=pabeni@redhat.com \
--cc=quic_avuyyuru@quicinc.com \
--cc=quic_cpratapa@quicinc.com \
--cc=quic_jponduru@quicinc.com \
--cc=quic_subashab@quicinc.com \
/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;
as well as URLs for NNTP newsgroup(s).