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 6BBC2A0C4B; Thu, 21 Oct 2021 12:42:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94F38411ED; Thu, 21 Oct 2021 12:42:11 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2050.outbound.protection.outlook.com [40.107.220.50]) by mails.dpdk.org (Postfix) with ESMTP id A399C411DF for ; Thu, 21 Oct 2021 12:42:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g5Wayxrapwyd4zIXbM+FcAfy87/dFKbC6b0Oxq16aoqwliIZ46T7BmsPytx2BMHcUkkuvmOFBsspyc9rN0NLYTdcF9uMFxa0HRG7QE1PvVjKt/MELNBR4P2/tZQWgEd1f4u5HavWkE1nIWkrhqoPGJeY4AyuA54Hwt0VhufscXyywLKM19jBkLnh6IukGeFCKEAblBeONtbWgwDFOdHa3Vb9KRBpu9If9Sb3CrptvKB5peXM8ENoJDN1Gb6VMOaU2u8RN5xDFl1C1EETn2adO7ZdeiQlBbQTy8kDke4us9ozVzD1q+9ZlAYN8TqB/nYfa9zPREc9quh+ambkCbcBrg== 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=th5WE7hzWwPx2N90+zqSyf1QEdnOyOSQHpWVRERrwrQ=; b=UmW2k8RB6cTmI5Zyw3dG3e27uvW81odw/ILWM9R/cazmCP8cyjLEptrEeEl+zOB7cn26NdWtCK0n1R0xC3xWDbC/9heCk5IbjST3mIuWqwQXz0PtEgsbdeBez5b65CQVvM1zb2GHplGIH3p7F7x2s6EAgFHX+bx51FcjG0xkXsZxzKdTzlm1uS+n7S+7DQ+RwwNlS0qncjT/R0HkwOFERDAo/UEkl9YqgUUcQTW8Se6wLKCyWIRGXanBQY7bB3ysANKNqTlBrB1o38iF83sex0SGIPfhazbHpe9sLYTjH0s/qnS/wj5+8h5uWntHXB17fp0/soZSP0JCuAgLvcghAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net 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=th5WE7hzWwPx2N90+zqSyf1QEdnOyOSQHpWVRERrwrQ=; b=Obn+55ZwsPdDPUtpWlXdJqsng+WI9WPNYnq58OiPf8XDh3A/KFRvVuA10SuxedIUdIxoHDrobXq7T3jb6mIx5mf0COESYWBhCQ0oWK8DuDXWhOviMcwEpOOCTQl3rpWO9Tz0fmU3H11ReA0oYIeCzgZUUVju0ooHqYZOxhuo8X6Vr68GPDxDap9C5S1rCAUwdKIjenaENT9kFnRPEEaMlzFH86JkfgaD/BQJ0VcrJ4tR7xzTw38eogSDVC0nE1ju9rru8D9GFo3c38xgZLR4g1/2rmQin9lK1jdCLJtrfRU/dukx6zT8qGH77Ovgr4xU+5o4QsTJ3bOPPTcOc/dYhQ== Received: from BN9PR03CA0297.namprd03.prod.outlook.com (2603:10b6:408:f5::32) by BN8PR12MB3171.namprd12.prod.outlook.com (2603:10b6:408:99::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Thu, 21 Oct 2021 10:42:07 +0000 Received: from BN8NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::d3) by BN9PR03CA0297.outlook.office365.com (2603:10b6:408:f5::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 10:42:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; 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 BN8NAM11FT020.mail.protection.outlook.com (10.13.176.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 10:42:06 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 21 Oct 2021 10:42:01 +0000 From: Xueming Li To: , Zhang Yuying , Li Xiaoyun CC: , Jerin Jacob , Ferruh Yigit , Andrew Rybchenko , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit , "Ananyev Konstantin" , Ajit Khaparde , Ray Kinsella Date: Thu, 21 Oct 2021 18:41:37 +0800 Message-ID: <20211021104142.2649060-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211021104142.2649060-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20211021104142.2649060-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] 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: 321cf1a7-ba62-4d66-6686-08d9947f6dc8 X-MS-TrafficTypeDiagnostic: BN8PR12MB3171: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True 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: 1zERqMxn4g9WZpUa7l3poy+FBIk6aTmr5GaxxwHNloJechl/1WMwmrdfcoVPWm702anGbKecQ/LDp42np4Bfcj0qP15R7gDPdnka/cHz3g3osSE6AC4jcDoFpYvmFUWw6osI5VQRNPaRnxG+UkRDZyCpqqlv/JTtCq10tPalhP0Sqx0wthrYuJ8I/9hmogBIN65nJgn48ks1oFmzPIzONLb3dP7C5T/XbZLnlT5dI4LqLglHz5xSbFtct3aGsVnCJSo4Pxs57Fk6YswFK/Z/LqmR2gslRoNhi4huNdbqVaUXkozhz0dX+pivNoOyOP2fazGmXHb6ZTrvziVed1OemmA9TCwpWOFxATRSxWOCz1MahA9ZjEl9hazo20Gl9OYNrLMa51iehzRqKOmeeKjHu2x4dl/1qL47WAd8Tt8wMhDxNzpgwYpXVIjueuIK3zyJxI4RwgM9SufC/qDnOv6tIM3/1TAdHhmfHKAYCnqmv+wq9piTBZNO33gLWp/xgnLXkjC3ST3eRE101JpWdVCxDUWG4QLpGhvP110o1yCTK/54LvXAt4H3AXixX2W0w7I+tXKWzg7hv/aEQp1d10G7HaAtdbAMG7rYlVT9zQrvjg8gBRpjXWW7C9Noqc21xuHj48AhXHLIIRaoDzKyRR7RbFnFhA0uezREYT/8YuMAsTTDGCOAam9hXVxYVMRSGjwHDm4Qh39BytLouyW5PWKxQg== 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)(36840700001)(46966006)(5660300002)(7636003)(186003)(110136005)(6286002)(2906002)(70586007)(26005)(70206006)(47076005)(7696005)(83380400001)(82310400003)(36860700001)(336012)(16526019)(426003)(508600001)(55016002)(1076003)(8936002)(6666004)(2616005)(316002)(4326008)(86362001)(8676002)(7416002)(54906003)(36756003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 10:42:06.9195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 321cf1a7-ba62-4d66-6686-08d9947f6dc8 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: BN8NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3171 Subject: [dpdk-dev] [PATCH v13 2/7] ethdev: get device capability name as string 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 Reviewed-by: Andrew Rybchenko Acked-by: Ajit Khaparde Acked-by: Thomas Monjalon --- lib/ethdev/rte_ethdev.c | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 14 ++++++++++++++ lib/ethdev/version.map | 1 + 3 files changed, 40 insertions(+) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 31a9cba065b..bfe5b0adbef 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -167,6 +167,15 @@ static const struct { #undef RTE_TX_OFFLOAD_BIT2STR +static const struct { + uint64_t offload; + const char *name; +} rte_eth_dev_capa_names[] = { + {RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP, "RUNTIME_RX_QUEUE_SETUP"}, + {RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP, "RUNTIME_TX_QUEUE_SETUP"}, + {RTE_ETH_DEV_CAPA_RXQ_SHARE, "RXQ_SHARE"}, +}; + /** * The user application callback description. * @@ -1236,6 +1245,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 40f88cc3d64..9baca39e97a 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 d552c955c94..e1abe997290 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -249,6 +249,7 @@ EXPERIMENTAL { rte_mtr_meter_policy_validate; # added in 21.11 + rte_eth_dev_capability_name; rte_eth_dev_conf_get; rte_eth_macaddrs_get; rte_eth_rx_metadata_negotiate; -- 2.33.0