Hi folks,
I would like to use BASIC pipe & action functionality to add a marker per entry.
it works in follow configuration and I see the marker (0xAA55) in packet.hash.fdir.hi field.
init_foo_pipe() {
doca_error_t result;
const int nb_queues = 4;
struct doca_flow_pipe_cfg pipe_cfg;
struct doca_flow_fwd fwd;
struct doca_flow_match match;
struct doca_flow_actions actions;
struct doca_flow_actions *actions_array[1];
struct flow_entries_status flow_status;
uint16_t rss_queues[nb_queues];
struct doca_flow_pipe_entry *entry;
const uint32_t num_of_entries = 1;
memset(&pipe_cfg, 0, sizeof(pipe_cfg));
memset(&fwd, 0, sizeof(fwd));
memset(&match, 0, sizeof(match));
memset(&actions, 0, sizeof(actions));
memset(&flow_status, 0, sizeof(flow_status));
pipe_cfg.attr.name = "FOO";
pipe_cfg.attr.type = DOCA_FLOW_PIPE_BASIC;
pipe_cfg.attr.nb_flows = num_of_entries;
pipe_cfg.attr.is_root = true;
pipe_cfg.match = &match;
pipe_cfg.port = port;
actions_array[0] = &actions;
pipe_cfg.actions = actions_array;
pipe_cfg.attr.nb_actions = 1;
actions.meta.mark = 0xAA55;
match.outer.l3_type = DOCA_FLOW_L3_TYPE_IP4;
match.outer.l4_type_ext = DOCA_FLOW_L4_TYPE_EXT_UDP;
match.outer.udp.l4_port.dst_port = rte_cpu_to_be_16(DNS_PORT);
for (int queue_index = 0; queue_index < nb_queues; queue_index++)
rss_queues[queue_index] = queue_index;
fwd.type = DOCA_FLOW_FWD_RSS;
fwd.rss_queues = rss_queues;
fwd.rss_outer_flags = DOCA_FLOW_RSS_IPV4 | DOCA_FLOW_RSS_UDP;
fwd.num_of_queues = nb_queues;
fwd_miss.type = DOCA_FLOW_FWD_PIPE;
fwd_miss.next_pipe = next_pipe;
result = doca_flow_pipe_create(&pipe_cfg, &fwd, &fwd_miss, pipe);
if (result != DOCA_SUCCESS) {
DOCA_LOG_ERR("failed: %s", doca_get_error_string(result));
return result;
}
result = doca_flow_pipe_add_entry(0, *pipe, &match, &actions, NULL,
&fwd, DOCA_FLOW_NO_WAIT, (void *) &flow_status, NULL);
if (result != DOCA_SUCCESS) {
DOCA_LOG_ERR("failed: %s", doca_get_error_string(result));
return result;
}
}
But If I want to use the action functionality per entry it does not work.
init_action_per_entry_pipe() {
doca_error_t result;
const int nb_queues = app_cfg->dpdk_cfg->port_config.nb_queues;
struct doca_flow_pipe_cfg pipe_cfg;
struct doca_flow_fwd fwd;
struct doca_flow_match match;
struct doca_flow_actions actions;
struct doca_flow_actions *actions_array[1];
struct flow_entries_status flow_status;
uint16_t rss_queues[nb_queues];
struct doca_flow_pipe_entry *entry;
const uint32_t num_of_entries = 1;
memset(&pipe_cfg, 0, sizeof(pipe_cfg));
memset(&fwd, 0, sizeof(fwd));
memset(&match, 0, sizeof(match));
memset(&actions, 0, sizeof(actions));
memset(&flow_status, 0, sizeof(flow_status));
pipe_cfg.attr.name = "FOO";
pipe_cfg.attr.type = DOCA_FLOW_PIPE_BASIC;
pipe_cfg.attr.nb_flows = num_of_entries;
pipe_cfg.attr.is_root = true;
pipe_cfg.match = &match;
pipe_cfg.port = port;
actions_array[0] = &actions;
pipe_cfg.actions = actions_array;
pipe_cfg.attr.nb_actions = 1;
fwd_miss.type = DOCA_FLOW_FWD_PIPE;
fwd_miss.next_pipe = next_pipe;
result = doca_flow_pipe_create(&pipe_cfg, NULL, &fwd_miss, pipe);
if (result != DOCA_SUCCESS) {
DOCA_LOG_ERR("failed: %s", doca_get_error_string(result));
return result;
}
actions.meta.mark = 0xAA55;
match.outer.l3_type = DOCA_FLOW_L3_TYPE_IP4;
match.outer.l4_type_ext = DOCA_FLOW_L4_TYPE_EXT_UDP;
match.outer.udp.l4_port.dst_port = rte_cpu_to_be_16(DNS_PORT);
for (int queue_index = 0; queue_index < nb_queues; queue_index++)
rss_queues[queue_index] = queue_index;
fwd.type = DOCA_FLOW_FWD_RSS;
fwd.rss_queues = rss_queues;
fwd.rss_outer_flags = DOCA_FLOW_RSS_IPV4 | DOCA_FLOW_RSS_UDP;
fwd.num_of_queues = nb_queues;
result = doca_flow_pipe_add_entry(0, *pipe, &match, &actions, NULL,
&fwd, DOCA_FLOW_NO_WAIT, (void *) &flow_status, NULL);
if (result != DOCA_SUCCESS) {
DOCA_LOG_ERR("failed: %s", doca_get_error_string(result));
return result;
}
}
Is it incorrect configuration?
Can someone share the working configuration or specify where the configuration error is?
Thanks in advance