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 7C9C645C11; Wed, 30 Oct 2024 08:09:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 62B3343304; Wed, 30 Oct 2024 08:09:03 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) by mails.dpdk.org (Postfix) with ESMTP id D7A2B402EE for ; Wed, 30 Oct 2024 08:09:01 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ilm0eZSdqu6Bml1AhD6Eh3SHg5bH6dtfQ44z7InlkZRKZj0WOdVG42xGNEnfMQJ9OEWhfHSD4FfSl4Tlke1h3QGjYrHP46KhdzomeqPDNF68h0fSBArfYJqy5T1jN6a7aHzDuPtYKg2+gGD4LO/INi16LXzi2zXp67T++dc3KfsUxVrcwtx6/1uWuqPmmgT9zHxC9SbEgqJRm9GU4LHq4/9ywscP2B+q6A0zMKZq7yUe7Y6iF07+AuUq+rQl+KUOfkNma9ZYZ1g+Mdzn+sfvgYgn5LOj2T2CNBouST6kaQ9sxjQYnhedDLVInVAVrzZ9Fx1Z6asPJAo+v6OSdBPG7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rDEFBBHqu4JkBmpIqOd+6LmUm4XLKd1oK2z/JiAtda8=; b=ig2nM28vp/ffGla74xQn6QhckphAYjuSnP26199uvOO/eEy2/JuX+EavbndkHrHkv9gIGtPJbX4wlH0RDo2fGCrqBzE/bhX2dt1tVSSmGwqzrSEQlEFTzDMeX5lFYLa/7DnZ2anYgrdEh95BQWCX+0dDkZ1VuJv6v5t76USBk5S8Bzifi8KSaUFoyRASoItyzBlbSFzhWiScBuldlFa80uAGUkCpyRHgFwt3VYwdKA6rOZF17dYJZ5YDNA4GEXh6riHYLxsQsafnfHlEtLKMMj3wrAFzTPbjF8nhpOSF/sNKo+TwbOtA+0D0rBR33CCn73NPsguH/9JNvWxVpo2c7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=rDEFBBHqu4JkBmpIqOd+6LmUm4XLKd1oK2z/JiAtda8=; b=qndgINZSK2oLubxLP5DIv7pdCyXv4eu28D9xkp+y5z1auMwKAWVL1NADOOX4fL7R9PB3j7IavplJxpGjW98bn4V/Sm21vs6+V3Mccp1jfMBUHupTKKtx3SPmfcMAou65b7Ke+1MEJM91Ncl9ovw374IU/t9mOXikNeSezfgZrJnlZishy4ee+qak/PilNgbbVFZwATmtayi9NC29SulAkPzYrdRuxyWNHAtaX0AVer2ondeHxgET5RxuFhZH3Hg+u3/VHLK8hHQQCfB2IcNZEjY5T5wrlGKQlFBDfLAo0nlPtIgcoZZqJD4BWYiHXAAOiN3oMbykGHjB1o1OXq8SDw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from PH7PR12MB6811.namprd12.prod.outlook.com (2603:10b6:510:1b5::9) by IA0PR12MB8745.namprd12.prod.outlook.com (2603:10b6:208:48d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.30; Wed, 30 Oct 2024 07:08:55 +0000 Received: from PH7PR12MB6811.namprd12.prod.outlook.com ([fe80::8f8e:db0b:ddfc:a5b8]) by PH7PR12MB6811.namprd12.prod.outlook.com ([fe80::8f8e:db0b:ddfc:a5b8%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 07:08:54 +0000 Date: Wed, 30 Oct 2024 09:08:46 +0200 (IST) From: "Etelson, Gregory" To: Stephen Hemminger cc: dev@dpdk.org, mkashani@nvidia.com, =?ISO-8859-15?B?oA==?= , Aman Singh , Yuying Zhang Subject: Re: [PATCH] testpmd: add hairpin-map parameter In-Reply-To: <20241029192945.4cfd7d73@hermes.local> Message-ID: <1fd13eb4-5051-f562-d72d-a277f5d7c91@nvidia.com> References: <20230928133906.711063-1-getelson@nvidia.com> <20241029192945.4cfd7d73@hermes.local> Content-Type: text/plain; charset=US-ASCII; format=flowed X-ClientProxiedBy: TL2P290CA0025.ISRP290.PROD.OUTLOOK.COM (2603:1096:950:3::20) To PH7PR12MB6811.namprd12.prod.outlook.com (2603:10b6:510:1b5::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR12MB6811:EE_|IA0PR12MB8745:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b445ac0-545c-4909-5616-08dcf8b1b6be X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?8rFMHy3e0WSUea9B0NPZeZRY/PPGpvwDOPDQ+eawnnKr1LyAfLRCbhvuUtbN?= =?us-ascii?Q?dVGH4bCIZgasTIqN7IYwsYdCqxhcILNV5JVOxCYyv5dbWUwEzAR2XWpzmVBy?= =?us-ascii?Q?p+bBy4cgz3WPXHztR3vK6nedYySPQi8Ttlz8CvAnIT3D9Z+HMYaTxgkdbArn?= =?us-ascii?Q?K9tS+rM20eL9Fjt0ZtM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cVucRIqKvociqmu?= =?us-ascii?Q?HjYntLLLdFJfgXbIH3Ug4ofEcPXjjUgtSiSdU2z+qAJNmQbX+xXJrxRtdEJP?= =?us-ascii?Q?b3Kh+Ru5oyAfDJjJkYYrizOOqljHWvUQ0Z8f7XvMuCN167g9viwniwjiLIkd?= =?us-ascii?Q?HbdsTGvMPxBI2g/g1i3PHK9FoHhDXsqCgv41DlkjrqYf/TJpuvPwck1mZrn4?= =?us-ascii?Q?E0YmjpEk0UMACkFWwE9pA1q6q3bixvjvKRS/RDxoWA7OG/2ihJT0IP8RSjan?= =?us-ascii?Q?O9a4Dao8Gol6wxSO39WbL0Tx?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR12MB6811.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?augGNuksIOsd/bLow75yEMPNqWtCPJvG2TGIr9sHjAt2D44gu/VjB9j9Ldue?= =?us-ascii?Q?ChuLkggZKaWDw/1aF/8R6wPUKVjxxU01vPfP/iaeDiK2OPMhBfgZ4RZjJLIh?= =?us-ascii?Q?yfzDeizyPVIPndd2R1zvydiPTvPVmy0a66IpKfx0KlkEeeg1tFebAWcLNLZg?= =?us-ascii?Q?mqoFPF/tUVWT+O7dF15W1B9kIWHtgyVx2o0Ymxk5DqEsYKrOmw21HjMERh5l?= =?us-ascii?Q?VnBtOvPjT9n0dCVqHCU4dXLFDHNokUZgNgKO1veqMdsEC4tXT4YfCHloZl+a?= =?us-ascii?Q?77THlcvR2XpjbLtPwhDoPANctAVmAlz8om4ozsfMBjl4P6Y9m4amVD709Ugz?= =?us-ascii?Q?gajcIU3iAQb+azBav3QBXRR2BhDwfYq1kETOX5eKvorrKujEM3ayglGgXwHf?= =?us-asc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fBQ4yjh0jPFGaUJx7g+o0rm?= =?us-ascii?Q?AM8epFOeZg5vjad4+P2W45/Bt5Z94fs/Fw1yh/notQZC3q7RI63CZtb4yMRR?= =?us-ascii?Q?Y+dyBrQAK/ELrXQ086KEdGAHU2UN2KOpMniHZpn7Au9/IuwMjAv4VHsCVSfZ?= =?us-ascii?Q?O8x601tEjipCWPFD2wyvDh2zcKP22qR9aT5l7nQ11VmV2czbcVKIVh/bJvsG?= =?us-ascii?Q?C1z+02hQaKcEoUlRDAEzemBk67rFtDG07XGxE9c1Eup0yd1abucHzMWBHmvV?= =?us-ascii?Q?MdA9e5Lhoc6vhcK5uIWx/Nppi2IsMQ62M+GflZ7S?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b445ac0-545c-4909-5616-08dcf8b1b6be X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB6811.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 07:08:53.9960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LHC4CgoRmYeBAf0sz3i51TPBZWV3SysElYgnfUQM0sQSA0Dshe9evCxluWBKafBPjaqRQZcZPYgJdABACbBylg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8745 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 Hello Stephen, >> +static __rte_always_inline >> +char *parse_hairpin_map_entry(char *input, char **next) >> +{ >> + char *tail = strchr(input, ':'); >> + >> + if (!tail) >> + return NULL; >> + tail[0] = '\0'; >> + *next = tail + 1; >> + return input; >> +} >> + > > There is no reason to mark this as inline. It is not in fast path. > Let compiler decide. > There will be no parse_hairpin_map_entry() in the next patch version. > >> + head = parse_hairpin_map_entry(next, &next); >> + if (!head) >> + goto err; >> + map->rx_port = atoi(head); > > Use strtoul() to allow checking for invalid number. > Seems like the parsing here is following the parsing code pattern > that could use strtok_r. I switched to sscanf(). > >> + /* Fail to setup rx queue, return */ >> + if (port->port_status == RTE_PORT_HANDLING) >> + port->port_status = RTE_PORT_STOPPED; >> + else >> + fprintf(stderr, >> + "Port %d can not be set back to stopped\n", pi); >> + fprintf(stderr, >> + "Port %d failed to configure hairpin on rxq %u.\n" >> + "Peer port: %u peer txq: %u\n", >> + pi, qi, peer_tx_port, i); > > Minor nit, port should be printed with %u since it is unsigned. > Lots of testpmd code gets this wrong, and compiler doesn't care. > fixed. > >> +/* Configure the Rx and Tx hairpin queues for the selected port. */ >> +static int >> +setup_hairpin_queues(portid_t pi, portid_t p_pi, uint16_t cnt_pi) >> +{ >> + return !hairpin_multiport_mode ? >> + setup_legacy_hairpin_queus(pi, p_pi, cnt_pi) : >> + setup_mapped_harpin_queues(pi); >> +} > > It is clearer to use an if statement in this case. > Also, better to write positive rather than negative logic. > > if (hairpin_multiport_mode) > return setup_mapped_hairpin_queues(pi); > else > return setup_legacy_hairpin_queus(pi, p_pi, cnt_pi); fixed. I'll post fixes in the next patch version. Regards, Gregory