Doca shared mirror to pipe problem

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;
		}
	}

  1. According to NVIDIA DOCA Flow documentation: DOCA Flow - NVIDIA Docs
    When using shared mirror resources with a pipe as the target, there are specific requirements:
  • “Mirror clone destination as next_pipe cannot be intermixed with port or rss types. Only clone destination and origin destination both as next_pipe is supported.”
  • “Mirror should be cloned to DOCA_FLOW_DIRECTION_BIDIRECTIONAL pipe”
  1. The pipe target must be created and fully initialized before being referenced in the mirror configuration.

Try modifying your code to ensure the pipe is properly set up before binding the shared mirror resource, and that all pipes involved use the same domain direction.

Regards,
Chen

Thank you for your reply.
I confirmed that all of your suggestions were reflected, but the segmentation fault still occurs.
I set fwd.type of both mirror_pipe with monitor setting and test_pipe(mirror target) to DOCA_FLOW_FWD_PIPE and also set next_pipe.

By any chance, does suggestion 1 means that the parameter(bind target) of doca_flow_shared_resources_bind() should be pipe?
When calling doca_flow_shared_resources_bind, setting the bind target to pipe rather than port causes an error during execution.

If I set the bind destination to port when calling the doca_flow_share_resources_bind() function as it was, segmentation failure still occurs,
To determine the cause, we compiled the dynamic library by changing it to /opt/mellanox/doca/lib/aarch64-linux-gnu/trace/libdoca_flow_trace.so.2, and added the --sdk-log-level 70 option to run it; no trace and debug messages are output regarding the bind function.

Is there an additional way to debug it?