29 #include <rte_byteorder.h>
30 #include <rte_ethdev.h>
31 #include <rte_mempool.h>
39 #include "flow_common.h"
78 #define NB_EGRESS_ENTRIES (SWITCH_RSS_BASIC_PIPE_MAX + SWITCH_RSS_CONTROL_MAX)
80 #define NB_INGRESS_ENTRIES INGRESS_ROOT_TO_MAX
82 #define NB_VPORT_ENTRIES INGRESS_TO_PORT_MAX
84 #define NB_TOTAL_ENTRIES \
85 (1 + NB_INGRESS_ENTRIES + NB_EGRESS_ENTRIES + NB_VPORT_ENTRIES + \
86 (SWITCH_RSS_BASIC_PIPE_MAX + SWITCH_RSS_CONTROL_MAX) * SWITCH_RSS_PIPE_DIR_MAX)
127 #define MAX_RSS_QUEUE 10
151 uint32_t sw_packet_type;
154 rc = rte_flow_dynf_metadata_register();
164 for (i = 0; i < nb_rx; i++) {
165 sw_packet_type = rte_net_get_ptype(mbufs[i],
NULL, RTE_PTYPE_ALL_MASK);
166 if (mbufs[i]->ol_flags & RTE_MBUF_F_RX_FDIR_ID)
168 mbufs[i]->hash.fdir.hi,
173 rte_pktmbuf_free(mbufs[i]);
191 struct doca_flow_pipe_cfg *pipe_cfg;
195 memset(&match, 0,
sizeof(match));
196 memset(&
fwd, 0,
sizeof(
fwd));
253 memset(&match, 0,
sizeof(match));
275 struct doca_flow_pipe **pipe)
277 struct doca_flow_pipe_cfg *pipe_cfg;
324 struct doca_flow_pipe **pipe)
330 struct doca_flow_pipe_cfg *pipe_cfg;
334 memset(&match, 0,
sizeof(match));
335 memset(&
fwd, 0,
sizeof(
fwd));
416 struct doca_flow_pipe_cfg *pipe_cfg;
419 memset(&match, 0,
sizeof(match));
421 memset(&
fwd, 0,
sizeof(
fwd));
485 struct doca_flow_pipe_cfg *pipe_cfg;
488 memset(&match, 0,
sizeof(match));
490 memset(&
fwd, 0,
sizeof(
fwd));
556 struct doca_flow_pipe_cfg *pipe_cfg;
559 memset(&match, 0,
sizeof(match));
561 memset(&
fwd, 0,
sizeof(
fwd));
562 memset(&pipe_cfg, 0,
sizeof(pipe_cfg));
630 memset(&
fwd, 0,
sizeof(
fwd));
631 memset(&match, 0,
sizeof(match));
680 memset(&
fwd, 0,
sizeof(
fwd));
681 memset(&match, 0,
sizeof(match));
734 memset(&
fwd, 0,
sizeof(
fwd));
735 memset(&match, 0,
sizeof(match));
817 memset(&match, 0,
sizeof(match));
825 memset(&
fwd, 0,
sizeof(
fwd));
859 memset(&
fwd, 0,
sizeof(
fwd));
916 uint32_t shared_rss_ids;
919 struct doca_dev *doca_dev =
ctx->doca_dev[0];
920 const char *start_str;
921 bool is_expert =
ctx->is_expert;
925 memset(&status, 0,
sizeof(status));
930 start_str =
"switch,hws,isolated,hairpinq_num=4,expert";
932 start_str =
"switch,hws,isolated,hairpinq_num=4";
940 memset(dev_arr, 0,
sizeof(
struct doca_dev *) *
nb_ports);
941 dev_arr[0] = doca_dev;
953 cfg.rss_cfg = rss_cfg;
968 DOCA_LOG_ERR(
"Failed to bind shared rss %d to port", i);
struct doca_flow_port * init_doca_flow(uint16_t port_id, uint8_t rxq_num)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static uint16_t * rss_queues
static struct doca_flow_actions actions
#define BE_IPV4_ADDR(a, b, c, d)
static struct doca_flow_monitor monitor
static struct doca_flow_fwd fwd
#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_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_flow_flags_type
doca flow flags type
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_monitor(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_monitor *monitor)
Set pipe's monitor.
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_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_dir_info(struct doca_flow_pipe_cfg *cfg, enum doca_flow_direction_info dir_info)
Set pipe's Direction info.
DOCA_STABLE struct doca_flow_port * doca_flow_port_switch_get(const struct doca_flow_port *port)
Get doca flow switch port.
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_EXPERIMENTAL doca_error_t doca_flow_resource_query_entry(struct doca_flow_pipe_entry *entry, struct doca_flow_resource_query *query_stats)
Extract information about specific entry.
@ DOCA_FLOW_SHARED_RESOURCE_RSS
@ DOCA_FLOW_DIRECTION_NETWORK_TO_HOST
@ DOCA_FLOW_WAIT_FOR_BATCH
@ DOCA_FLOW_RESOURCE_TYPE_SHARED
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
@ 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.
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
struct doca_flow_pipe * next_pipe
struct doca_flow_pipe * pipe
enum doca_flow_fwd_type type
enum doca_flow_resource_type rss_type
struct doca_flow_resource_rss_cfg rss
doca flow matcher information
struct doca_flow_parser_meta parser_meta
struct doca_flow_header_format outer
doca monitor action configuration
enum doca_flow_resource_type counter_type
struct doca_flow_resource_query::@115::@117 counter
doca flow shared resource configuration
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]
struct upf_accel_ctx * ctx