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 94037A04DD for ; Wed, 28 Oct 2020 11:50:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8C4BA2C2A; Wed, 28 Oct 2020 11:50:16 +0100 (CET) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by dpdk.org (Postfix) with ESMTP id 3BF602C2A for ; Wed, 28 Oct 2020 11:50:14 +0100 (CET) Received: by mail-wm1-f51.google.com with SMTP id e2so4300001wme.1 for ; Wed, 28 Oct 2020 03:50:14 -0700 (PDT) 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=rHfs5FxGPUjmxGfV5O9uVZbPv7z2ZeCip8VpOpWF7Ns=; b=qCMLr0lNnkDqdxByJq4GMwlvL5rmbo2YzsYF9mjISeXlPgLaHO5Y3J7wttmmlFOxNV XipW+9VwFG1Uu1cJVJX86lk79mwiTrhmxIdNI1cziGrMeO90Y1PRAyV+7qWukBhRQOac UCfKK/EUM24uZyghpCv1G4EE4tTLCeslS78wNUje+r/wSxgGR7Rqf+l3fsJxVb9y6Ws/ +8+yFmna85DTFxcJwrs79jgZLqe5mC5+EVJcJRis5wYoJBM0VyPREQhITvaSGByljKOs oIdo54FZSrFp+Nk9Pu4rCJ1EI+nDK5SdF0Xsk5n9St7VJ0ZgAIIaJWmhhOoaHbQZR41g okbA== 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=rHfs5FxGPUjmxGfV5O9uVZbPv7z2ZeCip8VpOpWF7Ns=; b=PwJWK3SfGoLjbrxfKvtPOEcdOiccvQQnmLt0yv8JhLuq28n/5tQxQFs9zBQrRO9Dj6 ZCjaYT7ITBnv/TKxIokdwnE8NvObiWUSE/yL3+UPRlT5QqXR9GO/4wWrji6bA7d25jyM XM/NpE1Qb7cHOShaX7gP6JhufyeG4EuqEtzTv6bonFiD96v/4UANALzGxoWXg9ceXD2x TIOykn/FYw05GJcbawv7TjAu/u4o38UaLpXF4y5/eLMcFvwfQvJDTapdCw5t1dOnoRRV tPy77a/MenKf3Cz7jg7XHiZpZklUTevlXQgrTD0Qvt59jkUaBRoXqZMp44pieZcJMUgK pk7g== X-Gm-Message-State: AOAM531N8YD3CcCGMrITVtQdoJO2Qn+vYJLPRwvO7sLm/d4xDLhazHJc x+82afkZHsn0fCiILGH6RsI= X-Google-Smtp-Source: ABdhPJxXLjVwjMI+Ft5elzrFkhoalJ9O9504fCQHMawzwpH3MWuAyeIAO5w6cI3p5MUAiSniT0/HmA== X-Received: by 2002:a1c:9a49:: with SMTP id c70mr2681796wme.117.1603882212973; Wed, 28 Oct 2020 03:50:12 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id d129sm6128206wmd.5.2020.10.28.03.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:50:12 -0700 (PDT) From: luca.boccassi@gmail.com To: Hongbo Zheng Cc: Wei Hu , dpdk stable Date: Wed, 28 Oct 2020 10:43:55 +0000 Message-Id: <20201028104606.3504127-76-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: skip VF register access when PF in FLR' has been queued to stable release 19.11.6 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.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/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 393a0611c7e389abb87c5deeb6790fb388decc22 Mon Sep 17 00:00:00 2001 From: Hongbo Zheng Date: Tue, 22 Sep 2020 20:03:18 +0800 Subject: [PATCH] net/hns3: skip VF register access when PF in FLR [ upstream commit 0eb7334f4034c08cbf2f23352bec0d35356872f1 ] According to the protocol of PCIe, FLR to a PF device resets the PF state as well as the SR-IOV extended capability including VF Enable which means that VFs no longer exist. When PF device is in FLR reset stage, at this time, the register state of VF device is not reliable, so VF device's register state detection is not carried out in PF FLR. In this case, we just ignore the register states to avoid accessing nonexistent register and return false in the internal function named hns3vf_is_reset_pending to indicate that there are no other reset states that need to be processed by PMD driver. Fixes: 2790c6464725 ("net/hns3: support device reset") Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_ethdev.h | 7 +++++++ drivers/net/hns3/hns3_ethdev_vf.c | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 35e64aa5ae..6e9173abd4 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -256,6 +256,13 @@ enum hns3_reset_level { * Kernel PF driver use mailbox to inform DPDK VF to do reset, the value * of the reset level and the one defined in kernel driver should be * same. + * + * According to the protocol of PCIe, FLR to a PF resets the PF state as + * well as the SR-IOV extended capability including VF Enable which + * means that VFs no longer exist. + * + * In PF FLR, the register state of VF is not reliable, VF's driver + * should not access the registers of the VF device. */ HNS3_VF_FULL_RESET = 3, HNS3_FLR_RESET, /* A VF perform FLR reset */ diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index e30e9f65c4..37c7d33f59 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1840,6 +1840,21 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) struct hns3_hw *hw = &hns->hw; enum hns3_reset_level reset; + /* + * According to the protocol of PCIe, FLR to a PF device resets the PF + * state as well as the SR-IOV extended capability including VF Enable + * which means that VFs no longer exist. + * + * HNS3_VF_FULL_RESET means PF device is in FLR reset. when PF device + * is in FLR stage, the register state of VF device is not reliable, + * so register states detection can not be carried out. In this case, + * we just ignore the register states and return false to indicate that + * there are no other reset states that need to be processed by driver. + */ + if (hw->reset.level == HNS3_VF_FULL_RESET) + return false; + + /* Check the registers to confirm whether there is reset pending */ hns3vf_check_event_cause(hns, NULL); reset = hns3vf_get_reset_level(hw, &hw->reset.pending); if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:14.136886055 +0000 +++ 0076-net-hns3-skip-VF-register-access-when-PF-in-FLR.patch 2020-10-28 10:35:11.584831201 +0000 @@ -1,8 +1,10 @@ -From 0eb7334f4034c08cbf2f23352bec0d35356872f1 Mon Sep 17 00:00:00 2001 +From 393a0611c7e389abb87c5deeb6790fb388decc22 Mon Sep 17 00:00:00 2001 From: Hongbo Zheng Date: Tue, 22 Sep 2020 20:03:18 +0800 Subject: [PATCH] net/hns3: skip VF register access when PF in FLR +[ upstream commit 0eb7334f4034c08cbf2f23352bec0d35356872f1 ] + According to the protocol of PCIe, FLR to a PF device resets the PF state as well as the SR-IOV extended capability including VF Enable which means that VFs no longer exist. @@ -17,7 +19,6 @@ that need to be processed by PMD driver. Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) @@ -27,10 +28,10 @@ 2 files changed, 22 insertions(+) diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index f170df9176..3f3f973c72 100644 +index 35e64aa5ae..6e9173abd4 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h -@@ -275,6 +275,13 @@ enum hns3_reset_level { +@@ -256,6 +256,13 @@ enum hns3_reset_level { * Kernel PF driver use mailbox to inform DPDK VF to do reset, the value * of the reset level and the one defined in kernel driver should be * same. @@ -45,10 +46,10 @@ HNS3_VF_FULL_RESET = 3, HNS3_FLR_RESET, /* A VF perform FLR reset */ diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 565cf60e76..cb2747b132 100644 +index e30e9f65c4..37c7d33f59 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2191,6 +2191,21 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) +@@ -1840,6 +1840,21 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) struct hns3_hw *hw = &hns->hw; enum hns3_reset_level reset;