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 6E18C41D8D for ; Mon, 27 Feb 2023 08:12:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65C5741140; Mon, 27 Feb 2023 08:12:57 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2069.outbound.protection.outlook.com [40.107.94.69]) by mails.dpdk.org (Postfix) with ESMTP id 921EC40ED6 for ; Mon, 27 Feb 2023 08:12:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iRnRR33iYcDdLVqMOg/bOianmXiojLPTxkAns3cIL6brryJsSx0BfPZ9qGC1P+UAnKragZtzLsf7MMFVg4t5e5Ad7rLJOYxM7swGFYZvfYd8rlHME1lXxSoGU/syDbLNSwMT8ThUSMi8MtDLd09qn361Mv4lwZLk13JnrnfBmAgRrfB3Fw/RhtHo+U/inVKC2uNQECRelZ+Xy/QXnnXplvLMs9wo2DATXmnJBxhrjdldHeTdS0JWPDSCODeeiYRJyMzyfj7FPnEODP05rLUMEM/bzUNj5fi/HTfb/vI4/dV5aEtXJdQrgVYFwN/2ym7RdwesFewDe3E+H3obVwNSpA== 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=+GDMwg83K2zaW3z7QWMF5UGen0EEpi5JaNWXuy1mVq0=; b=DdePH+/bvnLuFkHPF7uhXjfvfROfoYHujnQfVIO8cyixoHmlQbUgsYHmI+OcuGn5H3E9M2707pzl/8FsLOxRsUBif6upeuCchjOQ4I4RYjtBx0tgfeN/8OPcd3XMpkZ1qPbg3kZZ18m4x1oL/muVKvowadY+bVltSovOJ8P2jq6LR+1aJAZgAQjeFU8obzYnv46Huf6nmgGM7Sn0cVHqhoAe0TuOcutvuBhAswvFKAj9qqLot4E12ajrKOjHJ70VahuOADDTjy2YzC3lGGPpfPMjbVlBZ2icNp4wJh1Bofrdt4BhkMnmS8IKOFU98/iWm//kqeZA/SPFzdGP918Jqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=amd.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 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=+GDMwg83K2zaW3z7QWMF5UGen0EEpi5JaNWXuy1mVq0=; b=XGecTDs0gQf7alnrdr+W6mKoMN+ypoH5XpLhdfShxsDCLCUUDySm9URo0B6wQ3gJOS07bzCJtlWJf4xScoHjksf8j/JnvrkOwKWC9PrvLRyeQ1+42iNuqYxbPGmge65Auew38yGhUAIvgQDfOiqmf2T2POjP+Y0K5Mu7+9I/xHgk61Ugkcye2lYn6rBPZ67CWqnBmJet8BxvhBkN+LAwsmRSziCs1moh1Y640QeZVwKH06JYqkL0sphwHlXGCoKeB1KFhlJ/PhPkAODUUTlYo4TlHxXyviStym9zN9TUzYBKSIha9b26GXWVxb+5Y/RGGLpzS+otXAFr5/MSyitoKQ== Received: from DM6PR03CA0096.namprd03.prod.outlook.com (2603:10b6:5:333::29) by DS7PR12MB5840.namprd12.prod.outlook.com (2603:10b6:8:7b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.26; Mon, 27 Feb 2023 07:12:53 +0000 Received: from DM6NAM11FT087.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::5f) by DM6PR03CA0096.outlook.office365.com (2603:10b6:5:333::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29 via Frontend Transport; Mon, 27 Feb 2023 07:12:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT087.mail.protection.outlook.com (10.13.172.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.16 via Frontend Transport; Mon, 27 Feb 2023 07:12:52 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 26 Feb 2023 23:12:44 -0800 Received: from nvidia.com (10.126.230.37) 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.986.37; Sun, 26 Feb 2023 23:12:41 -0800 From: Xueming Li To: Ferruh Yigit CC: Aman Singh , dpdk stable Subject: patch 'app/testpmd: fix link check condition on port start' has been queued to stable release 22.11.2 Date: Mon, 27 Feb 2023 15:00:15 +0800 Message-ID: <20230227070107.15664-107-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227070107.15664-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230227070107.15664-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] 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: DM6NAM11FT087:EE_|DS7PR12MB5840:EE_ X-MS-Office365-Filtering-Correlation-Id: e519476b-701a-4952-00a2-08db18920ae5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1H8Udzv1Ya0azONk7RVuAUtO92FCnyIlPugvTpvS7O3C/TdK1IrdZFIumZubMF0PFQJ+/P0qJh7ijYpkoZ1DxfBPMSxvmyX/UOwUidCxBi4zce1z8NxV+DunTBuoXIBM9NrAoJACDdqtIGqCmF/7orHV+7y1sXSec0orAOop/OEBYn9Z2vAy7ejAzTCbsntycHyefPJ/pOxKLuTO3VpzOGIuoxxrZVJyZfHtjzy4wT6AaclRia+m8FQxouTI6LurDZw5bViwsiotE7y9xzn00px4c5C5UABjJXXNXPiZk2jnEPX/bdbTuZ52xJrXv12cH/lcdnyeLcMgg9+Jil/2JVxYAAGj9s9VdY/6Eqox3+mmx6CE7GMb923cKcutzb5MfzRTmcHg6ICzKcvDdAeLcgS6qixnW5PDwDp/mDh9KU98HyoMVV7zBRpGsy8y+WqDPpJpsUqCtRzrJBz+VdD8EvCFfZAYT/3gH6JBZ1bFzLvnCQjsvF02mNp/53xcZ0kLi0C0xM6W5sK6cbjLwO/D+cJBb4SENQUbwuq6RBScv8TUe4157ToPZz766a1ZMeu/+/X8FPqIcQr25ahi693xUs1HCdyLwZasy1vvu39b4L86cU3omTgEAJaKp6I3HR/kP0f685wnGg6uzW2hDG2636y26dvnios+7JS6+pk+f5R54nEmwH1ojMSqsf8bBhXltRqvlz6KjccVOxJK8kZ0VsYQV6Egv+hKzuZGOBP2ZE4zoodOUSKHPPTxa4HgZsB/1s9l5Z3NfuTMT8HbX6ULcVKFxmijGbUMOfmrgkKkXSTIjqf1ZyxT+TsfLx8vgjCQ X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(346002)(396003)(136003)(376002)(39860400002)(451199018)(36840700001)(40470700004)(46966006)(478600001)(82310400005)(7696005)(70586007)(8676002)(41300700001)(356005)(6916009)(4326008)(8936002)(70206006)(40480700001)(40460700003)(55016003)(36756003)(40140700001)(86362001)(6286002)(26005)(53546011)(6666004)(966005)(2616005)(16526019)(186003)(7636003)(82740400003)(336012)(1076003)(47076005)(426003)(2906002)(316002)(5660300002)(54906003)(34020700004)(83380400001)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 07:12:52.8566 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e519476b-701a-4952-00a2-08db18920ae5 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT087.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5840 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 22.11.2 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/01/23. 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=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=f418af17fc9927e2f9b854f6c5ab21105c1af94a Thanks. Xueming Li --- >From f418af17fc9927e2f9b854f6c5ab21105c1af94a Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Fri, 27 Jan 2023 22:45:13 +0000 Subject: [PATCH] app/testpmd: fix link check condition on port start Cc: Xueming Li [ upstream commit cdede073a515432fc168d252d93f9a2d333ce8a0 ] In testpmd port start function, 'need_check_link_status' variable is used to detect if a link check is required after port is started. Intention is if at least one port is started, link check should be called, and initially 'need_check_link_status' used as following: ``` start_port need_check_link_status <- 0 for each p in port ret <- config & start p if ret is failure break need_check_link_status <- 1 if need_check_link_status check link else log failure message ``` Later above logic is modified [1] because when there is no port at all, 'need_check_link_status' remains zero and it causes and error message although this is a valid use case. For this code updated as following: ``` start_port need_check_link_status <- -1 for each p in port need_check_link_status <- 0 ret <- config & start p if ret is failure break need_check_link_status <- 1 if need_check_link_status == 1 check link else if need_check_link_status == 0 log failure message ``` This modification works fine if 'start_port()' called for a single port, but function support both single port and all ports with 'RTE_PORT_ALL' parameter to the function. When it is called for all ports, above logic is wrong because 'need_check_link_status' value reset on each iteration of the loop. For multi port case, if last port fails to start, 'need_check_link_status' will be zero and no link check will be done and it will log a wrong error message. Overall there are three cases to cover: * No port exist at all * All ports are already started * At least one port started successfully To cover all three cases, one option is to use 'need_check_link_status' have multiple values to reflect above cases. But meaning of values are not obvious which can lead more issues in the future. Instead converting 'need_check_link_status' to multiple boolean variables whose names are self explanatory. This fixes issue and link check called if at least one port started successfully as intended. Also log message only printed when at least one port exists and all ports are already in started state. [1] Fixes: 92d2703e2c43 ("app/testpmd: fix log with no bound device") Signed-off-by: Ferruh Yigit Acked-by: Aman Singh --- app/test-pmd/testpmd.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 3c404c8a6e..538609d890 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2883,7 +2883,7 @@ update_bonding_port_dev_conf(portid_t bond_pid) int start_port(portid_t pid) { - int diag, need_check_link_status = -1; + int diag; portid_t pi; portid_t p_pi = RTE_MAX_ETHPORTS; portid_t pl[RTE_MAX_ETHPORTS]; @@ -2894,6 +2894,9 @@ start_port(portid_t pid) queueid_t qi; struct rte_port *port; struct rte_eth_hairpin_cap cap; + bool at_least_one_port_exist = false; + bool all_ports_already_started = true; + bool at_least_one_port_successfully_started = false; if (port_id_is_invalid(pid, ENABLED_WARN)) return 0; @@ -2909,11 +2912,13 @@ start_port(portid_t pid) continue; } - need_check_link_status = 0; + at_least_one_port_exist = true; + port = &ports[pi]; - if (port->port_status == RTE_PORT_STOPPED) + if (port->port_status == RTE_PORT_STOPPED) { port->port_status = RTE_PORT_HANDLING; - else { + all_ports_already_started = false; + } else { fprintf(stderr, "Port %d is now not stopped\n", pi); continue; } @@ -3133,15 +3138,14 @@ start_port(portid_t pid) printf("Port %d: " RTE_ETHER_ADDR_PRT_FMT "\n", pi, RTE_ETHER_ADDR_BYTES(&port->eth_addr)); - /* at least one port started, need checking link status */ - need_check_link_status = 1; + at_least_one_port_successfully_started = true; pl[cfg_pi++] = pi; } - if (need_check_link_status == 1 && !no_link_check) + if (at_least_one_port_successfully_started && !no_link_check) check_all_ports_link_status(RTE_PORT_ALL); - else if (need_check_link_status == 0) + else if (at_least_one_port_exist & all_ports_already_started) fprintf(stderr, "Please stop the ports first\n"); if (hairpin_mode & 0xf) { -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-27 14:08:44.335173400 +0800 +++ 0108-app-testpmd-fix-link-check-condition-on-port-start.patch 2023-02-27 14:08:40.849237000 +0800 @@ -1 +1 @@ -From cdede073a515432fc168d252d93f9a2d333ce8a0 Mon Sep 17 00:00:00 2001 +From f418af17fc9927e2f9b854f6c5ab21105c1af94a Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit cdede073a515432fc168d252d93f9a2d333ce8a0 ] @@ -77 +79,0 @@ -Cc: stable@dpdk.org @@ -86 +88 @@ -index f3e29a5b4b..d93d07ae09 100644 +index 3c404c8a6e..538609d890 100644 @@ -89 +91 @@ -@@ -2920,7 +2920,7 @@ update_bonding_port_dev_conf(portid_t bond_pid) +@@ -2883,7 +2883,7 @@ update_bonding_port_dev_conf(portid_t bond_pid) @@ -98 +100 @@ -@@ -2931,6 +2931,9 @@ start_port(portid_t pid) +@@ -2894,6 +2894,9 @@ start_port(portid_t pid) @@ -108 +110 @@ -@@ -2946,11 +2949,13 @@ start_port(portid_t pid) +@@ -2909,11 +2912,13 @@ start_port(portid_t pid) @@ -125 +127 @@ -@@ -3170,15 +3175,14 @@ start_port(portid_t pid) +@@ -3133,15 +3138,14 @@ start_port(portid_t pid)