[PATCH 08/18] common/idpf: swap opcode and retval location in msg struct
Wenjing Qiao
wenjing.qiao at intel.com
Thu Apr 13 11:44:52 CEST 2023
To make the code more readable and make it clearer that the opcode goes
in cookie_high and retval goes in cookie_low.
Add macro definitions for filling opcode and retval.
Signed-off-by: Charles Stoll <charles.stoll at intel.com>
Signed-off-by: Wenjing Qiao <wenjing.qiao at intel.com>
---
drivers/common/idpf/base/idpf_controlq.c | 2 ++
drivers/common/idpf/base/idpf_controlq_api.h | 6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/common/idpf/base/idpf_controlq.c b/drivers/common/idpf/base/idpf_controlq.c
index 8e4d3ee54f..8381e4000f 100644
--- a/drivers/common/idpf/base/idpf_controlq.c
+++ b/drivers/common/idpf/base/idpf_controlq.c
@@ -288,6 +288,8 @@ int idpf_ctlq_deinit(struct idpf_hw *hw)
* send routine via the q_msg struct / control queue specific data struct.
* The control queue will hold a reference to each send message until
* the completion for that message has been cleaned.
+ * Since all q_msgs being sent are store in native endianness, these values
+ * must be converted to LE before being written to the hw descriptor.
*/
int idpf_ctlq_send(struct idpf_hw *hw, struct idpf_ctlq_info *cq,
u16 num_q_msg, struct idpf_ctlq_msg q_msg[])
diff --git a/drivers/common/idpf/base/idpf_controlq_api.h b/drivers/common/idpf/base/idpf_controlq_api.h
index 32d17baadf..80be282b42 100644
--- a/drivers/common/idpf/base/idpf_controlq_api.h
+++ b/drivers/common/idpf/base/idpf_controlq_api.h
@@ -63,9 +63,13 @@ struct idpf_ctlq_msg {
u16 status; /* when receiving a message */
};
union {
+#ifndef __KERNEL__
+#define FILL_OPCODE_V1(msg, opcode) ((msg).cookie.cfg.mbx.chnl_opcode = opcode)
+#define FILL_RETVAL_V1(msg, retval) ((msg).cookie.cfg.mbx.chnl_retval = retval)
+#endif /* __KERNEL__ */
struct {
- u32 chnl_retval;
u32 chnl_opcode;
+ u32 chnl_retval;
} mbx;
} cookie;
union {
--
2.25.1
More information about the dev
mailing list