[dpdk-dev] [PATCH 14/18] net/mlx5: add hardware flow debug dump

Xueming Li xuemingl at mellanox.com
Mon Feb 26 16:09:43 CET 2018


Dump verb flow detail including each flow spec type and size for debug
purpose.

Signed-off-by: Xueming Li <xuemingl at mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index f01c90f..5b95afc 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1994,6 +1994,30 @@ struct ibv_spec_header {
 		flow->frxq[i].ibv_flow =
 			mlx5_glue->create_flow(flow->frxq[i].hrxq->qp,
 					       flow->frxq[i].ibv_attr);
+#ifndef NDEBUG
+		uintptr_t spec_ptr;
+		uint16_t j;
+		char buf[256];
+		uint8_t off;
+
+		spec_ptr = (uintptr_t)(flow->frxq[i].ibv_attr + 1);
+		for (j = 0, off = 0; j < flow->frxq[i].ibv_attr->num_of_specs;
+		     j++) {
+			struct ibv_flow_spec *spec = (void *)spec_ptr;
+			off += sprintf(buf + off, " %x(%hu)", spec->hdr.type,
+				       spec->hdr.size);
+			spec_ptr += spec->hdr.size;
+		}
+		DEBUG("verb flow: qp:%p n_specs:%hhu, size:%hu, priority:%hu, type:%d, flags:%x, comp_mask:%x specs:%s",
+		       (void *)flow->frxq[i].hrxq->qp,
+		       flow->frxq[i].ibv_attr->num_of_specs,
+		       flow->frxq[i].ibv_attr->size,
+		       flow->frxq[i].ibv_attr->priority,
+		       flow->frxq[i].ibv_attr->type,
+		       flow->frxq[i].ibv_attr->flags,
+		       flow->frxq[i].ibv_attr->comp_mask,
+		       buf);
+#endif
 		if (!flow->frxq[i].ibv_flow) {
 			rte_flow_error_set(error, ENOMEM,
 					   RTE_FLOW_ERROR_TYPE_HANDLE,
-- 
1.8.3.1



More information about the dev mailing list