From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id DBF0FA04DD;
	Mon, 26 Oct 2020 18:51:28 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id BF1602BB8;
	Mon, 26 Oct 2020 18:51:27 +0100 (CET)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 272C71D9E
 for <dev@dpdk.org>; Mon, 26 Oct 2020 18:51:26 +0100 (CET)
IronPort-SDR: x4twqZq3mJIeV/tGQc5AXuFxGafPfH8RFXkBshwZKwpQKWMardmNSHUYa+tmPlzbqQtEkcIEfs
 kADgXa+QEiyg==
X-IronPort-AV: E=McAfee;i="6000,8403,9786"; a="165372628"
X-IronPort-AV: E=Sophos;i="5.77,420,1596524400"; d="scan'208";a="165372628"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 26 Oct 2020 10:51:24 -0700
IronPort-SDR: 4QNsC5DsE4Yz3XAs9cZLXbINsBgbc/3e6PqIYZ7y6VoJZjUfm4QWXCWzU+mVCz5FxDFpsZv4V1
 utFkLxKJwviQ==
X-IronPort-AV: E=Sophos;i="5.77,420,1596524400"; d="scan'208";a="535450326"
Received: from vmedvedk-mobl.ger.corp.intel.com (HELO [10.252.22.85])
 ([10.252.22.85])
 by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 26 Oct 2020 10:51:22 -0700
To: David Marchand <david.marchand@redhat.com>
Cc: dev <dev@dpdk.org>, Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
 Ray Kinsella <mdr@ashroe.eu>, Thomas Monjalon <thomas@monjalon.net>,
 "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>,
 Ciara Power <ciara.power@intel.com>
References: <cover.1603119828.git.vladimir.medvedkin@intel.com>
 <cover.1603649185.git.vladimir.medvedkin@intel.com>
 <b388b7d1424b79a686477a2cd684d535de90d620.1603649185.git.vladimir.medvedkin@intel.com>
 <CAJFAV8xXErP5UfT9dSuEm4JDemz7E1Rzrvpn7jdq21nV967NNQ@mail.gmail.com>
From: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
Message-ID: <b4deb58d-605f-1af2-5d85-0ba764b0182b@intel.com>
Date: Mon, 26 Oct 2020 17:51:20 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.3.2
MIME-Version: 1.0
In-Reply-To: <CAJFAV8xXErP5UfT9dSuEm4JDemz7E1Rzrvpn7jdq21nV967NNQ@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v14 1/8] fib: make lookup function type
	configurable
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hello David,

On 26/10/2020 13:58, David Marchand wrote:
> Hello Vladimir,
> 
> On Sun, Oct 25, 2020 at 7:08 PM Vladimir Medvedkin
> <vladimir.medvedkin@intel.com> wrote:
>> diff --git a/lib/librte_fib/rte_fib.h b/lib/librte_fib/rte_fib.h
>> index 84ee774..2097ee5 100644
>> --- a/lib/librte_fib/rte_fib.h
>> +++ b/lib/librte_fib/rte_fib.h
>> @@ -58,6 +58,21 @@ enum rte_fib_dir24_8_nh_sz {
>>          RTE_FIB_DIR24_8_8B
>>   };
>>
>> +/** Type of lookup function implementation */
>> +enum rte_fib_dir24_8_lookup_type {
>> +       RTE_FIB_DIR24_8_SCALAR_MACRO,
>> +       /**< Macro based lookup function */
>> +       RTE_FIB_DIR24_8_SCALAR_INLINE,
>> +       /**<
>> +        * Lookup implementation using inlined functions
>> +        * for different next hop sizes
>> +        */
>> +       RTE_FIB_DIR24_8_SCALAR_UNI
>> +       /**<
>> +        * Unified lookup function for all next hop sizes
>> +        */
>> +};
>> +
> 
> We can't have a generic function, with a specific type/
> Let's have a generic name, in hope it will be extended later for other
> fib implementations.
> For the default behavior and selecting the "best" possible
> implementation, we can introduce a RTE_FIB_LOOKUP_DEFAULT magic value
> that would work with any fib type.
> 
> How about:
> 
> enum rte_fib_lookup_type {
>    RTE_FIB_LOOKUP_DEFAULT,
>    RTE_FIB_LOOKUP_DIR24_8_SCALAR_MACRO,
>    RTE_FIB_LOOKUP_DIR24_8_SCALAR_INLINE,
>    RTE_FIB_LOOKUP_DIR24_8_SCALAR_UNI,
>    RTE_FIB_LOOKUP_DIR24_8_VECTOR_AVX512,
> };
> 
> 

I introduced special magic value to select the "best" possible lookup 
implementation in "fib: introduce AVX512 lookup patch":
+       RTE_FIB_DIR24_8_ANY = UINT32_MAX
+       /**< Selects the best implementation based on the max simd 
bitwidth */
and I wanted to get rid of dir24_8 in names after I remove all 
unnecessary lookup implementations in the separate patches.

But I'm OK with your suggestion, I will reflect it in v15.


>>   /** FIB configuration structure */
>>   struct rte_fib_conf {
>>          enum rte_fib_type type; /**< Type of FIB struct */
>> @@ -196,6 +211,23 @@ __rte_experimental
>>   struct rte_rib *
>>   rte_fib_get_rib(struct rte_fib *fib);
>>
>> +/**
>> + * Set lookup function based on type
>> + *
>> + * @param fib
>> + *   FIB object handle
>> + * @param type
>> + *   type of lookup function
>> + *
>> + * @return
>> + *    -EINVAL on failure
>> + *    0 on success
>> + */
>> +__rte_experimental
>> +int
>> +rte_fib_set_lookup_fn(struct rte_fib *fib,
>> +       enum rte_fib_dir24_8_lookup_type type);
>> +
> 
> _fn does not give much info, how about rte_fib_select_lookup ?
> 

rte_fib_select_lookup is OK, I will rename it in v15 as well.

> 
>>   #ifdef __cplusplus
>>   }
>>   #endif
> 
> 

-- 
Regards,
Vladimir