attr->max_geneve_tlv_option_data_len = MLX5_GET(cmd_hca_cap, hcattr,
max_geneve_tlv_option_data_len);
attr->qos.sup = MLX5_GET(cmd_hca_cap, hcattr, qos);
+ attr->qos.flow_meter_aso_sup = !!(MLX5_GET64(cmd_hca_cap, hcattr,
+ general_obj_types) &
+ MLX5_GENERAL_OBJ_TYPES_CAP_FLOW_METER_ASO);
attr->vdpa.valid = !!(MLX5_GET64(cmd_hca_cap, hcattr,
general_obj_types) &
MLX5_GENERAL_OBJ_TYPES_CAP_VIRTQ_NET_Q);
MLX5_GET(qos_cap, hcattr, packet_pacing);
attr->qos.wqe_rate_pp =
MLX5_GET(qos_cap, hcattr, wqe_rate_pp);
+ if (attr->qos.flow_meter_aso_sup) {
+ attr->qos.log_meter_aso_granularity =
+ MLX5_GET(qos_cap, hcattr,
+ log_meter_aso_granularity);
+ attr->qos.log_meter_aso_max_alloc =
+ MLX5_GET(qos_cap, hcattr,
+ log_meter_aso_max_alloc);
+ attr->qos.log_max_num_meter_aso =
+ MLX5_GET(qos_cap, hcattr,
+ log_max_num_meter_aso);
+ }
}
if (attr->vdpa.valid)
mlx5_devx_cmd_query_hca_vdpa_attr(ctx, &attr->vdpa);
return -ret;
}
+int
+mlx5_devx_cmd_flow_single_dump(void *rule_info __rte_unused,
+ FILE *file __rte_unused)
+{
+ int ret = 0;
+#ifdef HAVE_MLX5_DR_FLOW_DUMP_RULE
+ if (rule_info)
+ ret = mlx5_glue->dr_dump_rule(file, rule_info);
+#else
+ ret = ENOTSUP;
+#endif
+ return -ret;
+}
+
/*
* Create CQ using DevX API.
*
return ppd;
}
+/**
+ * Create general object of type FLOW_METER_ASO using DevX API.
+ *
+ * @param[in] ctx
+ * Context returned from mlx5 open_device() glue function.
+ * @param [in] pd
+ * PD value to associate the FLOW_METER_ASO object with.
+ * @param [in] log_obj_size
+ * log_obj_size define to allocate number of 2 * meters
+ * in one FLOW_METER_ASO object.
+ *
+ * @return
+ * The DevX object created, NULL otherwise and rte_errno is set.
+ */
+struct mlx5_devx_obj *
+mlx5_devx_cmd_create_flow_meter_aso_obj(void *ctx, uint32_t pd,
+ uint32_t log_obj_size)
+{
+ uint32_t in[MLX5_ST_SZ_DW(create_flow_meter_aso_in)] = {0};
+ uint32_t out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)];
+ struct mlx5_devx_obj *flow_meter_aso_obj;
+ void *ptr;
+
+ flow_meter_aso_obj = mlx5_malloc(MLX5_MEM_ZERO,
+ sizeof(*flow_meter_aso_obj),
+ 0, SOCKET_ID_ANY);
+ if (!flow_meter_aso_obj) {
+ DRV_LOG(ERR, "Failed to allocate FLOW_METER_ASO object data");
+ rte_errno = ENOMEM;
+ return NULL;
+ }
+ ptr = MLX5_ADDR_OF(create_flow_meter_aso_in, in, hdr);
+ MLX5_SET(general_obj_in_cmd_hdr, ptr, opcode,
+ MLX5_CMD_OP_CREATE_GENERAL_OBJECT);
+ MLX5_SET(general_obj_in_cmd_hdr, ptr, obj_type,
+ MLX5_GENERAL_OBJ_TYPE_FLOW_METER_ASO);
+ MLX5_SET(general_obj_in_cmd_hdr, ptr, log_obj_range,
+ log_obj_size);
+ ptr = MLX5_ADDR_OF(create_flow_meter_aso_in, in, flow_meter_aso);
+ MLX5_SET(flow_meter_aso, ptr, access_pd, pd);
+ flow_meter_aso_obj->obj = mlx5_glue->devx_obj_create(
+ ctx, in, sizeof(in),
+ out, sizeof(out));
+ if (!flow_meter_aso_obj->obj) {
+ rte_errno = errno;
+ DRV_LOG(ERR, "Failed to create FLOW_METER_ASO obj using DevX.");
+ mlx5_free(flow_meter_aso_obj);
+ return NULL;
+ }
+ flow_meter_aso_obj->id = MLX5_GET(general_obj_out_cmd_hdr,
+ out, obj_id);
+ return flow_meter_aso_obj;
+}
+
/**
* Create general object of type GENEVE TLV option using DevX API.
*