[dpdk-dev] [PATCH 00/22] Generic flow API (rte_flow)

Ferruh Yigit ferruh.yigit at intel.com
Fri Dec 2 17:58:53 CET 2016


Hi Adrien,

On 11/16/2016 4:23 PM, Adrien Mazarguil wrote:
> As previously discussed in RFC v1 [1], RFC v2 [2], with changes
> described in [3] (also pasted below), here is the first non-draft series
> for this new API.
> 
> Its capabilities are so generic that its name had to be vague, it may be
> called "Generic flow API", "Generic flow interface" (possibly shortened
> as "GFI") to refer to the name of the new filter type, or "rte_flow" from
> the prefix used for its public symbols. I personally favor the latter.
> 
> While it is currently meant to supersede existing filter types in order for
> all PMDs to expose a common filtering/classification interface, it may
> eventually evolve to cover the following ideas as well:
> 
> - Rx/Tx offloads configuration through automatic offloads for specific
>   packets, e.g. performing checksum on TCP packets could be expressed with
>   an egress rule with a TCP pattern and a kind of checksum action.
> 
> - RSS configuration (already defined actually). Could be global or per rule
>   depending on hardware capabilities.
> 
> - Switching configuration for devices with many physical ports; rules doing
>   both ingress and egress could even be used to completely bypass software
>   if supported by hardware.
> 
>  [1] http://dpdk.org/ml/archives/dev/2016-July/043365.html
>  [2] http://dpdk.org/ml/archives/dev/2016-August/045383.html
>  [3] http://dpdk.org/ml/archives/dev/2016-November/050044.html
> 
> Changes since RFC v2:
> 
> - New separate VLAN pattern item (previously part of the ETH definition),
>   found to be much more convenient.
> 
> - Removed useless "any" field from VF pattern item, the same effect can be
>   achieved by not providing a specification structure.
> 
> - Replaced bit-fields from the VXLAN pattern item to avoid endianness
>   conversion issues on 24-bit fields.
> 
> - Updated struct rte_flow_item with a new "last" field to create inclusive
>   ranges. They are defined as the interval between (spec & mask) and
>   (last & mask). All three parameters are optional.
> 
> - Renamed ID action MARK.
> 
> - Renamed "queue" fields in actions QUEUE and DUP to "index".
> 
> - "rss_conf" field in RSS action is now const.
> 
> - VF action now uses a 32 bit ID like its pattern item counterpart.
> 
> - Removed redundant struct rte_flow_pattern, API functions now expect
>   struct
>   rte_flow_item lists terminated by END items.
> 
> - Replaced struct rte_flow_actions for the same reason, with struct
>   rte_flow_action lists terminated by END actions.
> 
> - Error types (enum rte_flow_error_type) have been updated and the cause
>   pointer in struct rte_flow_error is now const.
> 
> - Function prototypes (rte_flow_create, rte_flow_validate) have also been
>   updated for clarity.
> 
> Additions:
> 
> - Public wrapper functions rte_flow_{validate|create|destroy|flush|query}
>   are now implemented in rte_flow.c, with their symbols exported and
>   versioned. Related filter type RTE_ETH_FILTER_GENERIC has been added.
> 
> - A separate header (rte_flow_driver.h) has been added for driver-side
>   functionality, in particular struct rte_flow_ops which contains PMD
>   callbacks returned by RTE_ETH_FILTER_GENERIC query.
> 
> - testpmd now exposes most of this API through the new "flow" command.
> 
> What remains to be done:
> 
> - Using endian-aware integer types (rte_beX_t) where necessary for clarity.
> 
> - API documentation (based on RFC).
> 
> - testpmd flow command documentation (although context-aware command
>   completion should already help quite a bit in this regard).
> 
> - A few pattern item / action properties cannot be configured yet
>   (e.g. rss_conf parameter for RSS action) and a few completions
>   (e.g. possible queue IDs) should be added.
> 

<...>

I was trying to check driver filter API patches, but hit a few compiler
errors with this patchset.

[1] clang complains about variable bitfield value changed from -1 to 1.
Which is correct, but I guess that is intentional, but I don't know how
to tell this to clang?

[2] shred library compilation error, because of missing rte_flow_flush
in rte_ether_version.map file

[3] bunch of icc compilation errors, almost all are same type:
error #188: enumerated type mixed with another type


Thanks,
ferruh



[1]
=============================
.../app/test-pmd/cmdline_flow.c:944:16: error: implicit truncation from
'int' to bitfield changes value from -1 to 1
[-Werror,-Wbitfield-constant-conversion]
                .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_raw,
relative)),

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../app/test-pmd/cmdline_flow.c:282:42: note: expanded from macro
'ARGS_ENTRY_BF'
                .mask = (const void *)&(const s){ .f = -1 }, \
                                                       ^~
.../app/test-pmd/cmdline_flow.c:269:49: note: expanded from macro 'ARGS'
#define ARGS(...) (const struct arg *const []){ __VA_ARGS__, NULL, }
                                                ^~~~~~~~~~~
.../app/test-pmd/cmdline_flow.c:950:16: error: implicit truncation from
'int' to bitfield changes value from -1 to 1
[-Werror,-Wbitfield-constant-conversion]
                .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_raw,
search)),
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../app/test-pmd/cmdline_flow.c:282:42: note: expanded from macro
'ARGS_ENTRY_BF'
                .mask = (const void *)&(const s){ .f = -1 }, \
                                                       ^~
.../app/test-pmd/cmdline_flow.c:269:49: note: expanded from macro 'ARGS'
#define ARGS(...) (const struct arg *const []){ __VA_ARGS__, NULL, }
                                                ^~~~~~~~~~~
.../app/test-pmd/cmdline_flow.c:1293:16: error: implicit truncation from
'int' to bitfield changes value from -1 to 1
[-Werror,-Wbitfield-constant-conversion]
                .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_action_vf,
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../app/test-pmd/cmdline_flow.c:282:42: note: expanded from macro
'ARGS_ENTRY_BF'
                .mask = (const void *)&(const s){ .f = -1 }, \
                                                       ^~
.../app/test-pmd/cmdline_flow.c:269:49: note: expanded from macro 'ARGS'
#define ARGS(...) (const struct arg *const []){ __VA_ARGS__, NULL, }
                                                ^~~~~~~~~~~
.../app/test-pmd/cmdline_flow.c:1664:26: error: duplicate 'const'
declaration specifier [-Werror,-Wduplicate-decl-specifier]
        static const enum index const next[] = NEXT_ENTRY(ACTION_RSS_QUEUE);
                                ^
4 errors generated.



[2]
=============================
  LD testpmd
config.o: In function `port_flow_flush':
config.c:(.text+0x2231): undefined reference to `rte_flow_flush'
collect2: error: ld returned 1 exit status


[3]
=============================
.../app/test-pmd/cmdline_flow.c(364): error #188: enumerated type mixed
with another type

        0,


        ^

.../app/test-pmd/cmdline_flow.c(370): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(376): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(385): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(406): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(413): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(419): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(425): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(435): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(443): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(450): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(457): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(464): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(471): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(478): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(485): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(492): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(498): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(514): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(520): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(526): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(532): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(538): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(545): error #188: enumerated type mixed
with another type
        0,
        ^

.../app/test-pmd/cmdline_flow.c(619): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(FLOW)),
                        ^

.../app/test-pmd/cmdline_flow.c(716): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY
                        ^

.../app/test-pmd/cmdline_flow.c(729): error #188: enumerated type mixed
with another type
                .next = NEXT(next_vc_attr, NEXT_ENTRY(PORT_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(736): error #188: enumerated type mixed
with another type
                .next = NEXT(next_vc_attr, NEXT_ENTRY(PORT_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(743): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(DESTROY_RULE), NEXT_ENTRY(PORT_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(743): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(DESTROY_RULE), NEXT_ENTRY(PORT_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(750): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(PORT_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(757): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(QUERY_ACTION),
                        ^

.../app/test-pmd/cmdline_flow.c(757): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(QUERY_ACTION),
                        ^

.../app/test-pmd/cmdline_flow.c(757): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(QUERY_ACTION),
                        ^

.../app/test-pmd/cmdline_flow.c(768): error #188: enumerated type mixed
with another type
                .next = NEXT(next_list_attr, NEXT_ENTRY(PORT_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(776): error #188: enumerated type mixed
with another type
                .next = NEXT(next_destroy_attr, NEXT_ENTRY(RULE_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(792): error #188: enumerated type mixed
with another type
                .next = NEXT(next_list_attr, NEXT_ENTRY(GROUP_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(800): error #188: enumerated type mixed
with another type
                .next = NEXT(next_vc_attr, NEXT_ENTRY(GROUP_ID)),
                        ^

.../app/test-pmd/cmdline_flow.c(807): error #188: enumerated type mixed
with another type
                .next = NEXT(next_vc_attr, NEXT_ENTRY(PRIORITY_LEVEL)),
                        ^

.../app/test-pmd/cmdline_flow.c(864): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ACTIONS)),
                        ^

.../app/test-pmd/cmdline_flow.c(871): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ITEM_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(878): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ITEM_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(891): error #188: enumerated type mixed
with another type
                .next = NEXT(item_any, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(897): error #188: enumerated type mixed
with another type
                .next = NEXT(item_any, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(904): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ITEM_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(917): error #188: enumerated type mixed
with another type
                .next = NEXT(item_vf, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(930): error #188: enumerated type mixed
with another type
                .next = NEXT(item_port, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(943): error #188: enumerated type mixed
with another type
                .next = NEXT(item_raw, NEXT_ENTRY(BOOLEAN), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(949): error #188: enumerated type mixed
with another type
                .next = NEXT(item_raw, NEXT_ENTRY(BOOLEAN), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(955): error #188: enumerated type mixed
with another type
                .next = NEXT(item_raw, NEXT_ENTRY(INTEGER), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(961): error #188: enumerated type mixed
with another type
                .next = NEXT(item_raw, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(967): error #188: enumerated type mixed
with another type
                .next = NEXT(item_raw,
                        ^

.../app/test-pmd/cmdline_flow.c(967): error #188: enumerated type mixed
with another type
                .next = NEXT(item_raw,
                        ^

.../app/test-pmd/cmdline_flow.c(987): error #188: enumerated type mixed
with another type
                .next = NEXT(item_eth, NEXT_ENTRY(MAC_ADDR), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(993): error #188: enumerated type mixed
with another type
                .next = NEXT(item_eth, NEXT_ENTRY(MAC_ADDR), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(999): error #188: enumerated type mixed
with another type
                .next = NEXT(item_eth, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1012): error #188: enumerated type mixed
with another type
                .next = NEXT(item_vlan, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1018): error #188: enumerated type mixed
with another type
                .next = NEXT(item_vlan, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1031): error #188: enumerated type mixed
with another type
                .next = NEXT(item_ipv4, NEXT_ENTRY(IPV4_ADDR), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1038): error #188: enumerated type mixed
with another type
                .next = NEXT(item_ipv4, NEXT_ENTRY(IPV4_ADDR), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1052): error #188: enumerated type mixed
with another type
                .next = NEXT(item_ipv6, NEXT_ENTRY(IPV6_ADDR), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1059): error #188: enumerated type mixed
with another type
                .next = NEXT(item_ipv6, NEXT_ENTRY(IPV6_ADDR), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1073): error #188: enumerated type mixed
with another type
                .next = NEXT(item_icmp, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1080): error #188: enumerated type mixed
with another type
                .next = NEXT(item_icmp, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1094): error #188: enumerated type mixed
with another type
                .next = NEXT(item_udp, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1101): error #188: enumerated type mixed
with another type
                .next = NEXT(item_udp, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1115): error #188: enumerated type mixed
with another type
                .next = NEXT(item_tcp, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1122): error #188: enumerated type mixed
with another type
                .next = NEXT(item_tcp, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1136): error #188: enumerated type mixed
with another type
                .next = NEXT(item_sctp, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1143): error #188: enumerated type mixed
with another type
                .next = NEXT(item_sctp, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1157): error #188: enumerated type mixed
with another type
                .next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param),
                        ^

.../app/test-pmd/cmdline_flow.c(1182): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(1189): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(1202): error #188: enumerated type mixed
with another type
                .next = NEXT(action_mark, NEXT_ENTRY(UNSIGNED)),
                        ^

.../app/test-pmd/cmdline_flow.c(1210): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(1224): error #188: enumerated type mixed
with another type
                .next = NEXT(action_queue, NEXT_ENTRY(UNSIGNED)),
                        ^

.../app/test-pmd/cmdline_flow.c(1232): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(1239): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(1252): error #188: enumerated type mixed
with another type
                .next = NEXT(action_dup, NEXT_ENTRY(UNSIGNED)),
                        ^

.../app/test-pmd/cmdline_flow.c(1266): error #188: enumerated type mixed
with another type
                .next = NEXT(action_rss, NEXT_ENTRY(ACTION_RSS_QUEUE)),
                        ^

.../app/test-pmd/cmdline_flow.c(1279): error #188: enumerated type mixed
with another type
                .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
                        ^

.../app/test-pmd/cmdline_flow.c(1292): error #188: enumerated type mixed
with another type
                .next = NEXT(action_vf, NEXT_ENTRY(BOOLEAN)),
                        ^

.../app/test-pmd/cmdline_flow.c(1300): error #188: enumerated type mixed
with another type
                .next = NEXT(action_vf, NEXT_ENTRY(UNSIGNED)),
                        ^

.../app/test-pmd/cmdline_flow.c(1599): error #188: enumerated type mixed
with another type
                ctx->next[ctx->next_num - 2] = NEXT_ENTRY(PREFIX);
                                               ^

.../app/test-pmd/cmdline_flow.c(1664): error #83: type qualifier
specified more than once
        static const enum index const next[] = NEXT_ENTRY(ACTION_RSS_QUEUE);
                                ^

.../app/test-pmd/cmdline_flow.c(1664): error #188: enumerated type mixed
with another type
        static const enum index const next[] = NEXT_ENTRY(ACTION_RSS_QUEUE);
                                               ^

.../app/test-pmd/cmdline_flow.c(2302): error #188: enumerated type mixed
with another type
        ctx->curr = 0;
                  ^

.../app/test-pmd/cmdline_flow.c(2303): error #188: enumerated type mixed
with another type
        ctx->prev = 0;
                  ^




More information about the dev mailing list