1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
4 * The file contains the implementations of the method to
5 * fill items, actions & attributes in their corresponding
6 * arrays, and then generate rte_flow rule.
8 * After the generation. The rule goes to validation then
9 * creation state and then return the results.
15 #include "items_gen.h"
16 #include "actions_gen.h"
20 fill_attributes(struct rte_flow_attr *attr,
21 uint64_t flow_attrs, uint16_t group)
23 if (flow_attrs & INGRESS)
25 if (flow_attrs & EGRESS)
27 if (flow_attrs & TRANSFER)
33 generate_flow(uint16_t port_id,
37 uint64_t flow_actions,
39 uint32_t outer_ip_src,
41 struct rte_flow_error *error)
43 struct rte_flow_attr attr;
44 struct rte_flow_item items[MAX_ITEMS_NUM];
45 struct rte_flow_action actions[MAX_ACTIONS_NUM];
46 struct rte_flow *flow = NULL;
48 memset(items, 0, sizeof(items));
49 memset(actions, 0, sizeof(actions));
50 memset(&attr, 0, sizeof(struct rte_flow_attr));
52 fill_attributes(&attr, flow_attrs, group);
54 fill_actions(actions, flow_actions,
55 outer_ip_src, next_table, hairpinq);
57 fill_items(items, flow_items, outer_ip_src);
59 flow = rte_flow_create(port_id, &attr, items, actions, error);