From: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: anthony.l.nguyen@intel.com, netdev@vger.kernel.org,
Przemyslaw R Karpinski <przemyslaw.r.karpinski@intel.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Subject: [PATCH iwl-next v1 1/2] i40e: Add read alternate indirect command
Date: Fri, 12 Jan 2024 10:59:44 +0100 [thread overview]
Message-ID: <20240112095945.450590-2-jedrzej.jagielski@intel.com> (raw)
In-Reply-To: <20240112095945.450590-1-jedrzej.jagielski@intel.com>
From: Przemyslaw R Karpinski <przemyslaw.r.karpinski@intel.com>
Introduce implementation of 0x0903 Admin Queue command.
This indirect command reads a block of data from the alternate structure
of memory. The command defines the number of Dwords to be read and the
starting address inside the alternate structure.
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemyslaw R Karpinski <przemyslaw.r.karpinski@intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
---
.../net/ethernet/intel/i40e/i40e_adminq_cmd.h | 4 +-
drivers/net/ethernet/intel/i40e/i40e_common.c | 40 +++++++++++++++++++
.../net/ethernet/intel/i40e/i40e_prototype.h | 3 ++
3 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
index 18a1c3b6d72c..50785f7e6d08 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
@@ -1983,14 +1983,14 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write);
* Indirect read (indirect 0x0903)
*/
-struct i40e_aqc_alternate_ind_write {
+struct i40e_aqc_alternate_ind_read_write {
__le32 address;
__le32 length;
__le32 addr_high;
__le32 addr_low;
};
-I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_ind_write);
+I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_ind_read_write);
/* Done alternate write (direct 0x0904)
* uses i40e_aq_desc
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index de6ca6295742..93971c9c98cc 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -4375,6 +4375,46 @@ static int i40e_aq_alternate_read(struct i40e_hw *hw,
return status;
}
+/**
+ * i40e_aq_alternate_read_indirect
+ * @hw: pointer to the hardware structure
+ * @addr: address of the alternate structure field
+ * @dw_count: number of alternate structure fields to read
+ * @buffer: pointer to the command buffer
+ *
+ * Read 'dw_count' dwords from alternate structure starting at 'addr' and
+ * place them in 'buffer'. The buffer should be allocated by caller.
+ *
+ **/
+int i40e_aq_alternate_read_indirect(struct i40e_hw *hw, u32 addr, u32 dw_count,
+ void *buffer)
+{
+ struct i40e_aqc_alternate_ind_read_write *cmd_resp;
+ struct i40e_aq_desc desc;
+ int status;
+
+ if (!buffer)
+ return -EINVAL;
+
+ cmd_resp = (struct i40e_aqc_alternate_ind_read_write *)&desc.params.raw;
+
+ i40e_fill_default_direct_cmd_desc(&desc,
+ i40e_aqc_opc_alternate_read_indirect);
+
+ desc.flags |= cpu_to_le16(I40E_AQ_FLAG_RD);
+ desc.flags |= cpu_to_le16(I40E_AQ_FLAG_BUF);
+ if (dw_count > I40E_AQ_LARGE_BUF / 4)
+ desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
+
+ cmd_resp->address = cpu_to_le32(addr);
+ cmd_resp->length = cpu_to_le32(dw_count);
+
+ status = i40e_asq_send_command(hw, &desc, buffer,
+ lower_16_bits(4 * dw_count), NULL);
+
+ return status;
+}
+
/**
* i40e_aq_suspend_port_tx
* @hw: pointer to the hardware structure
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
index af4269330581..37c23a0bded6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
@@ -322,6 +322,9 @@ i40e_aq_rem_cloud_filters_bb(struct i40e_hw *hw, u16 seid,
u8 filter_count);
int i40e_read_lldp_cfg(struct i40e_hw *hw,
struct i40e_lldp_variables *lldp_cfg);
+
+int i40e_aq_alternate_read_indirect(struct i40e_hw *hw, u32 addr, u32 dw_count,
+ void *buffer);
int
i40e_aq_suspend_port_tx(struct i40e_hw *hw, u16 seid,
struct i40e_asq_cmd_details *cmd_details);
--
2.31.1
next prev parent reply other threads:[~2024-01-12 10:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 9:59 [PATCH iwl-next v1 0/2] i40e: Log FW state in recovery mode Jedrzej Jagielski
2024-01-12 9:59 ` Jedrzej Jagielski [this message]
2024-01-13 16:07 ` [PATCH iwl-next v1 1/2] i40e: Add read alternate indirect command Simon Horman
2024-01-12 9:59 ` [PATCH iwl-next v1 2/2] i40e-linux: Add support for reading Trace Buffer Jedrzej Jagielski
2024-01-12 12:49 ` Jiri Pirko
2024-01-15 10:37 ` Jagielski, Jedrzej
2024-01-15 14:06 ` Jiri Pirko
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=20240112095945.450590-2-jedrzej.jagielski@intel.com \
--to=jedrzej.jagielski@intel.com \
--cc=aleksandr.loktionov@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.r.karpinski@intel.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;
as well as URLs for NNTP newsgroup(s).