Hello
I’m trying to use ‘shared mirror’ function to copy ingress packet through port 0 to pipe.
When I set mirror_cfg.target.fwd.type DOCA_FLOW_FWD_PORT, it works well.
But if i change fwd target to pipe, segmentation fault occurs during doca_flow_shared_resources_bind()
and no error message printed.
I use ‘vnf, isolated,hws’ mode and there is no problem on test_pipe implementation(without shared mirror, it works well).
Is there any recommendation or examples I refer to?
Here is my code.
...
// create test_pipe and add entries code
...
mirror_cfg.nr_targets = 1;
target.fwd.type = DOCA_FLOW_FWD_PIPE;
target.fwd.next_pipe = test_pipe;
//target.fwd.type = DOCA_FLOW_FWD_PORT;
//target.fwd.port_id = 1;
mirror_cfg.target = ⌖
cfg.mirror_cfg = mirror_cfg;
result = doca_flow_shared_resource_set_cfg(DOCA_FLOW_SHARED_RESOURCE_MIRROR, shared_mirror_ids[0], &cfg);
if (result != DOCA_SUCCESS) {
DOCA_LOG_ERR("Failed to cfg shared mirror");
stop_doca_flow_ports(nb_ports, ports);
doca_flow_destroy();
return result;
}
/* bind shared mirror to port */
result = doca_flow_shared_resources_bind(DOCA_FLOW_SHARED_RESOURCE_MIRROR, shared_mirror_ids, 1, ports[port_id]);
if (result != DOCA_SUCCESS) {
DOCA_LOG_ERR("Failed to bind shared mirror to port");
stop_doca_flow_ports(nb_ports, ports);
doca_flow_destroy();
return result;
}
/* create mirror pipe & add entry */
memset(&fwd, 0, sizeof(fwd));
fwd.type = DOCA_FLOW_FWD_PIPE;
fwd.next_pipe = icmp_pipe;
result = create_shared_mirror_pipe(ports[0], DOCA_FLOW_L4_TYPE_EXT_UDP, &fwd, true, UINT32_MAX, &mirror_pipe);
if (result != DOCA_SUCCESS) {
DOCA_LOG_ERR("Failed to create pipe: %s", doca_error_get_descr(result));
stop_doca_flow_ports(nb_ports, ports);
doca_flow_destroy();
return result;
}
result = add_shared_mirror_pipe_entry(mirror_pipe,
DOCA_FLOW_L4_TYPE_EXT_UDP,
NULL,
true,
shared_mirror_ids[0],
&status);
if (result != DOCA_SUCCESS) {
DOCA_LOG_ERR("Failed to add entry: %s", doca_error_get_descr(result));
stop_doca_flow_ports(nb_ports, ports);
doca_flow_destroy();
return result;
}
}