29 #include <rte_byteorder.h>
35 #include "flow_common.h"
39 #define NB_ACTION_DESC (1)
40 #define DEFAULT_CTRL_PIPE_SIZE (8192)
55 struct doca_flow_pipe_cfg *pipe_cfg;
58 memset(&match, 0,
sizeof(match));
60 memset(&
fwd, 0,
sizeof(
fwd));
112 struct doca_flow_pipe_entry *
entry;
117 memset(&match, 0,
sizeof(match));
151 struct doca_flow_pipe_cfg *pipe_cfg;
154 uint8_t src_mac[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
155 uint8_t dst_mac[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
157 memset(&match, 0,
sizeof(match));
158 memset(&
fwd, 0,
sizeof(
fwd));
230 struct doca_flow_pipe_entry *
entry;
235 memset(&match, 0,
sizeof(match));
262 struct doca_flow_pipe_cfg *pipe_cfg;
263 uint8_t src_mac[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
264 uint8_t dst_mac[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
267 memset(&match, 0,
sizeof(match));
270 memset(&
fwd, 0,
sizeof(
fwd));
343 struct doca_flow_pipe_entry *
entry;
346 memset(&match, 0,
sizeof(match));
383 struct doca_flow_pipe_cfg *pipe_cfg;
384 uint8_t src_mac[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
385 uint8_t dst_mac[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
388 memset(&match, 0,
sizeof(match));
390 memset(&
fwd, 0,
sizeof(
fwd));
459 struct doca_flow_pipe_entry *
entry;
463 memset(&match, 0,
sizeof(match));
491 struct doca_flow_pipe **pipe)
496 struct doca_flow_pipe_cfg *pipe_cfg;
497 struct doca_flow_pipe_entry *
entry;
500 memset(&match, 0,
sizeof(match));
502 memset(&
fwd, 0,
sizeof(
fwd));
548 memset(&match, 0,
sizeof(match));
573 struct doca_flow_pipe_cfg *pipe_cfg;
604 struct doca_flow_pipe *nvgre_pipe,
611 memset(&match, 0,
sizeof(match));
612 memset(&
fwd, 0,
sizeof(
fwd));
658 struct doca_flow_pipe *vxlan_pipe,
659 struct doca_flow_pipe *vxlan_gpe_pipe,
660 struct doca_flow_pipe *mpls_pipe,
661 struct doca_flow_pipe *gre_pipe,
662 struct doca_flow_pipe *nvgre_pipe,
665 int shared_counter_id)
670 uint8_t priority = 0;
673 memset(&match, 0,
sizeof(match));
674 memset(&
fwd, 0,
sizeof(
fwd));
708 memset(&match, 0,
sizeof(match));
709 memset(&
fwd, 0,
sizeof(
fwd));
738 memset(&match, 0,
sizeof(match));
739 memset(&
fwd, 0,
sizeof(
fwd));
768 memset(&match, 0,
sizeof(match));
769 memset(&
fwd, 0,
sizeof(
fwd));
822 struct doca_flow_pipe *vxlan_pipe;
823 struct doca_flow_pipe *vxlan_gpe_pipe;
824 struct doca_flow_pipe *mpls_pipe;
825 struct doca_flow_pipe *gre_pipe;
826 struct doca_flow_pipe *nvgre_pipe;
827 struct doca_flow_pipe *control_pipe;
829 int num_of_entries = 0;
832 uint32_t shared_counter_ids[] = {0, 1};
843 memset(dev_arr, 0,
sizeof(
struct doca_dev *) *
nb_ports);
852 for (port_id = 0; port_id <
nb_ports; port_id++, num_of_entries = 0) {
853 memset(&status, 0,
sizeof(status));
858 DOCA_LOG_ERR(
"Failed to configure shared counter to port %d", port_id);
865 &shared_counter_ids[port_id],
967 shared_counter_ids[port_id]);
1004 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 create_vxlan_gpe_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
static doca_error_t create_control_pipe(struct doca_flow_port *port, struct doca_flow_pipe **pipe)
static doca_error_t add_vxlan_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
static doca_error_t control_add_nvgre_entry(struct doca_flow_pipe *control_pipe, struct doca_flow_pipe *nvgre_pipe, struct entries_status *status, uint8_t priority)
static doca_error_t add_vxlan_gpe_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
static doca_error_t create_nvgre_pipe_and_entry(struct doca_flow_port *port, int port_id, struct entries_status *status, int *num_of_entries, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(FLOW_CONTROL_PIPE)
static doca_error_t add_mpls_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
static doca_error_t create_vxlan_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
#define DEFAULT_CTRL_PIPE_SIZE
doca_error_t flow_control_pipe(int nb_queues)
static doca_error_t create_mpls_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
static doca_error_t add_gre_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
static doca_error_t add_control_pipe_entries(struct doca_flow_pipe *control_pipe, struct doca_flow_pipe *vxlan_pipe, struct doca_flow_pipe *vxlan_gpe_pipe, struct doca_flow_pipe *mpls_pipe, struct doca_flow_pipe *gre_pipe, struct doca_flow_pipe *nvgre_pipe, struct entries_status *status, int *num_of_entries, int shared_counter_id)
static doca_error_t create_gre_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static struct doca_flow_actions actions
static struct doca_flow_monitor monitor
static struct doca_flow_fwd fwd
static struct doca_flow_match match_mask
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
#define DEFAULT_TIMEOUT_US
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
#define DOCA_FLOW_VXLAN_GPE_DEFAULT_PORT
#define DOCA_FLOW_VXLAN_DEFAULT_PORT
#define DOCA_FLOW_PROTO_GRE
#define DOCA_FLOW_PROTO_UDP
#define DOCA_FLOW_VXLAN_GPE_TYPE_IPV4
#define DOCA_FLOW_ETHER_TYPE_TEB
#define DOCA_FLOW_ETHER_TYPE_IPV4
@ DOCA_FLOW_L4_TYPE_EXT_UDP
@ DOCA_FLOW_TUN_EXT_VXLAN_STANDARD
@ DOCA_FLOW_TUN_EXT_VXLAN_GPE
@ DOCA_FLOW_TUN_MPLS_O_UDP
@ DOCA_FLOW_TUN_EXT_GRE_NVGRE
@ DOCA_FLOW_TUN_EXT_GRE_STANDARD
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_STABLE doca_error_t doca_flow_entries_process(struct doca_flow_port *port, uint16_t pipe_queue, uint64_t timeout, uint32_t max_processed_entries)
Process entries in queue.
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_STABLE doca_error_t doca_flow_shared_resources_bind(enum doca_flow_shared_resource_type type, uint32_t *res_array, uint32_t res_array_len, void *bindable_obj)
Binds a bulk of shared resources to a bindable object.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_control_add_entry(uint16_t pipe_queue, uint32_t priority, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_match *match_mask, const struct doca_flow_match_condition *condition, const struct doca_flow_actions *actions, const struct doca_flow_actions *actions_mask, const struct doca_flow_action_descs *action_descs, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a control pipe.
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_shared_resource_set_cfg(enum doca_flow_shared_resource_type type, uint32_t id, struct doca_flow_shared_resource_cfg *cfg)
Configure a single shared resource.
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_EXPERIMENTAL doca_error_t doca_flow_shared_resources_query(enum doca_flow_shared_resource_type type, uint32_t *res_array, struct doca_flow_resource_query *query_results_array, uint32_t array_len)
Extract information about shared counter.
@ DOCA_FLOW_SHARED_RESOURCE_COUNTER
@ DOCA_FLOW_WAIT_FOR_BATCH
@ DOCA_FLOW_RESOURCE_TYPE_SHARED
@ 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.
const struct ip_frag_config * cfg
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 ARRAY_INIT(array, val)
doca flow actions information
enum doca_flow_resource_type decap_type
struct doca_flow_resource_decap_cfg decap_cfg
struct doca_flow_pipe * next_pipe
enum doca_flow_fwd_type type
doca flow matcher information
struct doca_flow_header_format inner
struct doca_flow_parser_meta parser_meta
struct doca_flow_header_format outer
doca monitor action configuration
struct doca_flow_monitor::@103::@107 shared_counter
enum doca_flow_resource_type counter_type
uint32_t shared_counter_id
struct doca_flow_header_eth eth
struct doca_flow_resource_query::@115::@117 counter
doca flow shared resource configuration
enum doca_flow_tun_type type
enum doca_flow_tun_ext_gre_type gre_type
enum doca_flow_tun_ext_vxlan_type vxlan_type
struct doca_flow_header_mpls mpls[DOCA_FLOW_MPLS_LABELS_MAX]
uint8_t vxlan_gpe_next_protocol
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]