On 31 May 2017 at 14:03, Savolainen, Petri (Nokia - FI/Espoo)
<petri.savolai...@nokia.com> wrote:
>
>> diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h
>
> I think it's better to have a new file for this (feature.h). It may be needed 
> also in other parts (of implementation) than init.
>
>
>> index 154cdf8f..ab2ec577 100644
>> --- a/include/odp/api/spec/init.h
>> +++ b/include/odp/api/spec/init.h
>> @@ -105,6 +105,78 @@ typedef int (*odp_log_func_t)(odp_log_level_t level,
>> const char *fmt, ...);
>>  /** Replaceable abort function */
>>  typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
>>
>> +/** ODP Feature set. Used to inform implementation which
>> + *  ODP features will not be used by this application. Knowing this may
>> + *  improve implementation efficiency.
>> + */
>> +typedef union odp_unused_feature_t {
>
> odp_features_t or odp_feature_list_t or odp_feature_bits_t could be better, 
> since odp_feature_t could be reserved for an enum (single feature).
>
> Anyway, used vs unused is variable definition, not type.
>
>> +     uint64_t all_features;
>> +     struct {
>> +             /** APIs in atomic.h are not used */
>> +             uint32_t atomic:1;
>> +             /** APIs in barrier.h are not used */
>> +             uint32_t barrier:1;
>> +             /** APIs in buffer.h are not used */
>> +             uint32_t buffer:1;
>> +             /** APIs in byteorder.h are not used */
>> +             uint32_t byteorder:1;
>> +             /** APIs in classification.h are not used */
>> +             uint32_t classification:1;
>> +             /** APIs in cpu.h are not used */
>> +             uint32_t cpu:1;
>> +             /** APIs in cpumask.h are not used */
>> +             uint32_t cpumask:1;
>> +             /** APIs in crypto.h are not used */
>> +             uint32_t crypto:1;
>> +             /** APIs in errno.h are not used */
>> +             uint32_t odp_errno:1;
>> +             /** APIs in event.h are not used */
>> +             uint32_t event:1;
>> +             /** APIs in hash.h are not used */
>> +             uint32_t hash:1;
>> +             /** APIs in ipsec.h are not used */
>> +             uint32_t ipsec:1;
>> +             /** APIs in packet_flags.h are not used */
>> +             uint32_t packet_flags:1;
>> +             /** APIs in packet.h are not used */
>> +             uint32_t packet:1;
>> +             /** APIs in packet_io.h are not used */
>> +             uint32_t packet_io:1;
>> +             /** APIs in packet_io_stats.h are not used */
>> +             uint32_t packet_io_stats:1;
>> +             /** APIs in pool.h are not used */
>> +             uint32_t pool:1;
>> +             /** APIs in queue.h are not used */
>> +             uint32_t queue:1;
>> +             /** APIs in random.h are not used */
>> +             uint32_t random:1;
>> +             /** APIs in rwlock.h are not used */
>> +             uint32_t rwlock:1;
>> +             /** APIs in rwlock_recursive.h are not used */
>> +             uint32_t rwlock_recursive:1;
>> +             /** APIs in schedule.h are not used */
>> +             uint32_t schedule:1;
>> +             /** APIs in std_clib.h are not used */
>> +             uint32_t std_clib:1;
>> +             /** APIs in sync.h are not used */
>> +             uint32_t sync:1;
>> +             /** APIs in system_info.h are not used */
>> +             uint32_t system_info:1;
>> +             /** APIs in thread.h are not used */
>> +             uint32_t thread:1;
>> +             /** APIs in thrmask.h are not used */
>> +             uint32_t thrmask:1;
>> +             /** APIs in ticketlock.h are not used */
>> +             uint32_t ticketlock:1;
>> +             /** APIs in time.h are not used */
>> +             uint32_t time:1;
>> +             /** APIs in timer.h are not used */
>> +             uint32_t timer:1;
>> +             /** APIs in traffic_mngr.h are not used */
>> +             uint32_t traffic_mngr:1;
>> +     };
>> +} odp_unused_feature_t;
>> +
>
> The list should be much shorter, at least in the beginning. It's easy to add 
> more later on. Just major/complex features should be enough for now.
>
> typedef union odp_features_t {
>
>         struct {
>                 uint32_t classification:1;
>                 uint32_t crypto:1;
>                 uint32_t ipsec:1;
>                 uint32_t packet_io:1;
>                 uint32_t pool:1;

IMO packet_io and pool should not be part of this list. Since they are
very basic for dataplane application.

-Bala

>                 uint32_t queue:1;
>                 uint32_t schedule:1;
>                 uint32_t time:1;
>                 uint32_t timer:1;
>                 uint32_t traffic_mngr:1;
>         } feat;
>
>         uint32_t all_feat;
>
> } odp_features_t;
>
>
>
>>  /**
>>   * ODP initialization data
>>   *
>> @@ -153,6 +225,10 @@ typedef struct odp_init_t {
>>       odp_log_func_t log_fn;
>>       /** Replacement for the default abort fn */
>>       odp_abort_func_t abort_fn;
>> +     /** Hints to allow application to tell implementation which ODP
>> +      *  features will not be used by this application.
>> +      */
>> +     odp_unused_feature_t unused_features;
>
> odp_features_t not_used;
>
>
> Later on we may add some init time configuration here and the same bit field 
> can be used to indicate which configs we have filled in.
> odp_features_t config;
>
> but that can be left for future.
>
> -Petri
>
>
>>  } odp_init_t;
>>

Reply via email to