[4/5] regex/mlx5: add timestamp format support

Message ID 20210307100251.22538-5-viacheslavo@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series mlx5: add timestamp format support |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Slava Ovsiienko March 7, 2021, 10:02 a.m. UTC
  This patch adds support for the timestamp format settings for
the receive and send queues. If the firmware version x.30.256
or above is installed and the NIC timestamps are configured
with the real-time format, the default zero values for new
added values cause the queue creation reject. The patch
queries the timestamp formats supported by the
hardware and sets the configuration values in queue context
accordingly.

Fixes: 92f2c6a30fe0 ("regex/mlx5: add send queue")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/regex/mlx5/mlx5_regex.c         | 1 +
 drivers/regex/mlx5/mlx5_regex.h         | 1 +
 drivers/regex/mlx5/mlx5_regex_control.c | 4 ++++
 3 files changed, 6 insertions(+)
  

Comments

Matan Azrad March 11, 2021, 7:56 p.m. UTC | #1
From: Viacheslav Ovsiienko
> This patch adds support for the timestamp format settings for the receive and
> send queues. If the firmware version x.30.256 or above is installed and the NIC
> timestamps are configured with the real-time format, the default zero values
> for new added values cause the queue creation reject. The patch queries the
> timestamp formats supported by the hardware and sets the configuration
> values in queue context accordingly.
> 
> Fixes: 92f2c6a30fe0 ("regex/mlx5: add send queue")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
  

Patch

diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index f1fd911405..ac5b205fa9 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -160,6 +160,7 @@  mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		rte_errno = ENOMEM;
 		goto dev_error;
 	}
+	priv->sq_ts_format = attr.sq_ts_format;
 	priv->ctx = ctx;
 	priv->nb_engines = 2; /* attr.regexp_num_of_engines */
 	ret = mlx5_devx_regex_register_read(priv->ctx, 0,
diff --git a/drivers/regex/mlx5/mlx5_regex.h b/drivers/regex/mlx5/mlx5_regex.h
index 484819c38c..a2b3f0d9f3 100644
--- a/drivers/regex/mlx5/mlx5_regex.h
+++ b/drivers/regex/mlx5/mlx5_regex.h
@@ -70,6 +70,7 @@  struct mlx5_regex_priv {
 	struct ibv_pd *pd;
 	struct mlx5_mr_share_cache mr_scache; /* Global shared MR cache. */
 	uint8_t is_bf2; /* The device is BF2 device. */
+	uint8_t sq_ts_format; /* Whether SQ supports timestamp formats. */
 };
 
 /* mlx5_regex.c */
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index df57fada5d..fec0c91886 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -158,6 +158,10 @@  regex_ctrl_create_sq(struct mlx5_regex_priv *priv, struct mlx5_regex_qp *qp,
 		.wq_attr = (struct mlx5_devx_wq_attr){
 			.uar_page = priv->uar->page_id,
 		},
+		.ts_format = priv->sq_ts_format ==
+			MLX5_HCA_CAP_TIMESTAMP_FORMAT_FR ?
+				MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING :
+				MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT,
 	};
 	struct mlx5_devx_modify_sq_attr modify_attr = {
 		.state = MLX5_SQC_STATE_RDY,