aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/ipa/ipa_endpoint.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2022-11-02 17:11:37 -0500
committerDavid S. Miller <davem@davemloft.net>2022-11-04 10:16:53 +0000
commit0f97fbd478587a4ac2d53a88e5a9aefd6632a251 (patch)
tree03a7e860cf1679876b6d1a52eba22f73228c1a45 /drivers/net/ipa/ipa_endpoint.c
parentnet: ipa: use a bitmap for available endpoints (diff)
downloadwireguard-linux-0f97fbd478587a4ac2d53a88e5a9aefd6632a251.tar.xz
wireguard-linux-0f97fbd478587a4ac2d53a88e5a9aefd6632a251.zip
net: ipa: support more filtering endpoints
Prior to IPA v5.0, there could be no more than 32 endpoints. A filter table begins with a bitmap indicating which endpoints have a filter defined. That bitmap is currently assumed to fit in a 32-bit value. Starting with IPA v5.0, more than 32 endpoints are supported, so it's conceivable that a TX endpoint has an ID that exceeds 32. Increase the size of the field representing endpoints that support filtering to 64 bits. Rename the bitmap field "filtered". Unlike other similar fields, we do not use an (arbitrarily long) Linux bitmap for this purpose. The reason is that if a filter table ever *did* need to support more than 64 TX endpoints, its format would change in ways we can't anticipate. Have ipa_endpoint_init() return a negative errno rather than a mask that indicates which endpoints support filtering, and have that function assign the "filtered" field directly. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipa/ipa_endpoint.c')
-rw-r--r--drivers/net/ipa/ipa_endpoint.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index a7932e8d0b2b..03811871dc4a 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -1973,6 +1973,8 @@ void ipa_endpoint_exit(struct ipa *ipa)
{
u32 endpoint_id;
+ ipa->filtered = 0;
+
for_each_set_bit(endpoint_id, ipa->defined, ipa->endpoint_count)
ipa_endpoint_exit_one(&ipa->endpoint[endpoint_id]);
@@ -1984,25 +1986,25 @@ void ipa_endpoint_exit(struct ipa *ipa)
}
/* Returns a bitmask of endpoints that support filtering, or 0 on error */
-u32 ipa_endpoint_init(struct ipa *ipa, u32 count,
+int ipa_endpoint_init(struct ipa *ipa, u32 count,
const struct ipa_gsi_endpoint_data *data)
{
enum ipa_endpoint_name name;
- u32 filter_map;
+ u32 filtered;
BUILD_BUG_ON(!IPA_REPLENISH_BATCH);
/* Number of endpoints is one more than the maximum ID */
ipa->endpoint_count = ipa_endpoint_max(ipa, count, data) + 1;
if (!ipa->endpoint_count)
- return 0; /* Error */
+ return -EINVAL;
/* Initialize the defined endpoint bitmap */
ipa->defined = bitmap_zalloc(ipa->endpoint_count, GFP_KERNEL);
if (!ipa->defined)
- return 0; /* Error */
+ return -ENOMEM;
- filter_map = 0;
+ filtered = 0;
for (name = 0; name < count; name++, data++) {
if (ipa_gsi_endpoint_data_empty(data))
continue; /* Skip over empty slots */
@@ -2010,18 +2012,20 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count,
ipa_endpoint_init_one(ipa, name, data);
if (data->endpoint.filter_support)
- filter_map |= BIT(data->endpoint_id);
+ filtered |= BIT(data->endpoint_id);
if (data->ee_id == GSI_EE_MODEM && data->toward_ipa)
ipa->modem_tx_count++;
}
- if (!ipa_filter_map_valid(ipa, filter_map))
+ if (!ipa_filtered_valid(ipa, filtered))
goto err_endpoint_exit;
- return filter_map; /* Non-zero bitmask */
+ ipa->filtered = filtered;
+
+ return 0;
err_endpoint_exit:
ipa_endpoint_exit(ipa);
- return 0; /* Error */
+ return -EINVAL;
}