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 D517F41DF7; Mon, 6 Mar 2023 16:06:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 973A240EE4; Mon, 6 Mar 2023 16:06:09 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by mails.dpdk.org (Postfix) with ESMTP id D90DF40EDB; Mon, 6 Mar 2023 16:06:07 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b55T6oMlV/r5lMCkDhsq2CLWo55YwqU/veAv1+dg5aJeWiOSBkwliuHWB3D2OXI0NvlKQPhJbHnHKJnvheBBUa2JPxuY85byDFDC9onXilouBqV1xvz5eR4+Ug2Ky/EgnI3fPBUdqmkUIl5YmqSHBY3g814kdk5ZlEl/uXwoLS7zYj2Cc4rB1WfYj5JzjpL7mn+wGY75b2RJ4Oh9UsQmiYAlSfd5HMnpdq4qGxGL2G/Z2cEe8bMtDGee0ZyX15VskuTATBRhdSlmk0ylzvESPCKz7CzVHnO6Q6u3R057o/BfhgsDOWqP8S3vSBrJcyUSdH1Cq6UedDmUMtPlcOW1NQ== 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=lsRRrP6OM6WRHO/8Jcy5C8ygYbH6tm9pfTIJgHlM8Ho=; b=k7ZJpUcnwhvJbwVhPwyR4pmkuGFPXn7lbdEx9cbDSbTdPNq7jS6IMdE8QhBwX0m1EO4D1faIkvU1WnQTA7HH5/4Ek0dk44G4qElLEytb/R4CJzJfgDHvJQ4Zkx1YOqxHo0nrzk5g0eJVrjj3fXZh8ZloXGes5CSfJXIGD+AKo8zUVSKBG6HzuZV58b8IhZU3Mqt9mhEWt3yZ3QuZvRhPLWttlBITfsYdMs009vlRuKBMAnUqhQG077a/QnhgtmOlFnnByWdKb8hZ43ozh9u0RlkAt7kHvLtfqVzjYWzpRLSEsOgGIqp+k0OphJTUpfpTIGjIVohy3w4IWOozsgR9mw== 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=lsRRrP6OM6WRHO/8Jcy5C8ygYbH6tm9pfTIJgHlM8Ho=; b=ORtTy+TJ4iLu3q6B2F290gfODhVUkdx1V4za1CzSwhM6NGdB6kjVj+fRxBWyeoulRUxZ1rm1M0L1KndTNek2Se8D6X8CkmvESUtAq2moiNLKsIu6IfB1uoH2ZZ7k77tgv6qsxRAHKZ6v4NeHn0oeNVetA4X2DW55WQuwTe7ZLOY= 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 CH2PR12MB4857.namprd12.prod.outlook.com (2603:10b6:610:64::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Mon, 6 Mar 2023 15:06:05 +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:06:05 +0000 Message-ID: <6b982bad-f9e6-62be-7a0d-30c7431889ad@amd.com> Date: Mon, 6 Mar 2023 15:05:58 +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: 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> From: Ferruh Yigit Subject: Re: [PATCH v3] app/testpmd: fix secondary process not forwarding In-Reply-To: <20230223144106.707999-1-shiyangx.he@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO6P265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ff::19) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|CH2PR12MB4857:EE_ X-MS-Office365-Filtering-Correlation-Id: d917c05e-301e-4286-bd2f-08db1e544f0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YQW+N7XxfcmvujEL2grYDjpqpV9IYsMmAS7K7yx8fFYA5mqFjJwODHM4CWwEXENWIdb3eOlw5o+B+TaPLctYkaXAGIp2r1Ee/h4wwaBwCQWxwi+8760xNaTAa8iZtDONQ/At+DrOBxkTu6psCgJ+f0sIAKz4Y7yx4WR8PJNFA5devQb2zFuMFKlaT+9bfWktDXcdVj/ojtSPhslVzMiKX3hcSxLPeTmO9GK2xSF9P8yFxGpM58oEMymSqCDrXcHxBdWuJTae6Iad0nKz0TFPKLLZF1u7V2QVBPRxdvmWGbFm+ibqXXKTHOKIC2uQ4EtXlu/2uV52eB7zLhEav/tv+1xOdp5NNg8SnWjjF0CsPAkN6EpwgrXXkD8Jmlkx12R8fonS1x3d5kYBrn2Skxy8tkgkXXB48DfKWzwQjzD3BWSvNumPmNHBt5Y+M8maUvX5jcgkYmhKGlRQi14j0CcpbStn57+PP1kcogv815NHQenR9onw/YBYyUXfUb/kWYCx60SXvjth7W7M2nKCw6/HjTKqdYN20GX6jd1kA9ajHr89tFwaNljnpL2+MOaFnjf5Xeuhk5BmvzqRyOugo7HUy9mXJvQDkBV5YSTxYeMvCjP18LzqL/Fr86EnY7KHxMVvURKyaMRPxuGZVRtVNrgBp0X5v9ql7k0ojcqiSA5/yyqpewk5qqDKcdN5/FP/8LEFpBOtWRm/Bu+dfZUn/98pFp7Kgs4OWI7R43E93oAlf7w= 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)(396003)(136003)(346002)(39860400002)(366004)(376002)(451199018)(36756003)(53546011)(6486002)(6512007)(6506007)(26005)(6666004)(2616005)(186003)(316002)(41300700001)(54906003)(66476007)(66946007)(44832011)(66556008)(8676002)(4326008)(5660300002)(2906002)(8936002)(478600001)(86362001)(38100700002)(31696002)(83380400001)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?V1RENGZSWC9KR00zcERoK1VES0dhd0YvMkdTNEFoZkNlNHJXcjkwemRScm0z?= =?utf-8?B?MC9QaEQzSGxLMmplT2Fxek4xTHZqLzNIc3B6NUdJSkRVREpIK0xjZWdZcnkw?= =?utf-8?B?anpzZHpBcU9DZmRpU2Q4dktiWUx3TDgwVHBqWFRQRGdHOE1WdWM4VW5ZeVpy?= =?utf-8?B?S2hCYlJMK3dkckMvSnM0a0FZbGJqdnNEUzd3a2JybVd4bkN5QUE3QmJGR29j?= =?utf-8?B?a1RXbTFx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F3V0RL?= =?utf-8?B?NlhOcm1xZEo3eVVUKzI4WFBYNGZ2cnA0VjhUYmM5LzJoak94UXREL28rU09R?= =?utf-8?Q?+kdzFtCZwBH05L24JlS37icKq?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d917c05e-301e-4286-bd2f-08db1e544f0b 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:06:05.7656 (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: fjr7b3CKyVAMDpTBnJT8a8BawcSmD3V5yGAfRam1wuUpDkymm+Q98iKNkXvUFjOf X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4857 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 2/23/2023 2:41 PM, Shiyang He wrote: > 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"); > + } > + } > stream_init(fwd_streams[i]); > + } > + } > Testpmd duplicates some dpdk/ethdev state/config in application level, and this can bite in multiple cases, as it is happening here. I am not sure if this was a design decision, but I think instead of testpmd storing ethdev related state/config in application level, it should store only application level state/config, and when ethdev related state/config is required app should get it directly from ethdev. It may be too late already for testpmd, there is a mixed usage, but I am for preferring this approach when there is an opportunity. For above issue, why queue state needs to be stored in application level 'port' variable? Where is this queue state used? Can it work to get queue state directly from ethdev where this state is used, instead of storing it in the 'port' variable in advance? And perhaps testpmd 'port' variable can be updated there, both for primary and secondary, for backward compatibility (other existing users of this queue state). What do you think?