@@ -605,6 +605,62 @@ mlx5_devx_cmd_query_hca_vdpa_attr(void *ctx,
}
}
+/**
+ * Query match sample handle parameters.
+ *
+ * This command allows translating a field sample handle returned by either
+ * PARSE_GRAPH_FLOW_MATCH_SAMPLE or by GENEVE TLV OPTION object into values
+ * used for header modification or header matching/hashing.
+ *
+ * @param[in] ctx
+ * Context used to create either GENEVE TLV option or FLEX PARSE GRAPH object.
+ * @param[in] sample_field_id
+ * Field sample handle returned by either PARSE_GRAPH_FLOW_MATCH_SAMPLE
+ * or by GENEVE TLV OPTION object.
+ * @param[out] attr
+ * Pointer to match sample info attributes structure.
+ *
+ * @return
+ * 0 on success, a negative errno otherwise and rte_errno is set.
+ */
+int
+mlx5_devx_cmd_match_sample_info_query(void *ctx, uint32_t sample_field_id,
+ struct mlx5_devx_match_sample_info_query_attr *attr)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ uint32_t out[MLX5_ST_SZ_DW(query_match_sample_info_out)] = {0};
+ uint32_t in[MLX5_ST_SZ_DW(query_match_sample_info_in)] = {0};
+ int rc;
+
+ MLX5_SET(query_match_sample_info_in, in, opcode,
+ MLX5_CMD_OP_QUERY_MATCH_SAMPLE_INFO);
+ MLX5_SET(query_match_sample_info_in, in, op_mod, 0);
+ MLX5_SET(query_match_sample_info_in, in, sample_field_id,
+ sample_field_id);
+ rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
+ if (rc) {
+ DRV_LOG(ERR, "Failed to query match sample info using DevX: %s",
+ strerror(rc));
+ rte_errno = rc;
+ return -rc;
+ }
+ attr->modify_field_id = MLX5_GET(query_match_sample_info_out, out,
+ modify_field_id);
+ attr->sample_dw_data = MLX5_GET(query_match_sample_info_out, out,
+ field_format_select_dw);
+ attr->sample_dw_ok_bit = MLX5_GET(query_match_sample_info_out, out,
+ ok_bit_format_select_dw);
+ attr->sample_dw_ok_bit_offset = MLX5_GET(query_match_sample_info_out,
+ out, ok_bit_offset);
+ return 0;
+#else
+ (void)ctx;
+ (void)sample_field_id;
+ (void)attr;
+ return -ENOTSUP;
+#endif
+}
+
int
mlx5_devx_cmd_query_parse_samples(struct mlx5_devx_obj *flex_obj,
struct mlx5_ext_sample_id *ids,
@@ -1029,6 +1085,8 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
alloc_flow_counter_pd);
attr->flow_counter_access_aso = MLX5_GET(cmd_hca_cap, hcattr,
flow_counter_access_aso);
+ attr->query_match_sample_info = MLX5_GET(cmd_hca_cap, hcattr,
+ query_match_sample_info);
attr->flow_access_aso_opc_mod = MLX5_GET(cmd_hca_cap, hcattr,
flow_access_aso_opc_mod);
if (attr->crypto) {
@@ -296,6 +296,7 @@ struct mlx5_hca_attr {
uint32_t flow_counter_bulk_log_granularity:5;
uint32_t alloc_flow_counter_pd:1;
uint32_t flow_counter_access_aso:1;
+ uint32_t query_match_sample_info:1;
uint32_t flow_access_aso_opc_mod:8;
uint32_t cross_vhca:1;
uint32_t lag_rx_port_affinity:1;
@@ -523,7 +524,6 @@ struct mlx5_devx_virtq_attr {
uint8_t q_type;
};
-
struct mlx5_devx_qp_attr {
uint32_t pd:24;
uint32_t uar_index:24;
@@ -551,6 +551,18 @@ struct mlx5_devx_virtio_q_couners_attr {
uint32_t invalid_buffer;
};
+/*
+ * Match sample info attributes structure, used by:
+ * - GENEVE TLV option query.
+ * - Graph flow match sample query.
+ */
+struct mlx5_devx_match_sample_info_query_attr {
+ uint32_t modify_field_id:12;
+ uint32_t sample_dw_data:8;
+ uint32_t sample_dw_ok_bit:8;
+ uint32_t sample_dw_ok_bit_offset:5;
+};
+
/*
* graph flow match sample attributes structure,
* used by flex parser operations.
@@ -717,6 +729,9 @@ __rte_internal
int mlx5_devx_cmd_modify_tir(struct mlx5_devx_obj *tir,
struct mlx5_devx_modify_tir_attr *tir_attr);
__rte_internal
+int mlx5_devx_cmd_match_sample_info_query(void *ctx, uint32_t sample_field_id,
+ struct mlx5_devx_match_sample_info_query_attr *attr);
+__rte_internal
int mlx5_devx_cmd_query_parse_samples(struct mlx5_devx_obj *flex_obj,
struct mlx5_ext_sample_id ids[],
uint32_t num, uint8_t *anchor);
@@ -823,4 +838,5 @@ __rte_internal
int
mlx5_devx_cmd_query_lag(void *ctx,
struct mlx5_devx_lag_context *lag_ctx);
+
#endif /* RTE_PMD_MLX5_DEVX_CMDS_H_ */
@@ -1169,6 +1169,7 @@ enum {
MLX5_CMD_SET_REGEX_REGISTERS = 0xb06,
MLX5_CMD_QUERY_REGEX_REGISTERS = 0xb07,
MLX5_CMD_OP_ACCESS_REGISTER_USER = 0xb0c,
+ MLX5_CMD_OP_QUERY_MATCH_SAMPLE_INFO = 0xb13,
MLX5_CMD_OP_ALLOW_OTHER_VHCA_ACCESS = 0xb16,
MLX5_CMD_OP_GENERATE_WQE = 0xb17,
};
@@ -1258,6 +1259,31 @@ struct mlx5_ifc_query_flow_counter_in_bits {
u8 flow_counter_id[0x20];
};
+struct mlx5_ifc_query_match_sample_info_out_bits {
+ u8 status[0x8];
+ u8 reserved_at_8[0x18];
+ u8 syndrome[0x20];
+ u8 reserved_at_40[0x40];
+ u8 reserved_at_80[0x4];
+ u8 modify_field_id[0xc];
+ u8 ok_bit_format_select_dw[0x8];
+ u8 field_format_select_dw[0x8];
+ u8 reserved_at_a0[0x3];
+ u8 ok_bit_offset[0x5];
+ u8 reserved_at_a8[0x18];
+ u8 reserved_at_c0[0x40];
+};
+
+struct mlx5_ifc_query_match_sample_info_in_bits {
+ u8 opcode[0x10];
+ u8 uid[0x10];
+ u8 reserved_at_20[0x10];
+ u8 op_mod[0x10];
+ u8 reserved_at_40[0x60];
+ u8 sample_field_id[0x20];
+ u8 reserved_at_c0[0x140];
+};
+
#define MLX5_MAX_KLM_BYTE_COUNT 0x80000000u
#define MLX5_MIN_KLM_FIXED_BUFFER_SIZE 0x1000u
@@ -1442,7 +1468,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
u8 access_other_hca_roce[0x1];
u8 alloc_flow_counter_pd[0x1];
u8 flow_counter_access_aso[0x1];
- u8 reserved_at_3[0x5];
+ u8 query_match_sample_info[0x1];
+ u8 reserved_at_4[0x4];
u8 flow_access_aso_opc_mod[0x8];
u8 reserved_at_10[0xf];
u8 vhca_resource_manager[0x1];
@@ -45,6 +45,7 @@ INTERNAL {
mlx5_devx_cmd_flow_counter_query;
mlx5_devx_cmd_flow_dump;
mlx5_devx_cmd_flow_single_dump;
+ mlx5_devx_cmd_match_sample_info_query;
mlx5_devx_cmd_mkey_create;
mlx5_devx_cmd_modify_qp_state;
mlx5_devx_cmd_modify_rq;