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 2AB85A034C; Wed, 15 Dec 2021 02:06:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0B8A940041; Wed, 15 Dec 2021 02:06:25 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 9D8264003C for ; Wed, 15 Dec 2021 02:06:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639530383; x=1671066383; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=DlluLAW4bUBlAlwjiV82vjve5Xq3VkIG1aZT42aNd04=; b=EQrTXMWGrW/Flvitq8eTLVKztUeQblSqs39V9hL7KS6Z5fVKoLVOGGkr V4xKP0Y1NwTNDobv4GGq6wxZytuu1SKKSssnreTtmFzu9Qg06oyI8bV6j gV0ApZE2TEqzraosGD9EPjXyX8iJJhzqaGYeyLFlkQPijqJzystDsNzg7 WDBUzsIbT9PD6LlFIpHR0gahdCTzDMMaYOPAU17bey8UJSQvin/lJB2b1 9sU9NGwOqYJ9ualsniBXbrGBOtE8wnijRYPBQBhtlRBG+TTrmvgq69dvN su2L8+7WXztuowigPsGCI3mOfbzPkKkWtcktWUBJlvjw0XGgAYgYyPxpD w==; X-IronPort-AV: E=McAfee;i="6200,9189,10197"; a="237855043" X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="237855043" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 17:06:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="465327204" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga006.jf.intel.com with ESMTP; 14 Dec 2021 17:06:22 -0800 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 14 Dec 2021 17:06:21 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Tue, 14 Dec 2021 17:06:21 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.48) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Tue, 14 Dec 2021 17:06:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ze0neQbVoNIB3lDa2cdYNq2rCczair+jWGeUv7cClNOML3VoLWniZfLhKALgv+GgGy/lyM7Go5qlkHbIGn8POAZhtMAGVHhOidAHVTFmsZlvZhAD/asN74NsXh7X+zKrAcgerJLSIP7mIFmNcTYoGxutvHjYuF/rVVAD0TOI1lOA5MWfRLoARlNx2TEJ+nAr/XXID9odaM3fpeQlCkok00shJ3I1Vc+qomVarZhPY0TxnXZTiANfSvkrIoNTFbIYBWE7TbquZ28gXQ360mwP2q1HsnEzBDkoV/qoJGreHmgqEwVFJYmxVEQpr/yzUd82WHmmc94aO+oEXC8ZHRRkHQ== 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=60bq57hjkkAXzMOmpzsEYY/1tpOyMeNFJfBdOb0WDYg=; b=FjFs81PUVuWSjlUaf2mJ3c9PWnPrAAPR5H4xMV9lpHnv/2qv8qY3gM6pM/Wezd1oEIkkE23arxi1epw4ZY9jgTXE1inNEWUEViShsbfsx0kf/eunTLBst6PxzanvtK8sxrskhDIXJ6b1jpWynZoEfyHAV0klisCeodjfInkN036UhEe5Ucdf0+BmNoldmnalE6WrFG/Ox9Jf7k+F03SdeZYHJxyBbyauTPDZkCt/w5A3dWKDuPyO8DUR7FUPSLXICeammMX/8K6NP+lESCIWxoo4pZ4gBP8CXGXBIJx0XE1wD/RwWbF1gFbel8OGUeiaNXsbJJcLZTWOEK71u0U13A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=60bq57hjkkAXzMOmpzsEYY/1tpOyMeNFJfBdOb0WDYg=; b=wED2bormgCur0VPGERA/OULN8SvNBmuFPraQ2QbegKXl85miq2lm/k1GbJkLnV1rE3a5l2rW4A4d6Baoqa8M6cSEKSLDbMOO9LEVGN9f5AEA9+nz5oQXycoQv81vN/uKOfI4N8W8WIr9MxBl/QPkh7sK8mm5+IhWUXpMMZ/aoD4= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB4514.namprd11.prod.outlook.com (2603:10b6:5:2a3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Wed, 15 Dec 2021 01:06:15 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::fc25:a06b:f39b:569a]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::fc25:a06b:f39b:569a%5]) with mapi id 15.20.4801.014; Wed, 15 Dec 2021 01:06:15 +0000 From: "Ananyev, Konstantin" To: =?iso-8859-1?Q?Morten_Br=F8rup?= , "Randles, Ronan" , "dev@dpdk.org" CC: "Van Haaren, Harry" Subject: RE: [PATCH 02/12] net: add function to pretty print IPv4 Thread-Topic: [PATCH 02/12] net: add function to pretty print IPv4 Thread-Index: AQHX8PTFP9hsNqd7j0O0/WdLpn6lkqwyPuCAgAB9U2A= Date: Wed, 15 Dec 2021 01:06:14 +0000 Message-ID: References: <20211214141242.3383831-1-ronan.randles@intel.com> <20211214141242.3383831-3-ronan.randles@intel.com> <98CBD80474FA8B44BF855DF32C47DC35D86D6F@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D86D6F@smartserver.smartshare.dk> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 73ddafca-b1d3-4f47-5a59-08d9bf6717b8 x-ms-traffictypediagnostic: DM6PR11MB4514:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ac6cJFo0lrjmzq7b9ptPyr7cJvF7qJcH8iiutJo7qkfFaINrRqS8Du/h7fBHLI4ZFP7YWsBH5Mnd1rhB5oZ4z37dYglPH2aGrrdPaGgmK4CDWr7ByF0ykCNchGdPHn5BMsaVxHungAG5E2uDprv8hD9zcV9urmVwpsIrd7pnXCsRFKcGN6BFl40HhFv457ZfgcNXlEH5wJGeW5wlOFiVdlorzKoxmc0ozvRYSEfTJ8HoxuzcopUC4yiua33i327IFoo8719jYzsYRnEeO1Bkx0uVEQnUxiW6XrwYxblSqL0Iag4m52TK+WIH7vnr8TbiPrlgaZ6DNgHvS56lkJkj04+a9s23ZbD48I0AX/cEYnA09ow4AWgEbSzKFJoLVLrwclKIomS5KMd9WDwIQBa4iMMBmFQyS1QArwD3iPOaDu3omim5fC+aYlLCtCGAUiVWiwFo0kikrSkDOslZObGHn9fZGyMSjGp7NQ3Rk0GMW5wLsDAuTEDj4/tGW2+XFlwM/UA0PcC9HrpJfvviPSqwFMJoUfPyGN08YPzHobZuyxe5jWhZZkHMwtT4uxRq0GXhnYM+x+GPeLhKdbiASbD9G+BspQkE9AQ1ctgYzBFC/6mWFYzu84zpkN2hNU7jQZKgQyyv70si2oxdhKRFMmhg1SuCbEio4EzwrfmLz60/UTCKwICHPwXNOpXjSe+sFazhMgs+NDTTbXyKaUk/tNmcYQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(66446008)(55016003)(64756008)(8676002)(66946007)(38100700002)(66476007)(66556008)(66574015)(110136005)(316002)(8936002)(186003)(53546011)(508600001)(52536014)(6506007)(82960400001)(76116006)(122000001)(107886003)(86362001)(5660300002)(7696005)(71200400001)(9686003)(38070700005)(4326008)(83380400001)(55236004)(33656002)(2906002)(26005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?jwmvzcmKhIXqh6wr8thwBJuk9BYDDU7TcU6nnWCD25ES9h9U8eBVxbBS/k?= =?iso-8859-1?Q?WQivtdp+0YH9wP1gc+K61JTFtUIszZHGSJDbzZauxEPfmfd+FJg6Ljaz5y?= =?iso-8859-1?Q?En+/WAn4pVhJxaHx5QNTblz/G36nUGn47qiawgai3EEAv35yb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MVW2grtg9pAyMrF+KJ3UKo89LrKTx81?= =?iso-8859-1?Q?ZRIrjfGnKcfby4gNpoTuBmOi5Rf0w4vivQXgxvAgSGiuh3NVb4cisJPBn5?= =?iso-8859-1?Q?j3NbH6NUZLBdCE4kitGZ3UC+bR20XeLnrOgepxKdy+9L2WZfLSzHIoGUln?= =?iso-8859-1?Q?fACZ5g1ENoxSMTqV5EFWZuo4c6OwBsAFzfkSP053ImcXW+LkQmiPjJTzHX?= =?iso-8859-1?Q?Sfwn6EZG6zbS2d6F2tz0AYmz+gtpgo88FBKDfdQQxc3KKVGRt4/9JuC7vU?= =?iso-8859-1?Q?+4yUGVeCqj/M510JJTb30PY0YnVw+U3w1dsDbFe9DENlS1QNvafsyuG41d?= =?iso-8859-1?Q?4KupkARyiQFD/kVWj9zudIdiuNJhL1lXLatooUuSRkpNTIBhOLfWzT1BjU?= =?iso-8859-1?Q?DX228LRL34HBYrYG1ddupvziPChRqlThMrQLCNmokDt7Ieu2WeFgFQk4FW?= =?iso-8859-1?Q?WwfYwLvhdNrsbnygPTDQVZra14dWFv5vXqu5BYkVzDXLzleaTcJC4sSsJR?= =?iso-8859-1?Q?tLX3B5mUH+l1YDv2sCPdUnL4AcZwkYQJvZdKdlcpPO0/2Py0RTpK9Hlrsn?= =?iso-8859-1?Q?XNYBl1e+oaW+P+XAiLf0bYbdmP5cXLEQPsvf69d5X+bTh0Wcnnth2iY/30?= =?iso-8859-1?Q?PvxsKpmmrakIT5Ba/7IgduCe5R3Fz+9eS1/a/AyYfj/rcC+Ga7oTz/9HQp?= =?iso-8859-1?Q?EBog=3D=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73ddafca-b1d3-4f47-5a59-08d9bf6717b8 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 01:06:14.9192 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nlmI0INdh7N5vLhApjQBGuxTydnR1MvGuD9HP1jybvsSqkges63ks3xlBGs2Q81hgGaPm6dILSeUPmJfClkihkU49dComfMYVL653WUcvCY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4514 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Morten Br=F8rup > Sent: Tuesday, December 14, 2021 5:31 PM > To: Randles, Ronan ; dev@dpdk.org > Cc: Van Haaren, Harry > Subject: RE: [PATCH 02/12] net: add function to pretty print IPv4 >=20 > > From: Ronan Randles [mailto:ronan.randles@intel.com] > > Sent: Tuesday, 14 December 2021 15.13 > > > > This function accepts an uint32_t representation of an IP address and > > produces a string representation stored in a char * buffer. Realavent > > unit tests also included. > > > > Signed-off-by: Ronan Randles >=20 > [snip] >=20 > > diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h > > index 188054fda4..e46f0b41ba 100644 > > --- a/lib/net/rte_ip.h > > +++ b/lib/net/rte_ip.h > > @@ -444,6 +444,26 @@ __rte_experimental > > int32_t > > rte_ip_parse_addr(const char *src_ip, uint32_t *output_addr); > > > > + > > +/** > > + * Print IP address from 32 bit int into char * buffer. > > + * > > + * @param ip_addr > > + * ip address to be printed. > > + * @param buffer > > + * The buffer the string will be saved into. > > + * @param buffer_size > > + * size of buffer to be used. > > + * > > + * @retval 0 > > + * Success. > > + * @retval -1 > > + * Failure due to invalid input arguments. > > + */ > > +__rte_experimental > > +int32_t > > +rte_ip_print_addr(uint32_t ip_addr, char *buffer, uint32_t > > buffer_size); > > + >=20 > In continuation of my email reply about the IPv4 parse function... >=20 > I have a few suggestions to the IPv4 print function too: >=20 > The return value should be the number of characters written to the output= string, and still -1 on error. With this modification, you could > use the return type ssize_t instead of int32_t. >=20 > Furthermore, I would prefer having the parameters in the same order as sn= printf(): char *str, size_t size, const uint32_t ip_addr. Please > also notice the suggested changed type for the size, and the const added = to the ip_addr. >=20 Honestly, I don't understand why we need to introduce such functions inside DPDK at all. What's wrong with existing standard ones: inet_ntop() and inet_pton()?