188259515SOphir Munk /* SPDX-License-Identifier: BSD-3-Clause
288259515SOphir Munk * Copyright 2020 Mellanox Technologies, Ltd
388259515SOphir Munk */
488259515SOphir Munk
588259515SOphir Munk #ifndef RTE_PMD_MLX5_FLOW_OS_H_
688259515SOphir Munk #define RTE_PMD_MLX5_FLOW_OS_H_
788259515SOphir Munk
888259515SOphir Munk #include "mlx5_flow.h"
903e1f7f7SOphir Munk #include "mlx5_malloc.h"
1088259515SOphir Munk
1188259515SOphir Munk #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
1288259515SOphir Munk extern const struct mlx5_flow_driver_ops mlx5_flow_dv_drv_ops;
132b679150SSuanming Mou extern const struct mlx5_flow_driver_ops mlx5_flow_hw_drv_ops;
1488259515SOphir Munk #endif
1588259515SOphir Munk
1688259515SOphir Munk /**
1788259515SOphir Munk * Get OS enforced flow type. MLX5_FLOW_TYPE_MAX means "non enforced type".
1888259515SOphir Munk *
1988259515SOphir Munk * @return
2088259515SOphir Munk * Flow type (MLX5_FLOW_TYPE_MAX)
2188259515SOphir Munk */
2288259515SOphir Munk static inline enum mlx5_flow_drv_type
mlx5_flow_os_get_type(void)2388259515SOphir Munk mlx5_flow_os_get_type(void)
2488259515SOphir Munk {
2588259515SOphir Munk return MLX5_FLOW_TYPE_DV;
2688259515SOphir Munk }
2788259515SOphir Munk
2888259515SOphir Munk /**
2988259515SOphir Munk * Check if item type is supported.
3088259515SOphir Munk *
3188259515SOphir Munk * @param item
3288259515SOphir Munk * Item type to check.
3388259515SOphir Munk *
3488259515SOphir Munk * @return
3588259515SOphir Munk * True is this item type is supported, false if not supported.
3688259515SOphir Munk */
3788259515SOphir Munk static inline bool
mlx5_flow_os_item_supported(int item)3888259515SOphir Munk mlx5_flow_os_item_supported(int item)
3988259515SOphir Munk {
4088259515SOphir Munk switch (item) {
4188259515SOphir Munk case RTE_FLOW_ITEM_TYPE_END:
4288259515SOphir Munk case RTE_FLOW_ITEM_TYPE_VOID:
4388259515SOphir Munk case RTE_FLOW_ITEM_TYPE_ETH:
4488259515SOphir Munk case RTE_FLOW_ITEM_TYPE_IPV4:
4588259515SOphir Munk case RTE_FLOW_ITEM_TYPE_UDP:
46a6a18d06STal Shnaiderman case RTE_FLOW_ITEM_TYPE_TCP:
47a6a18d06STal Shnaiderman case RTE_FLOW_ITEM_TYPE_IPV6:
486061cc41STal Shnaiderman case RTE_FLOW_ITEM_TYPE_VLAN:
49fb96caa5SRaja Zidane case RTE_FLOW_ITEM_TYPE_ESP:
5088259515SOphir Munk return true;
5188259515SOphir Munk default:
5288259515SOphir Munk return false;
5388259515SOphir Munk }
5488259515SOphir Munk }
5588259515SOphir Munk
5688259515SOphir Munk /**
5788259515SOphir Munk * Check if action type is supported.
5888259515SOphir Munk *
5988259515SOphir Munk * @param action
6088259515SOphir Munk * Action type to check.
6188259515SOphir Munk *
6288259515SOphir Munk * @return
6388259515SOphir Munk * True is this action type is supported, false if not supported.
6488259515SOphir Munk */
6588259515SOphir Munk static inline bool
mlx5_flow_os_action_supported(int action)6688259515SOphir Munk mlx5_flow_os_action_supported(int action)
6788259515SOphir Munk {
6888259515SOphir Munk switch (action) {
6988259515SOphir Munk case RTE_FLOW_ACTION_TYPE_END:
7088259515SOphir Munk case RTE_FLOW_ACTION_TYPE_VOID:
7188259515SOphir Munk case RTE_FLOW_ACTION_TYPE_QUEUE:
7288259515SOphir Munk case RTE_FLOW_ACTION_TYPE_RSS:
7388259515SOphir Munk return true;
7488259515SOphir Munk default:
7588259515SOphir Munk return false;
7688259515SOphir Munk }
7788259515SOphir Munk }
7888259515SOphir Munk
7988259515SOphir Munk /**
8088259515SOphir Munk * Create flow table.
8188259515SOphir Munk *
8288259515SOphir Munk * @param[in] domain
8388259515SOphir Munk * Pointer to relevant domain.
8488259515SOphir Munk * @param[in] table_id
8588259515SOphir Munk * Table ID.
8688259515SOphir Munk * @param[out] table
8788259515SOphir Munk * NULL (no table object required)
8888259515SOphir Munk *
8988259515SOphir Munk * @return
9088259515SOphir Munk * 0 if table_id is 0, negative value otherwise and errno is set.
9188259515SOphir Munk */
9288259515SOphir Munk static inline int
mlx5_flow_os_create_flow_tbl(void * domain,uint32_t table_id,void ** table)9388259515SOphir Munk mlx5_flow_os_create_flow_tbl(void *domain, uint32_t table_id, void **table)
9488259515SOphir Munk {
9588259515SOphir Munk RTE_SET_USED(domain);
9688259515SOphir Munk *table = NULL;
9788259515SOphir Munk if (table_id) {
9888259515SOphir Munk rte_errno = ENOTSUP;
9988259515SOphir Munk return -rte_errno;
10088259515SOphir Munk }
10188259515SOphir Munk return 0;
10288259515SOphir Munk }
10388259515SOphir Munk
10488259515SOphir Munk /**
10588259515SOphir Munk * Destroy flow table.
10688259515SOphir Munk *
10788259515SOphir Munk * @param table
10888259515SOphir Munk * Pointer to table to destroy.
10988259515SOphir Munk *
11088259515SOphir Munk * @return
11188259515SOphir Munk * 0 on success (silently ignored).
11288259515SOphir Munk */
11388259515SOphir Munk static inline int
mlx5_flow_os_destroy_flow_tbl(void * table)11488259515SOphir Munk mlx5_flow_os_destroy_flow_tbl(void *table)
11588259515SOphir Munk {
11688259515SOphir Munk RTE_SET_USED(table);
11788259515SOphir Munk /* Silently ignore */
11888259515SOphir Munk return 0;
11988259515SOphir Munk }
12088259515SOphir Munk
12188259515SOphir Munk /**
12288259515SOphir Munk * Create flow action: packet reformat.
12388259515SOphir Munk *
12488259515SOphir Munk * @param[in] ctx
12588259515SOphir Munk * Pointer to relevant device context.
12688259515SOphir Munk * @param[in] domain
12788259515SOphir Munk * Pointer to domain handler.
12888259515SOphir Munk * @param[in] resource
12988259515SOphir Munk * Pointer to action data resource.
13088259515SOphir Munk * @param[out] action
13188259515SOphir Munk * Pointer to a valid action on success, NULL otherwise.
13288259515SOphir Munk *
13388259515SOphir Munk *
13488259515SOphir Munk * @return
13588259515SOphir Munk * 0 on success, or negative value on failure and errno is set.
13688259515SOphir Munk */
13788259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_packet_reformat(void * ctx,void * domain,void * resource,void ** action)13888259515SOphir Munk mlx5_flow_os_create_flow_action_packet_reformat(void *ctx, void *domain,
13988259515SOphir Munk void *resource, void **action)
14088259515SOphir Munk {
14188259515SOphir Munk RTE_SET_USED(ctx);
14288259515SOphir Munk RTE_SET_USED(domain);
14388259515SOphir Munk RTE_SET_USED(resource);
14488259515SOphir Munk RTE_SET_USED(action);
14588259515SOphir Munk rte_errno = ENOTSUP;
14688259515SOphir Munk return -rte_errno;
14788259515SOphir Munk }
14888259515SOphir Munk
14988259515SOphir Munk /**
15088259515SOphir Munk * Create flow action: modify header.
15188259515SOphir Munk *
15288259515SOphir Munk * @param[in] ctx
15388259515SOphir Munk * Pointer to relevant device context.
15488259515SOphir Munk * @param[in] domain
15588259515SOphir Munk * Pointer to domain handler.
15688259515SOphir Munk * @param[in] resource
15788259515SOphir Munk * Pointer to action data resource.
15888259515SOphir Munk * @param[in] actions_len
15988259515SOphir Munk * Total length of actions data in resource.
16088259515SOphir Munk * @param[out] action
16188259515SOphir Munk * Pointer to a valid action on success, NULL otherwise.
16288259515SOphir Munk *
16388259515SOphir Munk *
16488259515SOphir Munk * @return
16588259515SOphir Munk * 0 on success, or -1 on failure and errno is set.
16688259515SOphir Munk */
16788259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_modify_header(void * ctx,void * domain,void * resource,uint32_t actions_len,void ** action)16888259515SOphir Munk mlx5_flow_os_create_flow_action_modify_header(void *ctx,
16988259515SOphir Munk void *domain,
17088259515SOphir Munk void *resource,
17188259515SOphir Munk uint32_t actions_len,
17288259515SOphir Munk void **action)
17388259515SOphir Munk {
17488259515SOphir Munk RTE_SET_USED(ctx);
17588259515SOphir Munk RTE_SET_USED(domain);
17688259515SOphir Munk RTE_SET_USED(resource);
17788259515SOphir Munk RTE_SET_USED(actions_len);
17888259515SOphir Munk RTE_SET_USED(action);
17988259515SOphir Munk rte_errno = ENOTSUP;
18088259515SOphir Munk return -rte_errno;
18188259515SOphir Munk }
18288259515SOphir Munk
18388259515SOphir Munk /**
18488259515SOphir Munk * Create flow action: destination flow table.
18588259515SOphir Munk *
18688259515SOphir Munk * @param[in] tbl_obj
18788259515SOphir Munk * Pointer to destination table object.
18888259515SOphir Munk * @param[out] action
18988259515SOphir Munk * Pointer to a valid action on success, NULL otherwise.
19088259515SOphir Munk *
19188259515SOphir Munk * @return
19288259515SOphir Munk * 0 on success, or negative value on failure and errno is set.
19388259515SOphir Munk */
19488259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_dest_flow_tbl(void * tbl_obj,void ** action)19588259515SOphir Munk mlx5_flow_os_create_flow_action_dest_flow_tbl(void *tbl_obj, void **action)
19688259515SOphir Munk {
19788259515SOphir Munk RTE_SET_USED(tbl_obj);
19888259515SOphir Munk RTE_SET_USED(action);
19988259515SOphir Munk rte_errno = ENOTSUP;
20088259515SOphir Munk return -rte_errno;
20188259515SOphir Munk }
20288259515SOphir Munk
20388259515SOphir Munk /**
20488259515SOphir Munk * Create flow action: destination port.
20588259515SOphir Munk *
20688259515SOphir Munk * @param[in] domain
20788259515SOphir Munk * Pointer to domain handler.
20888259515SOphir Munk * @param[in] port_id
20988259515SOphir Munk * Destination port ID.
21088259515SOphir Munk * @param[out] action
21188259515SOphir Munk * Pointer to a valid action on success, NULL otherwise.
21288259515SOphir Munk *
21388259515SOphir Munk * @return
21488259515SOphir Munk * 0 on success, or negative value on failure and errno is set.
21588259515SOphir Munk */
21688259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_dest_port(void * domain,uint32_t port_id,void ** action)21788259515SOphir Munk mlx5_flow_os_create_flow_action_dest_port(void *domain, uint32_t port_id,
21888259515SOphir Munk void **action)
21988259515SOphir Munk {
22088259515SOphir Munk RTE_SET_USED(domain);
22188259515SOphir Munk RTE_SET_USED(port_id);
22288259515SOphir Munk *action = NULL;
22388259515SOphir Munk rte_errno = ENOTSUP;
22488259515SOphir Munk return -rte_errno;
22588259515SOphir Munk }
22688259515SOphir Munk
22788259515SOphir Munk /**
22888259515SOphir Munk * Create flow action: push vlan.
22988259515SOphir Munk *
23088259515SOphir Munk * @param[in] domain
23188259515SOphir Munk * Pointer to domain handler.
23288259515SOphir Munk * @param[in] vlan_tag
23388259515SOphir Munk * VLAN tag value.
23488259515SOphir Munk * @param[out] action
23588259515SOphir Munk * Pointer to a valid action on success, NULL otherwise.
23688259515SOphir Munk *
23788259515SOphir Munk * @return
23888259515SOphir Munk * 0 on success, or negative value on failure and errno is set.
23988259515SOphir Munk */
24088259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_push_vlan(void * domain,rte_be32_t vlan_tag,void ** action)24188259515SOphir Munk mlx5_flow_os_create_flow_action_push_vlan(void *domain, rte_be32_t vlan_tag,
24288259515SOphir Munk void **action)
24388259515SOphir Munk {
24488259515SOphir Munk RTE_SET_USED(domain);
24588259515SOphir Munk RTE_SET_USED(vlan_tag);
24688259515SOphir Munk *action = NULL;
24788259515SOphir Munk rte_errno = ENOTSUP;
24888259515SOphir Munk return -rte_errno;
24988259515SOphir Munk }
25088259515SOphir Munk
25188259515SOphir Munk /**
25288259515SOphir Munk * Create flow action: count.
25388259515SOphir Munk *
25488259515SOphir Munk * @param[in] cnt_obj
25588259515SOphir Munk * Pointer to DevX counter object.
25688259515SOphir Munk * @param[in] offset
25788259515SOphir Munk * Offset of counter in array.
25888259515SOphir Munk * @param[out] action
25988259515SOphir Munk * Pointer to a valid action on success, NULL otherwise.
26088259515SOphir Munk *
26188259515SOphir Munk * @return
26288259515SOphir Munk * 0 on success, or negative value on failure and errno is set.
26388259515SOphir Munk */
26488259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_count(void * cnt_obj,uint16_t offset,void ** action)26588259515SOphir Munk mlx5_flow_os_create_flow_action_count(void *cnt_obj, uint16_t offset,
26688259515SOphir Munk void **action)
26788259515SOphir Munk {
26888259515SOphir Munk RTE_SET_USED(cnt_obj);
26988259515SOphir Munk RTE_SET_USED(offset);
27088259515SOphir Munk *action = NULL;
27188259515SOphir Munk rte_errno = ENOTSUP;
27288259515SOphir Munk return -rte_errno;
27388259515SOphir Munk }
27488259515SOphir Munk
27588259515SOphir Munk /**
27688259515SOphir Munk * Create flow action: tag.
27788259515SOphir Munk *
27888259515SOphir Munk * @param[in] tag
27988259515SOphir Munk * Tag value.
28088259515SOphir Munk * @param[out] action
28188259515SOphir Munk * Pointer to a valid action on success, NULL otherwise.
28288259515SOphir Munk *
28388259515SOphir Munk * @return
28488259515SOphir Munk * 0 on success, or negative value on failure and errno is set.
28588259515SOphir Munk */
28688259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_tag(uint32_t tag,void ** action)28788259515SOphir Munk mlx5_flow_os_create_flow_action_tag(uint32_t tag, void **action)
28888259515SOphir Munk {
28988259515SOphir Munk RTE_SET_USED(tag);
29088259515SOphir Munk *action = NULL;
29188259515SOphir Munk rte_errno = ENOTSUP;
29288259515SOphir Munk return -rte_errno;
29388259515SOphir Munk }
29488259515SOphir Munk
29588259515SOphir Munk /**
29688259515SOphir Munk * Create flow action: drop.
29788259515SOphir Munk *
29888259515SOphir Munk * @param[out] action
29988259515SOphir Munk * Pointer to a valid action on success, NULL otherwise.
30088259515SOphir Munk *
30188259515SOphir Munk * @return
30288259515SOphir Munk * 0 on success, or negative value on failure and errno is set.
30388259515SOphir Munk */
30488259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_drop(void ** action)30588259515SOphir Munk mlx5_flow_os_create_flow_action_drop(void **action)
30688259515SOphir Munk {
30788259515SOphir Munk *action = NULL;
30888259515SOphir Munk rte_errno = ENOTSUP;
30988259515SOphir Munk return -rte_errno;
31088259515SOphir Munk }
31188259515SOphir Munk
31288259515SOphir Munk /**
31388259515SOphir Munk * Create flow action: default miss.
31488259515SOphir Munk *
31588259515SOphir Munk * @param[out] action
31688259515SOphir Munk * NULL action pointer.
31788259515SOphir Munk *
31888259515SOphir Munk * @return
31988259515SOphir Munk * 0 as success.
32088259515SOphir Munk */
32188259515SOphir Munk static inline int
mlx5_flow_os_create_flow_action_default_miss(void ** action)32288259515SOphir Munk mlx5_flow_os_create_flow_action_default_miss(void **action)
32388259515SOphir Munk {
32488259515SOphir Munk *action = 0;
32588259515SOphir Munk /* Silently ignore */
32688259515SOphir Munk return 0;
32788259515SOphir Munk }
32888259515SOphir Munk
32988259515SOphir Munk /**
33080f998daSMichael Savisko * Create flow action: send_to_kernel.
33180f998daSMichael Savisko *
33280f998daSMichael Savisko * @param[in] tbl
33380f998daSMichael Savisko * Pointer to destination root table.
33480f998daSMichael Savisko * @param[in] priority
33580f998daSMichael Savisko * Priority to which traffic will arrive.
33680f998daSMichael Savisko * @param[out] action
33780f998daSMichael Savisko * Pointer to a valid action on success, NULL otherwise.
33880f998daSMichael Savisko *
33980f998daSMichael Savisko * @return
34080f998daSMichael Savisko * 0 on success, or -1 on failure and errno is set.
34180f998daSMichael Savisko */
34280f998daSMichael Savisko static inline int
mlx5_flow_os_create_flow_action_send_to_kernel(void * tbl,uint16_t priority,void ** action)34380f998daSMichael Savisko mlx5_flow_os_create_flow_action_send_to_kernel(void *tbl, uint16_t priority,
34480f998daSMichael Savisko void **action)
34580f998daSMichael Savisko {
34680f998daSMichael Savisko RTE_SET_USED(tbl);
34780f998daSMichael Savisko RTE_SET_USED(priority);
34880f998daSMichael Savisko *action = NULL;
34980f998daSMichael Savisko rte_errno = ENOTSUP;
35080f998daSMichael Savisko return -rte_errno;
35180f998daSMichael Savisko }
35280f998daSMichael Savisko
35380f998daSMichael Savisko /**
354bd935fe3SOphir Munk * Create flow action: sampler
355bd935fe3SOphir Munk *
356bd935fe3SOphir Munk * @param[in] attr
357bd935fe3SOphir Munk * Pointer to sampler attribute
358bd935fe3SOphir Munk * @param[out] action
359bd935fe3SOphir Munk * Pointer to a valid action on success, NULL otherwise.
360bd935fe3SOphir Munk *
361bd935fe3SOphir Munk * @return
362bd935fe3SOphir Munk * 0 on success, or -1 on failure and errno is set.
363bd935fe3SOphir Munk */
364bd935fe3SOphir Munk static inline int
mlx5_os_flow_dr_create_flow_action_sampler(struct mlx5dv_dr_flow_sampler_attr * attr,void ** action)365bd935fe3SOphir Munk mlx5_os_flow_dr_create_flow_action_sampler
366bd935fe3SOphir Munk (struct mlx5dv_dr_flow_sampler_attr *attr,
367bd935fe3SOphir Munk void **action)
368bd935fe3SOphir Munk {
369bd935fe3SOphir Munk RTE_SET_USED(attr);
370bd935fe3SOphir Munk *action = NULL;
371bd935fe3SOphir Munk rte_errno = ENOTSUP;
372bd935fe3SOphir Munk return -rte_errno;
373bd935fe3SOphir Munk }
374bd935fe3SOphir Munk
375bd935fe3SOphir Munk /**
376bd935fe3SOphir Munk * Create flow action: dest_array
377bd935fe3SOphir Munk *
378bd935fe3SOphir Munk * @param[in] domain
379bd935fe3SOphir Munk * Pointer to relevant domain.
380bd935fe3SOphir Munk * @param[in] num_dest
381bd935fe3SOphir Munk * Number of destinations array.
382bd935fe3SOphir Munk * @param[in] dests
383bd935fe3SOphir Munk * Array of destination attributes.
384bd935fe3SOphir Munk * @param[out] action
385bd935fe3SOphir Munk * Pointer to a valid action on success, NULL otherwise.
386bd935fe3SOphir Munk *
387bd935fe3SOphir Munk * @return
388bd935fe3SOphir Munk * 0 on success, or -1 on failure and errno is set.
389bd935fe3SOphir Munk */
390bd935fe3SOphir Munk static inline int
mlx5_os_flow_dr_create_flow_action_dest_array(void * domain,size_t num_dest,struct mlx5dv_dr_action_dest_attr * dests[],void ** action)391bd935fe3SOphir Munk mlx5_os_flow_dr_create_flow_action_dest_array
392bd935fe3SOphir Munk (void *domain,
393bd935fe3SOphir Munk size_t num_dest,
394bd935fe3SOphir Munk struct mlx5dv_dr_action_dest_attr *dests[],
395bd935fe3SOphir Munk void **action)
396bd935fe3SOphir Munk {
397bd935fe3SOphir Munk RTE_SET_USED(domain);
398bd935fe3SOphir Munk RTE_SET_USED(num_dest);
399bd935fe3SOphir Munk RTE_SET_USED(dests);
400bd935fe3SOphir Munk *action = NULL;
401bd935fe3SOphir Munk rte_errno = ENOTSUP;
402bd935fe3SOphir Munk return -rte_errno;
403bd935fe3SOphir Munk }
404bd935fe3SOphir Munk
405bd935fe3SOphir Munk /**
40688259515SOphir Munk * OS stub for mlx5_flow_adjust_priority() API.
40788259515SOphir Munk * Windows only supports flow priority 0 that cannot be adjusted.
40888259515SOphir Munk *
40988259515SOphir Munk * @param[in] dev
41088259515SOphir Munk * Pointer to the Ethernet device structure.
41188259515SOphir Munk * @param[in] priority
41288259515SOphir Munk * The rule base priority.
41388259515SOphir Munk * @param[in] subpriority
41488259515SOphir Munk * The priority based on the items.
41588259515SOphir Munk *
41688259515SOphir Munk * @return
41788259515SOphir Munk * 0
41888259515SOphir Munk */
41988259515SOphir Munk static inline uint32_t
mlx5_os_flow_adjust_priority(struct rte_eth_dev * dev,int32_t priority,uint32_t subpriority)42088259515SOphir Munk mlx5_os_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
42188259515SOphir Munk uint32_t subpriority)
42288259515SOphir Munk {
42388259515SOphir Munk RTE_SET_USED(dev);
42488259515SOphir Munk RTE_SET_USED(priority);
42588259515SOphir Munk RTE_SET_USED(subpriority);
42688259515SOphir Munk return 0;
42788259515SOphir Munk }
42888259515SOphir Munk
42962d5b30bSTal Shnaiderman static inline int
mlx5_os_flow_dr_sync_domain(void * domain,uint32_t flags)43062d5b30bSTal Shnaiderman mlx5_os_flow_dr_sync_domain(void *domain, uint32_t flags)
43162d5b30bSTal Shnaiderman {
43262d5b30bSTal Shnaiderman RTE_SET_USED(domain);
43362d5b30bSTal Shnaiderman RTE_SET_USED(flags);
43462d5b30bSTal Shnaiderman errno = ENOTSUP;
43562d5b30bSTal Shnaiderman return errno;
43662d5b30bSTal Shnaiderman }
43762d5b30bSTal Shnaiderman
43888259515SOphir Munk int mlx5_flow_os_validate_flow_attributes(struct rte_eth_dev *dev,
43988259515SOphir Munk const struct rte_flow_attr *attributes,
44088259515SOphir Munk bool external,
44188259515SOphir Munk struct rte_flow_error *error);
44288259515SOphir Munk int mlx5_flow_os_create_flow_matcher(void *ctx,
44388259515SOphir Munk void *attr,
44488259515SOphir Munk void *table,
44588259515SOphir Munk void **matcher);
44688259515SOphir Munk int mlx5_flow_os_destroy_flow_matcher(void *matcher);
44788259515SOphir Munk int mlx5_flow_os_create_flow_action_dest_devx_tir(struct mlx5_devx_obj *tir,
44888259515SOphir Munk void **action);
44988259515SOphir Munk int mlx5_flow_os_destroy_flow_action(void *action);
45088259515SOphir Munk int mlx5_flow_os_create_flow(void *matcher, void *match_value,
45188259515SOphir Munk size_t num_actions,
45288259515SOphir Munk void *actions[], void **flow);
45388259515SOphir Munk int mlx5_flow_os_destroy_flow(void *drv_flow_ptr);
454fb96caa5SRaja Zidane
455fb96caa5SRaja Zidane /**
456fb96caa5SRaja Zidane * Validate ESP item.
457fb96caa5SRaja Zidane *
458fb96caa5SRaja Zidane * @param[in] item
459fb96caa5SRaja Zidane * Item specification.
460fb96caa5SRaja Zidane * @param[in] item_flags
461fb96caa5SRaja Zidane * Bit-fields that holds the items detected until now.
462fb96caa5SRaja Zidane * @param[in] target_protocol
463fb96caa5SRaja Zidane * The next protocol in the previous item.
464fb96caa5SRaja Zidane * @param[out] error
465fb96caa5SRaja Zidane * Pointer to error structure.
466fb96caa5SRaja Zidane *
467fb96caa5SRaja Zidane * @return
468fb96caa5SRaja Zidane * 0 on success, a negative errno value otherwise and rte_errno is set.
469fb96caa5SRaja Zidane */
470fb96caa5SRaja Zidane int
471*80c67625SGregory Etelson mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
472*80c67625SGregory Etelson const struct rte_flow_item *item,
473fb96caa5SRaja Zidane uint64_t item_flags,
474fb96caa5SRaja Zidane uint8_t target_protocol,
475fb96caa5SRaja Zidane struct rte_flow_error *error);
476fb96caa5SRaja Zidane
4772ece3b71SBing Zhao /**
4782ece3b71SBing Zhao * Add per thread workspace to the global list for garbage collection.
4792ece3b71SBing Zhao *
4802ece3b71SBing Zhao * @param[in] ws
4812ece3b71SBing Zhao * Pointer to the flow workspace.
4822ece3b71SBing Zhao */
4832ece3b71SBing Zhao void mlx5_flow_os_workspace_gc_add(struct mlx5_flow_workspace *ws);
4842ece3b71SBing Zhao
48588259515SOphir Munk #endif /* RTE_PMD_MLX5_FLOW_OS_H_ */
486