37 #include "flow_common.h"
42 #define WAITING_TIME 10
43 #define NB_INGRESS_PIPE_ENTRIES (4)
44 #define NB_MODIFY_PIPE_ENTRIES (2)
45 #define NB_ENCAP_PIPE_ENTRIES (2)
46 #define NB_EGRESS_PIPE_ENTRIES (NB_MODIFY_PIPE_ENTRIES + NB_ENCAP_PIPE_ENTRIES)
47 #define TOTAL_ENTRIES (NB_INGRESS_PIPE_ENTRIES + NB_EGRESS_PIPE_ENTRIES)
62 struct doca_flow_pipe *pipe;
63 struct doca_flow_pipe_entry *
entry;
67 struct doca_flow_pipe_cfg *pipe_cfg;
71 memset(&match, 0,
sizeof(match));
73 memset(&
fwd, 0,
sizeof(
fwd));
181 struct doca_flow_pipe_entry *
entry;
184 uint8_t mac1[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
185 uint8_t mac2[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
189 memset(&match, 0,
sizeof(match));
265 struct doca_flow_pipe *next_pipe,
269 struct doca_flow_pipe *pipe;
274 struct doca_flow_pipe_cfg *pipe_cfg;
277 memset(&match, 0,
sizeof(match));
280 memset(&
fwd, 0,
sizeof(
fwd));
371 uint32_t src_bit_offset,
379 desc->
field_op.src.field_string = src_str;
380 desc->
field_op.src.bit_offset = src_bit_offset;
381 desc->
field_op.dst.field_string =
"outer.ipv6.flow_label";
397 struct doca_flow_pipe **pipe,
408 struct doca_flow_pipe_cfg *pipe_cfg;
411 memset(&match, 0,
sizeof(match));
413 memset(&
fwd, 0,
sizeof(
fwd));
426 descs_arr[0] = &ip4_descs;
427 descs_arr[1] = &ip6_descs;
484 struct doca_flow_pipe_entry *
entry;
487 memset(&match, 0,
sizeof(match));
521 struct doca_flow_pipe *pipe;
522 uint32_t total_entries = 0;
523 uint32_t nb_pipe_entries;
531 total_entries += nb_pipe_entries;
533 memset(status, 0,
sizeof(*status));
546 total_entries += nb_pipe_entries;
567 uint32_t num_of_entries;
570 memset(status, 0,
sizeof(*status));
612 memset(dev_arr, 0,
sizeof(
struct doca_dev *) *
nb_ports);
621 for (port_id = 0; port_id <
nb_ports; port_id++) {
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)
DOCA_LOG_REGISTER(FLOW_IPV6_FLOW_LABEL)
static doca_error_t prepare_egress_pipeline(struct doca_flow_port *pair_port, int pair_port_id, struct entries_status *status)
static doca_error_t create_ingress_pipe(struct doca_flow_port *port, int port_id, struct entries_status *status, uint32_t *nb_entries)
static doca_error_t add_encap_pipe_entries(struct doca_flow_pipe *pipe, struct entries_status *status)
static doca_error_t prepare_ingress_pipeline(struct doca_flow_port *port, int port_id, struct entries_status *status)
doca_error_t flow_ipv6_flow_label(int nb_queues)
static doca_error_t add_modify_pipe_entries(struct doca_flow_pipe *pipe, struct entries_status *status)
static void fill_copy_to_outer_ipv6_fl_desc(const char *src_str, uint32_t src_bit_offset, struct doca_flow_action_desc *desc, struct doca_flow_action_descs *descs)
static doca_error_t create_modify_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe, uint32_t *nb_entries)
static doca_error_t create_encap_pipe(struct doca_flow_port *port, struct doca_flow_pipe *next_pipe, struct entries_status *status, uint32_t *nb_entries)
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_MPLS_DEFAULT_PORT
@ DOCA_FLOW_L4_TYPE_EXT_UDP
@ DOCA_FLOW_L4_TYPE_EXT_TRANSPORT
@ DOCA_FLOW_TUN_MPLS_O_UDP
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_flow_flags_type
doca flow flags type
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_mpls_label_encode(uint32_t label, uint8_t traffic_class, uint8_t ttl, bool bottom_of_stack, struct doca_flow_header_mpls *mpls)
Prepare an MPLS label header in big-endian.
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_STABLE doca_error_t doca_flow_pipe_cfg_set_nr_entries(struct doca_flow_pipe_cfg *cfg, uint32_t nr_entries)
Set pipe's maximum number of flow rules.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_domain(struct doca_flow_pipe_cfg *cfg, enum doca_flow_pipe_domain domain)
Set pipe's domain.
@ DOCA_FLOW_WAIT_FOR_BATCH
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
@ DOCA_FLOW_PIPE_DOMAIN_EGRESS
@ DOCA_FLOW_PIPE_DOMAIN_DEFAULT
#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 SET_IPV6_ADDR(addr, a, b, c, d)
#define ARRAY_INIT(array, val)
enum doca_flow_action_type type
struct doca_flow_action_desc::@108::@110 field_op
struct doca_flow_action_desc * desc_array
doca flow actions information
struct doca_flow_resource_encap_cfg encap_cfg
enum doca_flow_resource_type encap_type
struct doca_flow_meta meta
struct doca_flow_header_format outer
struct doca_flow_pipe * next_pipe
enum doca_flow_fwd_type type
doca flow matcher information
struct doca_flow_parser_meta parser_meta
struct doca_flow_header_format outer
struct doca_flow_meta meta
struct doca_flow_encap_action encap
enum doca_flow_tun_type type
struct doca_flow_header_mpls mpls[DOCA_FLOW_MPLS_LABELS_MAX]
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]