[08/18] common/idpf: swap opcode and retval location in msg struct

Message ID 20230413094502.1714755-9-wenjing.qiao@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series update idpf shared code |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Wenjing Qiao April 13, 2023, 9:44 a.m. UTC
  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@intel.com>
Signed-off-by: Wenjing Qiao <wenjing.qiao@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(-)
  

Patch

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 {