From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6CFE43B86 for ; Tue, 5 Mar 2024 10:49:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BCCD34026B; Tue, 5 Mar 2024 10:49:36 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2062.outbound.protection.outlook.com [40.107.96.62]) by mails.dpdk.org (Postfix) with ESMTP id 605B34014F for ; Tue, 5 Mar 2024 10:49:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eg1MUVhbKSGSwREkDbwN4lcGZPwS3iEZiLhvVkybmdCUr6nHWoCkA9V3rrXY8l0noV8xP6xAboZOEh07SCg1umxUnVYbMlWUD1vevGXooB09u6fiG/micpBHQ5jRw2poeYZ/4V0dJBt2dUkhGpWz9uQPVWR3Ma5AWhK4fpTJDdij+XcCBK9d0zxm77+0yglTfNnh66wzFxOG1aVF487M6DsxWzDcg520o3SZR1dPbUAI80qmkv4NOnLXSgliGMzzUtexdkAPKEHZKAWs01Fiu9dXVuZbYL8b9sTt5RYbxvKykseM0VDOOJpajAWzZJr9eytGtt+efWnUggrqfGWUBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rS+ApTgV789SWdzkLKZA1WJS95EkMsPLEUOZf2zacbY=; b=WSySB+r/SBx7JVEVCnZtJGM4PCzrz4rnmiWPAi+wUu4pOZha1U8AC7TacXf288bcxaEj5ETgRSRGIpU4aU0TddjsuoMXdLrBmqoC5zNdUBNQL5HansFvkzif8DT856WjeGyj1jETJ3hih3xFe+Shpq48VCGIQggzph8xDyxCqAQ5JGtQ0bgGyhlkIJ+3Ps0iUn9OgXH4HmEqWeSGFs1PS7jReuFmdf6/BzjCkuq3x+1l7CHC0zjbTa+bqtBR9SKneF9SCzjL53usId+9W4nNLDCaOMj6HZPVwIIV19f7DFFc7knAYYfVPsOwWHJ6TZXxjLbfrQVrJKFruHx1L96f/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rS+ApTgV789SWdzkLKZA1WJS95EkMsPLEUOZf2zacbY=; b=tO9mzNZsZiUDZA5dOncK7N6g8lkbsCtVzBLCnqrtKIVBc5ALCr8oKcdQvCXB1CjYq7u6Zj6FAoZZx1+fjmD4MCURsoZ3m9n0y41E7ZMF3xpKl2qe1o73CK9mnhAaNo2UCsnUhaWGtuhRuy+rw4Ei9bi/8CFhTuhSMhOtVpiIn31gOothz6gWL+DI+s/06P60WM0Wj5qHMipK7U1M2nMLUk8sMLp5SUAcMGG+OncRVVgibJByu1RoRxOAQ4ysQw5aoHdUbGkAXgCDbL+6TpDDg/Nw6QeMtucY9mLTcmofSJbLH30/9TlmGfKUzwyvw4jo5a0Q+dugVN2dFxYFLz8zsg== Received: from CY5PR15CA0153.namprd15.prod.outlook.com (2603:10b6:930:67::23) by IA1PR12MB6603.namprd12.prod.outlook.com (2603:10b6:208:3a1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Tue, 5 Mar 2024 09:49:32 +0000 Received: from CY4PEPF0000FCC5.namprd03.prod.outlook.com (2603:10b6:930:67:cafe::1a) by CY5PR15CA0153.outlook.office365.com (2603:10b6:930:67::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Tue, 5 Mar 2024 09:49:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000FCC5.mail.protection.outlook.com (10.167.242.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:49:32 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 5 Mar 2024 01:49:16 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 5 Mar 2024 01:49:15 -0800 From: Xueming Li To: Mingjin Ye CC: Qi Zhang , dpdk stable Subject: patch 'net/iavf: fix no polling mode switching' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:45:55 +0800 Message-ID: <20240305094757.439387-15-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC5:EE_|IA1PR12MB6603:EE_ X-MS-Office365-Filtering-Correlation-Id: 3937526b-be72-4f50-b292-08dc3cf98ef7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fhn1QcwFnJTWJ8vwfChjLP5h8q2Ic/iZUy7sPUvSFnnmbXuPr4SXr26a5KyfiQJI2e2/ah9aPTp6sb3FtmoVqzRNcf+L2oMrCBklBEezyKyCDwwkia4bZahHXW94pwhv2Ov9cr1ckJaa6k4WMBE/UGSJi4Y7Xr2g669kYp1UhH+dTNV/5/475/MbBMEE4NQEreruoXlVev7VuXGixdft5ybvgsU7lUIsA21azINahzcrh8MzsSSYBul8xC5Bsn1edsFKUYLJQWJr4q28iAOfUH0InCdSfO5y1zFzb7F+fLGfKmVFygcA88vGHK3vTon+xLqPYcEq5WNLp3TInZM1VINIuMM1tveEmqyCRc4B6LcRVWzIIIKLbt0ilf/uw/wyK8huIgm5YgeRQIDFCuHPGc1MUFXXTYenzpsNAeaq7Id32HgaYE349YzQ/VGv9TTS3l3KBQbmV0DIa/h3BRKMOBdp0CSkhmymRa1r4AIHpkvePhxbE/hSTAJjecGyWTtV7AAdfKZkLwxni9Oq/Bkj/r7UAjegCvJqORUv1RWQfq9cdXXPBXq8worKPqWjmh5dMDNE7E9s3dBbnRZMX5wJmxa9rfQI6Vv9mxwLDCe2UOK/r9anvqgTgyj300m17/z8Iy5Q8GOnheQpvx6uWPK9Oq+3HcLLPtsSgSLjHq6s6CclBZ30dfG2pJd3ywksXt2MlDQoR7QPfZ8a9pTbK8G/AYLDplk6YqliwVbBs4Fs8d5YPXEQn6mnN/Stu4Gn9oES X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(82310400014)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:49:32.1482 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3937526b-be72-4f50-b292-08dc3cf98ef7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6603 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 23.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 03/31/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=0a72821dd9ecd32734257c1a740f37b89c95c601 Thanks. Xueming Li --- >From 0a72821dd9ecd32734257c1a740f37b89c95c601 Mon Sep 17 00:00:00 2001 From: Mingjin Ye Date: Thu, 14 Dec 2023 10:33:02 +0000 Subject: [PATCH] net/iavf: fix no polling mode switching Cc: Xueming Li [ upstream commit 5c8ca9f13c78096589e3fb2f323987df6c973f8d ] PMD does not switch to no polling mode when the PF triggers a reset event or the watchdog detects a reset event. In this scenario, data path will access the freed resources and cause a core dump. This patch fixes this issue by automatically switching modes on VF reset. Fixes: 5b3124a0a6ef ("net/iavf: support no polling when link down") Signed-off-by: Mingjin Ye Acked-by: Qi Zhang --- drivers/net/iavf/iavf.h | 3 ++- drivers/net/iavf/iavf_ethdev.c | 27 +++++++++++++++++++++++---- drivers/net/iavf/iavf_vchnl.c | 24 ++++++++++-------------- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 10868f2c30..5bfe85dabd 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -18,7 +18,7 @@ #define IAVF_AQ_LEN 32 #define IAVF_AQ_BUF_SZ 4096 -#define IAVF_RESET_WAIT_CNT 500 +#define IAVF_RESET_WAIT_CNT 2000 #define IAVF_BUF_SIZE_MIN 1024 #define IAVF_FRAME_SIZE_MAX 9728 #define IAVF_QUEUE_BASE_ADDR_UNIT 128 @@ -512,4 +512,5 @@ int iavf_flow_sub_check(struct iavf_adapter *adapter, void iavf_dev_watchdog_enable(struct iavf_adapter *adapter); void iavf_dev_watchdog_disable(struct iavf_adapter *adapter); int iavf_handle_hw_reset(struct rte_eth_dev *dev); +void iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change); #endif /* _IAVF_ETHDEV_H_ */ diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d1edb0dd5c..0952998304 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -296,6 +296,7 @@ iavf_dev_watchdog(void *cb_arg) PMD_DRV_LOG(INFO, "VF \"%s\" reset has completed", adapter->vf.eth_dev->data->name); adapter->vf.vf_reset = false; + iavf_set_no_poll(adapter, false); } /* If not in reset then poll vfr_inprogress register for VFLR event */ } else { @@ -308,6 +309,7 @@ iavf_dev_watchdog(void *cb_arg) /* enter reset state with VFLR event */ adapter->vf.vf_reset = true; + iavf_set_no_poll(adapter, false); adapter->vf.link_up = false; iavf_dev_event_post(adapter->vf.eth_dev, RTE_ETH_EVENT_INTR_RESET, @@ -2916,8 +2918,10 @@ iavf_dev_close(struct rte_eth_dev *dev) * effect. */ out: - if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) + if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) { vf->vf_reset = false; + iavf_set_no_poll(adapter, false); + } /* disable watchdog */ iavf_dev_watchdog_disable(adapter); @@ -2948,6 +2952,8 @@ static int iavf_dev_reset(struct rte_eth_dev *dev) { int ret; + struct iavf_adapter *adapter = + IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); @@ -2962,6 +2968,7 @@ iavf_dev_reset(struct rte_eth_dev *dev) return ret; } vf->vf_reset = false; + iavf_set_no_poll(adapter, false); PMD_DRV_LOG(DEBUG, "Start dev_reset ...\n"); ret = iavf_dev_uninit(dev); @@ -2977,10 +2984,13 @@ iavf_dev_reset(struct rte_eth_dev *dev) int iavf_handle_hw_reset(struct rte_eth_dev *dev) { + struct iavf_adapter *adapter = + IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); int ret; vf->in_reset_recovery = true; + iavf_set_no_poll(adapter, false); ret = iavf_dev_reset(dev); if (ret) @@ -2998,16 +3008,25 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev) if (ret) goto error; dev->data->dev_started = 1; - - vf->in_reset_recovery = false; - return 0; + goto exit; error: PMD_DRV_LOG(DEBUG, "RESET recover with error code=%d\n", ret); +exit: vf->in_reset_recovery = false; + iavf_set_no_poll(adapter, false); return ret; } +void +iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change) +{ + struct iavf_info *vf = &adapter->vf; + + adapter->no_poll = (link_change & !vf->link_up) || + vf->vf_reset || vf->in_reset_recovery; +} + static int iavf_dcf_cap_check_handler(__rte_unused const char *key, const char *value, __rte_unused void *opaque) diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 0a3e1d082c..1111d30f57 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -273,20 +273,18 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len, iavf_dev_watchdog_enable(adapter); } if (adapter->devargs.no_poll_on_link_down) { - if (vf->link_up && adapter->no_poll) { - adapter->no_poll = false; - PMD_DRV_LOG(DEBUG, "VF no poll turned off"); - } - if (!vf->link_up) { - adapter->no_poll = true; + iavf_set_no_poll(adapter, true); + if (adapter->no_poll) PMD_DRV_LOG(DEBUG, "VF no poll turned on"); - } + else + PMD_DRV_LOG(DEBUG, "VF no poll turned off"); } PMD_DRV_LOG(INFO, "Link status update:%s", vf->link_up ? "up" : "down"); break; case VIRTCHNL_EVENT_RESET_IMPENDING: vf->vf_reset = true; + iavf_set_no_poll(adapter, false); PMD_DRV_LOG(INFO, "VF is resetting"); break; case VIRTCHNL_EVENT_PF_DRIVER_CLOSE: @@ -462,6 +460,7 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg, vf->link_up = false; if (!vf->vf_reset) { vf->vf_reset = true; + iavf_set_no_poll(adapter, false); iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_RESET, NULL, 0); } @@ -485,14 +484,11 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg, iavf_dev_watchdog_enable(adapter); } if (adapter->devargs.no_poll_on_link_down) { - if (vf->link_up && adapter->no_poll) { - adapter->no_poll = false; - PMD_DRV_LOG(DEBUG, "VF no poll turned off"); - } - if (!vf->link_up) { - adapter->no_poll = true; + iavf_set_no_poll(adapter, true); + if (adapter->no_poll) PMD_DRV_LOG(DEBUG, "VF no poll turned on"); - } + else + PMD_DRV_LOG(DEBUG, "VF no poll turned off"); } iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_LSC, NULL, 0); break; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:31.538476919 +0800 +++ 0014-net-iavf-fix-no-polling-mode-switching.patch 2024-03-05 17:39:30.683566490 +0800 @@ -1 +1 @@ -From 5c8ca9f13c78096589e3fb2f323987df6c973f8d Mon Sep 17 00:00:00 2001 +From 0a72821dd9ecd32734257c1a740f37b89c95c601 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 5c8ca9f13c78096589e3fb2f323987df6c973f8d ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org