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 1A75D41DC9; Fri, 3 Mar 2023 17:59:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F373140EE3; Fri, 3 Mar 2023 17:59:30 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2057.outbound.protection.outlook.com [40.107.93.57]) by mails.dpdk.org (Postfix) with ESMTP id 5F04240ED9 for ; Fri, 3 Mar 2023 17:59:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WDLBxxfJZ6hvK0Sxdtgwpc32ZX47kGpEJixizM/Y+fZTqEtvSUs0TXJuP68Q+k1XVXZl7ZOtmxBgUOoCNwiS9oAyJOriwHPMX+pxBkKkXAwJzIDpN7g5YJd4XfxAx2dpHEVg04DidtAClPTzagrSfNlkBtPHp1G15TpCNZoOwpwfnAtr11MeFF7A7EGizH4ul/iYBz0uuO0ZJqAnQvf8XIJHhyLX10iwchWVEUsqgZWMWffVojcsu227U0RFChqRcY4hZ4hlD8EJFNyC2uXHBscWrBDbl8mwn7uyT40/jCbSu50LfXnZqr+c5oVgKXp3PXEexIqRgpNuL9lB8GHkQQ== 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=0Y0CJYlp+d6uNtzQ1Ykh2DVYzjFe/zHQKlwZCMjlZQk=; b=dtmW1rFqZH36DAsAOe52al9ATnzKhJnJcJqEnsmSmjSm/iSbbd6z9NToF0cc7R69TK4jAbUviDVlmw1JjfMo59gvJstdS6e/DLRfv40Ww2bp6MrFUehxGrJfjhB2sUe4KU1c9KenMnolhE8Uw/WiePZejqF8XuWuNFevX5+7Gw8YXTUsqJTIjVL8nL+GZW313CvSi74SBgUaNwKnrtVFGu9wwOkGCqhzcfSFfRwJscyONVSXyISNYHQN/ObxxYkd792C336xk1SsxVsAyiAiMszoREqLAae7lTkyjLT0ZlQq53eLlULq1xaEYZRjgKpOgHE2GOkY3mR5N30SxJnb0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Y0CJYlp+d6uNtzQ1Ykh2DVYzjFe/zHQKlwZCMjlZQk=; b=AzIh7wBbGyX74Da62SdplU7te1lniyQLZDtUc8J9SW/EpKlyjYPkfSbQxhXZoPGY7+zRVHaHleldCVeCtW+HIfZIxuAGxrCS9EwXA6K6bkVHgMvC5EKSOhRLtXI8hP0O32LUix1Sse47fBExdxEdDtXD1FG2ueXG+A0f1czuv+U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by CH2PR12MB4955.namprd12.prod.outlook.com (2603:10b6:610:68::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.22; Fri, 3 Mar 2023 16:59:24 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640%4]) with mapi id 15.20.6156.022; Fri, 3 Mar 2023 16:59:24 +0000 Message-ID: Date: Fri, 3 Mar 2023 16:59:18 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: fengchengwen , Konstantin Ananyev , "thomas@monjalon.net" , Aman Singh , Yuying Zhang Cc: "dev@dpdk.org" References: <20230301030610.49468-1-fengchengwen@huawei.com> <20230301030610.49468-6-fengchengwen@huawei.com> <27b5e0017a304183b812a7e45858e03a@huawei.com> <194fd7a3-ee13-0993-255a-e75d8f256127@huawei.com> From: Ferruh Yigit Subject: Re: [PATCH 5/5] app/testpmd: add error recovery usage demo In-Reply-To: <194fd7a3-ee13-0993-255a-e75d8f256127@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0234.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a6::23) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|CH2PR12MB4955:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d67c42a-f848-444d-92fa-08db1c08a436 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vsq4W4eKS6AsEik8yeJvN+2k+b9foaxX3RSrkJtczdhN8j1V7sD1FpU5VEjBVfWKy93NQ5Fctt3F0OLJDOudhr9WsoYkMZyWm1OIY0QTe6CjwZsRyRAKqadgA+TzJAs7dH6Y+VOnTVJpukyoL6+nmurJYBPdSnznkW7VaYn1u6cZo8K5zo3SZ7fBdgsyLnRbMOXzmv5RSjOv1zASoZGok5bvTBHCPq+e4KM+xAZWiQCxlUQUFYKAAwDcHVbUNkbo9K9ZMM6uMRuC5Ev241G8gcJkNZ0B2SS1T7hv43rLfUQuCl+wAAWc7UzTzTJjmHTUkuZq0j0aw7KOWsjx95wT9Rqdpev+Ca8G61Jsiglvhmd02JsexQnH0oo1Jaa6/QsoGHk5tMn4R9nQWhLQOdQ4wFYezJ10FqIaM1MTqo3CBWN+ioQKQLlsIs4eVUgQDAZYRt+k5QSNr2pmLbrayK13fjxiA/khVmDiWkqzVuW0wxp05nfa7wprvorFDx+9q7Z7XfDnVd3p3FYW+FDBWst9Jy+VVfV+8eiAMT7I0MN4wFERSO0RYk1ip2cAK/yg/2zxTbrbJ+cFlOVLG2nEBtI4f6hwxmhZPrdHmH2zgp/O9W3rm/r9umPIzd7hnXY1Y8NvDzYZmUQnpXqdEqxIznJ9Dt5tFydU9QUOCst9Hc0V7ioPXFYIw4gnV30qe2Uy1aQojkxyzrdfT8aoPKA1X4bAb6Vrk0+RunwTkdiGJN8tV74= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(346002)(136003)(366004)(396003)(376002)(451199018)(31686004)(6666004)(83380400001)(36756003)(478600001)(110136005)(38100700002)(316002)(6486002)(2616005)(41300700001)(26005)(6506007)(6512007)(186003)(53546011)(44832011)(66946007)(5660300002)(31696002)(66556008)(66476007)(8936002)(2906002)(8676002)(86362001)(4326008)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VGtyYytYeVh6S3NPczJlMFF3M3MzOWdGV2w0SG5RekxudWVPWThFRmdRVkdu?= =?utf-8?B?aUZrRUcwUSt1V1BDVS9CNThxblE1M2tkS09jNzJpaDVRSXkzVW96d1NHbnZn?= =?utf-8?B?V1MyQUExUmkwSjlyeU9xdGtONDJ5T1F6Z2NNY0dkOVdmWXludk1KSnJlVnNG?= =?utf-8?B?VXhLQU1Fc1J3aGpHVGpBd2R4cVR5WkFhS2hpejNKRjd6NFJMY0xrOVJHR0ZL?= =?utf-8?B?dEhmaT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mYmFhbVZoaUg5allTUFZqakZM?= =?utf-8?B?WTJ6SnlIOHVBVjA3cG1FdVlVR0N4S1M2cEttVXRQTGpnVEtJdWloZUhrZXEx?= =?utf-8?Q?G5eld+WF5pI9h/2QXRWH8drrg?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d67c42a-f848-444d-92fa-08db1c08a436 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2023 16:59:24.5299 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Sbs4a2CWJYqwoemxdkro9jA2I6hN5cj4NvucdoxSb54giMudu4XQJCd6crYqsLa+ X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4955 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 3/3/2023 1:49 AM, fengchengwen wrote: > On 2023/3/2 21:01, Konstantin Ananyev wrote: >> >> >>> >>> This patch adds error recovery usage demo which will: >>> 1. stop packet forwarding when the RTE_ETH_EVENT_ERR_RECOVERING event >>> is received. >>> 2. restart packet forwarding when the RTE_ETH_EVENT_RECOVERY_SUCCESS >>> event is received. >>> 3. prompt the ports that fail to recovery and need to be removed when >>> the RTE_ETH_EVENT_RECOVERY_FAILED event is received. >>> >>> In addition, a message is added to the printed information, requiring >>> no command to be executed during the error recovery. >>> >>> Signed-off-by: Chengwen Feng >>> --- >>> app/test-pmd/testpmd.c | 80 ++++++++++++++++++++++++++++++++++++++++++ >>> app/test-pmd/testpmd.h | 4 ++- >>> 2 files changed, 83 insertions(+), 1 deletion(-) >>> >>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c >>> index 0c14325b8d..fdc3ae604b 100644 >>> --- a/app/test-pmd/testpmd.c >>> +++ b/app/test-pmd/testpmd.c >>> @@ -3823,6 +3823,77 @@ rmv_port_callback(void *arg) >>> start_packet_forwarding(0); >>> } >>> >>> +static int need_start_when_recovery_over; >>> + >>> +static bool >>> +has_port_in_err_recovering(void) >>> +{ >>> + struct rte_port *port; >>> + portid_t pid; >>> + >>> + RTE_ETH_FOREACH_DEV(pid) { >>> + port = &ports[pid]; >>> + if (port->err_recovering) >>> + return true; >>> + } >>> + >>> + return false; >>> +} >>> + >>> +static void >>> +err_recovering_callback(portid_t port_id) >>> +{ >>> + if (!has_port_in_err_recovering()) >>> + printf("Please stop executing any commands until recovery result events are received!\n"); >>> + >>> + ports[port_id].err_recovering = 1; >>> + ports[port_id].recover_failed = 0; >>> + >>> + /* To simplify implementation, stop forwarding regardless of whether the port is used. */ >>> + if (!test_done) { >>> + printf("Stop packet forwarding because some ports are in error recovering!\n"); >>> + stop_packet_forwarding(); >>> + need_start_when_recovery_over = 1; >>> + } >>> +} >> >> One thought I have - should we somehow stop user to attempt restart RX/TX while recovery >> in progress? >> But probably it is an overkill, and just documenting what is happening is enough.... > > Yes, the testpmd is already complicated. > In addition, considering that only a few PMDs support and are not commonly invoking. > So I thinking show above such promote is enough. > >> Do we need to update testpmd UG with some short description? > > It's better to update UG, but it wasn't triggered by command, I don't know which chapter to put it in. > > @Ferruh could you provide some advise ? > I think better to extract event handling to a new .c file, something like 'event.c', and various events handling optional, controlled by testpmd parameter. Right now by default all events are just printed (unless explicitly requested from command line not to do (--mask-event)), that is very basic and I think sufficient for default behavior. And in documentation, it would be nice to have a section like "event handling" and document what option enables which event handling, how it is used and what is the expected behavior, etc... btw, overall I agree to implement recover events in testpmd, it is good to give some examples on how to handle these events in application, I am just not sure to enable it by default. >> Apart from that, LGTM: >> Acked-by: Konstantin Ananyev >> >>> + >>> +static void >>> +recover_success_callback(portid_t port_id) >>> +{ >>> + ports[port_id].err_recovering = 0; >>> + if (has_port_in_err_recovering()) >>> + return; >>> + >>> + if (need_start_when_recovery_over) { >>> + printf("Recovery success! Restart packet forwarding!\n"); >>> + start_packet_forwarding(0); >>> + need_start_when_recovery_over = 0; >>> + } else { >>> + printf("Recovery success!\n"); >>> + } >>> +} >>> + >>> +static void >>> +recover_failed_callback(portid_t port_id) >>> +{ >>> + struct rte_port *port; >>> + portid_t pid; >>> + >>> + ports[port_id].err_recovering = 0; >>> + ports[port_id].recover_failed = 1; >>> + if (has_port_in_err_recovering()) >>> + return; >>> + >>> + need_start_when_recovery_over = 0; >>> + printf("The ports:"); >>> + RTE_ETH_FOREACH_DEV(pid) { >>> + port = &ports[pid]; >>> + if (port->recover_failed) >>> + printf(" %u", pid); >>> + } >>> + printf(" recovery failed! Please remove them!\n"); >>> +} >>> + >>> /* This function is used by the interrupt thread */ >>> static int >>> eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param, >>> @@ -3878,6 +3949,15 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param, >>> } >>> break; >>> } >>> + case RTE_ETH_EVENT_ERR_RECOVERING: >>> + err_recovering_callback(port_id); >>> + break; >>> + case RTE_ETH_EVENT_RECOVERY_SUCCESS: >>> + recover_success_callback(port_id); >>> + break; >>> + case RTE_ETH_EVENT_RECOVERY_FAILED: >>> + recover_failed_callback(port_id); >>> + break; >>> default: >>> break; >>> } >>> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h >>> index 329a6378a1..1bbf82a96c 100644 >>> --- a/app/test-pmd/testpmd.h >>> +++ b/app/test-pmd/testpmd.h >>> @@ -323,7 +323,9 @@ struct rte_port { >>> uint8_t slave_flag : 1, /**< bonding slave port */ >>> bond_flag : 1, /**< port is bond device */ >>> fwd_mac_swap : 1, /**< swap packet MAC before forward */ >>> - update_conf : 1; /**< need to update bonding device configuration */ >>> + update_conf : 1, /**< need to update bonding device configuration */ >>> + err_recovering : 1, /**< port is in error recovering */ >>> + recover_failed : 1; /**< port recover failed */ >>> struct port_template *pattern_templ_list; /**< Pattern templates. */ >>> struct port_template *actions_templ_list; /**< Actions templates. */ >>> struct port_table *table_list; /**< Flow tables. */ >>> -- >>> 2.17.1 >> >> . >>