diff options
author | Alex Elder <elder@linaro.org> | 2022-10-25 14:51:43 -0500 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2022-10-27 13:38:13 +0200 |
commit | f787d84830152be76b76470ac865d2033285c2d9 (patch) | |
tree | c33bde78d4dd627559ef856494327761aba4e914 /drivers/net/ipa/ipa_cmd.c | |
parent | 8defab8bdfb1d0dc4e4e3c687cfde33b596896f7 (diff) | |
download | lwn-f787d84830152be76b76470ac865d2033285c2d9.tar.gz lwn-f787d84830152be76b76470ac865d2033285c2d9.zip |
net: ipa: determine filter table size from memory region
Currently we assume that any filter table contains a fixed number
of entries. Like routing tables, the number of entries in a filter
table is limited only by the size of the IPA-local memory region
used to hold the table.
Stop assuming that a filter table has exactly 14 entries. Instead,
determine the number of entries in a routing table by dividing its
memory region size by the size of an entry. (Note that the first
"entry" in a filter table contains an endpoint bitmap.)
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ipa/ipa_cmd.c')
-rw-r--r-- | drivers/net/ipa/ipa_cmd.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index 08e3f395a945..bb3dfa9a2bc8 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -151,11 +151,6 @@ static void ipa_cmd_validate_build(void) * maximum size. IPv4 and IPv6 filter tables have the same number * of entries. */ -#define TABLE_SIZE (IPA_FILTER_COUNT_MAX * sizeof(__le64)) - BUILD_BUG_ON(TABLE_SIZE > field_max(IP_FLTRT_FLAGS_HASH_SIZE_FMASK)); - BUILD_BUG_ON(TABLE_SIZE > field_max(IP_FLTRT_FLAGS_NHASH_SIZE_FMASK)); -#undef TABLE_SIZE - /* Hashed and non-hashed fields are assumed to be the same size */ BUILD_BUG_ON(field_max(IP_FLTRT_FLAGS_HASH_SIZE_FMASK) != field_max(IP_FLTRT_FLAGS_NHASH_SIZE_FMASK)); @@ -177,7 +172,8 @@ bool ipa_cmd_table_init_valid(struct ipa *ipa, const struct ipa_mem *mem, struct device *dev = &ipa->pdev->dev; u32 size; - size = route ? ipa->route_count * sizeof(__le64) : mem->size; + size = route ? ipa->route_count : ipa->filter_count + 1; + size *= sizeof(__le64); /* Size must fit in the immediate command field that holds it */ if (size > size_max) { |