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 0C047A0C45; Wed, 20 Oct 2021 09:54:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8608B41186; Wed, 20 Oct 2021 09:54:13 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2068.outbound.protection.outlook.com [40.107.94.68]) by mails.dpdk.org (Postfix) with ESMTP id 25F89411B3 for ; Wed, 20 Oct 2021 09:54:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eKjRoM4l6yTx+k7bosbersODsG3jTdckd2ZjEvhZFzf11w9gwo5Jj7wJR5IyaEheyyrinUMCxlvx3dLl3vlI7WkKeNV/SBstVNc/7gGn1Lf4d2trWizHv4w3fx8Vr3xEaDZkz/uNQ2OAUYzcgPNy6I+X1hOdA6ZdV4tx5Ew+xLu4o/wcIVRt/cCI5eadnL5CDFtMnLQHg9toi+nu/F9JbvGLBV3ObDgehsDpb4UT3fT0L1nM7J+x+3J+jDbnm6oeDeeEC0VWzmp+EOkc7plf8sfos4+PsMhasIuzA7t/rfnkQp8xBw4s4vdXYstsEB0nAuRRb1qqwsEm+St23XRr4g== 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=rPQmQJQVPgk1nPK4F/IUAx/SKMTVASCm3dIS38fwDhI=; b=aXxwAMN99qhXWbozmAC2tU9EI8ES9SdFjvBtb3MMVdM+WZpRwzmGpH8yZkyZH076DAWbOaIkqytKZUYCWeyeh5ZZyqr1n53z8nJ+Sc76XTxY0YSQxq7ndTuuXgqez/pf/M7qZkbblr3C/CsO+KnaOUf6ucVg8axlJ0zOcy/DHkcZJ9yCeB+hb9PmYDJhJ0hqUSn6LCWwkIymqDgvhe8GtRuOUGmattu0HgMd5l06bdt0vy60xM1oeRbMGAo/v4yLvIbX3cEwFckQv/8TNjhKoS4zYZLD5Hb1VFErD2anW5HD8asyjLRpITlTKo3yar0ecscNptRk4aoSLdcn6UzLdQ== 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=rPQmQJQVPgk1nPK4F/IUAx/SKMTVASCm3dIS38fwDhI=; b=h/H2g6JlhEDvu1Y16C7DiqSp0cfLBdlXhlDKP81zCjX8xH2sa4WpeTiPqjZuFrW68dVR3qtKPlr8RSIz3j9CmmlhPWFdPwgX5ZXzQ8T4H3thA5wPDmZm9cQ8BXLCdPa3KWzlYfijuCiPzVEpLH5N3DQZmLp2Is5TMepabPMSRF6b5l7WjHFNmfUz7HoOOR8S4tmkfKQgVW6RkYamtWFXgc+ECFCLRldeg8pz1vekvHcl0TnRtijOsqN9k8jKVPsJo68yY8P9IXSM1pWe7ZBA22EhpZ1Ryp1oCvcpon0r9/LsSpFZOs10DqWX4ou0zxt4KzGyMIQ3VvS19rni31ohEw== Received: from DM5PR21CA0053.namprd21.prod.outlook.com (2603:10b6:3:129::15) by CH2PR12MB3830.namprd12.prod.outlook.com (2603:10b6:610:2f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Wed, 20 Oct 2021 07:54:10 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:3:129:cafe::e8) by DM5PR21CA0053.outlook.office365.com (2603:10b6:3:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.1 via Frontend Transport; Wed, 20 Oct 2021 07:54:10 +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 DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Wed, 20 Oct 2021 07:54:09 +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; Wed, 20 Oct 2021 07:54:02 +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: Wed, 20 Oct 2021 15:53:14 +0800 Message-ID: <20211020075319.2397551-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211020075319.2397551-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20211020075319.2397551-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: 5094fa7b-e000-469b-10e3-08d9939eccaa X-MS-TrafficTypeDiagnostic: CH2PR12MB3830: 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: BJz+aa8Ea4PS4Fq7KPODw14ynvSTPBzIJ7DoSJ1a1127NgCnpIuuelS/u2G7ACP1w4b4dym94U2HqXA/qyKgU/A61Oj0L9nwfBCeIy7m5kzsNq4m25vxbGJTNPrv27IwjyCq8BLevn0F4CRWpfyNyS5VcF3uxD3Lt6YYIHJSLUQ7UIwHTqoN9S4U6II2cKetIhXis/ep279stCMUbmVfnxDwUl7Cubb1ni5fRK6d1EHWDtoW/0mW1a/WALMBKQm8m8DTNLPGuG39F0L6+Elw0ubyRw227EgGajpOkulnKL8sPcLDAyvU/VW/yxKVWbhITKLwNnLaXlD0pIxEzLJ6hQkMSF2H/fWgqQT5NDjNqZlzTy84nFEVg1Bn53HtTiXnNSY/QsmJF3y8fdpJvY6E7cmo+qJWPNxdT4rirOvKyO0kmjQz0o/C9kM7B/oDEtZlOiYd82ML3rKGylmGMlczw6enBT/Gl48yaYXRHKrjmp6xf4b5vLOWtkNTwSgiUAWMncZy110lkwWfsDuiEaTwxwhfOfk13jOWI9bBwa4U0jMzzBx9Ag9Bj6g1o6xUhZN4ZSneap1IEFKpH27DD3rPioA9hl6DR8EUjgVpzR5yjoJTwSIU5CLSJxkajEmDtHb0qW5pmP+hCCa/EsmvSWmo4KlEpspKmWI+NSXmrYsHE3bOEZU9ee58Q9DqfwR7H8vwZEc9KPjd0llVYh0owzqvQg== 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)(16526019)(6666004)(186003)(6286002)(7636003)(2616005)(508600001)(36860700001)(2906002)(36756003)(4326008)(356005)(336012)(86362001)(83380400001)(55016002)(426003)(70586007)(8936002)(82310400003)(110136005)(26005)(70206006)(47076005)(316002)(1076003)(7696005)(54906003)(8676002)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2021 07:54:09.4590 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5094fa7b-e000-469b-10e3-08d9939eccaa 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: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3830 Subject: [dpdk-dev] [PATCH v11 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 | 25 +++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 14 ++++++++++++++ lib/ethdev/version.map | 3 +++ 3 files changed, 42 insertions(+) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index bc55f899f72..d1a4a0405d6 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -165,6 +165,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. * @@ -1260,6 +1269,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