Skip to contentSkip to conversation

net/mlx5/hws: fix timestamp format on Tx queue creation

PATCH Superseded Viacheslav Ovsiienko 2 participants 3 messages Nov 8, 2022 – Nov 9, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5/hws: fix timestamp format on Tx queue creation

The NIC since 6DX supports multiple timestamp formats in CQEs configured via firmware. If real time timestamp format has been configured the correct attributes should be specified on queue creation via DevX. These attributes setting was missed on steering queue creation and hardware steering initialization failed.

Fixes 3eb748869d2d ("net/mlx5/hws: add send layer")
---
 drivers/net/mlx5/hws/mlx5dr_cmd.c  | 7 +++++++
 drivers/net/mlx5/hws/mlx5dr_cmd.h  | 3 +++
 drivers/net/mlx5/hws/mlx5dr_send.c | 3 +++
 3 files changed, 13 insertions(+)
drivers/net/mlx5/hws/mlx5dr_cmd.c +7 -0
index da8cc3d265..ae6637475c 100644
@@ -674,6 +674,7 @@ mlx5dr_cmd_sq_create(struct ibv_context *ctx,
 	MLX5_SET(sqc, sqc, cqn, attr->cqn);
 	MLX5_SET(sqc, sqc, flush_in_error_en, 1);
 	MLX5_SET(sqc, sqc, non_wire, 1);
+	MLX5_SET(sqc, sqc, ts_format, attr->ts_format);
 	MLX5_SET(wq, wqc, wq_type, MLX5_WQ_TYPE_CYCLIC);
 	MLX5_SET(wq, wqc, pd, attr->pdn);
 	MLX5_SET(wq, wqc, uar_page, attr->page_id);
@@ -682,6 +683,7 @@ mlx5dr_cmd_sq_create(struct ibv_context *ctx,
 	MLX5_SET(wq, wqc, dbr_umem_id, attr->dbr_id);
 	MLX5_SET(wq, wqc, wq_umem_id, attr->wq_id);
 
+
 	devx_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out, sizeof(out));
 	if (!devx_obj->obj) {
 		simple_free(devx_obj);
@@ -763,6 +765,11 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
 		MLX5_GET64(query_hca_cap_out, out,
 			   capability.cmd_hca_cap.match_definer_format_supported);
 
+	caps->rq_ts_format = MLX5_GET(query_hca_cap_out, out,
+				      capability.cmd_hca_cap.rq_ts_format);
+	caps->sq_ts_format = MLX5_GET(query_hca_cap_out, out,
+				      capability.cmd_hca_cap.sq_ts_format);
+
 	MLX5_SET(query_hca_cap_in, in, op_mod,
 		 MLX5_GET_HCA_CAP_OP_MOD_GENERAL_DEVICE_2 |
 		 MLX5_HCA_CAP_OPMOD_GET_CUR);
drivers/net/mlx5/hws/mlx5dr_cmd.h +3 -0
index 2548b2b238..d29ed55adc 100644
@@ -121,6 +121,7 @@ struct mlx5dr_cmd_sq_create_attr {
 	uint32_t dbr_id;
 	uint32_t wq_id;
 	uint32_t log_wq_sz;
+	uint32_t ts_format;
 };
 
 struct mlx5dr_cmd_query_ft_caps {
@@ -161,6 +162,8 @@ struct mlx5dr_cmd_query_caps {
 	uint8_t log_header_modify_argument_max_alloc;
 	uint64_t definer_format_sup;
 	uint32_t trivial_match_definer;
+	uint8_t rq_ts_format;
+	uint8_t sq_ts_format;
 	char fw_ver[64];
 };
 
drivers/net/mlx5/hws/mlx5dr_send.c +3 -0
index 1e9953a38f..06d4a7e5c5 100644
@@ -492,6 +492,9 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,
 	attr.dbr_id = sq->db_umem->umem_id;
 	attr.wq_id = sq->buf_umem->umem_id;
 	attr.log_wq_sz = log_wq_sz;
+	attr.ts_format = (ctx->caps->sq_ts_format == MLX5_HCA_CAP_TIMESTAMP_FORMAT_FR) ?
+			 MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING :
+			 MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT;
 
 	sq->obj = mlx5dr_cmd_sq_create(ctx->ibv_ctx, &attr);
 	if (!sq->obj)
Signature · 1 line
2.18.1
#1 lore raw

PATCH v2 1/1 net/mlx5/hws: fix timestamp format on Tx queue creation

The NIC since 6DX supports multiple timestamp formats in CQEs configured via firmware. If real time timestamp format has been configured the correct attributes should be specified on queue creation via DevX. These attributes setting was missed on steering queue creation and hardware steering initialization failed.

Fixes 3eb748869d2d ("net/mlx5/hws: add send layer")
---
 drivers/net/mlx5/hws/mlx5dr_cmd.c  | 4 ++++
 drivers/net/mlx5/hws/mlx5dr_cmd.h  | 2 ++
 drivers/net/mlx5/hws/mlx5dr_send.c | 4 ++++
 3 files changed, 10 insertions(+)

v1:
- http://patches.dpdk.org/project/dpdk/patch/[email protected]/
v2:
- minor style changes
- removed unnessesary variables

drivers/net/mlx5/hws/mlx5dr_cmd.c +4 -0
index da8cc3d265..721376b8da 100644
@@ -674,6 +674,7 @@ mlx5dr_cmd_sq_create(struct ibv_context *ctx,
 	MLX5_SET(sqc, sqc, cqn, attr->cqn);
 	MLX5_SET(sqc, sqc, flush_in_error_en, 1);
 	MLX5_SET(sqc, sqc, non_wire, 1);
+	MLX5_SET(sqc, sqc, ts_format, attr->ts_format);
 	MLX5_SET(wq, wqc, wq_type, MLX5_WQ_TYPE_CYCLIC);
 	MLX5_SET(wq, wqc, pd, attr->pdn);
 	MLX5_SET(wq, wqc, uar_page, attr->page_id);
@@ -763,6 +764,9 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
 		MLX5_GET64(query_hca_cap_out, out,
 			   capability.cmd_hca_cap.match_definer_format_supported);
 
+	caps->sq_ts_format = MLX5_GET(query_hca_cap_out, out,
+				      capability.cmd_hca_cap.sq_ts_format);
+
 	MLX5_SET(query_hca_cap_in, in, op_mod,
 		 MLX5_GET_HCA_CAP_OP_MOD_GENERAL_DEVICE_2 |
 		 MLX5_HCA_CAP_OPMOD_GET_CUR);
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
index 2548b2b238..2b3b47f473 100644
@@ -121,6 +121,7 @@ struct mlx5dr_cmd_sq_create_attr {
 	uint32_t dbr_id;
 	uint32_t wq_id;
 	uint32_t log_wq_sz;
+	uint32_t ts_format;
 };
 
 struct mlx5dr_cmd_query_ft_caps {
@@ -159,6 +160,7 @@ struct mlx5dr_cmd_query_caps {
 	uint32_t eswitch_manager_vport_number;
 	uint8_t log_header_modify_argument_granularity;
 	uint8_t log_header_modify_argument_max_alloc;
+	uint8_t sq_ts_format;
 	uint64_t definer_format_sup;
 	uint32_t trivial_match_definer;
 	char fw_ver[64];
drivers/net/mlx5/hws/mlx5dr_send.c +4 -0
index 1e9953a38f..5c8bbe6fc6 100644
@@ -492,6 +492,10 @@ static int mlx5dr_send_ring_create_sq_obj(struct mlx5dr_context *ctx,
 	attr.dbr_id = sq->db_umem->umem_id;
 	attr.wq_id = sq->buf_umem->umem_id;
 	attr.log_wq_sz = log_wq_sz;
+	if (ctx->caps->sq_ts_format == MLX5_HCA_CAP_TIMESTAMP_FORMAT_FR)
+		attr.ts_format = MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING;
+	else
+		attr.ts_format = MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT;
 
 	sq->obj = mlx5dr_cmd_sq_create(ctx->ibv_ctx, &attr);
 	if (!sq->obj)
Signature · 1 line
2.18.1
#2 lore raw

Hi,

Quoted 25 lines

-----Original Message-----
From: Slava Ovsiienko <[email protected]>
Sent: Wednesday, November 9, 2022 9:58 AM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Alex Vesker <[email protected]>
Subject: [PATCH v2] net/mlx5/hws: fix timestamp format on Tx queue creation

The NIC since 6DX supports multiple timestamp formats in CQEs configured via firmware. If real time timestamp format has been configured the correct attributes should be specified on queue creation via DevX. These attributes setting was missed on steering queue creation and hardware steering initialization failed.

Fixes 3eb748869d2d ("net/mlx5/hws: add send layer")
---
 drivers/net/mlx5/hws/mlx5dr_cmd.c  | 4 ++++
 drivers/net/mlx5/hws/mlx5dr_cmd.h  | 2 ++
 drivers/net/mlx5/hws/mlx5dr_send.c | 4 ++++
 3 files changed, 10 insertions(+)
Quoted 7 lines

v1:
- http://patches.dpdk.org/project/dpdk/patch/20221108185650.15489-1-
[email protected]/
v2:
- minor style changes
- removed unnessesary variables

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh