From: Alex Elder <elder@ieee.org>
To: Alexander Duyck <alexander.duyck@gmail.com>,
Alex Elder <elder@linaro.org>
Cc: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
elder@kernel.org, evgreen@chromium.org,
bjorn.andersson@linaro.org, cpratapa@codeaurora.org,
Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>,
Netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 net-next 4/5] net: ipa: introduce ipa_table_hash_support()
Date: Fri, 12 Feb 2021 19:35:50 -0600 [thread overview]
Message-ID: <fdf0f89d-a5f3-7240-514d-b56194e8a438@ieee.org> (raw)
In-Reply-To: <CAKgT0Ue7x9M9qyLffeXDLv0D3gnFzimAbd==5A_t0r3WpxMgcQ@mail.gmail.com>
On 2/12/21 7:05 PM, Alexander Duyck wrote:
> On Fri, Feb 12, 2021 at 6:40 AM Alex Elder <elder@linaro.org> wrote:
>>
>> Introduce a new function to abstract the knowledge of whether hashed
>> routing and filter tables are supported for a given IPA instance.
>>
>> IPA v4.2 is the only one that doesn't support hashed tables (now
>> and for the foreseeable future), but the name of the helper function
>> is better for explaining what's going on.
>>
>> Signed-off-by: Alex Elder <elder@linaro.org>
>> ---
>> v2: - Update copyrights.
>>
>> drivers/net/ipa/ipa_cmd.c | 2 +-
>> drivers/net/ipa/ipa_table.c | 16 +++++++++-------
>> drivers/net/ipa/ipa_table.h | 8 +++++++-
>> 3 files changed, 17 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c
>> index fd8bf6468d313..35e35852c25c5 100644
>> --- a/drivers/net/ipa/ipa_cmd.c
>> +++ b/drivers/net/ipa/ipa_cmd.c
>> @@ -268,7 +268,7 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa)
>> /* If hashed tables are supported, ensure the hash flush register
>> * offset will fit in a register write IPA immediate command.
>> */
>> - if (ipa->version != IPA_VERSION_4_2) {
>> + if (ipa_table_hash_support(ipa)) {
>> offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version);
>> name = "filter/route hash flush";
>> if (!ipa_cmd_register_write_offset_valid(ipa, name, offset))
>> diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c
>> index 32e2d3e052d55..baaab3dd0e63c 100644
>> --- a/drivers/net/ipa/ipa_table.c
>> +++ b/drivers/net/ipa/ipa_table.c
>> @@ -1,7 +1,7 @@
>> // SPDX-License-Identifier: GPL-2.0
>>
>> /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
>> - * Copyright (C) 2018-2020 Linaro Ltd.
>> + * Copyright (C) 2018-2021 Linaro Ltd.
>> */
>>
>> #include <linux/types.h>
>> @@ -239,6 +239,11 @@ static void ipa_table_validate_build(void)
>>
>> #endif /* !IPA_VALIDATE */
>>
>> +bool ipa_table_hash_support(struct ipa *ipa)
>> +{
>> + return ipa->version != IPA_VERSION_4_2;
>> +}
>> +
>
> Since this is only a single comparison it might make more sense to
> make this a static inline and place it in ipa.h. Otherwise you are
> just bloating the code up to jump to such a small function.
Static inline will duplicate the function everywhere also,
"bloating" it in another way (but it's a fairly trivial
amount of code either way).
Nevertheless I agree with your sentiment. It's moot now
because the series was just accepted, but I'll keep it
in mind.
Thanks for your input.
-Alex
>> /* Zero entry count means no table, so just return a 0 address */
>> static dma_addr_t ipa_table_addr(struct ipa *ipa, bool filter_mask, u16 count)
>> {
>> @@ -412,8 +417,7 @@ int ipa_table_hash_flush(struct ipa *ipa)
>> struct gsi_trans *trans;
>> u32 val;
>>
>> - /* IPA version 4.2 does not support hashed tables */
>> - if (ipa->version == IPA_VERSION_4_2)
>> + if (!ipa_table_hash_support(ipa))
>> return 0;
>>
>> trans = ipa_cmd_trans_alloc(ipa, 1);
>> @@ -531,8 +535,7 @@ static void ipa_filter_config(struct ipa *ipa, bool modem)
>> enum gsi_ee_id ee_id = modem ? GSI_EE_MODEM : GSI_EE_AP;
>> u32 ep_mask = ipa->filter_map;
>>
>> - /* IPA version 4.2 has no hashed route tables */
>> - if (ipa->version == IPA_VERSION_4_2)
>> + if (!ipa_table_hash_support(ipa))
>> return;
>>
>> while (ep_mask) {
>> @@ -582,8 +585,7 @@ static void ipa_route_config(struct ipa *ipa, bool modem)
>> {
>> u32 route_id;
>>
>> - /* IPA version 4.2 has no hashed route tables */
>> - if (ipa->version == IPA_VERSION_4_2)
>> + if (!ipa_table_hash_support(ipa))
>> return;
>>
>> for (route_id = 0; route_id < IPA_ROUTE_COUNT_MAX; route_id++)
>> diff --git a/drivers/net/ipa/ipa_table.h b/drivers/net/ipa/ipa_table.h
>> index 78038d14fcea9..1a68d20f19d6a 100644
>> --- a/drivers/net/ipa/ipa_table.h
>> +++ b/drivers/net/ipa/ipa_table.h
>> @@ -1,7 +1,7 @@
>> /* SPDX-License-Identifier: GPL-2.0 */
>>
>> /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
>> - * Copyright (C) 2019-2020 Linaro Ltd.
>> + * Copyright (C) 2019-2021 Linaro Ltd.
>> */
>> #ifndef _IPA_TABLE_H_
>> #define _IPA_TABLE_H_
>> @@ -51,6 +51,12 @@ static inline bool ipa_filter_map_valid(struct ipa *ipa, u32 filter_mask)
>>
>> #endif /* !IPA_VALIDATE */
>>
>> +/**
>> + * ipa_table_hash_support() - Return true if hashed tables are supported
>> + * @ipa: IPA pointer
>> + */
>> +bool ipa_table_hash_support(struct ipa *ipa);
>> +
>> /**
>> * ipa_table_reset() - Reset filter and route tables entries to "none"
>> * @ipa: IPA pointer
>
> Just define the function here and make it a static inline.
>
next prev parent reply other threads:[~2021-02-13 1:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 14:33 [PATCH v3 net-next 0/5] net: ipa: some more cleanup Alex Elder
2021-02-12 14:33 ` [PATCH v3 net-next 1/5] net: ipa: use a separate pointer for adjusted GSI memory Alex Elder
2021-02-12 14:33 ` [PATCH v3 net-next 2/5] net: ipa: use dev_err_probe() in ipa_clock.c Alex Elder
2021-02-12 14:34 ` [PATCH v3 net-next 3/5] net: ipa: fix register write command validation Alex Elder
2021-02-12 14:34 ` [PATCH v3 net-next 4/5] net: ipa: introduce ipa_table_hash_support() Alex Elder
2021-02-13 1:05 ` Alexander Duyck
2021-02-13 1:35 ` Alex Elder [this message]
2021-02-12 14:34 ` [PATCH v3 net-next 5/5] net: ipa: introduce gsi_channel_initialized() Alex Elder
2021-02-13 1:00 ` [PATCH v3 net-next 0/5] net: ipa: some more cleanup 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=fdf0f89d-a5f3-7240-514d-b56194e8a438@ieee.org \
--to=elder@ieee.org \
--cc=alexander.duyck@gmail.com \
--cc=bjorn.andersson@linaro.org \
--cc=cpratapa@codeaurora.org \
--cc=davem@davemloft.net \
--cc=elder@kernel.org \
--cc=elder@linaro.org \
--cc=evgreen@chromium.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®