Skip to contentSkip to conversation

net/idpf: fix compiling error in CentOS 7

PATCH Superseded [email protected] 3 participants 4 messages Nov 1, 2022 – Nov 2, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/idpf: fix compiling error in CentOS 7

From: Beilei Xing <[email protected]>

There's build error with clang 3.4.2 in CentOS 7:

drivers/net/idpf/idpf_vchnl.c:141:13: error: comparison of constant 522 with expression of type 'enum virtchnl_ops' is always false [-Werror,-Wtautological-constant-out-of-range-compare]

Fixed the compiling error in the patch.

Fixes 549343c25db8 ("net/idpf: support device initialization")
---
 drivers/net/idpf/idpf_vchnl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/idpf/idpf_vchnl.c +3 -3
index 00ac5b2a6b..ac6486d4ef 100644
@@ -55,7 +55,7 @@ idpf_vc_clean(struct idpf_adapter *adapter)
 }
 
 static int
-idpf_send_vc_msg(struct idpf_adapter *adapter, enum virtchnl_ops op,
+idpf_send_vc_msg(struct idpf_adapter *adapter, uint32_t op,
 		 uint16_t msg_size, uint8_t *msg)
 {
 	struct idpf_ctlq_msg *ctlq_msg;
@@ -118,7 +118,7 @@ idpf_read_msg_from_cp(struct idpf_adapter *adapter, uint16_t buf_len,
 	struct idpf_ctlq_msg ctlq_msg;
 	struct idpf_dma_mem *dma_mem = NULL;
 	enum idpf_vc_result result = IDPF_MSG_NON;
-	enum virtchnl_ops opcode;
+	uint32_t opcode;
 	uint16_t pending = 1;
 	int ret;
 
@@ -132,7 +132,7 @@ idpf_read_msg_from_cp(struct idpf_adapter *adapter, uint16_t buf_len,
 
 	rte_memcpy(buf, ctlq_msg.ctx.indirect.payload->va, buf_len);
 
-	opcode = (enum virtchnl_ops)rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_opcode);
+	opcode = rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_opcode);
 	adapter->cmd_retval =
 		(enum virtchnl_status_code)rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_retval);
 
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/1 net/idpf: fix compiling error in CentOS 7

From: Beilei Xing <[email protected]>

There's build error with clang 3.4.2 in CentOS 7:

drivers/net/idpf/idpf_vchnl.c:141:13: error: comparison of constant 522 with expression of type 'enum virtchnl_ops' is always false [-Werror,-Wtautological-constant-out-of-range-compare]

Fixed the compiling error in the patch.

Fixes 549343c25db8 ("net/idpf: support device initialization")

---

v2 change: modify enum virtchnl_ops with uint32_t in header file.

 drivers/net/idpf/idpf_ethdev.h | 10 +++++-----
 drivers/net/idpf/idpf_vchnl.c  |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/idpf/idpf_ethdev.h +5 -5
index ccdf4abe40..1efdfe4ce0 100644
@@ -137,7 +137,7 @@ struct idpf_adapter {
 	struct virtchnl2_version_info virtchnl_version;
 	struct virtchnl2_get_capabilities *caps;
 
-	volatile enum virtchnl_ops pend_cmd; /* pending command not finished */
+	volatile uint32_t pend_cmd; /* pending command not finished */
 	uint32_t cmd_retval; /* return value of the cmd response from ipf */
 	uint8_t *mbx_resp; /* buffer to store the mailbox response from ipf */
 
@@ -195,7 +195,7 @@ notify_cmd(struct idpf_adapter *adapter, int msg_ret)
 	adapter->cmd_retval = msg_ret;
 	/* Return value may be checked in anither thread, need to ensure the coherence. */
 	rte_wmb();
-	adapter->pend_cmd = VIRTCHNL_OP_UNKNOWN;
+	adapter->pend_cmd = VIRTCHNL2_OP_UNKNOWN;
 }
 
 /* clear current command. Only call in case execute
@@ -206,15 +206,15 @@ clear_cmd(struct idpf_adapter *adapter)
 {
 	/* Return value may be checked in anither thread, need to ensure the coherence. */
 	rte_wmb();
-	adapter->pend_cmd = VIRTCHNL_OP_UNKNOWN;
+	adapter->pend_cmd = VIRTCHNL2_OP_UNKNOWN;
 	adapter->cmd_retval = VIRTCHNL_STATUS_SUCCESS;
 }
 
 /* Check there is pending cmd in execution. If none, set new command. */
 static inline bool
-atomic_set_cmd(struct idpf_adapter *adapter, enum virtchnl_ops ops)
+atomic_set_cmd(struct idpf_adapter *adapter, uint32_t ops)
 {
-	enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
+	uint32_t op_unk = VIRTCHNL2_OP_UNKNOWN;
 	bool ret = __atomic_compare_exchange(&adapter->pend_cmd, &op_unk, &ops,
 					    0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
 
drivers/net/idpf/idpf_vchnl.c +3 -3
index 00ac5b2a6b..ac6486d4ef 100644
@@ -55,7 +55,7 @@ idpf_vc_clean(struct idpf_adapter *adapter)
 }
 
 static int
-idpf_send_vc_msg(struct idpf_adapter *adapter, enum virtchnl_ops op,
+idpf_send_vc_msg(struct idpf_adapter *adapter, uint32_t op,
 		 uint16_t msg_size, uint8_t *msg)
 {
 	struct idpf_ctlq_msg *ctlq_msg;
@@ -118,7 +118,7 @@ idpf_read_msg_from_cp(struct idpf_adapter *adapter, uint16_t buf_len,
 	struct idpf_ctlq_msg ctlq_msg;
 	struct idpf_dma_mem *dma_mem = NULL;
 	enum idpf_vc_result result = IDPF_MSG_NON;
-	enum virtchnl_ops opcode;
+	uint32_t opcode;
 	uint16_t pending = 1;
 	int ret;
 
@@ -132,7 +132,7 @@ idpf_read_msg_from_cp(struct idpf_adapter *adapter, uint16_t buf_len,
 
 	rte_memcpy(buf, ctlq_msg.ctx.indirect.payload->va, buf_len);
 
-	opcode = (enum virtchnl_ops)rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_opcode);
+	opcode = rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_opcode);
 	adapter->cmd_retval =
 		(enum virtchnl_status_code)rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_retval);
 
Signature · 1 line
2.26.2
Tested-by on v2 1/1
#2 lore raw
Quoted 15 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, November 1, 2022 4:44 AM
To: [email protected]
Cc: [email protected]; Beilei Xing <[email protected]>
Subject: [PATCH v2] net/idpf: fix compiling error in CentOS 7

From: Beilei Xing <[email protected]>

There's build error with clang 3.4.2 in CentOS 7:

drivers/net/idpf/idpf_vchnl.c:141:13: error: comparison of constant 522 with expression of type 'enum virtchnl_ops' is always false [-Werror,-Wtautological-constant-out-of-range-compare]

Quoted 7 lines

Fixed the compiling error in the patch.

Fixes 549343c25db8 ("net/idpf: support device initialization")

---

Verified compilation now passes, thanks Beilei.

Applied
#3 lore raw
Quoted 28 lines

-----Original Message-----
From: Ali Alnubani <[email protected]>
Sent: Tuesday, November 1, 2022 3:39 PM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH v2] net/idpf: fix compiling error in CentOS 7

Quoted 19 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, November 1, 2022 4:44 AM
To: [email protected]
Cc: [email protected]; Beilei Xing <[email protected]>
Subject: [PATCH v2] net/idpf: fix compiling error in CentOS 7

From: Beilei Xing <[email protected]>

There's build error with clang 3.4.2 in CentOS 7:

drivers/net/idpf/idpf_vchnl.c:141:13: error: comparison of constant 522 with expression of type 'enum virtchnl_ops' is always false [-Werror,-Wtautological-constant-out-of-range-compare]

Fixed the compiling error in the patch.

Fixes 549343c25db8 ("net/idpf: support device initialization")
Quoted 7 lines
Quoted 3 lines

---

Verified compilation now passes, thanks Beilei.

Applied to dpdk-next-net-intel.

Thanks
Qi