32 #include "flow_common.h"
36 #define ACL_MEM_REQ_PER_ENTRY (32)
38 #define ACL_ACTIONS_MEM_SIZE(nr_queues, entries) \
39 rte_align32pow2(MAX((uint32_t)(entries * ACL_MEM_REQ_PER_ENTRY * DOCA_FLOW_MAX_ENTRY_ACTIONS_MEM_SIZE), \
40 (uint32_t)(nr_queues * MIN_ACTIONS_MEM_SIZE_PER_QUEUE)))
57 struct doca_flow_pipe_cfg *pipe_cfg;
61 memset(&match, 0,
sizeof(match));
62 memset(&
fwd, 0,
sizeof(
fwd));
117 struct doca_flow_pipe_cfg *pipe_cfg;
122 memset(&match, 0,
sizeof(match));
228 memset(&match, 0,
sizeof(match));
230 memset(&
fwd, 0,
sizeof(
fwd));
297 RTE_BE32(0xffffffff),
298 RTE_BE32(0xffffffff),
315 RTE_BE32(0xffffffff),
316 RTE_BE32(0xffffffff),
334 RTE_BE32(0xffffffff),
335 RTE_BE32(0xffffffff),
353 RTE_BE32(0xffffff00),
354 RTE_BE32(0xffffff00),
381 struct doca_flow_pipe *acl_pipe;
382 struct doca_flow_pipe *rx_pipe;
384 int num_of_entries = 4;
386 int port_id, port_acl;
394 memset(dev_arr, 0,
sizeof(
struct doca_dev *) *
nb_ports);
403 for (port_id = 0; port_id <
nb_ports; port_id++) {
404 memset(&status, 0,
sizeof(status));
409 port_acl = port_id ^ 1;
struct doca_flow_port * init_doca_flow(uint16_t port_id, uint8_t rxq_num)
doca_error_t flow_acl(int nb_queues)
doca_error_t create_acl_pipe(struct doca_flow_port *port, bool is_root, struct doca_flow_pipe **pipe)
static enum doca_flow_pipe_domain domain
doca_error_t add_acl_pipe_entries(struct doca_flow_pipe *pipe, int port_id, struct entries_status *status)
doca_error_t add_acl_specific_entry(struct doca_flow_pipe *pipe, int port_id, struct entries_status *status, doca_be32_t src_ip_addr, doca_be32_t dst_ip_addr, doca_be16_t src_port, doca_be16_t dst_port, uint8_t l4_type, doca_be32_t src_ip_addr_mask, doca_be32_t dst_ip_addr_mask, doca_be16_t src_port_mask, doca_be16_t dst_port_mask, uint16_t priority, bool is_allow, enum doca_flow_flags_type flag)
#define ACL_ACTIONS_MEM_SIZE(nr_queues, entries)
doca_error_t create_rx_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(FLOW_ACL)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static struct doca_flow_fwd fwd_miss
static struct doca_flow_actions actions
#define BE_IPV4_ADDR(a, b, c, d)
static struct doca_flow_fwd fwd
static struct doca_flow_match match_mask
#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.
@ DOCA_FLOW_L4_TYPE_EXT_TCP
@ DOCA_FLOW_L4_TYPE_EXT_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_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_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_acl_add_entry(uint16_t pipe_queue, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_match *match_mask, const uint32_t priority, const struct doca_flow_fwd *fwd, const enum doca_flow_flags_type flag, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a acl 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_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_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_flow_pipe_domain
doca flow pipe domain
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_FWD_CHANGEABLE
@ 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.
uint16_t doca_be16_t
Declare DOCA endianity types.
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 ARRAY_INIT(array, val)
doca flow actions information
struct doca_flow_pipe * pipe
enum doca_flow_fwd_type type
doca flow matcher information
struct doca_flow_parser_meta parser_meta
struct doca_flow_header_format outer
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]