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 665D0A0C41; Tue, 19 Oct 2021 17:28:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4027E4124E; Tue, 19 Oct 2021 17:28:49 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) by mails.dpdk.org (Postfix) with ESMTP id B98CE41248 for ; Tue, 19 Oct 2021 17:28:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K+w07ldBSXQEd14dRxh9SkwHGsCf8tF/Yw5oLF+lGc//W9jniOi1fQMnrdooiG1Of+ZGyWvlCpOwi+kRcKBX1iP3ojBphT71FoX4LCblnXaaRVRP7ifW3pItOGcuc2Mxmpe7jkB6jInbLtX8kgglTvoYX6G6VzLWI13zdj39ke6vKJgXkajoxRTYYO8r5t5exoc/9olB1BZ08mfWlx988dkr6QAJFNh4CeycTKMRygs6ossA3jR8Vu/66u7w6/BtpPtjPXFEgP+FuZlOMllibFYePikA1rVa/bXPhohKxHv9fcdFFIGQqod+BHqOfoRBPCktTWp9Ibvp/r4CGycEqA== 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=E3b4b609lbdYzvyq4NbeZJX1muEW9R7jDVp2ebNg2lI=; b=JEnbE6m7PFw9KkLYoBb9GG3uN1NHB4Xj3jOFvZbNDUOIIDaNAICZIpK9Z2QsLyhg8D1Q6ga52It8dESHqk7+0mGsA/9eWxb8tsSFSfnfBgmd0GdmfyyWoW9WiZ/ZdfSNhhdDVgVUV1Nem2H8sciEKZMzXqkFqoWAO3b5NKTcELV6p5TeZX/jNxTjDU3RJd84bDxqKX29z9q08ll/+Ym2z8OxwImyT+ej6kenkGFhWrlwjGNA3M4B/2ls5qdLo/py/ix7ZwW/xXi4nxHtNq57toacWfzjpvpB6X9xtzUa1sN9hZcdTIsfQO/9aDpAOGCFl1+/RkVwucwueoAz5AvWrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=E3b4b609lbdYzvyq4NbeZJX1muEW9R7jDVp2ebNg2lI=; b=dl5UwcAEOUW4Q4hEHZswqmfj+8h2yFIq34HKAvh3ZqBXW1WYi6CgZ1GZmumrDVHbxN8NMk/OFS+zVWEiYGVwRsj+cZJDXJdNGxaUkzTfaGCvF7ooliy1qF1HaKepmU5fBpcgCr47aij4g5DWBKDkBDqYNKgbiEWJKDJ3tZYZRu3sjHsqzJ24YGRvZtsTmACeQaBd2uTdHeXQNL5vRmRJAlNRansLBugpIcgyP3z+c7rDHA3VfNKTK6GKk4/tUsWPw9yGfKNI2INIJyk+2SQEGwYt4hsIebHHXCF3pMH5qn6PMPwCgmAW3Q9fwPS+3vEOn+7yNXx1bq3hPhzoTHlJnQ== Received: from BN8PR03CA0023.namprd03.prod.outlook.com (2603:10b6:408:94::36) by MWHPR12MB1294.namprd12.prod.outlook.com (2603:10b6:300:10::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 15:28:46 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::80) by BN8PR03CA0023.outlook.office365.com (2603:10b6:408:94::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 15:28:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 15:28:45 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 19 Oct 2021 15:28:41 +0000 From: Xueming Li To: , Zhang Yuying CC: , Jerin Jacob , Ferruh Yigit , Andrew Rybchenko , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit , "Ananyev Konstantin" , Ajit Khaparde , Ray Kinsella Date: Tue, 19 Oct 2021 23:28:04 +0800 Message-ID: <20211019152809.2278464-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211019152809.2278464-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20211019152809.2278464-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d6bc4db-0fc0-4016-93eb-08d993152428 X-MS-TrafficTypeDiagnostic: MWHPR12MB1294: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2331; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lHII0ZSPlWLYcqZLmljipPbemVHSbEBVnhPvLOh97ON9vJb2/aWmRucX1cfwxScosOriGQly8NN7YHOjNuJJ8r5hbKSFq0suoiWqc5KP5E35r/Rw9mJoRmBch7VXIHAJf9SGLO/hlX2FitKxM7daooOSaG4oGm73xaFPBe6hMSLjAw3f0FE36lb1Vjc5u0fdt6k28Neyic4xOPv1V6jcYCZMYYpHdQkKORgaJpgxjWOxCFbCA4HaXAJZsMVoHL5hYpBEvQdcUk5Mdf6OWzQeEyFBYOPqyOH1NxtMhgpnvK8mCknK03a+lTTip5efwfKmSgEVk+jBwlSofqqzjv/Zvcw4k54beqvXnpM3gSXvLfqCSZKOwWfYbuS+SfmBqX17WaCnRdTXppw115kS+f65QXRVTC5pC0eeO7teF4LMYTl3vYFMy2H4EyWS0khJ44QQUiqX1z/u/rhPp3ETJR4wG3yhM+qCvxnqwr7WjhuQ628dqZ+GbeK+kVfEfbZdM7uSqUWmLsinN1VleFKUUuVmvsZSDFCLrLqCBOz22Fr6ZvDJukW3eJVm2t4IEuEBDc7OLd0CuQd1fdAWb6w6bA0KAE+Oq1LuCwDZIkvqok9YTqxTUCOYxsLZm6t9aBdXboCdfu0R3QnVFdkGv1lDvfVp7sgkN3F/DE0uAmvmcPBnp44HsZxc8fXUtMH8vp7rFYt/RB+A6kkCMOhdlCWiDQaQNQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(82310400003)(316002)(336012)(47076005)(426003)(7636003)(4326008)(186003)(6286002)(36860700001)(6666004)(2616005)(54906003)(26005)(36906005)(110136005)(16526019)(356005)(5660300002)(1076003)(86362001)(7696005)(83380400001)(70586007)(70206006)(55016002)(8676002)(2906002)(36756003)(8936002)(508600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 15:28:45.4734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d6bc4db-0fc0-4016-93eb-08d993152428 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1294 Subject: [dpdk-dev] [PATCH v10 2/7] ethdev: new API to resolve device capability name 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" This patch adds API to return name of device capability. Signed-off-by: Xueming Li --- lib/ethdev/rte_ethdev.c | 30 ++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 14 ++++++++++++++ lib/ethdev/version.map | 3 +++ 3 files changed, 47 insertions(+) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index bc55f899f72..97217529449 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -165,6 +165,20 @@ static const struct { #undef RTE_TX_OFFLOAD_BIT2STR +#define RTE_ETH_DEV_CAPA_BIT2STR(_name) \ + { RTE_ETH_DEV_CAPA_##_name, #_name } + +static const struct { + uint64_t offload; + const char *name; +} rte_eth_dev_capa_names[] = { + RTE_ETH_DEV_CAPA_BIT2STR(RUNTIME_RX_QUEUE_SETUP), + RTE_ETH_DEV_CAPA_BIT2STR(RUNTIME_TX_QUEUE_SETUP), + RTE_ETH_DEV_CAPA_BIT2STR(RXQ_SHARE), +}; + +#undef RTE_ETH_DEV_CAPA_BIT2STR + /** * The user application callback description. * @@ -1260,6 +1274,22 @@ rte_eth_dev_tx_offload_name(uint64_t offload) return name; } +const char * +rte_eth_dev_capability_name(uint64_t capability) +{ + const char *name = "UNKNOWN"; + unsigned int i; + + for (i = 0; i < RTE_DIM(rte_eth_dev_capa_names); ++i) { + if (capability == rte_eth_dev_capa_names[i].offload) { + name = rte_eth_dev_capa_names[i].name; + break; + } + } + + return name; +} + static inline int eth_dev_check_lro_pkt_size(uint16_t port_id, uint32_t config_size, uint32_t max_rx_pkt_len, uint32_t dev_info_size) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 34acc91273d..df8ef9382a9 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -2109,6 +2109,20 @@ const char *rte_eth_dev_rx_offload_name(uint64_t offload); */ const char *rte_eth_dev_tx_offload_name(uint64_t offload); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Get RTE_ETH_DEV_CAPA_* flag name. + * + * @param capability + * Capability flag. + * @return + * Capability name or 'UNKNOWN' if the flag cannot be recognized. + */ +__rte_experimental +const char *rte_eth_dev_capability_name(uint64_t capability); + /** * Configure an Ethernet device. * This function must be invoked first before any other function in the diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index efd729c0f2d..e1d403dd357 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -245,6 +245,9 @@ EXPERIMENTAL { rte_mtr_meter_policy_delete; rte_mtr_meter_policy_update; rte_mtr_meter_policy_validate; + + # added in 21.11 + rte_eth_dev_capability_name; }; INTERNAL { -- 2.33.0