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 8E12341CFE for ; Mon, 6 Mar 2023 16:16:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7C33941149; Mon, 6 Mar 2023 16:16:42 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2086.outbound.protection.outlook.com [40.107.94.86]) by mails.dpdk.org (Postfix) with ESMTP id F2E0440EF0; Mon, 6 Mar 2023 16:16:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kWJCD35pUzPB90r1p8abBsd4SXx96v2COhI16cOd3PY4+fDs64yzSQ5MeAOJ1fzMBNSXMww6TcSSFo5NhFb5DS3bNGExCNi7DzSjLOHievnm15BRjgk3UZ3jlnlJ+1i+gVtmTSycN13btGl7JLaS09uqYgvvp67AgsI+r8bq31+gPb6WHRnH9O+//9E9AvJujDD5dUv8g4Ch2p213bsKCwRPxVOMkYxv3TpchAYFU89C3jZVFm4MNj/nzoJUyh9Yrb7SskZ2viWPqAJjhbDnTRnp4R5+WAoe8WONgxNu0oRBQYnbG/rJaL5Wjw6HyF6UmmCySvfhsrGIXxZrv9FiPQ== 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=nNf+903vutaK6TNvteGx58BGgQqYylVm3YjPPyxyfJQ=; b=F7t0FbzUJzjJjHnbzV2gmCSncNnItPx4w64gREPrXkEjBpBfXjGbp4VqkTGWUJle2GAhlqCdFZfKLR/+6V2+LBTJlDY/l49lSUKcxhHyYvK6DqoIALVTNyGPOzi/bc+rPu3rqrlOdNBAtVH275PFTVG0mjv1NkkbJRYYcKIXyrOEkgar1ZFH+6UZyBNsbqc4pa1tWtQwC8GQb9x49gmDOLO1Il7fHxtXxCzMs79+fqM5/kmBfmPPMggYS+VEbtrYXxP6m+JAYEY05MjtDMJ0uBRsVih9UvjBKbmtsJLgk/iGppRzUqmoupCHsXCn3SMQEaNJZDQ1dDF+g13IYqzang== 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=nNf+903vutaK6TNvteGx58BGgQqYylVm3YjPPyxyfJQ=; b=zx0RL/yoccnbC3vBH7FMdAHa4tmRL7HnMaz2qVHy8AexHW8AZ96He7uY6hIwocJPXPvLez94jKhTqD76bZo4npjNTqQNjW2fng4tufJ+QZN42nv1zVz0Y0YuSpiYYstjoEwaOrlMfi9GKwqhVd+aQhcoosgFl/z63QV6o0Q4AUU= 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 SJ2PR12MB9008.namprd12.prod.outlook.com (2603:10b6:a03:543::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.22; Mon, 6 Mar 2023 15:16:33 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640%5]) with mapi id 15.20.6156.028; Mon, 6 Mar 2023 15:16:33 +0000 Message-ID: Date: Mon, 6 Mar 2023 15:16:25 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v3] app/testpmd: fix secondary process not forwarding Content-Language: en-US To: "lihuisong (C)" , Shiyang He , dev@dpdk.org Cc: yidingx.zhou@intel.com, stable@dpdk.org, Yuying Zhang , Aman Singh , Anatoly Burakov , Matan Azrad , Dmitry Kozlyuk References: <20221230075554.25244-1-shiyangx.he@intel.com> <20230223144106.707999-1-shiyangx.he@intel.com> <5f8d0435-def4-b874-b9ea-4a8a3c0191b5@huawei.com> From: Ferruh Yigit In-Reply-To: <5f8d0435-def4-b874-b9ea-4a8a3c0191b5@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0567.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:33b::20) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SJ2PR12MB9008:EE_ X-MS-Office365-Filtering-Correlation-Id: 60320dc7-1e7a-46ae-28d6-08db1e55c51b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uhXJEgoFpdjnVpK9MuMZ2ojbC4TjEt83EOp+V+YpTKQGIHiNwpHRhnSbOHpAkPJh62q6gkijZg7mEsxJiqu9fSWFscyaW0rRqo/JqrC1Ra1JTbrcRNxhxvJsc/2xdVKvYu1pmFSqRREze/e9b5Z8CXdDo6QwZoxSI75WWC8QQd0HwTTcTfuFoD64y/HHqHB35bDlOV/E0JfLZGFaBXI09tNPbEZBG8OjrkDhIizddSWCCvG+iQmc+X/rlCLwEi22T7FNgPs+bLQUJdA/lBb2NDKm8IoIP+TIMPJSBXcPN9G/ydQzI3aCQ7ikiwM731AzBJXakKTQKfRFOdCiQDGpFBJOlsWuNSLIGzlu0VP8q7XuVhgAnhj4gK1RWs0llvH2ffKikcTfCAzyy+TB0oqxk7mu0UNUaTEct20n+cQgm1//MeDQqzBuvqwQ05E2J5zQJDXOvbliTTYoIpoVvZHnS044vGe4pUQNyGg6NJehZOjZDKbAfxf4E7+qW2mG3OsQlf8CCrFUdfkZGowQIXo6mhk5y6y3rVwAF27iRua/u4/DY8LJDzHdEqMgv2JjgiTbXWswYL4laV8VEGZ23Xm9S1OiZFUv47cmI4Im8zg1H57nqRFdrIKKM4ffThJTIxb+U6xbKq078L5ERL0/ZY77+s9IjKgTjVOoPictsJhoirGZrhMPtEO0H4ORdFZnx1lMwqaQaPeISxo5Zi6KzAONtCYXFzGvAV5/0G3w5B/3W9A= 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)(396003)(136003)(366004)(346002)(376002)(451199018)(31686004)(36756003)(4326008)(66946007)(41300700001)(66556008)(8676002)(66476007)(8936002)(44832011)(7416002)(2906002)(5660300002)(86362001)(31696002)(38100700002)(6666004)(26005)(6486002)(478600001)(110136005)(54906003)(6506007)(316002)(83380400001)(6512007)(2616005)(186003)(53546011)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aElnZEdyUWRyVVVVa1hYRE5BdGxDREdPc1JtcE5OWTlVVllpR0pXdGs5S0NX?= =?utf-8?B?ekdtdFM0T1I5V2IvVkQzc2RHTnBBQ2NGMFYrbzZLWFlhTGFnQ1F5WmlkOHVZ?= =?utf-8?B?TzNYYWM2NlhScDkwbHFuYkNsN252UlBBUlZxSmYxZzc5ZjRCekVFTHlXYng4?= =?utf-8?B?aEhYaXBWM1FwdVZ3VGlRdUpMbExITXdCYU5XZjJqZVh3dE0rYk9aMndjc2JR?= =?utf-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Ra0hLZHFoLytveGhIQUpEVThMSUN0WGU2bThxbU9E?= =?utf-8?B?WnQvQm5sdFducTlvUEpQVmJnbVR0b3NzeGJwcmcrVjlPQVVUeFRHeEVlbGdk?= =?utf-8?Q?SxkBx27MbqkfB2RAj8Z2ztX+a?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60320dc7-1e7a-46ae-28d6-08db1e55c51b X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2023 15:16:33.3032 (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: sc7NoEoeKTXTEZyZhFWhomy2gxsjX0uxbhP3zVAnMzH/H5LYdPlEF+V8jzbLNgf9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9008 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 On 2/23/2023 8:08 AM, lihuisong (C) wrote: > > 在 2023/2/23 22:41, Shiyang He 写道: >> Under multi-process scenario, the secondary process gets queue state >> from the wrong location (the global variable 'ports'). Therefore, the >> secondary process can not forward since "stream_init" is not called. >> >> This commit fixes the issue by calling 'rte_eth_rx/tx_queue_info_get' >> to get queue state from shared memory. >> >> Fixes: 3c4426db54fc ("app/testpmd: do not poll stopped queues") >> Cc: stable@dpdk.org >> >> Signed-off-by: Shiyang He >> Acked-by: Yuying Zhang >> >> v3: Add return value description >> --- >>   app/test-pmd/testpmd.c | 45 ++++++++++++++++++++++++++++++++++++++++-- >>   1 file changed, 43 insertions(+), 2 deletions(-) >> >> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c >> index 0c14325b8d..a050472aea 100644 >> --- a/app/test-pmd/testpmd.c >> +++ b/app/test-pmd/testpmd.c >> @@ -2418,9 +2418,50 @@ start_packet_forwarding(int with_tx_first) >>       if (!pkt_fwd_shared_rxq_check()) >>           return; >>   -    if (stream_init != NULL) >> -        for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) >> +    if (stream_init != NULL) { >> +        for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) { >> +            if (rte_eal_process_type() == RTE_PROC_SECONDARY) { >> +                struct fwd_stream *fs = fwd_streams[i]; >> +                struct rte_eth_rxq_info rx_qinfo; >> +                struct rte_eth_txq_info tx_qinfo; >> +                int32_t rc; >> +                rc = rte_eth_rx_queue_info_get(fs->rx_port, >> +                        fs->rx_queue, &rx_qinfo); >> +                if (rc == 0) { >> +                    ports[fs->rx_port].rxq[fs->rx_queue].state = >> +                        rx_qinfo.queue_state; >> +                } else if (rc == -ENOTSUP) { >> +                    /* Set the rxq state to RTE_ETH_QUEUE_STATE_STARTED >> +                     * to ensure that the PMDs do not implement >> +                     * rte_eth_rx_queue_info_get can forward. >> +                     */ >> +                    ports[fs->rx_port].rxq[fs->rx_queue].state = >> +                        RTE_ETH_QUEUE_STATE_STARTED; >> +                } else { >> +                    TESTPMD_LOG(WARNING, >> +                        "Failed to get rx queue info\n"); >> +                } >> + >> +                rc = rte_eth_tx_queue_info_get(fs->tx_port, >> +                        fs->tx_queue, &tx_qinfo); >> +                if (rc == 0) { >> +                    ports[fs->tx_port].txq[fs->tx_queue].state = >> +                        tx_qinfo.queue_state; >> +                } else if (rc == -ENOTSUP) { >> +                    /* Set the txq state to RTE_ETH_QUEUE_STATE_STARTED >> +                     * to ensure that the PMDs do not implement >> +                     * rte_eth_tx_queue_info_get can forward. >> +                     */ >> +                    ports[fs->tx_port].txq[fs->tx_queue].state = >> +                        RTE_ETH_QUEUE_STATE_STARTED; >> +                } else { >> +                    TESTPMD_LOG(WARNING, >> +                        "Failed to get tx queue info\n"); >> +                } >> +            } > This code is a little long after adding some comments.😂 > It is a full code block. Let's extract a function to do it. what do you > think, Shiyang? +1 to extract code into a function. >>               stream_init(fwd_streams[i]); >> +        } >> +    } >>         port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin; >>       if (port_fwd_begin != NULL) {