From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3F77AA0542 for ; Fri, 7 Feb 2020 16:13:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A0A81C137; Fri, 7 Feb 2020 16:13:58 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 498F81C12A for ; Fri, 7 Feb 2020 16:13:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581088436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tfYMbf0TVMvg+Yrjr4ZoJattHYp4cz0s6YYWIYdCViE=; b=UebMJZzjFrd3kL4rqjNQVqHnQc6SkvIbL6tJTDw0ARpBM40KHbWi431F19as890wTd60oU iuuy9BmC67qRvY1kIAbdusZTkSBsixkC8dwhF9XUKcSlPuKHsjtQ1N82xLU7xEpZg92qbh RA67s/J5+4Ic9GdUTHw7KWNT0VRksk8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-398--OGHICBMPHCOXD9y3R9vtA-1; Fri, 07 Feb 2020 10:13:46 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E2D578010F6; Fri, 7 Feb 2020 15:13:44 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id A29FD10016DA; Fri, 7 Feb 2020 15:13:43 +0000 (UTC) From: Kevin Traynor To: Yahui Cao Cc: Qi Zhang , Xiaolong Ye , dpdk stable Date: Fri, 7 Feb 2020 15:12:33 +0000 Message-Id: <20200207151248.29804-21-ktraynor@redhat.com> In-Reply-To: <20200207151248.29804-1-ktraynor@redhat.com> References: <20200207151248.29804-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: -OGHICBMPHCOXD9y3R9vtA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'net/iavf: fix virtual channel return' has been queued to LTS release 18.11.7 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 rebasi= ng (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/74937a80186a5f2271= 81b303db51d4099124e53b Thanks. Kevin. --- >From 74937a80186a5f227181b303db51d4099124e53b Mon Sep 17 00:00:00 2001 From: Yahui Cao 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 =3D=3D 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 =3D 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 Acked-by: Qi Zhang Acked-by: Xiaolong Ye --- 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 { }; =20 +/* 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) +{ +=09vf->cmd_retval =3D msg_ret; +=09rte_wmb(); +=09vf->pend_cmd =3D 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) =09=09=09} else { =09=09=09=09/* read message and it's expected one */ -=09=09=09=09if (msg_opc =3D=3D vf->pend_cmd) { -=09=09=09=09=09vf->cmd_retval =3D msg_ret; -=09=09=09=09=09/* prevent compiler reordering */ -=09=09=09=09=09rte_compiler_barrier(); -=09=09=09=09=09_clear_cmd(vf); -=09=09=09=09} else +=09=09=09=09if (msg_opc =3D=3D vf->pend_cmd) +=09=09=09=09=09_notify_cmd(vf, msg_ret); +=09=09=09=09else =09=09=09=09=09PMD_DRV_LOG(ERR, "command mismatch," =09=09=09=09=09=09 "expect %u, get %u", --=20 2.21.1 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092020-02-07 15:08:18.619862819 +0000 +++ 0021-net-iavf-fix-virtual-channel-return.patch=092020-02-07 15:08:17.53= 0062737 +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@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)