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 7A4F7A051C for ; Tue, 11 Feb 2020 12:25:16 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 711C02B9C; Tue, 11 Feb 2020 12:25:16 +0100 (CET) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by dpdk.org (Postfix) with ESMTP id 5904C1BFA9 for ; Tue, 11 Feb 2020 12:25:15 +0100 (CET) Received: by mail-wm1-f53.google.com with SMTP id t23so3034256wmi.1 for ; Tue, 11 Feb 2020 03:25:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LsrTVrj6/KazZ7pMYhuUaDXUF3UuubKSiXxH67zdY8U=; b=qIfkyyLFGYTK1+u4gtzb56BB5QvFoGnP4rHffbEFPV2mv9Ln8882PKrWZD8H9QX526 Rhzn6gET7qBtPJf4Xl61BVFWfyA54CGvJZqytOSH5+aaCOZ636zOAu7LO9kdVLAktcvQ 2llMS9Mh+ZE/aL4E52ZiMjsCVS1i8JNHh//c09koIu3AIwUVYGB4dgRzPZxIkaZ2pCx4 5D91gZiLVPVO0jqm5oZdaJIYFp13S+Q4fTOjnZJoaVzDdBeO76JwEyZUHTTCJBG0J8vT iynF4NkNw8C9AU2LLpT3mNNa6jWh1BLy/nyvi7AhARHmBFZpUeFvO2ic24khy9/lhE+v iwuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LsrTVrj6/KazZ7pMYhuUaDXUF3UuubKSiXxH67zdY8U=; b=eTGjDLbEU7y3pJoL+vkfVq/5iYPDon8N62pZOnzYoCdUrQKf/sW5lsO98pK3lSAofG HjXU3T8D/ssM9Pkk2/3oRSiTu3r+sef0abJ1neex/vhY4k9tHVInrIYVuLPlaEShWi0V w77ZmJK7c6E0FqQu/GMmsEdVcOqcUHxXpw+hUC9f4IF9NEQsYgnG3NXUI4zm+nWXSLhs qY6eUdBLk4RrHNYSRQFkcxOMF//yrC+l+F1l7EcCySNeLJDbPqHfxxc67U6q9j29Cnue GvzDw/PrZ9oDnOCfs7kT8sqz0Rg3nj1RUx1nqbqvphSsEwRXQuiy1ZQMGXRKhTDOuuv2 4eEg== X-Gm-Message-State: APjAAAVezjZabSXvKnBtFadx5z193S1m/T5KzDENZd7WwfBMPgFoblwK foGUVfLR9h+0J6yrQnF01Cc= X-Google-Smtp-Source: APXvYqzmzOOdpjX0DezkkscJW/uvdnGHXAqqFcewuRz0C2VXvDW8O3fKzhhoZsAigX36RACuffyWBA== X-Received: by 2002:a1c:7205:: with SMTP id n5mr5359794wmc.9.1581420314984; Tue, 11 Feb 2020 03:25:14 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id a9sm3224574wmm.15.2020.02.11.03.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:25:14 -0800 (PST) From: luca.boccassi@gmail.com To: Yahui Cao Cc: Qi Zhang , Xiaolong Ye , dpdk stable Date: Tue, 11 Feb 2020 11:19:54 +0000 Message-Id: <20200211112216.3929-48-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/iavf: fix virtual channel return' has been queued to stable release 19.11.1 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 stable release 19.11.1 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. Thanks. Luca Boccassi --- >From 5a7217b86939c81d21f4cd749ec4f12c7a22c777 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 == 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 Acked-by: Qi Zhang Acked-by: Xiaolong Ye --- drivers/net/iavf/iavf.h | 11 +++++++++++ drivers/net/iavf/iavf_vchnl.c | 9 +++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index bbd4d75d00..84f8213542 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -173,6 +173,17 @@ struct iavf_cmd_info { uint32_t out_size; /* buffer size for response */ }; +/* notify current command done. Only call in case execute + * _atomic_set_cmd successfully. + */ +static inline void +_notify_cmd(struct iavf_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/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 14395fed31..cf0f6458ed 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -210,12 +210,9 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev) info.msg_len); } 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", vf->pend_cmd, msg_opc); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:40.759074450 +0000 +++ 0048-net-iavf-fix-virtual-channel-return.patch 2020-02-11 11:17:38.400001347 +0000 @@ -1,8 +1,10 @@ -From be5466e4e9cc547f7792f04bee1f1d593d8072b8 Mon Sep 17 00:00:00 2001 +From 5a7217b86939c81d21f4cd749ec4f12c7a22c777 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() @@ -30,7 +32,6 @@ success and then return success. Fixes: 22b123a36d07 ("net/avf: initialize PMD") -Cc: stable@dpdk.org Signed-off-by: Yahui Cao Acked-by: Qi Zhang @@ -41,10 +42,10 @@ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h -index 77b7068939..9466808917 100644 +index bbd4d75d00..84f8213542 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h -@@ -174,6 +174,17 @@ struct iavf_cmd_info { +@@ -173,6 +173,17 @@ struct iavf_cmd_info { uint32_t out_size; /* buffer size for response */ }; @@ -63,7 +64,7 @@ * _atomic_set_cmd successfully. */ diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c -index bf87ab6115..303b515386 100644 +index 14395fed31..cf0f6458ed 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -210,12 +210,9 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)