From: Alex Elder <elder@linaro.org>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: caleb.connolly@linaro.org, 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 4/9] net: ipa: tighten up IPA register validity checking
Date: Wed, 8 Feb 2023 14:56:48 -0600 [thread overview]
Message-ID: <20230208205653.177700-5-elder@linaro.org> (raw)
In-Reply-To: <20230208205653.177700-1-elder@linaro.org>
When checking the validity of an IPA register ID, compare it against
all possible ipa_reg_id values.
Rename the function ipa_reg_id_valid() to be specific about what's
being checked.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_reg.c | 49 +++++++++++++++++++++++++++++++++++----
1 file changed, 45 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ipa/ipa_reg.c b/drivers/net/ipa/ipa_reg.c
index d3d05420c5e91..65d747200be3c 100644
--- a/drivers/net/ipa/ipa_reg.c
+++ b/drivers/net/ipa/ipa_reg.c
@@ -9,8 +9,8 @@
#include "ipa.h"
#include "ipa_reg.h"
-/* Is this register valid and defined for the current IPA version? */
-static bool ipa_reg_valid(struct ipa *ipa, enum ipa_reg_id reg_id)
+/* Is this register ID valid for the current IPA version? */
+static bool ipa_reg_id_valid(struct ipa *ipa, enum ipa_reg_id reg_id)
{
enum ipa_version version = ipa->version;
bool valid;
@@ -57,8 +57,49 @@ static bool ipa_reg_valid(struct ipa *ipa, enum ipa_reg_id reg_id)
valid = version >= IPA_VERSION_3_1;
break;
+ case COMP_CFG:
+ case CLKON_CFG:
+ case ROUTE:
+ case SHARED_MEM_SIZE:
+ case QSB_MAX_WRITES:
+ case QSB_MAX_READS:
+ case FILT_ROUT_HASH_EN:
+ case FILT_ROUT_CACHE_CFG:
+ case FILT_ROUT_HASH_FLUSH:
+ case FILT_ROUT_CACHE_FLUSH:
+ case STATE_AGGR_ACTIVE:
+ case LOCAL_PKT_PROC_CNTXT:
+ case AGGR_FORCE_CLOSE:
+ case SRC_RSRC_GRP_01_RSRC_TYPE:
+ case SRC_RSRC_GRP_23_RSRC_TYPE:
+ case DST_RSRC_GRP_01_RSRC_TYPE:
+ case DST_RSRC_GRP_23_RSRC_TYPE:
+ case ENDP_INIT_CTRL:
+ case ENDP_INIT_CFG:
+ case ENDP_INIT_NAT:
+ case ENDP_INIT_HDR:
+ case ENDP_INIT_HDR_EXT:
+ case ENDP_INIT_HDR_METADATA_MASK:
+ case ENDP_INIT_MODE:
+ case ENDP_INIT_AGGR:
+ case ENDP_INIT_HOL_BLOCK_EN:
+ case ENDP_INIT_HOL_BLOCK_TIMER:
+ case ENDP_INIT_DEAGGR:
+ case ENDP_INIT_RSRC_GRP:
+ case ENDP_INIT_SEQ:
+ case ENDP_STATUS:
+ case ENDP_FILTER_CACHE_CFG:
+ case ENDP_ROUTER_CACHE_CFG:
+ case IPA_IRQ_STTS:
+ case IPA_IRQ_EN:
+ case IPA_IRQ_CLR:
+ case IPA_IRQ_UC:
+ case IRQ_SUSPEND_INFO:
+ valid = true; /* These should be defined for all versions */
+ break;
+
default:
- valid = true; /* Others should be defined for all versions */
+ valid = false;
break;
}
@@ -69,7 +110,7 @@ static bool ipa_reg_valid(struct ipa *ipa, enum ipa_reg_id reg_id)
const struct ipa_reg *ipa_reg(struct ipa *ipa, enum ipa_reg_id reg_id)
{
- if (WARN_ON(!ipa_reg_valid(ipa, reg_id)))
+ if (WARN_ON(!ipa_reg_id_valid(ipa, reg_id)))
return NULL;
return ipa->regs->reg[reg_id];
--
2.34.1
next prev parent reply other threads:[~2023-02-08 20:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 20:56 [PATCH net-next 0/9] net: ipa: prepare for GSI register updtaes Alex Elder
2023-02-08 20:56 ` [PATCH net-next 1/9] net: ipa: generic command param fix Alex Elder
2023-02-08 20:56 ` [PATCH net-next 2/9] net: ipa: get rid of ipa->reg_addr Alex Elder
2023-02-08 20:56 ` [PATCH net-next 3/9] net: ipa: add some new IPA versions Alex Elder
2023-02-08 20:56 ` Alex Elder [this message]
2023-02-08 20:56 ` [PATCH net-next 5/9] net: ipa: use bitmasks for GSI IRQ values Alex Elder
2023-02-08 20:56 ` [PATCH net-next 6/9] net: ipa: GSI register cleanup Alex Elder
2023-02-08 20:56 ` [PATCH net-next 7/9] net: ipa: start generalizing "ipa_reg" Alex Elder
2023-02-08 20:56 ` [PATCH net-next 8/9] net: ipa: generalize register offset functions Alex Elder
2023-02-08 20:56 ` [PATCH net-next 9/9] net: ipa: generalize register field functions Alex Elder
2023-02-10 8:50 ` [PATCH net-next 0/9] net: ipa: prepare for GSI register updtaes 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=20230208205653.177700-5-elder@linaro.org \
--to=elder@linaro.org \
--cc=andersson@kernel.org \
--cc=caleb.connolly@linaro.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