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 57ECCA0C45; Mon, 25 Oct 2021 09:26:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BB61407FF; Mon, 25 Oct 2021 09:26:19 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 277ED4003E for ; Mon, 25 Oct 2021 09:26:17 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19P0E3wP015507; Mon, 25 Oct 2021 00:26:17 -0700 Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2041.outbound.protection.outlook.com [104.47.56.41]) by mx0a-0016f401.pphosted.com with ESMTP id 3bwhv1s48d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Oct 2021 00:26:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aAt/+64HORItwxIC40w3mgGmVxJJj2jfTdB7GysBOxzt9f+NW6YaZsB+tXkTvcurpE6aC22Z5Co3w9vcVYZZ8UKwVAa6kya77mGLVJrvmU7nrU3AVp9IroeAalkT/7vZagsT8YU8u2GVN5tis3L03RuayVISbP6EFQzY/mTrwtsXENE+/jb7GjgMikYQQSufhq/oNP5YB5O4wXIFk6mO3D5T+ovo61qRC4OaTT5mQlkK0D/UKneROYX1DXmLO1/JC2s8JUDolu8wCjdvMuhT0pb+eCrxk4sY0YizO2hQ9WL+5cTmjMAByJ7trSAV2C8HMcFyaU+1XvVFybdm5/I4rA== 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=2sLmsf6b12gl7ZWdd3x+QXLanIRyp6WWEoweXjGYgik=; b=Sb6dQfEZWUKnfekxbDmO0fOsyFfXzhCcTG0vuxAswm0f06wfSJlVCmIH14l0y741t4GyxVq2/fe6c8ixwq/Tc2atyg6BEv2C74lWl68ZZajWfxfiuAzCLmsfBoU7AfJwKQZH0+8rlqnWxISSXU5KzWKS1g8B0RIHvBbl8Y0KUd6ext1J3AWeh82UxoxSbeNDZblkEmuxlJ+ps42NckPQscQjo4iJZV19jBn7nAaYgQEiK/iQVOCvw23M1WfPL4Eh0CrhRYLfZRfjtYhE+XkUc1VLnwaM/3D4fstDp/9usNcsqKenjeleA5hul5YzLiu/E79aIGsKsAlI683fY3bBhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2sLmsf6b12gl7ZWdd3x+QXLanIRyp6WWEoweXjGYgik=; b=kdMX92AdCenfDpjumwuvcjdA/DNrwI8R9djkERlvOMX6+iEcfvEJzixVQ8nWqxoEdtnHhNtG8VM8TvNZybTEdXiMZdOmrXzxW0jKVbCMEryneVumgWKJymdXo9HScr6nHQioDuAbHGbyexharlO5jLGq0BRJpVlovib0q8dexJQ= Received: from CO6PR18MB4484.namprd18.prod.outlook.com (2603:10b6:5:359::9) by CO1PR18MB4650.namprd18.prod.outlook.com (2603:10b6:303:e5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Mon, 25 Oct 2021 07:26:15 +0000 Received: from CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::c41e:707:3f91:71b8]) by CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::c41e:707:3f91:71b8%8]) with mapi id 15.20.4628.020; Mon, 25 Oct 2021 07:26:15 +0000 From: Akhil Goyal To: Gowrishankar Muthukrishnan , "dev@dpdk.org" CC: Declan Doherty , Jerin Jacob Kollanukkaran , Gowrishankar Muthukrishnan Thread-Topic: [v3] cryptodev: add telemetry endpoint for cryptodev capabilities Thread-Index: AQHXx0RgQp+VPiCbN06RMgkW+eCjWavjU6JQ Date: Mon, 25 Oct 2021 07:26:15 +0000 Message-ID: References: <7587cf36f51ff62f1467bfa44af5364130c8163c.1632896481.git.gmuthukrishn@marvell.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 50c7d89b-67d5-467b-e477-08d99788badc x-ms-traffictypediagnostic: CO1PR18MB4650: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2582; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BEkBBPXNL5xBetgRc02/tMUBHPSGF829F6Z3+UJlYKhuMjQVPlMQ7BxyhloFJTUMAO/CsfD2w6ambX8VsqYfN5WI6SdwsB5/SDReHgC/57jlX2Kf7L2IYSjhlLLlTJVPYWbezl9m9i9vNI2sMmHUs8T8HUjWN8ZaQKdtP41HBEbe3yvTQFEIOOUYiKW60QCjanle6fTldh3KHE8UjfO0+vqMRQl8lutQ91EBrI8+M5VCIiNSS9g7IYKZzEXak4dJXgpCrJNGXbEiq8OiJQ+i/9+J8fj2Eoxk8ae5ve7KE8k2ZU1cEb1E+XO1BhrcemgjtSHIZ4HYY8qs9GLcIccvcRUyT3boAIZaY5Gfs+wyC5em+TOBEPHxMPMdj3+PiX+bz1qhbFZpYMfsd/hoaXjAasHs8Xg4rlVNompxdDKD0WCekDE53rpeOyUsM7i6E9W/5M5j5t1yjOjRajY+fiZJy008R2usZb/Qp4i4Lv1StUEIrbEAq89QBdcNdGTUgG5IpOZlYXeXX+xHQSvFVGBfjC+Uc6GWy9hL3Iskh3WfMgDDNWHK7KWcxksFJ/J8ZUB3wOtgmIVulqhZW7WYsq11khOoZlcXeleddkj+X8exEHl1EcVAdBxlTFuz2KIe6wPcICBuIPdKvijTsAOg/lGrna6R5XDFKbPvc5hKEKVXKmeDDL0HAItA7EpEBu7pqK7/8lRpglUmCTjx0yW1VhgOPQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB4484.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(55016002)(26005)(186003)(9686003)(38100700002)(5660300002)(2906002)(33656002)(55236004)(71200400001)(107886003)(122000001)(8676002)(110136005)(54906003)(52536014)(66946007)(86362001)(64756008)(66476007)(66446008)(66556008)(38070700005)(508600001)(4326008)(8936002)(76116006)(6506007)(7696005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?lDfWqwKp/4K2/EvVPhoj8nX4ovXdkIA1/X5qdlGxj+C1yJnAcq1eJKxVTqw3?= =?us-ascii?Q?JMPldX0APwD8WeKU2NnEm7T9QGUG9bodH4TY07Umpwef5xXE4w1nnA3JHlyG?= =?us-ascii?Q?J3XcYAFT1PsIVxdVRDfJuD6aQpIJGAKR4QR/ti3LTX4c9Dyv+syzazy3i/3Q?= =?us-ascii?Q?0xxcu2E+feNbh3AozssHAct0i66WG0nDEL8oNxcbkjrwZh2pLEPcRkO6yumx?= =?us-ascii?Q?f1L7NNM0q3+pr8I0dAybJ7uYhWBY6KlntlH0aRXlFaMxoP30g0odOkyW2Qp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Ql3gwuM1ZPbf75msrk?= =?us-ascii?Q?lORKPmAzPNSGaPsW4qYwr1kKjvv0SuYcwK7zv4uY1WGCKRX+VkOmE1B4CwpS?= =?us-ascii?Q?6JDvMfuH6y2LPDWoWAqoJ9PTbjC78B6p/sN5xvP10oxawnx8gISodj2ugAXZ?= =?us-ascii?Q?4nV02WIDSKN/4Fi2UJ0d098QXF//GBGVLADykvFK6cMiU1wEY29jwhWY+9VB?= =?us-ascii?Q?BYY2xrLekkAWEXt58USXELZcpPjDiClpw9ynwQ7D1RGrEoZFZ8CXOmNu3ojJ?= =?us-ascii?Q?kOQhp49ikbi0pEpCYFQ726DrVNkgK4lhMFx7PrytUf5PdcHh3Orkkjb8Et4m?= =?us-ascii?Q?Zky0+03p4HCrGlOwF4uvAk1yldt5Nboz9ni4/4cYLg4tVebjb3M8pipcvVVq?= =?us-ascii?Q?uwVE0OWskYp/bS71eRgimuXWaiGL0cmWciVPFIvsBMs5VM0J+K0u1Xh52CTK?= =?us-ascii?Q?VhfOHGMKlB9GicKUOm+r3y0=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB4484.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50c7d89b-67d5-467b-e477-08d99788badc X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Oct 2021 07:26:15.4557 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0AfvZY17YQuKLuxTZP/F02rY0gPcnltZq5yfFd0vvMNtNDTDdirbQnxVdEcYI0Atqv0+xJR2rACYLDd24ykE8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR18MB4650 X-Proofpoint-ORIG-GUID: xVwY0Uor-Rk6VlqZtnT6mMnf7jZbK7rk X-Proofpoint-GUID: xVwY0Uor-Rk6VlqZtnT6mMnf7jZbK7rk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-25_02,2021-10-25_01,2020-04-07_01 Subject: Re: [dpdk-dev] [v3] cryptodev: add telemetry endpoint for cryptodev capabilities 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" > +#define CRYPTO_CAPS_SZ \ > + (RTE_ALIGN_CEIL(sizeof(struct rte_cryptodev_capabilities), \ > + sizeof(uint64_t)) / \ > + sizeof(uint64_t)) > + > +static int > +crypto_caps_array(struct rte_tel_data *d, > + const struct rte_cryptodev_capabilities *capabilities) > +{ > + const struct rte_cryptodev_capabilities *dev_caps; > + union caps_u { > + struct rte_cryptodev_capabilities dev_caps; > + uint64_t val[CRYPTO_CAPS_SZ]; > + } caps; > + unsigned int i =3D 0, j, n =3D 0; > + > + rte_tel_data_start_array(d, RTE_TEL_U64_VAL); > + > + while ((dev_caps =3D &capabilities[i++])->op !=3D > + RTE_CRYPTO_OP_TYPE_UNDEFINED) { > + memset(&caps, 0, sizeof(caps)); > + rte_memcpy(&caps.dev_caps, dev_caps, > sizeof(capabilities[0])); > + for (j =3D 0; j < CRYPTO_CAPS_SZ; j++) > + rte_tel_data_add_array_u64(d, caps.val[j]); > + ++n; > + } > + > + return n; > +} We do not need 2 iterators i and n. both are for same purpose. Also, union is not required for caps.=20 static int crypto_caps_array(struct rte_tel_data *d, const struct rte_cryptodev_capabilities *capabilities) { const struct rte_cryptodev_capabilities *dev_caps; uint64_t caps_val[CRYPTO_CAPS_SZ]; unsigned int j, n =3D 0; rte_tel_data_start_array(d, RTE_TEL_U64_VAL); while ((dev_caps =3D &capabilities[n++])->op !=3D RTE_CRYPTO_OP_TYPE_UNDEFINED) { memset(&caps_val, 0, CRYPTO_CAPS_SZ * sizeof(uint64_t)); rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); for (j =3D 0; j < CRYPTO_CAPS_SZ; j++) rte_tel_data_add_array_u64(d, caps_val[j]); } return n; } > + > +static int > +cryptodev_handle_dev_caps(const char *cmd __rte_unused, const char > *params, > + struct rte_tel_data *d) > +{ > + struct rte_cryptodev_info dev_info; > + struct rte_tel_data *crypto_caps; > + int crypto_caps_n; > + char *end_param; > + int dev_id; > + > + if (!params || strlen(params) =3D=3D 0 || !isdigit(*params)) > + return -EINVAL; > + > + dev_id =3D strtoul(params, &end_param, 0); > + if (*end_param !=3D '\0') > + CDEV_LOG_ERR("Extra parameters passed to command, > ignoring"); > + if (!rte_cryptodev_is_valid_dev(dev_id)) > + return -EINVAL; > + > + rte_tel_data_start_dict(d); > + crypto_caps =3D rte_tel_data_alloc(); > + if (!crypto_caps) > + return -ENOMEM; > + > + rte_cryptodev_info_get(dev_id, &dev_info); > + crypto_caps_n =3D crypto_caps_array(crypto_caps, > dev_info.capabilities); > + rte_tel_data_add_dict_container(d, "crypto_caps", crypto_caps, 0); > + rte_tel_data_add_dict_int(d, "crypto_caps_n", crypto_caps_n); > + > + return 0; > +} > + > RTE_INIT(cryptodev_init_telemetry) > { > rte_telemetry_register_cmd("/cryptodev/info", > cryptodev_handle_dev_info, > @@ -2517,4 +2579,7 @@ RTE_INIT(cryptodev_init_telemetry) > rte_telemetry_register_cmd("/cryptodev/stats", > cryptodev_handle_dev_stats, > "Returns the stats for a cryptodev. Parameters: int > dev_id"); > + rte_telemetry_register_cmd("/cryptodev/caps", > + cryptodev_handle_dev_caps, > + "Returns the capabilities for a cryptodev. Parameters: > int dev_id"); > } > -- > 2.25.1