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 92CA9A0C41; Fri, 27 Aug 2021 10:20:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33199406B4; Fri, 27 Aug 2021 10:20:41 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2073.outbound.protection.outlook.com [40.107.100.73]) by mails.dpdk.org (Postfix) with ESMTP id 1904A4067C for ; Fri, 27 Aug 2021 10:20:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZozpppW0BcZJuoURzg7kw+rweoMr1g4zgsVZCo5yWMP4Q3KutiuEJHpI2AHhf99Dyd/IulLExXjrVoRqMHw8rebXG4j/QO1GX7JFstVeoNGlCibcRzne3DxH0ygUScARdS9sNd1RcHAxot+WwDotrWI5QyJ3Utp0y94kg7HXjgJ4uDyMx/CQXDCzKYHCuWjoIP2zNiJjLm2zDnEk9noLHgU/Mx7vTW/3wYSyxVC1/+E8cpFnslhxkERoM1eilzRkwS1Qiom4E/RdWxfvLLQTBSRE6lcXHCWXdlrOWKXisBG4iHJDDB3PzfZbLoBHjwyDXzJqv7crqXv8AhT+YxZxow== 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-SenderADCheck; bh=qyHNEGWvefWvCURvtIMejBv8YIqs0vALs73v+qwERQQ=; b=lX4J3BQVPmiH1HVq/aqUknCjm0dKUGZvNlf15Ml7qbyq/8i+TRF8fEXEM32RETQWHFb4fKj2U7PxIFnX1cYufiiKnU3GMiAI9b7znB3vw17tdx8FHAMDSn+M2YRZ6EgdGJJ0P2bW6ak3rr+NyGyunXBTXEQ+PLIXPRPwxstA5bTGiGCD0mKaKGDNHJ1/QiLMipDQbC98M1Cp9wWvk8TUB3S3csC6UqVQLbvYsA6cilFAxU4sI377U0z1+avPJyLFqd8nUHoxwlso8KIdolZDhVMPfdVc5v98PmoYN8XmGG88DNoyKhXSmBQNcGndecteaaGfZzkPo90BC9hcXboi/g== 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=qyHNEGWvefWvCURvtIMejBv8YIqs0vALs73v+qwERQQ=; b=YRj5kXE3LsO+MJlBYSnLVQOKvgNvRu7uKjDOAGz2W6c89FJg3kwnI+I4mdUSnbUrXX2tUZ/owY8LUOjddie5I9O9UnM1dkvKtrtZU4AWGZoV9cmNjsjNJCe0DD7UAoTJEm1uqY58+5DP38qVmJROkr85Ow6dRliLQer9kqzHp7kV1X0DEaE5TFGNFFnIIrUe+mvRXHmoz7+NDev4Zip2TiHGgbKIbIuD7ASP9FWz4Oy66DexzhGkrLZG8E4vS3Icr8YsI61+VCEp6DB0kdqhHPehfk/4o6fc1507xN+rOFnM3yNth+mX1quVc/I7t9vbOQiPmcHFVSsWgPAMasepJg== Received: from DM4PR12MB5373.namprd12.prod.outlook.com (2603:10b6:5:39a::17) by DM4PR12MB5261.namprd12.prod.outlook.com (2603:10b6:5:398::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.20; Fri, 27 Aug 2021 08:20:37 +0000 Received: from DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::20f5:dbdd:64b1:617b]) by DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::20f5:dbdd:64b1:617b%9]) with mapi id 15.20.4415.023; Fri, 27 Aug 2021 08:20:37 +0000 From: "Xueming(Steven) Li" To: Andrew Rybchenko , Xiaoyun Li CC: "dev@dpdk.org" , Viacheslav Galaktionov , Andy Moreton Thread-Topic: [PATCH] app/testpmd: add command to print representor info Thread-Index: AQHXmw5bEKh4eP3aT0OBqUUZwLCQHauHAN3g Date: Fri, 27 Aug 2021 08:20:37 +0000 Message-ID: References: <20210827063935.1834143-1-andrew.rybchenko@oktetlabs.ru> In-Reply-To: <20210827063935.1834143-1-andrew.rybchenko@oktetlabs.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: acb97dc2-d406-466f-9f9f-08d969338cfd x-ms-traffictypediagnostic: DM4PR12MB5261: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:773; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pFvxycWhBuTLBsst8ppKttDXGjRBTo25ZWc/6kxLigX5JV4WkTeo5YGJhoqgxC9vrUv8ulZbRMy/XdTZhCc2ZDTra43WnJfCmYyalBbc9CsyosWzgK7VB+QWkoWd7KNr7DJ/504k2FIibPsNZ0tjVQVT0xZX+2Od+QcLxEUL6c8M7mFJ0wMdP2FX6Wbpm2D0dfTOWxc0hcxw999KNVytaGKuDJV/Uvn46Cp1Mkj1y4waBYgo6KCc2NGrQ8yTuJNwk/yVnL42XiN7+dFTJZ0NVCMjM4cX839Vaeswkv3b4esg4UMpDqorcK9rLYPysvr0ESYsMetjgKuH6NGUuwHQ/omt300Kzbtmmez2Mz5LIkvQmBvjQgKc+52GwZSYdWMNc9BuXaII48BP9wBDilF3IIJJSy3Ugyk8UjOyRVydMeYIH8x8fe8Es5pCOIyQkJHGIbbaZOmUhPz7h8nfDCGxozcpa6egAbyKRVmj440axDSO5h/anoOZOg1QW1PGI7nLVQZangoXnpldNazvM2KsjymLWZNidtOQyKSXjg9jFy/hPkmZFcS1Jm/QbRffnCdC2QB597Ia7z+mm5Jy2P7D4rk2j2XV+XeHWQCPadhWgfHZT56+H60mVf2/HmI8Hd08QQsSFbGQkHT9iZ6ZRDLopZAv0VK7lWmDN8tpnojrkGx4q4kT2hL1veblrYF6Lz0eDVlwe/hcRzkMzIs7BUD69Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5373.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(66476007)(110136005)(7696005)(33656002)(122000001)(53546011)(54906003)(4326008)(2906002)(5660300002)(52536014)(71200400001)(38100700002)(6506007)(38070700005)(316002)(76116006)(26005)(186003)(55016002)(66446008)(8936002)(66556008)(478600001)(8676002)(64756008)(66946007)(83380400001)(86362001)(9686003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?4z0OOe3te2wH47dqif/xyxwFM41hDKP8xEgqmlIY1ygcbQWGNSBel7ubU5/H?= =?us-ascii?Q?H/k4AsrJhTd/7OTwhHgkohiuQwNiC6zHNudVzUsVkjOG9TU65WQRz2SdUY8C?= =?us-ascii?Q?7t18ZIz3HvlfnzFwNCzuX4EbQlqxNuh9n1zFh31lXSK1RrZ0Lym6CxH/nQIs?= =?us-ascii?Q?Hh5HECercbAN2NmcmrNqFqcFSy6pkiarG9guIDZmJB7MWzWllK9hinR0Y6fD?= =?us-ascii?Q?t8Df8KeTX2ij+RGXW68jeRakX8ij3EBS9p1EzZFjObhgmV1HUpIb3StHEj8i?= =?us-ascii?Q?8xad5kdKgHqxbvFt4vqkIzv1lmHMgyJVoALCYCkQpFhW9B4nW/Y5hYYwVIvk?= =?us-ascii?Q?gzOCo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gbZ88ckEHMtvYPJMN?= =?us-ascii?Q?oq5qgpIft3tDeXCC+4nnmNca/gMsgOyRX3l59WV4h5HfMABEyoy5G1HYhdle?= =?us-ascii?Q?VLfZ14dh5aeqJKaIR+liWu08?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: acb97dc2-d406-466f-9f9f-08d969338cfd X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Aug 2021 08:20:37.8609 (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: OzAGQd0n4lbiaZp8EbdonquXA0VyBiqbCKv4fZGlk/3Cvp92GqbdHeoIJaFgeMYw0d86UUC6wfJArNyDy9FuxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5261 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: add command to print representor info 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 Sender: "dev" Thanks for getting this feature more complete! > -----Original Message----- > From: Andrew Rybchenko > Sent: Friday, August 27, 2021 2:40 PM > To: Xiaoyun Li > Cc: dev@dpdk.org; Xueming(Steven) Li ; Viacheslav Ga= laktionov ; Andy > Moreton > Subject: [PATCH] app/testpmd: add command to print representor info >=20 > From: Viacheslav Galaktionov >=20 > Make it simpler to debug configurations and code related to the represent= or info API. >=20 > Signed-off-by: Viacheslav Galaktionov > Signed-off-by: Andrew Rybchenko > Reviewed-by: Andy Moreton > --- > app/test-pmd/cmdline.c | 117 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 117 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 82253b= c751..49e6e63471 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -236,6 +236,10 @@ static void cmd_help_long_parsed(void *parsed_result= , > " Show port supported ptypes" > " for a specific port\n\n" >=20 > + "show port (port_id) representors\n" > + " Show supported representors" > + " for a specific port\n\n" Confusing name, code below shows representor info, not probed representor d= evices. How about "show port (port_id) representor info"? > + > "show device info (|all)" > " Show general information about devices probed.\n\n" >=20 > @@ -16962,6 +16966,118 @@ cmdline_parse_inst_t cmd_show_capability =3D { > }, > }; >=20 > +/* *** show port representors information *** */ struct > +cmd_representor_info_result { > + cmdline_fixed_string_t cmd_show; > + cmdline_fixed_string_t cmd_port; > + cmdline_fixed_string_t cmd_keyword; > + portid_t cmd_pid; > +}; > + > +static void > +cmd_representor_info_parsed(void *parsed_result, > + __rte_unused struct cmdline *cl, > + __rte_unused void *data) > +{ > + struct cmd_representor_info_result *res =3D parsed_result; > + struct rte_eth_representor_info *info; > + uint32_t i; > + int ret; > + int num; > + > + if (!rte_eth_dev_is_valid_port(res->cmd_pid)) { Seems port "all" not supported, is there a check? > + fprintf(stderr, "Invalid port id %u\n", res->cmd_pid); > + return; > + } > + > + ret =3D rte_eth_representor_info_get(res->cmd_pid, NULL); > + if (ret < 0) { > + fprintf(stderr, > + "Failed to get the number of representor info ranges for port %hu: %s= \n", > + res->cmd_pid, rte_strerror(-ret)); > + return; > + } > + num =3D ret; > + > + info =3D calloc(1, sizeof(*info) + num * sizeof(info->ranges[0])); > + if (info =3D=3D NULL) { > + fprintf(stderr, > + "Failed to allocate memory for representor info for port %hu\n", > + res->cmd_pid); > + return; > + } > + info->nb_ranges_alloc =3D num; > + > + ret =3D rte_eth_representor_info_get(res->cmd_pid, info); > + if (ret < 0) { > + fprintf(stderr, > + "Failed to get the representor info for port %hu: %s\n", > + res->cmd_pid, rte_strerror(-ret)); > + free(info); > + return; > + } > + > + printf("Port controller: %hu\n", info->controller); > + printf("Port PF: %hu\n", info->pf); > + printf("Ranges: %u\n", info->nb_ranges); > + for (i =3D 0; i < info->nb_ranges; i++) { > + printf("%u:\n", i); Normally there will be certain amount of ranges here, how about output as a= table? > + printf(" Name: %s\n", info->ranges[i].name); > + printf(" Controller: %d\n", info->ranges[i].controller); > + printf(" PF: %d\n", info->ranges[i].pf); > + switch (info->ranges[i].type) { > + case RTE_ETH_REPRESENTOR_NONE: > + printf(" Type: NONE\n"); > + break; > + case RTE_ETH_REPRESENTOR_VF: > + printf(" Type: VF\n"); > + printf(" VF: %d\n", info->ranges[i].vf); > + break; > + case RTE_ETH_REPRESENTOR_SF: > + printf(" Type: SF\n"); > + printf(" SF: %d\n", info->ranges[i].sf); > + break; > + case RTE_ETH_REPRESENTOR_PF: > + printf(" Type: PF\n"); > + break; > + default: > + printf(" Type: UNKNOWN VALUE %d\n", > + info->ranges[i].type); > + break; > + } > + printf(" Range: [%u-%u]\n", info->ranges[i].id_base, > + info->ranges[i].id_end); > + } > + > + free(info); > +} > + > +cmdline_parse_token_string_t cmd_representor_info_show =3D > + TOKEN_STRING_INITIALIZER(struct cmd_representor_info_result, > + cmd_show, "show"); > +cmdline_parse_token_string_t cmd_representor_info_port =3D > + TOKEN_STRING_INITIALIZER(struct cmd_representor_info_result, > + cmd_port, "port"); > +cmdline_parse_token_num_t cmd_representor_info_pid =3D > + TOKEN_NUM_INITIALIZER(struct cmd_representor_info_result, > + cmd_pid, RTE_UINT16); > +cmdline_parse_token_string_t cmd_representor_info_keyword =3D > + TOKEN_STRING_INITIALIZER(struct cmd_representor_info_result, > + cmd_keyword, "representors"); > + > +cmdline_parse_inst_t cmd_representor_info =3D { > + .f =3D cmd_representor_info_parsed, > + .data =3D NULL, > + .help_str =3D "show port representors", > + .tokens =3D { > + (void *)&cmd_representor_info_show, > + (void *)&cmd_representor_info_port, > + (void *)&cmd_representor_info_pid, > + (void *)&cmd_representor_info_keyword, > + NULL, > + }, > +}; > + > /* *** show fec mode per port configuration *** */ struct cmd_show_fec_= metadata_result { > cmdline_fixed_string_t cmd_show; > @@ -17816,6 +17932,7 @@ cmdline_parse_ctx_t main_ctx[] =3D { > (cmdline_parse_inst_t *)&cmd_show_fec_mode, > (cmdline_parse_inst_t *)&cmd_set_fec_mode, > (cmdline_parse_inst_t *)&cmd_show_capability, > + (cmdline_parse_inst_t *)&cmd_representor_info, > NULL, > }; >=20 > -- > 2.30.2