Skip to contentSkip to conversation

net/mlx5: fix imissed statistic

PATCH In review Matan Azrad 3 participants 10 messages Feb 25, 2021 – Mar 3, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/mlx5: fix imissed statistic

The imissed port statistic counts packets that were dropped by the device Rx queues.

In mlx5, the imissed counter summarizes 2 counters:
- packets dropped by the SW queue handling counted by SW.
- packets dropped by the HW queues due to "out of buffer" events detected when no SW buffer is available for the incoming packets.

There is HW counter object that should be created per device, and all the Rx queues should be assigned to this counter in configuration time.

This part was missed when the Rx queues were created by DevX what remained the "out of buffer" counter clean forever in this case.

Add 2 options to assign the DevX Rx queues to queue counter:
- Create queue counter per device by DevX and assign all the queues to it.
- Query the kernel counter and assign all the queues to it.

Use the first option by default and if it is failed, fallback to the second option.

Matan Azrad (4):
common/mlx5/linux: add glue function to query WQ common/mlx5: add DevX command to query WQ common/mlx5: add DevX commands for queue counters net/mlx5: fix imissed statistics

 drivers/common/mlx5/linux/mlx5_glue.c |  18 ++++++
 drivers/common/mlx5/linux/mlx5_glue.h |   2 +
 drivers/common/mlx5/mlx5_devx_cmds.c  | 100 ++++++++++++++++++++++++++++++++++
 drivers/common/mlx5/mlx5_devx_cmds.h  |   9 +++
 drivers/common/mlx5/mlx5_prm.h        | 100 ++++++++++++++++++++++++++++++++++
 drivers/common/mlx5/version.map       |   5 +-
 drivers/net/mlx5/linux/mlx5_os.c      |  52 ++++++++++++++++++
 drivers/net/mlx5/mlx5.c               |   4 ++
 drivers/net/mlx5/mlx5.h               |   2 +
 drivers/net/mlx5/mlx5_devx.c          |   2 +
 10 files changed, 293 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/4 common/mlx5/linux: add glue function to query WQ

When Rx queue is created by VERBS API ibv_create_wq there is a dedicated rdma-core API to query an information about this WQ(Work Queue).

VERBS WQ querying is needed for PMD cases which combine VERBS objects with DevX objects.

Next feature to use this glue function is the HW queue counters.

---
 drivers/common/mlx5/linux/mlx5_glue.c | 18 ++++++++++++++++++
 drivers/common/mlx5/linux/mlx5_glue.h |  2 ++
 2 files changed, 20 insertions(+)
drivers/common/mlx5/linux/mlx5_glue.c +18 -0
index 8146c79..964f7e7 100644
@@ -1068,6 +1068,23 @@
 }
 
 static int
+mlx5_glue_devx_wq_query(struct ibv_wq *wq, const void *in, size_t inlen,
+			void *out, size_t outlen)
+{
+#ifdef HAVE_IBV_DEVX_QP
+	return mlx5dv_devx_wq_query(wq, in, inlen, out, outlen);
+#else
+	(void)wq;
+	(void)in;
+	(void)inlen;
+	(void)out;
+	(void)outlen;
+	errno = ENOTSUP;
+	return errno;
+#endif
+}
+
+static int
 mlx5_glue_devx_port_query(struct ibv_context *ctx,
 			  uint32_t port_num,
 			  struct mlx5dv_devx_port *mlx5_devx_port)
@@ -1403,6 +1420,7 @@
 	.devx_umem_reg = mlx5_glue_devx_umem_reg,
 	.devx_umem_dereg = mlx5_glue_devx_umem_dereg,
 	.devx_qp_query = mlx5_glue_devx_qp_query,
+	.devx_wq_query = mlx5_glue_devx_wq_query,
 	.devx_port_query = mlx5_glue_devx_port_query,
 	.dr_dump_domain = mlx5_glue_dr_dump_domain,
 	.dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory,
drivers/common/mlx5/linux/mlx5_glue.h +2 -0
index 8be446a..9e385be 100644
@@ -307,6 +307,8 @@ struct mlx5_glue {
 	int (*devx_qp_query)(struct ibv_qp *qp,
 			     const void *in, size_t inlen,
 			     void *out, size_t outlen);
+	int (*devx_wq_query)(struct ibv_wq *wq, const void *in, size_t inlen,
+			     void *out, size_t outlen);
 	int (*devx_port_query)(struct ibv_context *ctx,
 			       uint32_t port_num,
 			       struct mlx5dv_devx_port *mlx5_devx_port);
Signature · 1 line
1.8.3.1
Acked-by on v1 1/4
#2 lore raw

Re: [dpdk-dev] [PATCH 1/4] common/mlx5/linux: add glue function to query WQ

Quoted 10 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Thursday, February 25, 2021 12:45
To: [email protected]
Cc: Slava Ovsiienko <[email protected]>; [email protected]
Subject: [PATCH 1/4] common/mlx5/linux: add glue function to query WQ

When Rx queue is created by VERBS API ibv_create_wq there is a dedicated rdma-core API to query an information about this WQ(Work Queue).

Quoted 8 lines

VERBS WQ querying is needed for PMD cases which combine VERBS objects with DevX objects.

Next feature to use this glue function is the HW queue counters.

#3 lore raw

PATCH 2/4 common/mlx5: add DevX command to query WQ

In reply to Matan Azrad

Add a DevX command to query Rx queues attributes created by VERBS.

Currently support only counter_set_id attribute.

This counter ID is managed by the kernel driver and being assigned to any queue created by the kernel.

---
 drivers/common/mlx5/mlx5_devx_cmds.c | 28 ++++++++++++++++++++++++++++
 drivers/common/mlx5/mlx5_devx_cmds.h |  3 +++
 drivers/common/mlx5/mlx5_prm.h       | 19 +++++++++++++++++++
 drivers/common/mlx5/version.map      |  1 +
 4 files changed, 51 insertions(+)
drivers/common/mlx5/mlx5_devx_cmds.c +28 -0
index 0185d57..2dcc1ff 100644
@@ -2165,3 +2165,31 @@ struct mlx5_devx_obj *
 	return geneve_tlv_opt_obj;
 }
 
+int
+mlx5_devx_cmd_wq_query(void *wq, uint32_t *counter_set_id)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+	uint32_t in[MLX5_ST_SZ_DW(query_rq_in)] = {0};
+	uint32_t out[MLX5_ST_SZ_DW(query_rq_out)] = {0};
+	int rc;
+	void *rq_ctx;
+
+	MLX5_SET(query_rq_in, in, opcode, MLX5_CMD_OP_QUERY_RQ);
+	MLX5_SET(query_rq_in, in, rqn, ((struct ibv_wq *)wq)->wq_num);
+	rc = mlx5_glue->devx_wq_query(wq, in, sizeof(in), out, sizeof(out));
+	if (rc) {
+		rte_errno = errno;
+		DRV_LOG(ERR, "Failed to query WQ counter set ID using DevX - "
+			"rc = %d, errno = %d.", rc, errno);
+		return -rc;
+	};
+	rq_ctx = MLX5_ADDR_OF(query_rq_out, out, rq_context);
+	*counter_set_id = MLX5_GET(rqc, rq_ctx, counter_set_id);
+	return 0;
+#else
+	(void)wq;
+	(void)counter_set_id;
+	return -ENOTSUP;
+#endif
+}
+
drivers/common/mlx5/mlx5_devx_cmds.h +3 -0
index 9dcd917..f01d5a8 100644
@@ -539,4 +539,7 @@ struct mlx5_devx_obj *mlx5_devx_cmd_create_flow_hit_aso_obj(void *ctx,
 
 __rte_internal
 struct mlx5_devx_obj *mlx5_devx_cmd_alloc_pd(void *ctx);
+
+__rte_internal
+int mlx5_devx_cmd_wq_query(void *wq, uint32_t *counter_set_id);
 #endif /* RTE_PMD_MLX5_DEVX_CMDS_H_ */
drivers/common/mlx5/mlx5_prm.h +19 -0
index de721aa..f832715 100644
@@ -911,6 +911,7 @@ enum {
 	MLX5_CMD_OP_MODIFY_SQ = 0X905,
 	MLX5_CMD_OP_CREATE_RQ = 0x908,
 	MLX5_CMD_OP_MODIFY_RQ = 0x909,
+	MLX5_CMD_OP_QUERY_RQ = 0x90b,
 	MLX5_CMD_OP_CREATE_TIS = 0x912,
 	MLX5_CMD_OP_QUERY_TIS = 0x915,
 	MLX5_CMD_OP_CREATE_RQT = 0x916,
@@ -1890,6 +1891,24 @@ struct mlx5_ifc_modify_rq_out_bits {
 	u8 reserved_at_40[0x40];
 };
 
+struct mlx5_ifc_query_rq_out_bits {
+	u8 status[0x8];
+	u8 reserved_at_8[0x18];
+	u8 syndrome[0x20];
+	u8 reserved_at_40[0xc0];
+	struct mlx5_ifc_rqc_bits rq_context;
+};
+
+struct mlx5_ifc_query_rq_in_bits {
+	u8 opcode[0x10];
+	u8 reserved_at_10[0x10];
+	u8 reserved_at_20[0x10];
+	u8 op_mod[0x10];
+	u8 reserved_at_40[0x8];
+	u8 rqn[0x18];
+	u8 reserved_at_60[0x20];
+};
+
 struct mlx5_ifc_create_tis_out_bits {
 	u8 status[0x8];
 	u8 reserved_at_8[0x18];
drivers/common/mlx5/version.map +1 -0
index 244b9c7..edd6c0e 100644
@@ -41,6 +41,7 @@ INTERNAL {
 	mlx5_devx_cmd_query_virtio_q_counters;
 	mlx5_devx_cmd_query_virtq;
 	mlx5_devx_cmd_register_read;
+	mlx5_devx_cmd_wq_query;
 	mlx5_devx_get_out_command_status;
 	mlx5_devx_alloc_uar;
 
Signature · 1 line
1.8.3.1
Acked-by on v1 2/4
#4 lore raw

Re: [dpdk-dev] [PATCH 2/4] common/mlx5: add DevX command to query WQ

Quoted 9 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Thursday, February 25, 2021 12:45
To: [email protected]
Cc: Slava Ovsiienko <[email protected]>; [email protected]
Subject: [PATCH 2/4] common/mlx5: add DevX command to query WQ

Add a DevX command to query Rx queues attributes created by VERBS.

Quoted 8 lines

Currently support only counter_set_id attribute.

This counter ID is managed by the kernel driver and being assigned to any queue created by the kernel.

#5 lore raw

PATCH 3/4 common/mlx5: add DevX commands for queue counters

In reply to Matan Azrad

A queue counter set is an HW object that can be assigned to any RQ\QP and it counts HW events on the assigned QPs\RQs.

Add DevX API to allocate and query queue counter set object.

The only used counter event is the "out of buffer" where the queue drops packets when no SW buffer is available to receive it.

---
 drivers/common/mlx5/mlx5_devx_cmds.c | 72 ++++++++++++++++++++++++++++++++
 drivers/common/mlx5/mlx5_devx_cmds.h |  6 +++
 drivers/common/mlx5/mlx5_prm.h       | 81 ++++++++++++++++++++++++++++++++++++
 drivers/common/mlx5/version.map      |  4 +-
 4 files changed, 162 insertions(+), 1 deletion(-)
drivers/common/mlx5/mlx5_devx_cmds.c +72 -0
index 2dcc1ff..0060c37 100644
@@ -2193,3 +2193,75 @@ struct mlx5_devx_obj *
 #endif
 }
 
+/*
+ * Allocate queue counters via devx interface.
+ *
+ * @param[in] ctx
+ *   Context returned from mlx5 open_device() glue function.
+ *
+ * @return
+ *   Pointer to counter object on success, a NULL value otherwise and
+ *   rte_errno is set.
+ */
+struct mlx5_devx_obj *
+mlx5_devx_cmd_queue_counter_alloc(void *ctx)
+{
+	struct mlx5_devx_obj *dcs = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*dcs), 0,
+						SOCKET_ID_ANY);
+	uint32_t in[MLX5_ST_SZ_DW(alloc_q_counter_in)]   = {0};
+	uint32_t out[MLX5_ST_SZ_DW(alloc_q_counter_out)] = {0};
+
+	if (!dcs) {
+		rte_errno = ENOMEM;
+		return NULL;
+	}
+	MLX5_SET(alloc_q_counter_in, in, opcode, MLX5_CMD_OP_ALLOC_Q_COUNTER);
+	dcs->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
+					      sizeof(out));
+	if (!dcs->obj) {
+		DRV_LOG(DEBUG, "Can't allocate q counter set by DevX - error "
+			"%d.", errno);
+		rte_errno = errno;
+		mlx5_free(dcs);
+		return NULL;
+	}
+	dcs->id = MLX5_GET(alloc_q_counter_out, out, counter_set_id);
+	return dcs;
+}
+
+/**
+ * Query queue counters values.
+ *
+ * @param[in] dcs
+ *   devx object of the queue counter set.
+ * @param[in] clear
+ *   Whether hardware should clear the counters after the query or not.
+ *  @param[out] out_of_buffers
+ *   Number of dropped occurred due to lack of WQE for the associated QPs/RQs.
+ *
+ * @return
+ *   0 on success, a negative value otherwise.
+ */
+int
+mlx5_devx_cmd_queue_counter_query(struct mlx5_devx_obj *dcs, int clear,
+				  uint32_t *out_of_buffers)
+{
+	uint32_t out[MLX5_ST_SZ_BYTES(query_q_counter_out)] = {0};
+	uint32_t in[MLX5_ST_SZ_DW(query_q_counter_in)] = {0};
+	int rc;
+
+	MLX5_SET(query_q_counter_in, in, opcode,
+		 MLX5_CMD_OP_QUERY_Q_COUNTER);
+	MLX5_SET(query_q_counter_in, in, op_mod, 0);
+	MLX5_SET(query_q_counter_in, in, counter_set_id, dcs->id);
+	MLX5_SET(query_q_counter_in, in, clear, !!clear);
+	rc = mlx5_glue->devx_obj_query(dcs->obj, in, sizeof(in), out,
+				       sizeof(out));
+	if (rc) {
+		DRV_LOG(ERR, "Failed to query devx q counter set - rc %d", rc);
+		rte_errno = rc;
+		return -rc;
+	}
+	*out_of_buffers = MLX5_GET(query_q_counter_out, out, out_of_buffer);
+	return 0;
+}
drivers/common/mlx5/mlx5_devx_cmds.h +6 -0
index f01d5a8..bc66d28 100644
@@ -542,4 +542,10 @@ struct mlx5_devx_obj *mlx5_devx_cmd_create_flow_hit_aso_obj(void *ctx,
 
 __rte_internal
 int mlx5_devx_cmd_wq_query(void *wq, uint32_t *counter_set_id);
+
+__rte_internal
+struct mlx5_devx_obj *mlx5_devx_cmd_queue_counter_alloc(void *ctx);
+__rte_internal
+int mlx5_devx_cmd_queue_counter_query(struct mlx5_devx_obj *dcs, int clear,
+				      uint32_t *out_of_buffers);
 #endif /* RTE_PMD_MLX5_DEVX_CMDS_H_ */
drivers/common/mlx5/mlx5_prm.h +81 -0

93 lines not on this page · raw message

drivers/common/mlx5/version.map +3 -1
index edd6c0e..91f3fa5 100644
@@ -22,7 +22,7 @@ INTERNAL {
 	mlx5_devx_cmd_create_tis;
 	mlx5_devx_cmd_create_virtio_q_counters;
 	mlx5_devx_cmd_create_virtq;
-        mlx5_devx_cmd_create_flow_hit_aso_obj;
+	mlx5_devx_cmd_create_flow_hit_aso_obj;
 	mlx5_devx_cmd_create_geneve_tlv_option;
 	mlx5_devx_cmd_destroy;
 	mlx5_devx_cmd_flow_counter_alloc;
@@ -40,6 +40,8 @@ INTERNAL {
 	mlx5_devx_cmd_query_parse_samples;
 	mlx5_devx_cmd_query_virtio_q_counters;
 	mlx5_devx_cmd_query_virtq;
+	mlx5_devx_cmd_queue_counter_alloc;
+	mlx5_devx_cmd_queue_counter_query;
 	mlx5_devx_cmd_register_read;
 	mlx5_devx_cmd_wq_query;
 	mlx5_devx_get_out_command_status;
Signature · 1 line
1.8.3.1
Acked-by on v1 3/4
#6 lore raw

Re: [dpdk-dev] [PATCH 3/4] common/mlx5: add DevX commands for queue counters

Quoted 10 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Thursday, February 25, 2021 12:45
To: [email protected]
Cc: Slava Ovsiienko <[email protected]>; [email protected]
Subject: [PATCH 3/4] common/mlx5: add DevX commands for queue counters

A queue counter set is an HW object that can be assigned to any RQ\QP and it counts HW events on the assigned QPs\RQs.

Quoted 8 lines

Add DevX API to allocate and query queue counter set object.

The only used counter event is the "out of buffer" where the queue drops packets when no SW buffer is available to receive it.

#7 lore raw

PATCH 4/4 net/mlx5: fix imissed statistics

In reply to Matan Azrad

The imissed port statistic counts packets that were dropped by the device Rx queues.

In mlx5, the imissed counter summarizes 2 counters:
- packets dropped by the SW queue handling counted by SW.
- packets dropped by the HW queues due to "out of buffer" events detected when no SW buffer is available for the incoming packets.

There is HW counter object that should be created per device, and all the Rx queues should be assigned to this counter in configuration time.

This part was missed when the Rx queues were created by DevX what remained the "out of buffer" counter clean forever in this case.

Add 2 options to assign the DevX Rx queues to queue counter:
- Create queue counter per device by DevX and assign all the queues to it.
- Query the kernel counter and assign all the queues to it.

Use the first option by default and if it is failed, fallback to the second option.

Fixes e79c9be91515 ("net/mlx5: support Rx hairpin queues")
Fixes dc9ceff73c99 ("net/mlx5: create advanced RxQ via DevX")
---
 drivers/net/mlx5/linux/mlx5_os.c | 52 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/mlx5/mlx5.c          |  4 ++++
 drivers/net/mlx5/mlx5.h          |  2 ++
 drivers/net/mlx5/mlx5_devx.c     |  2 ++
 4 files changed, 60 insertions(+)
drivers/net/mlx5/linux/mlx5_os.c +52 -0
index 2dc0797..81eb2e4 100644
@@ -645,6 +645,53 @@
 #endif
 }
 
+static void
+mlx5_queue_counter_id_prepare(struct rte_eth_dev *dev)
+{
+	struct mlx5_priv *priv = dev->data->dev_private;
+	void *ctx = priv->sh->ctx;
+
+	priv->q_counters = mlx5_devx_cmd_queue_counter_alloc(ctx);
+	if (!priv->q_counters) {
+		struct ibv_cq *cq = mlx5_glue->create_cq(ctx, 1, NULL, NULL, 0);
+		struct ibv_wq *wq;
+
+		DRV_LOG(DEBUG, "Port %d queue counter object cannot be created "
+			"by DevX - fall-back to use the kernel driver global "
+			"queue counter.", dev->data->port_id);
+		/* Create WQ by kernel and query its queue counter ID. */
+		if (cq) {
+			wq = mlx5_glue->create_wq(ctx,
+						  &(struct ibv_wq_init_attr){
+						    .wq_type = IBV_WQT_RQ,
+						    .max_wr = 1,
+						    .max_sge = 1,
+						    .pd = priv->sh->pd,
+						    .cq = cq,
+						});
+			if (wq) {
+				/* Counter is assigned only on RDY state. */
+				int ret = mlx5_glue->modify_wq(wq,
+						 &(struct ibv_wq_attr){
+						 .attr_mask = IBV_WQ_ATTR_STATE,
+						 .wq_state = IBV_WQS_RDY,
+						});
+
+				if (ret == 0)
+					mlx5_devx_cmd_wq_query(wq,
+							 &priv->counter_set_id);
+				claim_zero(mlx5_glue->destroy_wq(wq));
+			}
+			claim_zero(mlx5_glue->destroy_cq(cq));
+		}
+	} else {
+		priv->counter_set_id = priv->q_counters->id;
+	}
+	if (priv->counter_set_id == 0)
+		DRV_LOG(INFO, "Part of the port %d statistics will not be "
+			"available.", dev->data->port_id);
+}
+
 /**
  * Spawn an Ethernet device from Verbs information.
  *
@@ -1498,6 +1545,7 @@
 		/* Use specific wrappers for Tx object. */
 		priv->obj_ops.txq_obj_new = mlx5_os_txq_obj_new;
 		priv->obj_ops.txq_obj_release = mlx5_os_txq_obj_release;
+		mlx5_queue_counter_id_prepare(eth_dev);
 
 	} else {
 		priv->obj_ops = ibv_obj_ops;
@@ -2433,6 +2481,10 @@
 	int fd;
 
 	if (priv->sh) {
+		if (priv->q_counters != NULL &&
+		    strcmp(ctr_name, "out_of_buffer") == 0)
+			return mlx5_devx_cmd_queue_counter_query(priv->sh->ctx,
+							   0, (uint32_t *)stat);
 		MKSTR(path, "%s/ports/%d/hw_counters/%s",
 		      priv->sh->ibdev_path,
 		      priv->dev_port,
drivers/net/mlx5/mlx5.c +4 -0
index aae2ef9..d52f0b0 100644
@@ -1345,6 +1345,10 @@ struct mlx5_dev_ctx_shared *
 		priv->txqs = NULL;
 	}
 	mlx5_proc_priv_uninit(dev);
+	if (priv->q_counters) {
+		mlx5_devx_cmd_destroy(priv->q_counters);
+		priv->q_counters = NULL;
+	}
 	if (priv->drop_queue.hrxq)
 		mlx5_drop_action_destroy(dev);
 	if (priv->mreg_cp_tbl)
drivers/net/mlx5/mlx5.h +2 -0
index 5196a9e..a281fd2 100644
@@ -984,6 +984,8 @@ struct mlx5_priv {
 	LIST_HEAD(fdir, mlx5_fdir_flow) fdir_flows; /* fdir flows. */
 	rte_spinlock_t shared_act_sl; /* Shared actions spinlock. */
 	uint32_t rss_shared_actions; /* RSS shared actions. */
+	struct mlx5_devx_obj *q_counters; /* DevX queue counter object. */
+	uint32_t counter_set_id; /* Queue counter ID to set in DevX objects. */
 };
 
 #define PORT_ID(priv) ((priv)->dev_data->port_id)
drivers/net/mlx5/mlx5_devx.c +2 -0
index e4acab9..2cb3bd1 100644
@@ -275,6 +275,7 @@
 						MLX5_WQ_END_PAD_MODE_ALIGN :
 						MLX5_WQ_END_PAD_MODE_NONE;
 	rq_attr.wq_attr.pd = priv->sh->pdn;
+	rq_attr.counter_set_id = priv->counter_set_id;
 	/* Create RQ using DevX API. */
 	return mlx5_devx_rq_create(priv->sh->ctx, &rxq_ctrl->obj->rq_obj,
 				   wqe_size, log_desc_n, &rq_attr,
@@ -438,6 +439,7 @@
 	attr.wq_attr.log_hairpin_num_packets =
 			attr.wq_attr.log_hairpin_data_sz -
 			MLX5_HAIRPIN_QUEUE_STRIDE;
+	attr.counter_set_id = priv->counter_set_id;
 	tmpl->rq = mlx5_devx_cmd_create_rq(priv->sh->ctx, &attr,
 					   rxq_ctrl->socket);
 	if (!tmpl->rq) {
Signature · 1 line
1.8.3.1
Acked-by on v1 4/4
#8 lore raw

Re: [dpdk-dev] [PATCH 4/4] net/mlx5: fix imissed statistics

Quoted 27 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Thursday, February 25, 2021 12:45
To: [email protected]
Cc: Slava Ovsiienko <[email protected]>; [email protected]
Subject: [PATCH 4/4] net/mlx5: fix imissed statistics

The imissed port statistic counts packets that were dropped by the device Rx queues.

In mlx5, the imissed counter summarizes 2 counters:
- packets dropped by the SW queue handling counted by SW.
- packets dropped by the HW queues due to "out of buffer" events detected when no SW buffer is available for the incoming packets.

There is HW counter object that should be created per device, and all the Rx queues should be assigned to this counter in configuration time.

This part was missed when the Rx queues were created by DevX what remained the "out of buffer" counter clean forever in this case.

Add 2 options to assign the DevX Rx queues to queue counter:
- Create queue counter per device by DevX and assign all the queues to it.
- Query the kernel counter and assign all the queues to it.

Quoted 7 lines

Use the first option by default and if it is failed, fallback to the second option.

Fixes e79c9be91515 ("net/mlx5: support Rx hairpin queues")
Fixes dc9ceff73c99 ("net/mlx5: create advanced RxQ via DevX")
#9 lore raw
In reply to Matan Azrad

Hi,

Quoted 53 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Matan Azrad
Sent: Thursday, February 25, 2021 12:45 PM
To: [email protected]
Cc: Slava Ovsiienko <[email protected]>
Subject: [dpdk-dev] [PATCH 0/4] net/mlx5: fix imissed statistic

The imissed port statistic counts packets that were dropped by the device Rx queues.

In mlx5, the imissed counter summarizes 2 counters:
- packets dropped by the SW queue handling counted by SW.
- packets dropped by the HW queues due to "out of buffer" events detected when no SW buffer is available for the incoming packets.

There is HW counter object that should be created per device, and all the Rx queues should be assigned to this counter in configuration time.

This part was missed when the Rx queues were created by DevX what remained the "out of buffer" counter clean forever in this case.

Add 2 options to assign the DevX Rx queues to queue counter:
- Create queue counter per device by DevX and assign all the queues to it.
- Query the kernel counter and assign all the queues to it.

Use the first option by default and if it is failed, fallback to the second option.

Matan Azrad (4):
common/mlx5/linux: add glue function to query WQ common/mlx5: add DevX command to query WQ common/mlx5: add DevX commands for queue counters net/mlx5: fix imissed statistics

 drivers/common/mlx5/linux/mlx5_glue.c |  18 ++++++
 drivers/common/mlx5/linux/mlx5_glue.h |   2 +
 drivers/common/mlx5/mlx5_devx_cmds.c  | 100
++++++++++++++++++++++++++++++++++
 drivers/common/mlx5/mlx5_devx_cmds.h  |   9 +++
 drivers/common/mlx5/mlx5_prm.h        | 100
++++++++++++++++++++++++++++++++++
 drivers/common/mlx5/version.map       |   5 +-
 drivers/net/mlx5/linux/mlx5_os.c      |  52 ++++++++++++++++++
 drivers/net/mlx5/mlx5.c               |   4 ++
 drivers/net/mlx5/mlx5.h               |   2 +
 drivers/net/mlx5/mlx5_devx.c          |   2 +
 10 files changed, 293 insertions(+), 1 deletion(-)
Quoted 2 lines

--
1.8.3.1

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh