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 941ADA0C4B; Thu, 21 Oct 2021 07:09:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA90D41124; Thu, 21 Oct 2021 07:09:15 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2076.outbound.protection.outlook.com [40.107.100.76]) by mails.dpdk.org (Postfix) with ESMTP id 8ABF940142 for ; Thu, 21 Oct 2021 07:09:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZYTpnphyNs4DCiZfDruXNKY6r9VJaST/WeqmxdlUZsWmBlXw6+24v1Irpce6OD7yFoPZQMkaY/O26W2iYZi2kx8goVDbSrMITw/eXpTp8LHAd6qyDSi5+zW40Nekv1vouAJjmHtfF6XSyFi5KJRWITqsOqDrtyy6dZR2aopbOANczltiir87u3ZO58Dykw9EL7UNtYogKwzxJEOoj0K12ye1QOxBZ4Z7kUFHngrCYbZpwm7vPed6/mbxvODyTNUXXNB+A6lJLBOo+S/QUk2lXURTc9wlbv/iZ9lDnayFJ6HLaHW3mEIMb6lYDxtSVomoqbwFKaFrglx1vSgL4scozA== 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=gneV1YTqTBXrM5hylQuy5nuWxFGYzb1ssNqk3YDxGZWpu9CBivxRwqZ+tN7rp0sSloxO+48aL/xIxHMkUl75dznJBpA4LSy/iZsYY/6OMtp/k2LZfnlpzfTrBgqt01X3SIpNe3qyCBv1/xm+Pi3ytyKXjXKqS1wCOMjn/u330o+WRYv005/he6Hlg5fAVVxLGEM/NRK+blODAwMuIOM9wwwM8OeLk8yvU+GN3+Ncb7t8gr6TO6BPlyYgvCpZNPYr7gN6rmS3/CEOL/vPHAwqzrgEjNUW1J28gcDp3wrPtKz8CDGI3e5owTOWFB/KY7hkl96rwezkV07pqdr3tl9aLw== 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=LLhGk7eVVMaUP7Ms50Cnm7gZjY8x0em0Vl7fC/w2xxUc5aX3c1wPM6Hx85g6rjJzoS04rv6q8yeXvHfljbGFXaIV5J0C9iD19mffFP77UqYEukhiLjPl82V4/UPSfqbHGa3zLuzCERBLFANC/LMukJQucPuaysjNF8MiG++UMGKXxktKyQgVU9lpcnnm00QY1wl02Dp6zhQyhjcI6piGDGBsrOr0njYqrW4rnnqcTh6jdd3C1pAOxT3g2olW1c3SgpBkrdNbYs777SfldfV94FAwa6wVZuKsq0OHiO5BSZddGrL4/QejFmshTIEi68BwunGsL4cRNrXwbuMwviJd2Q== Received: from DM5PR13CA0028.namprd13.prod.outlook.com (2603:10b6:3:7b::14) by MWHPR1201MB0110.namprd12.prod.outlook.com (2603:10b6:301:56::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Thu, 21 Oct 2021 05:09:12 +0000 Received: from DM6NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:3:7b:cafe::f) by DM5PR13CA0028.outlook.office365.com (2603:10b6:3:7b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.8 via Frontend Transport; Thu, 21 Oct 2021 05:09:11 +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 DM6NAM11FT003.mail.protection.outlook.com (10.13.173.162) 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 05:09:11 +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 05:09:00 +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 13:08:27 +0800 Message-ID: <20211021050832.2599691-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211021050832.2599691-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20211021050832.2599691-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: ed59996e-f4ac-47eb-0ee9-08d99450eb81 X-MS-TrafficTypeDiagnostic: MWHPR1201MB0110: 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: kiYambtDPJ3mTBC0rouujzAjj1UMBtgsBgpTGyIQu96k4cIaT1KYy1n3i62JJbaJMsKELY/BMT0Aql6pdLPHQFMQTCaYZywOnHCYc+8OY4M8UYLaBSQxtK8DzvRSEKQQXplemh4yOlUeQ9gd5l4pi2K1aI34o+9oMXZVRc0Ym+q1qoRayS168/CTdrUAPhH32q7/H5bkFOu5zXAhjJx97MtiWDWeTYu49TBIeFRHp89wiV+Ok0dgOWCLFt13YNDI6SQcYAxW9J5EPTd17EEbI/f+b+CW0CdKmbC8vYc+X8/2c20K8cF6zVdd/SZbD9go6M4anreDhVVUhwfmwPY8vbSxRPMO+0I8DIYcogS1kMAXdiSD88Gy1ziRe1mH10725by5X6FrbwTUdFO1BEQV8oMXglmUAUBE9EynU7XHKXJOT4FXVpaohmf3dNCJDywYYq8zl+bCm4kPFbWavnLqfduc2IcUVJZHFH20gmZpswWN/YJhzxrLJUNlnPzMldvIV8PBN+BHSQAdlmtOTeiSSZr7XJNIDLQ/pOH3aauAA4/GboXY97lyZw9hsn1QdaQl+uTTxzMIWmqRsOQo0IH7W/t8qy79K9AshBdrxCUX5Q0eChNXH4/GVFbKuXLTBclVZSDCt+6Jw6zIdGg4w3fTDqwfRqA9jnzMEJ3V4lcsfF//sO9jePpBgraUT46oBNkz9/+rianVzLSM/tJY69TIXw== 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)(36756003)(36860700001)(426003)(336012)(83380400001)(6286002)(70586007)(5660300002)(8676002)(186003)(2616005)(55016002)(2906002)(508600001)(16526019)(86362001)(70206006)(110136005)(26005)(7696005)(356005)(7636003)(7416002)(36906005)(8936002)(54906003)(82310400003)(316002)(47076005)(1076003)(6666004)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 05:09:11.3117 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed59996e-f4ac-47eb-0ee9-08d99450eb81 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: DM6NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0110 Subject: [dpdk-dev] [PATCH v12 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