30 #include <rte_byteorder.h>
35 #include "flow_common.h"
39 #define SAMPLE_CLASS_ID 0x107
41 #define CHANGEABLE_32 (UINT32_MAX)
42 #define CHANGEABLE_16 (UINT16_MAX)
43 #define FULL_MASK_32 (UINT32_MAX)
142 struct doca_flow_pipe_cfg *pipe_cfg;
143 uint8_t mac_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
146 memset(&match, 0,
sizeof(match));
148 memset(&actions1, 0,
sizeof(actions1));
149 memset(&actions2, 0,
sizeof(actions2));
150 memset(&
fwd, 0,
sizeof(
fwd));
152 actions_arr[0] = &actions1;
153 actions_arr[1] = &actions2;
283 struct doca_flow_pipe_entry *
entry;
284 uint8_t mac1[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
285 uint8_t mac2[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
288 memset(&match, 0,
sizeof(match));
351 uint8_t nb_options = 3;
355 struct doca_flow_parser *parsers[
nb_ports];
359 struct doca_flow_pipe *pipes[
nb_ports];
361 uint32_t num_of_entries = 3;
371 memset(dev_arr, 0,
sizeof(
struct doca_dev *) *
nb_ports);
380 memset(tlv_list, 0,
sizeof(tlv_list[0]) * nb_options);
383 for (port_id = 0; port_id <
nb_ports; port_id++) {
384 memset(&status, 0,
sizeof(status));
struct doca_flow_port * init_doca_flow(uint16_t port_id, uint8_t rxq_num)
#define SET_MAC_ADDR(addr, a, b, c, d, e, f)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static doca_error_t create_geneve_opt_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
static void fill_parser_geneve_opt_cfg_list(struct doca_flow_parser_geneve_opt_cfg *list)
doca_error_t flow_geneve_opt(int nb_queues)
DOCA_LOG_REGISTER(FLOW_GENEVE_OPT)
static doca_error_t add_geneve_opt_pipe_entries(struct doca_flow_pipe *pipe, struct entries_status *status)
static struct doca_flow_actions actions
static struct doca_flow_fwd fwd
static struct doca_flow_match match_mask
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
#define DOCA_FLOW_ETHER_TYPE_IPV6
#define DOCA_FLOW_ETHER_TYPE_IPV4
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_destroy(struct doca_flow_pipe_cfg *cfg)
Destroy DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_create(struct doca_flow_pipe_cfg **cfg, struct doca_flow_port *port)
Create DOCA Flow pipe configuration struct.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_match(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_match *match, const struct doca_flow_match *match_mask)
Set pipe's match and match mask.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_create(const struct doca_flow_pipe_cfg *cfg, const struct doca_flow_fwd *fwd, const struct doca_flow_fwd *fwd_miss, struct doca_flow_pipe **pipe)
Create one new pipe.
DOCA_EXPERIMENTAL doca_error_t doca_flow_parser_geneve_opt_create(const struct doca_flow_port *port, const struct doca_flow_parser_geneve_opt_cfg tlv_list[], uint8_t nb_options, struct doca_flow_parser **parser)
Creates GENEVE TLV parser for the selected port.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_actions(struct doca_flow_pipe_cfg *cfg, struct doca_flow_actions *const *actions, struct doca_flow_actions *const *actions_masks, struct doca_flow_action_descs *const *action_descs, size_t nr_actions)
Set pipe's actions, actions mask and actions descriptor.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_add_entry(uint16_t pipe_queue, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_actions *actions, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, uint32_t flags, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a pipe.
DOCA_STABLE void doca_flow_destroy(void)
Destroy the doca flow.
@ DOCA_FLOW_PARSER_GENEVE_OPT_MODE_FIXED
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
doca_error_t flow_process_entries(struct doca_flow_port *port, struct entries_status *status, uint32_t nr_entries)
doca_error_t stop_doca_flow_ports(int nb_ports, struct doca_flow_port *ports[])
doca_error_t init_doca_flow_ports(int nb_ports, struct doca_flow_port *ports[], bool is_hairpin, struct doca_dev *dev_arr[], uint32_t actions_mem_size[])
doca_error_t set_flow_pipe_cfg(struct doca_flow_pipe_cfg *cfg, const char *name, enum doca_flow_pipe_type type, bool is_root)
#define SHARED_RESOURCE_NUM_VALUES
#define ACTIONS_MEM_SIZE(nr_queues, entries)
#define BUILD_VNI(uint24_vni)
#define ARRAY_INIT(array, val)
doca flow actions information
enum doca_flow_resource_type decap_type
struct doca_flow_resource_decap_cfg decap_cfg
enum doca_flow_fwd_type type
doca flow matcher information
struct doca_flow_parser_meta parser_meta
User configuration structure using to create parser for single GENEVE TLV option.
enum doca_flow_parser_geneve_opt_mode match_on_class_mode
doca_be32_t data_mask[DOCA_FLOW_GENEVE_DATA_OPTION_LEN_MAX]
struct doca_flow_header_eth eth
enum doca_flow_tun_type type
union doca_flow_geneve_option geneve_options[DOCA_FLOW_GENEVE_OPT_LEN_MAX]
struct doca_flow_header_geneve geneve
user context struct that will be used in entries process callback
static uint32_t actions_mem_size[FLOW_SWITCH_PORTS_MAX]
static struct doca_flow_port * ports[FLOW_SWITCH_PORTS_MAX]