Run flow_match_comparison sample error in Bluefield2

I encountered an error while running flow_match_comparison in the doca flow sample, and the error message is as follows:

root@localhost:/opt/mellanox/doca/samples/doca_flow/flow_match_comparison# sudo ./build/doca_my_tutorial  -a 03:00.0,dv_flow_en=2 -a 03:00.1,dv_flow_en=2 
sudo: ./build/doca_my_tutorial: command not found
root@localhost:/opt/mellanox/doca/samples/doca_flow/flow_match_comparison# sudo ./build/doca_flow_match_comparison   -a 03:00.0,dv_flow_e
n=2 -a 03:00.1,dv_flow_en=2 
[08:00:16:974890][2057470][DOCA][INF][flow_match_comparison_main.c:70][main] Starting the sample
EAL: Detected CPU lcores: 8
EAL: Detected NUMA nodes: 1
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probe PCI driver: mlx5_pci (15b3:a2d6) device: 0000:03:00.0 (socket -1)
EAL: Probe PCI driver: mlx5_pci (15b3:a2d6) device: 0000:03:00.1 (socket -1)
TELEMETRY: No legacy callbacks, legacy socket not created
[08:00:19:231982][2057470][DOCA][WRN][engine_model.c:92][adapt_queue_depth] adapting queue depth to 128.
mlx5_net: [mlx5dr_definer_conv_items_to_hl]: Compare matcher not supported for more than one item
mlx5_net: [mlx5dr_definer_calc_layout]: Failed to convert items to header layout
mlx5_net: [mlx5dr_definer_matcher_init]: Failed to calculate matcher definer layout
mlx5_net: [mlx5dr_matcher_bind_mt]: Failed to set matcher templates with match definers
mlx5_net: [mlx5dr_matcher_create]: Failed to initialise matcher: 95
[08:00:22:049361][2057470][DOCA][ERR][hws_matcher.c:534][template_items_get_template] failed pattern template create on port 0 (type 1: failed to validate pattern template)
[08:00:22:049400][2057470][DOCA][ERR][hws_matcher.c:1643][hws_matcher_create] failed to create items_template for port 0
[08:00:22:049420][2057470][DOCA][CRT][dpdk_pipe_control.c:661][pipe_control_queue_modify] failed modifying control queue 0 - pipe's matcher create failed
[08:00:22:049441][2057470][DOCA][ERR][dpdk_pipe_legacy.c:452][add_entry] failed to create entry - modify, rc=-22
[08:00:22:049458][2057470][DOCA][ERR][engine_pipe.c:1260][engine_pipe_entry_add] failed adding entry - driver entry creation failed
[08:00:22:049477][2057470][DOCA][ERR][doca_flow.c:1472][doca_flow_pipe_control_add_entry] pipe entry add failed, rc = -22
[08:00:22:049497][2057470][DOCA][ERR][flow_match_comparison_sample.c:398][flow_match_comparison] Failed to add comparison entry: Invalid input
[08:00:22:104189][2057470][DOCA][ERR][flow_match_comparison_main.c:94][main] flow_match_comparison() encountered an error: Invalid input
[08:00:22:930151][2057470][DOCA][INF][flow_match_comparison_main.c:110][main] Sample finished with errors

I don’t know why, is it because bluefeild2 doesn’t support this sample? By the way, I’m using DOCA 2.9.0 in bluefeild2

The match compare code is written like this in this sample:

static doca_error_t add_match_comparison_pipe_entry(struct doca_flow_pipe *pipe,
						    struct doca_flow_pipe *next_pipe,
						    struct entries_status *status)
{
	struct doca_flow_match_condition condition;
	struct doca_flow_fwd fwd;
	doca_error_t result;

	memset(&condition, 0, sizeof(condition));

	condition.operation = DOCA_FLOW_COMPARE_GT;
	condition.field_op.a.field_string = "meta.data";
	condition.field_op.a.bit_offset = META_U32_BIT_OFFSET(1);
	condition.field_op.b.field_string = "meta.data";
	condition.field_op.b.bit_offset = META_U32_BIT_OFFSET(0);
	condition.field_op.width = 32;

	fwd.type = DOCA_FLOW_FWD_PIPE;
	fwd.next_pipe = next_pipe;

	result = doca_flow_pipe_control_add_entry(0,
						  0,
						  pipe,
						  NULL,
						  NULL,
						  &condition,
						  NULL,
						  NULL,
						  NULL,
						  NULL,
						  &fwd,
						  status,
						  NULL);
	if (result != DOCA_SUCCESS)
		return result;

	return DOCA_SUCCESS;
}

Hi,

Thanks for your question.
This code is designed to run on SFs (subfunctions), and not on PFs (physical functions).

How to configure subfunctions:
https://docs.nvidia.com/doca/sdk/nvidia+bluefield+dpu+scalable+function+user+guide/index.html#

For example:
/build/doca_flow_match_comparison -a auxiliary:mlx5_core.sf.3,dv_flow_en=2 -a auxiliary:mlx5_core.sf.4,dv_flow_en=2
[15:59:35:419992][2857993][DOCA][INF][flow_match_comparison_main.c:70][main] Starting the sample
EAL: Detected CPU lcores: 16
EAL: Detected NUMA nodes: 1
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode ‘VA’
TELEMETRY: No legacy callbacks, legacy socket not created

[15:59:37:906971][2857993][DOCA][WRN][engine_model.c:92][adapt_queue_depth] adapting queue depth to 128.
[15:59:40:893383][2857993][DOCA][INF][flow_match_comparison_sample.c:437][flow_match_comparison] Wait few seconds for packets to arrive
[15:59:46:468726][2857993][DOCA][INF][flow_match_comparison_main.c:108][main] Sample finished successfully

Best Regards,
Anatoly