Re: [patch net-next v4 01/10] flow_offload: Introduce offload of HW stats type

Jiri Pirko
2020-03-10T11:19:56Z

Mon, Mar 09, 2020 at 06:46:57PM CET, ecree@solarflare.com wrote:
>On 09/03/2020 17:34, Jiri Pirko wrote:
>> Mon, Mar 09, 2020 at 05:52:16PM CET, ecree@solarflare.com wrote:
>>> An enum type seems safer.
>> Well, it's is a bitfield, how do you envision to implement it. Have enum
>> value for every combination? I don't get it.
>enum flow_action_stats_type {
>    FLOW_ACTION_HW_STATS_TYPE_DISABLED=0,
>    FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE=BIT(0),
>    FLOW_ACTION_HW_STATS_TYPE_DELAYED=BIT(1),
>    FLOW_ACTION_HW_STATS_TYPE_ANY=(FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE |
>                                   FLOW_ACTION_HW_STATS_TYPE_DELAYED),
>};
>
>It's not a requirement of the language for every value used withan
> enumeration to be a defined enumerator value, so if someone ends up
> putting (FLOW_ACTION_HW_STATS_TYPE_FOO | FLOW_ACTION_HW_STATS_TYPE_BAR)
> into (say) a driver that supports only FOO and BAR, that will work
> just fine.  I don't see what problem you expect to occur here.

Okay. Will do. Thanks!

>
>-ed