33 #include "flow_common.h"
34 #include <rte_byteorder.h>
35 #include <rte_ethdev.h>
36 #include <rte_mempool.h>
47 struct doca_flow_pipe **pipe,
48 struct doca_flow_pipe *fwd_pipe,
54 struct doca_flow_pipe_cfg *pipe_cfg;
57 memset(&match, 0,
sizeof(match));
59 memset(&
fwd, 0,
sizeof(
fwd));
110 struct doca_flow_pipe_entry *
entry;
113 memset(&match, 0,
sizeof(match));
119 if (
app_cfg->action_changeable) {
136 struct doca_flow_pipe_cfg *pipe_cfg;
141 memset(&match, 0,
sizeof(match));
142 memset(&
fwd, 0,
sizeof(
fwd));
190 struct doca_flow_pipe_entry *
entry;
195 memset(&match, 0,
sizeof(match));
214 uint32_t sw_packet_type;
219 rc = rte_flow_dynf_metadata_register();
229 for (i = 0; i < nb_rx; i++) {
230 sw_packet_type = rte_net_get_ptype(mbufs[i],
NULL, RTE_PTYPE_ALL_MASK);
231 if (mbufs[i]->ol_flags & RTE_MBUF_F_RX_FDIR_ID) {
232 DOCA_LOG_INFO(
"packet mark value: 0x%x", mbufs[i]->hash.fdir.hi);
233 mbufs[i]->ol_flags |= RTE_MBUF_DYNFLAG_TX_METADATA;
240 nb_tx = rte_eth_tx_burst(port_id,
queue_id, &mbufs[i], 1);
245 }
while (++retry < 5);
246 rte_pktmbuf_free(mbufs[i]);
259 int num_of_entries = 2;
264 struct doca_flow_pipe *rss_pipe;
265 struct doca_flow_pipe *match_pipe;
274 memset(dev_arr, 0,
sizeof(
struct doca_dev *) *
nb_ports);
283 for (port_id = 0; port_id <
nb_ports; port_id++) {
284 memset(&status, 0,
sizeof(status));
339 DOCA_LOG_INFO(
"===================================================");
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 doca_error_t add_rss_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
DOCA_LOG_REGISTER(FLOW_MARK_SET)
static doca_error_t add_match_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status, struct mark_set_config *app_cfg)
static doca_error_t create_rss_pipe(struct doca_flow_port *port, struct doca_flow_pipe **pipe)
doca_error_t flow_mark_set(int nb_queues, struct mark_set_config *app_cfg)
static doca_error_t create_match_pipe(struct doca_flow_port *port, struct doca_flow_pipe **pipe, struct doca_flow_pipe *fwd_pipe, struct mark_set_config *app_cfg)
static void handle_rx_tx_pkts(uint32_t port_id, uint16_t nb_queues)
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
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
#define DEFAULT_TIMEOUT_US
static struct app_gpu_cfg app_cfg
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_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_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_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_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 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_meta meta
struct doca_flow_pipe * next_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
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]