From: Murphy Yang <murphyx.yang@intel.com>
To: stable@dpdk.org
Cc: Murphy Yang <murphyx.yang@intel.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>,
Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-stable] [PATCH 19.11] net/ice/base: add macro specifying max NVM offset
Date: Wed, 10 Mar 2021 09:13:09 +0000 [thread overview]
Message-ID: <20210310091309.86205-1-murphyx.yang@intel.com> (raw)
[ upstream commit 9f041a72140c480fed178a743b7d327cba1031e8 ]
The ice_aq_read_nvm function uses a somewhat weird construction for
verifying that the incoming offset is valid. Replace this construction
with a simple greater-than expression, and define the maximum value
(24bits) in the ice_adminq_cmd.h
By providing a macro, the check becomes more clear. Additionally the
maximum offset can be used in other locations.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/ice/base/ice_adminq_cmd.h | 3 ++-
drivers/net/ice/base/ice_nvm.c | 3 +--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h
index a99670d51e..c4128aafae 100644
--- a/drivers/net/ice/base/ice_adminq_cmd.h
+++ b/drivers/net/ice/base/ice_adminq_cmd.h
@@ -1672,8 +1672,9 @@ struct ice_aqc_sff_eeprom {
* NVM Shadow RAM Dump commands (direct 0x0707)
*/
struct ice_aqc_nvm {
+#define ICE_AQC_NVM_MAX_OFFSET 0xFFFFFF
__le16 offset_low;
- u8 offset_high;
+ u8 offset_high; /* For Write Activate offset_high is used as flags2 */
u8 cmd_flags;
#define ICE_AQC_NVM_LAST_CMD BIT(0)
#define ICE_AQC_NVM_PCIR_REQ BIT(0) /* Used by NVM Write reply */
diff --git a/drivers/net/ice/base/ice_nvm.c b/drivers/net/ice/base/ice_nvm.c
index 64fb92b8a5..3eb097f955 100644
--- a/drivers/net/ice/base/ice_nvm.c
+++ b/drivers/net/ice/base/ice_nvm.c
@@ -29,8 +29,7 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,
cmd = &desc.params.nvm;
- /* In offset the highest byte must be zeroed. */
- if (offset & 0xFF000000)
+ if (offset > ICE_AQC_NVM_MAX_OFFSET)
return ICE_ERR_PARAM;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_nvm_read);
--
2.17.1
reply other threads:[~2021-03-10 9:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210310091309.86205-1-murphyx.yang@intel.com \
--to=murphyx.yang@intel.com \
--cc=jacob.e.keller@intel.com \
--cc=paul.m.stillwell.jr@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=stable@dpdk.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;
as well as URLs for NNTP newsgroup(s).