[dpdk-stable] patch 'net/iavf: fix virtual channel return' has been queued to LTS release 18.11.7

Kevin Traynor ktraynor at redhat.com
Fri Feb 7 16:12:33 CET 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/13/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/74937a80186a5f227181b303db51d4099124e53b

Thanks.

Kevin.

---
>From 74937a80186a5f227181b303db51d4099124e53b Mon Sep 17 00:00:00 2001
From: Yahui Cao <yahui.cao at intel.com>
Date: Tue, 24 Dec 2019 12:13:13 +0800
Subject: [PATCH] net/iavf: fix virtual channel return

[ upstream commit be5466e4e9cc547f7792f04bee1f1d593d8072b8 ]

In iavf_handle_virtchnl_msg(), it is not appropriate for _clear_cmd()
to be used as a notification to foreground thread. So introduce
_notify_cmd() to fix this error. In addition, since _notify_cmd()
contains rte_wmb(), rte_compiler_barrier() is not necessary.

Sending msg from VF to PF is mainly by calling iavf_execute_vf_cmd(),
the whole virtchnl msg process is like,

iavf_execute_vf_cmd() will call iavf_aq_send_msg_to_pf() to send
msg and then polling the cmd done flag as "if (vf->pend_cmd ==
VIRTCHNL_OP_UNKNOWN)"

When reply msg is returned by pf, iavf_handle_virtchnl_msg() in
isr will read msg return value by "vf->cmd_retval = msg_ret" and
immediately set the cmd done flag by calling _clear_cmd() to
notify the iavf_execute_vf_cmd().

iavf_execute_vf_cmd() find the cmd done flag is set and then
check whether command return value vf->cmd_retval is success or
not.

However _clear_cmd() also resets the vf->cmd_retval to success,
overwriting the actual return value which is used for diagnosis.
So iavf_execute_vf_cmd() will always find vf->cmd_retval is
success and then return success.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")

Signed-off-by: Yahui Cao <yahui.cao at intel.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye at intel.com>
---
 drivers/net/avf/avf.h       | 11 +++++++++++
 drivers/net/avf/avf_vchnl.c |  9 +++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/avf/avf.h b/drivers/net/avf/avf.h
index dcf8d1c727..bef66a258c 100644
--- a/drivers/net/avf/avf.h
+++ b/drivers/net/avf/avf.h
@@ -168,4 +168,15 @@ struct avf_cmd_info {
 };
 
+/* notify current command done. Only call in case execute
+ * _atomic_set_cmd successfully.
+ */
+static inline void
+_notify_cmd(struct avf_info *vf, uint32_t msg_ret)
+{
+	vf->cmd_retval = msg_ret;
+	rte_wmb();
+	vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
+}
+
 /* clear current command. Only call in case execute
  * _atomic_set_cmd successfully.
diff --git a/drivers/net/avf/avf_vchnl.c b/drivers/net/avf/avf_vchnl.c
index fd90cc2c34..276b406f91 100644
--- a/drivers/net/avf/avf_vchnl.c
+++ b/drivers/net/avf/avf_vchnl.c
@@ -211,10 +211,7 @@ avf_handle_virtchnl_msg(struct rte_eth_dev *dev)
 			} else {
 				/* read message and it's expected one */
-				if (msg_opc == vf->pend_cmd) {
-					vf->cmd_retval = msg_ret;
-					/* prevent compiler reordering */
-					rte_compiler_barrier();
-					_clear_cmd(vf);
-				} else
+				if (msg_opc == vf->pend_cmd)
+					_notify_cmd(vf, msg_ret);
+				else
 					PMD_DRV_LOG(ERR, "command mismatch,"
 						    "expect %u, get %u",
-- 
2.21.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-07 15:08:18.619862819 +0000
+++ 0021-net-iavf-fix-virtual-channel-return.patch	2020-02-07 15:08:17.530062737 +0000
@@ -1 +1 @@
-From be5466e4e9cc547f7792f04bee1f1d593d8072b8 Mon Sep 17 00:00:00 2001
+From 74937a80186a5f227181b303db51d4099124e53b Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit be5466e4e9cc547f7792f04bee1f1d593d8072b8 ]
+
@@ -33 +34,0 @@
-Cc: stable at dpdk.org
@@ -39,2 +40,2 @@
- drivers/net/iavf/iavf.h       | 11 +++++++++++
- drivers/net/iavf/iavf_vchnl.c |  9 +++------
+ drivers/net/avf/avf.h       | 11 +++++++++++
+ drivers/net/avf/avf_vchnl.c |  9 +++------
@@ -43,5 +44,5 @@
-diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
-index 77b7068939..9466808917 100644
---- a/drivers/net/iavf/iavf.h
-+++ b/drivers/net/iavf/iavf.h
-@@ -175,4 +175,15 @@ struct iavf_cmd_info {
+diff --git a/drivers/net/avf/avf.h b/drivers/net/avf/avf.h
+index dcf8d1c727..bef66a258c 100644
+--- a/drivers/net/avf/avf.h
++++ b/drivers/net/avf/avf.h
+@@ -168,4 +168,15 @@ struct avf_cmd_info {
@@ -54 +55 @@
-+_notify_cmd(struct iavf_info *vf, uint32_t msg_ret)
++_notify_cmd(struct avf_info *vf, uint32_t msg_ret)
@@ -63,5 +64,5 @@
-diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
-index bf87ab6115..303b515386 100644
---- a/drivers/net/iavf/iavf_vchnl.c
-+++ b/drivers/net/iavf/iavf_vchnl.c
-@@ -211,10 +211,7 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
+diff --git a/drivers/net/avf/avf_vchnl.c b/drivers/net/avf/avf_vchnl.c
+index fd90cc2c34..276b406f91 100644
+--- a/drivers/net/avf/avf_vchnl.c
++++ b/drivers/net/avf/avf_vchnl.c
+@@ -211,10 +211,7 @@ avf_handle_virtchnl_msg(struct rte_eth_dev *dev)



More information about the stable mailing list