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 84DA741B91; Tue, 31 Jan 2023 17:44:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3133C4067B; Tue, 31 Jan 2023 17:44:17 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2059.outbound.protection.outlook.com [40.107.20.59]) by mails.dpdk.org (Postfix) with ESMTP id BC33840041 for ; Tue, 31 Jan 2023 17:44:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SxiPdbvz6EmvThvwqKoxvAN43H7ACpL8QT1LUIADDYc=; b=X6xxuufuxEBsjojsdak1kQrXYRH0NU8HTHGoZBVZ88tKPocXzb/gU0baCW6/IHTmV6DclcQDlaTBtARhmDkeQTSta8ghOgesqOjR5VRT02jUvHodv49xkPpJ2qoms+HF8d/BPqCGALZcS0q4T00qO2vTdvoRprvuYyrcYwCncF4= Received: from DU2PR04CA0256.eurprd04.prod.outlook.com (2603:10a6:10:28e::21) by PAWPR08MB9445.eurprd08.prod.outlook.com (2603:10a6:102:2e1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Tue, 31 Jan 2023 16:44:14 +0000 Received: from DBAEUR03FT057.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28e:cafe::b9) by DU2PR04CA0256.outlook.office365.com (2603:10a6:10:28e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36 via Frontend Transport; Tue, 31 Jan 2023 16:44:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT057.mail.protection.outlook.com (100.127.142.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.22 via Frontend Transport; Tue, 31 Jan 2023 16:44:14 +0000 Received: ("Tessian outbound 6e565e48ed4a:v132"); Tue, 31 Jan 2023 16:44:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f6c039fe4e998ca4 X-CR-MTA-TID: 64aa7808 Received: from 3e2ca713a783.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A9FC2146-9FD9-4AB5-A7E4-A81812005090.1; Tue, 31 Jan 2023 16:44:07 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3e2ca713a783.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 31 Jan 2023 16:44:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IDXPE/5TRgt03wyNveRRizHTFcR7zeaET8ie1PrJUsbrVicNTar1B+kx/nMFmvs8ervr9ZaCd+sKSeBhCfSv2CavtgUH5ZV1YFCV9aemctfYPvn0LJ1M+WJ/KEqwhpYYnEjIl44A3t2UM1tiYjx5uHO//6DH613l6QQm40oMCTeynTmFK2ahEumiYRV8tOvKXs7ZgpPXeVebb8DiHH+dd4L8kQzLl7He2RS2wpDbJOnL/yb3WFKAjINnb5wqj4avl/2bJSpAW+go5Xml4Zj/LZ0SwS3gJuczGrWmU8HlYr8W+8TLUlmvdXW+2r2e8AB7Ns5wqovSd6O5x6/c0gbevA== 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=SxiPdbvz6EmvThvwqKoxvAN43H7ACpL8QT1LUIADDYc=; b=Ao3tTYCHdEsh2Ug6iLenbXqrOxtgAFMpfELl8z71GkJvK/IVylzLkpu7VT8C7nchmIsUcM0uUeCuhkuZ5MrBM+PIkLVCpA8vnOP2F/t+j8K6AOTZGZchYAFppU1Vbx4FT+WjM15eH2ED0bfGUXJCkhiUU/p0bUrfGbYMaPeTWAi8IC7LioIn6h7OhtT5jrEDLLIuoFC6BlHMc/v37cSE3sRkDAMHzubMpT4amTKDrKbKMXHG2ymqROyz0/FY9SoeJ4rvuIWLcII8ERctAQb2FCBuy8RKjdMzEnukPe3iw81SoxAAkw41O5AzGuJ6/o1MglFmOi9zKyfGJ+goJ1znFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SxiPdbvz6EmvThvwqKoxvAN43H7ACpL8QT1LUIADDYc=; b=X6xxuufuxEBsjojsdak1kQrXYRH0NU8HTHGoZBVZ88tKPocXzb/gU0baCW6/IHTmV6DclcQDlaTBtARhmDkeQTSta8ghOgesqOjR5VRT02jUvHodv49xkPpJ2qoms+HF8d/BPqCGALZcS0q4T00qO2vTdvoRprvuYyrcYwCncF4= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB3PR08MB8938.eurprd08.prod.outlook.com (2603:10a6:10:43f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Tue, 31 Jan 2023 16:44:03 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::f8c8:b4b6:c041:ac9d]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::f8c8:b4b6:c041:ac9d%6]) with mapi id 15.20.6043.038; Tue, 31 Jan 2023 16:44:03 +0000 From: Honnappa Nagarahalli To: Jie Hai , "konstantin.v.ananyev@yandex.ru" , "dev@dpdk.org" CC: "liudongdong3@huawei.com" , nd , nd Subject: RE: [PATCH v3 2/2] ring: add ring info telemetry cmd Thread-Topic: [PATCH v3 2/2] ring: add ring info telemetry cmd Thread-Index: AQHZNRvcSagMugHY70CDsL7WPsPXwa64uSSw Date: Tue, 31 Jan 2023 16:44:03 +0000 Message-ID: References: <20230117130333.8707-1-haijie1@huawei.com> <20230131022841.10775-1-haijie1@huawei.com> <20230131022841.10775-3-haijie1@huawei.com> In-Reply-To: <20230131022841.10775-3-haijie1@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: E71D24E177FBF94082F98470DB44C849.0 Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: DBAPR08MB5814:EE_|DB3PR08MB8938:EE_|DBAEUR03FT057:EE_|PAWPR08MB9445:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ca19c84-64d7-419f-5e93-08db03aa6316 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: f2zQPrSmILCbAYOCE4CTdumjqE6SPj7AxE2rAdHbCf4j/mjiq1v2gV0HsucRFtpBnGUChJmXdjQL3XcH1e0Fqg8JwFDs5LrOT7P/VJMIw6hREQ9huBAk4NZl7jPm0+M0H1munClXJUHdgz1KlGDf1Sm8qqLt1w6617pVF4sKiNevXLjCvYwpT9+166PzFGXIJKT05Rqrb+a6rBU1E73J0horVkMdir9/WQC7/5IZjFxzLTcNC4JAa4PMGkpP1KKfO+bXgGsFC7e3nSGD25zEtoSQAzpg1qjkmhSwAXyUuvH/2+OpzYKxB0k3aw4rltDMrTwjNV5b3yS4aWkUngxw/3GKAqpnwV8tdQheO5Fk9EqY0kEwGdDVu5bFgfUlp9d634nLWDhT5OKa0J3TKv/iwfr9m/3QhY3zGXjsmk/UAN3fyFcJNLwFuxByULf5g+hx2V+2Oppaxu/CYUhiqhMQ8Df+1s6+MUl/xZBSv0l9rrUdNuqpdFsyhlahd1fqoHGNha8m6jYzOAwAeRFMUuI2hwIGf352QHEHrAsGiuXgeBfyiqSyM6kNKvlKsZWPQShxYMxHcSiw6cKLUOn27PQrba2Wg8SoYMUorw+FIYQBl1+oFg8RRbifBwrys/Vw5nG8zdsypnKKyupu0UhLcR9G8XspRdhPYBeU95JOu93DPz5zxPFp0iDhOkegoft1xDdAxYmJZ8KJxKKazQgVT9KADnwLYzaGWhYJP3xWtizp2ck= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(136003)(346002)(396003)(39860400002)(376002)(366004)(451199018)(5660300002)(8936002)(52536014)(2906002)(6506007)(55016003)(83380400001)(86362001)(41300700001)(9686003)(53546011)(66556008)(33656002)(76116006)(64756008)(8676002)(110136005)(54906003)(478600001)(66446008)(4326008)(66946007)(66476007)(26005)(186003)(71200400001)(7696005)(38100700002)(38070700005)(316002)(122000001)(23180200003); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB8938 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: bf1aaa5c-5b09-44d7-d7f8-08db03aa5c4d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fFBsrcZkzYPT+A+1bub4KSDqozg+0X8gFSSkxiVtT6y3/FYOTv4W8faCMjyUGBFOLWADONO9FhKQcJOlCyVYeguj8q41QkU5UAw7hbXBxx/UIkEQUxxgDsazsqyCBHmcjfkjDc8bhLwYx/04By8RQh1l+6Y0LjMEHmEolrdNwdRcVLm+4P7feI2mi09E++FprqjyZrFXVcU+kPvpK/k90epItuEzExSLomLj6SKG9Oi58KZOletO3PNFvPmbqd+QT+FG7q+2haIEWU/AKbDZDAGWTVssx5j26JwZuC8+T7plqUhnlcvG8oYGs8fF2WNjNKAriyU0rsbmoKT8PEUBwtTnLbJYN02RDV3uBmeLj1N88RfWbTOzOpr1cwGFB2brmEKHdZJNwbFzZ9IGK3ViEzGtm71/Vv+97rs9QG/TCF1Rc1tt+fNn12Ju74S/Rtse9TN+Xx3TnslW8N921KSlnFt4z39hlv4I1RrPWRTYoPyQCFc9CeCc1aPLI3fJfyGuTKDAmoVrnjzNW6t4qDQi9WssR7fd30bppw89pqbHA0DhP0LYDGW6bvUkw5IYJRj2duBRCWEMGz0FziGSeMNbjh+nDu4vUxcQX3UBthiaxbwjvGfjaHPR+uFMvDBHQ/o7AGcnIkqThk5Bv9gFyyNF2byYEZasGzATx1trrbOsK36KC1bPM+w1FJxjAFI9+jwYf9aksXCa+/uBdmJ9NhmKnkSPzOm86d48pqWJdsYaFSI= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230025)(4636009)(396003)(346002)(376002)(136003)(39860400002)(451199018)(36840700001)(40470700004)(46966006)(5660300002)(54906003)(40460700003)(47076005)(110136005)(83380400001)(86362001)(7696005)(2906002)(336012)(6506007)(26005)(53546011)(40480700001)(33656002)(478600001)(9686003)(186003)(55016003)(82740400003)(81166007)(41300700001)(4326008)(70206006)(70586007)(82310400005)(316002)(52536014)(8676002)(356005)(36860700001)(8936002)(23180200003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2023 16:44:14.4634 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ca19c84-64d7-419f-5e93-08db03aa6316 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9445 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 Few minor nits. Otherwise, Reviewed-by: Honnappa Nagarahalli > -----Original Message----- > From: Jie Hai > Sent: Monday, January 30, 2023 8:29 PM > To: Honnappa Nagarahalli ; > konstantin.v.ananyev@yandex.ru; dev@dpdk.org > Cc: liudongdong3@huawei.com; haijie1@huawei.com > Subject: [PATCH v3 2/2] ring: add ring info telemetry cmd "ring: add telemetry cmd for ring info" >=20 > This patch supports dump of the info of ring by its name. This patch supports dump of ring information by its name. > An example using this command is shown below: >=20 > --> /ring/info,MP_mb_pool_0 > { > "/ring/info": { > "name": "MP_mb_pool_0", > "socket": 0, > "flags": 0, > "producer_type": "MP", > "consumer_type": "MC", > "size": 262144, > "mask": 262143, > "capacity": 262143, > "used_count": 147173, > "consumer_tail": 8283, > "consumer_head": 8283, > "producer_tail": 155456, > "producer_head": 155456, Sometimes it is much easier to understand these numbers if they are in hexa= decimal. Is it possible to add the hexadecimal format in brackets? Somethin= g like: "size": 262144 (0x40000) > "mz_name": "RG_MP_mb_pool_0", > "mz_len": 2097920, > "mz_hugepage_sz": 1073741824, > "mz_socket_id": 0, > "mz_flags": 0 > } > } >=20 > Signed-off-by: Jie Hai > --- > lib/ring/rte_ring.c | 83 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 83 insertions(+) >=20 > diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c index > e6aac332d88f..2e57aa653339 100644 > --- a/lib/ring/rte_ring.c > +++ b/lib/ring/rte_ring.c > @@ -454,8 +454,91 @@ ring_handle_list(const char *cmd __rte_unused, > return 0; > } >=20 > +static const char * > +ring_prod_sync_type_to_name(struct rte_ring *r) { > + switch (r->prod.sync_type) { > + case RTE_RING_SYNC_MT: > + return "MP"; > + case RTE_RING_SYNC_ST: > + return "SP"; > + case RTE_RING_SYNC_MT_RTS: > + return "MP_RTS"; > + case RTE_RING_SYNC_MT_HTS: > + return "MP_HTS"; > + default: > + return "Unknown"; > + } > +} > + > +static const char * > +ring_cons_sync_type_to_name(struct rte_ring *r) { > + switch (r->cons.sync_type) { > + case RTE_RING_SYNC_MT: > + return "MC"; > + case RTE_RING_SYNC_ST: > + return "SC"; > + case RTE_RING_SYNC_MT_RTS: > + return "MC_RTS"; > + case RTE_RING_SYNC_MT_HTS: > + return "MC_HTS"; > + default: > + return "Unknown"; > + } > +} > + > +static int > +ring_handle_info(const char *cmd __rte_unused, const char *params, > + struct rte_tel_data *d) > +{ > + const struct rte_memzone *mz; > + struct rte_ring *r; > + > + if (params =3D=3D NULL || strlen(params) =3D=3D 0 || > + strlen(params) >=3D RTE_RING_NAMESIZE) > + return -EINVAL; > + > + r =3D rte_ring_lookup(params); > + if (r =3D=3D NULL) > + return -EINVAL; > + > + rte_mcfg_tailq_read_lock(); > + > + rte_tel_data_start_dict(d); > + rte_tel_data_add_dict_string(d, "name", r->name); > + rte_tel_data_add_dict_int(d, "socket", r->memzone->socket_id); > + rte_tel_data_add_dict_int(d, "flags", r->flags); > + rte_tel_data_add_dict_string(d, "producer_type", > + ring_prod_sync_type_to_name(r)); > + rte_tel_data_add_dict_string(d, "consumer_type", > + ring_cons_sync_type_to_name(r)); > + rte_tel_data_add_dict_u64(d, "size", r->size); > + rte_tel_data_add_dict_u64(d, "mask", r->mask); > + rte_tel_data_add_dict_u64(d, "capacity", r->capacity); > + rte_tel_data_add_dict_u64(d, "used_count", rte_ring_count(r)); > + rte_tel_data_add_dict_u64(d, "consumer_tail", r->cons.tail); > + rte_tel_data_add_dict_u64(d, "consumer_head", r->cons.head); > + rte_tel_data_add_dict_u64(d, "producer_tail", r->prod.tail); > + rte_tel_data_add_dict_u64(d, "producer_head", r->prod.head); > + > + mz =3D r->memzone; > + if (mz =3D=3D NULL) > + return 0; > + rte_tel_data_add_dict_string(d, "mz_name", mz->name); > + rte_tel_data_add_dict_int(d, "mz_len", mz->len); > + rte_tel_data_add_dict_int(d, "mz_hugepage_sz", mz->hugepage_sz); > + rte_tel_data_add_dict_int(d, "mz_socket_id", mz->socket_id); > + rte_tel_data_add_dict_int(d, "mz_flags", mz->flags); > + > + rte_mcfg_tailq_read_unlock(); > + return 0; > +} > + > RTE_INIT(ring_init_telemetry) > { > rte_telemetry_register_cmd("/ring/list", ring_handle_list, > "Returns list of available ring. Takes no parameters"); > + rte_telemetry_register_cmd("/ring/info", ring_handle_info, > + "Returns ring info. Parameters: ring_name."); > } > -- > 2.33.0