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 64CACA0547; Tue, 19 Oct 2021 19:57:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3264940142; Tue, 19 Oct 2021 19:57:38 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id DF4334003E for ; Tue, 19 Oct 2021 19:57:36 +0200 (CEST) Received: from [192.168.1.192] (unknown [188.242.181.57]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 568A37F59B; Tue, 19 Oct 2021 20:57:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 568A37F59B DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634666256; bh=YZBksacvO/cRpxkgnV+Kq/PNmUyyzktnoUUdfnxit6I=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=DH7orNXnLJVg0uJpG60PsLBlImVhqtbVnm878T8um2WE2xslhEYOsWhZsCPdpMt0U upc0qgJ5T1Sv0MMxniD2cPbposuFJJ+ZEAzmZ5ih1tNVHg3sYLrew12W/bpQTaNFdu YDrb//jHJTTgLUyPoRLmqjERcA48q0nrOuWQLA2A= To: Xueming Li , dev@dpdk.org, Zhang Yuying Cc: Jerin Jacob , Ferruh Yigit , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit , Ananyev Konstantin , Ajit Khaparde , Ray Kinsella References: <20210727034204.20649-1-xuemingl@nvidia.com> <20211019152809.2278464-1-xuemingl@nvidia.com> <20211019152809.2278464-3-xuemingl@nvidia.com> From: Andrew Rybchenko Message-ID: <2dde9f24-fe30-45d9-7230-7d59991cc038@oktetlabs.ru> Date: Tue, 19 Oct 2021 20:57:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211019152809.2278464-3-xuemingl@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [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" On 10/19/21 6:28 PM, Xueming Li wrote: > This patch adds API to return name of device capability. > > Signed-off-by: Xueming Li [snip] > 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 } In fact, such macros make more harm than add value. It complicates grep by capability name. So, it is better to drop the macro and just duplicate few symbols below. > + > +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. > *