Skip to contentSkip to conversation

net/cpfl: fix a compiler issue about virtchnl opcode

PATCH Superseded Mingxia Liu 3 participants 5 messages Mar 9, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/cpfl: fix a compiler issue about virtchnl opcode

Comparing an enum virtchnl_ops variable with VIRTCHNL2_OP_EVENT will cause a compiler issue, as VIRTCHNL2_OP_EVENT is not included in enum virtchnl_ops. And the PMD uses virtual msg opcodes prefixed with virtchnl2 or VIRTCHNL2.

Fixes 20618563b81b ("net/cpfl: support device initialization")
---
 drivers/net/cpfl/cpfl_ethdev.c | 2 +-
 drivers/net/idpf/idpf_ethdev.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/cpfl/cpfl_ethdev.c +1 -1
index 0940bf1276..54261d5743 100644
@@ -1095,8 +1095,8 @@ cpfl_handle_virtchnl_msg(struct cpfl_adapter_ext *adapter)
 	struct idpf_ctlq_msg ctlq_msg;
 	enum idpf_mbx_opc mbx_op;
 	struct idpf_vport *vport;
-	enum virtchnl_ops vc_op;
 	uint16_t pending = 1;
+	uint32_t vc_op;
 	int ret;
 
 	while (pending) {
drivers/net/idpf/idpf_ethdev.c +1 -1
index db58157ba3..59883af8a8 100644
@@ -1058,8 +1058,8 @@ idpf_handle_virtchnl_msg(struct idpf_adapter_ext *adapter_ex)
 	struct idpf_ctlq_msg ctlq_msg;
 	enum idpf_mbx_opc mbx_op;
 	struct idpf_vport *vport;
-	enum virtchnl_ops vc_op;
 	uint16_t pending = 1;
+	enum virtchnl_ops vc_op;
 	int ret;
 
 	while (pending) {
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/1 net/cpfl: fix a compiler issue about virtchnl opcode

Comparing an enum virtchnl_ops variable with VIRTCHNL2_OP_EVENT will cause a compiler issue, as VIRTCHNL2_OP_EVENT is not included in enum virtchnl_ops. And the PMD uses virtual msg opcodes prefixed with virtchnl2 or VIRTCHNL2.

Fixes 20618563b81b ("net/cpfl: support device initialization")
---
 drivers/net/cpfl/cpfl_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +1 -1
index 0940bf1276..54261d5743 100644
@@ -1095,8 +1095,8 @@ cpfl_handle_virtchnl_msg(struct cpfl_adapter_ext *adapter)
 	struct idpf_ctlq_msg ctlq_msg;
 	enum idpf_mbx_opc mbx_op;
 	struct idpf_vport *vport;
-	enum virtchnl_ops vc_op;
 	uint16_t pending = 1;
+	uint32_t vc_op;
 	int ret;
 
 	while (pending) {
Signature · 1 line
2.34.1
Acked-by on v2 1/1 Applied
#2 lore raw
Quoted 7 lines · Mingxia Liu

Comparing an enum virtchnl_ops variable with VIRTCHNL2_OP_EVENT will cause a compiler issue, as VIRTCHNL2_OP_EVENT is not included in enum virtchnl_ops. And the PMD uses virtual msg opcodes prefixed with virtchnl2 or VIRTCHNL2.

Fixes 20618563b81b ("net/cpfl: support device initialization")
Fixes 2d823ecd671c ("net/cpfl: support device initialization")
Quoted 1 line

Applied to dpdk-next-net/main, thanks.

#3 lore raw
In reply to Mingxia Liu
Quoted 5 lines · On Thu, 9 Mar 2023 10:31:42 +0000 Mingxia Liu <[email protected]> wrote:

iff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index db58157ba3..59883af8a8 100644

drivers/net/idpf/idpf_ethdev.c idpf_handle_virtchnl_msg(struct idpf_adapter_ext *adapter_ex) · line 1065

Quoted 9 lines
drivers/net/idpf/idpf_ethdev.c +1 -1
@@ -1058,8 +1058,8 @@ idpf_handle_virtchnl_msg(struct idpf_adapter_ext *adapter_ex)
 	struct idpf_ctlq_msg ctlq_msg;
 	enum idpf_mbx_opc mbx_op;
 	struct idpf_vport *vport;
-	enum virtchnl_ops vc_op;
 	uint16_t pending = 1;
+	enum virtchnl_ops vc_op;
 	int ret;
 
 	while (pending) {

Why does order of declarations matter here?
Compilers are free to reorder this.

#4 lore raw
Quoted 27 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, March 9, 2023 10:42 AM
To: Liu, Mingxia <[email protected]>
Cc: [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH] net/cpfl: fix a compiler issue about virtchnl opcode

drivers/net/idpf/idpf_ethdev.c idpf_handle_virtchnl_msg(struct idpf_adapter_ext

Quoted 5 lines · On Thu, 9 Mar 2023 10:31:42 +0000 Mingxia Liu <[email protected]> wrote:

iff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index db58157ba3..59883af8a8 100644

drivers/net/idpf/idpf_ethdev.c +0 -0
@@ -1058,8 +1058,8 @@ idpf_handle_virtchnl_msg(struct idpf_adapter_ext

*adapter_ex)

Quoted 8 lines
drivers/net/idpf/idpf_ethdev.c +1 -1
 	struct idpf_ctlq_msg ctlq_msg;
 	enum idpf_mbx_opc mbx_op;
 	struct idpf_vport *vport;
-	enum virtchnl_ops vc_op;
 	uint16_t pending = 1;
+	enum virtchnl_ops vc_op;
 	int ret;
 
Quoted 5 lines

drivers/net/idpf/idpf_ethdev.c idpf_handle_virtchnl_msg(struct idpf_adapter_ext · line 1065

Quoted 1 line
drivers/net/idpf/idpf_ethdev.c +0 -0
 	while (pending) {

Why does order of declarations matter here? Compilers are free to reorder this.

[Liu, Mingxia] Unused changes, v2 was sent.