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 707FFA0C41; Tue, 19 Oct 2021 17:21:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D8D641232; Tue, 19 Oct 2021 17:21:02 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2046.outbound.protection.outlook.com [40.107.237.46]) by mails.dpdk.org (Postfix) with ESMTP id A5C804122F for ; Tue, 19 Oct 2021 17:21:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=STs7E5bVitY26JhMyWeUjnsP9DJu3nJZdKxlP99iPX1jy5xzw4OLg3lWtQHqWRwdCthU4L7vgm+XHWU/Yt9h7ll1gtVPaKptskflbJmp1yTaY7w7YXYw3s8EeZuZYZg+johQ6N3q4RETS+/c4JZluo5di2ONjLl0l9cMZF3hhai3LJAqxD92lCdr11I1Nwml5ctiuj32VhuERV/FhoTzfB2/bX6n7zK+DWY7st/dj5aQsHvlfuykUOzZf6FMH8EBTF+1RB6O6h2eR94Nd9tm77b2xI6DezxKO8d6oDhqBi+DMj5IDC/JGi9ED+px8vfHLixHDUNc3qCuqLDYJ6LEIg== 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=JvX/rtfYYPrfbiTaHjNXMugiTgMDpMahOP09Sy3Fk/DNRwECSsjFoayuU+CfJyl+mgrn9vbvyXeEVuNguq1VNOur3fPIXrzsFHyG1WscbFD6zy2WIaMoYtn5WaCySpN+6NOW5XA62K9UipHq7IygXD9GtfhWbj8mKGXFc5uezuMfmCaeqKUOMLBakZd76iWYL0lZ/ZtuVVR2J81BCQRZHQPY+wqKriGFIyvr1N0+QL96c65oQyh/kgHPL8rGaUyjJSn12NN+VPjGcY8qBINQLB9SPv+HPXJOawG78vwjFOlYVmJdB5Rm4ZGD2rkhrHDdAjZWyrQu5V7os6E6+kchHA== 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=ftDZ53dvdNt7e1guJieFjRuJAmtalIOlIk41Cr+Rm6B8h7wXm+JAoT6gAzdOMSnqTiFAOsBxhFQNE0D0cuIpv8iSPbDogbM/aGlIh4vfBs83uWgH2M3KCLvHlItaVxCip1Qnjg3mlmVYxlMV0JbEj1P3kj4U8TImX13Cl6x8j2CB7M+0JU6JfOZDbcH0MtAsgc1saT6EkqZv0TEakdytm3MVmByi7otXzm15+Nx+zeu/NX2nNQSq/Gf1KmNhkemljDc7P9BYToT0mc/rVVQLGDxLHhJIAMxfvGWdQcavpdwUg4yJsiYMi9fy9bRm0A5TSrNt8ByuuHoUW93cavXetQ== Received: from DM5PR07CA0045.namprd07.prod.outlook.com (2603:10b6:3:16::31) by BYAPR12MB2696.namprd12.prod.outlook.com (2603:10b6:a03:68::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.14; Tue, 19 Oct 2021 15:20:56 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:3:16:cafe::26) by DM5PR07CA0045.outlook.office365.com (2603:10b6:3:16::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 15:20:56 +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 DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) 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:20:55 +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:20:43 +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:20:19 +0800 Message-ID: <20211019152024.2277527-2-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211019152024.2277527-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20211019152024.2277527-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: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 94c70cee-9837-4978-4e34-08d993140c2c X-MS-TrafficTypeDiagnostic: BYAPR12MB2696: 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: 1mMeCZ66wby4cMTf1J0Zi0QBop5gmaDlgNWMsTaawZX+UXMTvrc07cSA89/Uj5Rs5H1gSTZcj0lhXIFBO9mzyTKtQNoJ8wEjoE/7FHyC1c9PVL6lkKP2TBQk3NtR3GioEaUwyttLMuw2FugALL7To/Bm5F5y21Hi+vGwRnp/ISGHRvupJ4N/8sX9nBhNCwTgr10qIHa/1hoS9yBQvE/Gm7SPKi4Pk0Goy8KqGXV1lyfxR0OcVXRAaCfT3FY4AEWYSqR/fcv/BVrN1uZVqWqWkNFAemBHOmNWZ0wdBoyAehfPjcG6226CaMxSHzyhk1t32zTNIRiQgWqlx1UuZY1oWlUUXXY2YOEqCiMjHfIzVvQGUlSdPApE1q+IPIeVgofJnbrVkY80gcpWoxBnVCzX1n80Gpx79UiJFVJ3RSL1NvseOAVcGZHDw21KkV8n8EDDfQn61LZSsfEWA0xQTbB8Z9fwT0RvOBPYWUTnbsKMb3uumAcwxbs8isae/MMXRH9C7bOizEVRRQZlsoJxLY5PPAok9gkUSV1JwJ34rYwVGYtnmmxitGPlt/xQBV9wD3eB/OoMJ/Aa65QwRfTqt8R7z0aD+Tc4N4IJBfDKHyioUe3egTdlpSJPbP7dTSsV0KPAwZ1DaFEP/J8kO/rU6bp8BT2tDfaHVBzl43WXyFAsRyxgKSEJWIXh++mDsRDgcuR9bS/Vg6c42t2Mq+pD+bOIKg== 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)(54906003)(356005)(70206006)(7636003)(16526019)(110136005)(508600001)(8936002)(2616005)(8676002)(86362001)(82310400003)(70586007)(316002)(36906005)(186003)(4326008)(5660300002)(7696005)(6286002)(55016002)(2906002)(1076003)(36860700001)(36756003)(426003)(6666004)(47076005)(26005)(83380400001)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 15:20:55.6958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94c70cee-9837-4978-4e34-08d993140c2c 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: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2696 Subject: [dpdk-dev] [PATCH v10 1/6] 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