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 17E99A0543; Thu, 15 Dec 2022 18:50:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 97EC740695; Thu, 15 Dec 2022 18:50:46 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2064.outbound.protection.outlook.com [40.107.244.64]) by mails.dpdk.org (Postfix) with ESMTP id 40BC340685 for ; Thu, 15 Dec 2022 18:50:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y4XhHRH4vSDq2CweMxn5dzq5I6SPuU+ikXVT6KVqf/lRkiOynufSrlmrz8w4dfntSAvauKqgzgccfjq7aYoddG6J1X3Ig1ZbnWR63Qqcgt15aoRrfEc6an/blkQ1rlkTVHgf3L9RImkWq7Si2V1EP2wyqyCu4XE5tscSUvbB+p6SuQX/JBellfdH9wDTLdByYciDNpQ0QQCM1b49uGQMwhV9iBA8x46GdMXpM43u9CI9mJABRbxIrzUoVqOp81qfh/iFOZUVqvAYaFchJgM1OZEsDbnO2/6HtMyD0+MABXoxHAPQgql9a+/I8W+pwUQTRKVQ9oSFGOmpZtYAxys2lw== 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=gDGaaOt2QzLwVkd5V/J9FYRUHDW6r4l3Q7+nsdaTNOg=; b=BI5WjtZ/E+mYmRbFfHhxfEyb3kMv5700q/ibMG3NEaek04r6LNaAhYGMP5DLaedssLTph+T26+mC2g5q7Vcap/GbVg1KeZNaNod7ySYJ8P6Y6z/r3zg4uB/keFcVhvR612wZaOvF7pAnUhI97JDZacq/WqJya7Hc42XzhtYCi6BWnbKa8aw2CrmOB9VvJfppsyWl6CH4MrbHbykO/EBbmUEOCQx8zPCwvCdDua2cnRws8JUHEglze+ejKbspMP8Wjzb3WN3444a9D5jwvXi9skTX9SRYoSUwlimjQ/dM+BpppDZhGjbzdEa+z+Q0GmJjivoL2Z0IOWOVDsqHQ0OOPQ== 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=gDGaaOt2QzLwVkd5V/J9FYRUHDW6r4l3Q7+nsdaTNOg=; b=D/MhUYKNt5wfrwkWLRVUzQmopsNjmDOUSpPG52app87BGwiXU0SNrG91pWLugEukmKDNRQ8zFVWIE4gWVXyTZuH6PdCpfbS0yx/ncui60vRKeXl+JH6iCVbhMusN5wjMk4iCocTsAbh7iFjwWbKEYTDbK5fwYvGDwHf+hKih7kM= 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 BN9PR12MB5273.namprd12.prod.outlook.com (2603:10b6:408:11e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.11; Thu, 15 Dec 2022 17:50:43 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a%7]) with mapi id 15.20.5924.012; Thu, 15 Dec 2022 17:50:43 +0000 Message-ID: <9347efde-b15f-a611-affd-a486a47bb44c@amd.com> Date: Thu, 15 Dec 2022 17:50:38 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: Question about add ethdev loopback set API Content-Language: en-US To: fengchengwen Cc: "dev@dpdk.org" , Andrew Rybchenko , Ori Kam , Thomas Monjalon References: <1109431c-2b18-cc02-5e36-5c1e2d298a82@amd.com> <2d70ef33-5cc8-f56e-91c1-a44fd5450ba2@huawei.com> <3fa49fba-4eaf-afd4-7677-9a50713eca04@huawei.com> From: Ferruh Yigit In-Reply-To: <3fa49fba-4eaf-afd4-7677-9a50713eca04@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0485.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a8::22) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BN9PR12MB5273:EE_ X-MS-Office365-Filtering-Correlation-Id: 11c5a31b-e0e0-40e7-8ece-08dadec4e2ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /tVQJG/F3Y1Y5NDhAL+oy+5HILA8tbPyr2omhSJbd147Jp9e5ovCYjo49lFWjVIZY/+tzLOG8hlFgKKyv56/GSS0EnABPKEubS/Ru599Wa2hG8jccBpYj8gbyg7ksFOxmuFynbw4xA6NkFUe0DAQnIzucEOookCxI3iwnv07TFxxfx7E4tMMUABEZGTy655HqCjeq4eesfOHxBeHU6IqwnyiNms+C226ulQZTy7z1hSFmwcIf1n2O4HtBLBxCJRJT2hQWFKIRtOUEneHDWj7+BkyXIPpWVyeqZmgwo00plnO6sVrj7a6f2LIBVG8dIIHPEo8EDtnXBDpLPUpx3E4jlytwOykWyuiphhVX1fVmRuvb3L0FttztrMDEe9bGzjtKPy26M7vUrNhDX0eRVjS+YQaCuVRwOqdl/3h3XFHEFh+RIGXjRIb/I/DZk17gioAWSjhv0vYEjzppQvrJYkcEJjYYPoxZXhJt23AVeMrs97cRKhd7RGPW7Vxqd0yt3LGzmGQ33dalRhJE+CnJUWV9xG6cbKmpW0k3Kh7wj1FkNpIt+YmVk+KufwH0t6qhav4AqDxSdzASZaF3iQYBM8kYDTzdSey8l3l1Ecw7B1tG9l0+wN8cvS+1RZJVH7rpEoawFwN66AAL8nOhbFF+ASkeVtUVmeNTn1TsZywjy37OhOYGAFB8jABE0Y6MqtYUl4O2VnF8MbmNW16LT3opRN+a2a4xjQ/K1amtvSLErdOj5c= 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:(13230022)(4636009)(39860400002)(346002)(366004)(136003)(396003)(376002)(451199015)(6916009)(54906003)(6486002)(31686004)(6506007)(66476007)(478600001)(2616005)(66556008)(6512007)(26005)(53546011)(186003)(4326008)(8676002)(8936002)(5660300002)(41300700001)(83380400001)(66946007)(2906002)(44832011)(31696002)(36756003)(38100700002)(316002)(6666004)(86362001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dFJPclBKU3RMcVp0RDhObHJPZ1owZ3JUR1dJdFRoZGFNbjlQUXF6dExrai8z?= =?utf-8?B?cEVRcUlNMmRvMHlrS2lJVmtISVVIQWxnOFRkUmNLQlIyN05Fb1FFMVJrY0JN?= =?utf-8?B?UEZybVZLMXNwZmNwUW5wMXFTemJXUG5mekQySk5CaWg3cThuR1lMbW1Wckpr?= =?utf-8?B?bXZqblY5WTBUL2Z2c3pYb0tKMGIyeGpYY0RIS2hFaDc4RTdabGlnS0ZsN2NE?= =?utf-8?B?RW44ckxlTVd1MjVDTWN5NnUxc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zVndUQXF4WThuazRSYWlDNk8zbTdZVkdBMUw2ekNJamw3cVZkWDRG?= =?utf-8?Q?GWGOJCyE63SIBj8cdxNNWZ1Zt?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11c5a31b-e0e0-40e7-8ece-08dadec4e2ee X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2022 17:50:43.0774 (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: GTxy4lkX5qo7NHL8zv+stzy9dVIs+XP3U29G78u1P+7moDQAJqAltk2XJ6320/2l X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5273 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 12/15/2022 12:46 PM, fengchengwen wrote: > On 2022/12/14 18:38, Ferruh Yigit wrote: >> On 12/14/2022 7:25 AM, fengchengwen wrote: >>> On 2022/12/13 19:25, Ferruh Yigit wrote: >>>> On 12/13/2022 10:04 AM, fengchengwen wrote: >>>>> Hi Ferruh, >>>>> >>>>> During the test, we need to delineate where go wrong when encountered >>>>> e.g. CRC error. In this scenario, loopback is useful. >>>>> >>>>> I think we can add a loopback set API which could set inner or outer loop, >>>>> and user can use telemetry to set the loopback in the above scenario. >>>>> >>>>> I'd like to hear your opinion about add a loopback set API. >>>>> >>>> >>>> Hi Chengwen, >>>> >>>> Is the intention to test ethdev layer or driver? >>>> >>>> It is possible to use ring vdev to create a loopback and to test ethdev >>>> layer. >>>> >>>> For driver, it can be possible to create physical loopback connection, >>>> or even can implement loopback Rx/Tx burst functions in driver. >>>> Using another host to send/receive packets to DUT (device under test) is >>>> another approach. >>>> >>>> >>>> What kind of loopback implementation do you have in your mind? >>> >>> Mainly MAC layer and lower physical layer: >>> >>> -------- --------------- ------------ ---------- -------------------- >>> | | | - rx | | - rx - | | - rx - | | | >>> | Host | - | MAC | - | SerDes | - | PHY | ==== | Packet Generator | >>> | | | - tx | | - tx - | | - tx - | | | >>> -------- --------------- ------------ ---------- -------------------- >>> >>> The support loopback in hns3 platform: >>> Inner loopback subtypes: which host send pkts and recv and then verify: >>> Serdes tx to rx >>> PHY tx to rx >>> >>> Outer loopback subtypes: which Packet-Generator send pkts and recv and then verify: >>> MAC tx to rx >>> >>> I think we could support the above loopback types, and maybe other PMD platform support >>> more loopback types. >>> >> >> There is a 'lpbk_mode' field of "struct rte_eth_conf", to configure >> loopback in 'rte_eth_dev_configure()', >> but it isn't fine grained to define the possible modes you mentioned >> above. Currently '0' means loopback disabled and non zero means it is >> enabled, details left to drivers. >> >> 'lpbk_mode' is 32bit, we have space to define detailed loopback modes. > > Emm, I found the lpbk_mode is not defined in a unified manner, which is vendor specified. > >> >> >> Having loopback configuration in 'rte_eth_dev_configure()' requires port >> to stop and reconfigure to enable/disable loopback. >> If it is possible to change loopback behavior without full >> reconfiguration cycle, we can add two new APIs to enable/disable >> loopback. But this has the downside of two different APIs change same >> config, and we had problems related this in the past. > > Yes, the 'use rte_eth_dev_configure() to config loopback' is inflexible, and I also notice > the testpmd command "set tx loopback port-id on/off", and it invoke PMD's public API which > is rte_pmd_ixgbe/i40e/bnxt/dpaa_set_tx_loopback. According to this information, loopback > needs to be configured during running. > > So I suggest add one API: > > int rte_eth_dev_set_loopback(uint16_t port_id, uint32_t lpbk_mode), and costraint > this API can only invoke when port is started, if turn off (lpbk_mode==0) then should > recovering rte_eth_conf's lpbk_mode. > > Also the lpbk_mode is vendor specified. > 'lpbk_mode' is 32bit, we can define as some X bits still will be used as vendor specific manner, but rest is defined. I think this can work. OK to have new API, and use 'lpbk_mode' parameter of it exactly as it is used by rte_eth_dev_configure(). >> >> >> >> Also there is a hairpin feature in ethdev, that connects Rx queue back >> to Tx queue, but not sure if that justifies your "MAC tx ro rx" testcase. >> >> >> . >>