DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
	Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH 1/7] net/nfp: add trace points about port
Date: Wed, 19 Jun 2024 18:07:48 +0800	[thread overview]
Message-ID: <20240619100754.3480077-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240619100754.3480077-1-chaoyong.he@corigine.com>

Add 3 trace points of control message related with representor
port, also modify the needed logic.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_cmsg.c | 17 +++++--
 drivers/net/nfp/flower/nfp_flower_cmsg.h | 14 +++---
 drivers/net/nfp/meson.build              |  1 +
 drivers/net/nfp/nfp_trace.c              | 17 +++++++
 drivers/net/nfp/nfp_trace.h              | 62 ++++++++++++++++++++++++
 5 files changed, 100 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/nfp/nfp_trace.c
 create mode 100644 drivers/net/nfp/nfp_trace.h

diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 9a5b5f52b8..ff20938b69 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -10,6 +10,7 @@
 #include "../nfp_net_meta.h"
 #include "nfp_flower_ctrl.h"
 #include "nfp_flower_representor.h"
+#include "nfp_trace.h"
 
 static char*
 nfp_flower_cmsg_get_data(struct rte_mbuf *m)
@@ -65,15 +66,12 @@ nfp_flower_cmsg_mac_repr_init(struct rte_mbuf *mbuf,
 }
 
 static void
-nfp_flower_cmsg_mac_repr_fill(struct rte_mbuf *m,
+nfp_flower_cmsg_mac_repr_fill(struct nfp_flower_cmsg_mac_repr *msg,
 		uint8_t idx,
 		uint32_t nbi,
 		uint32_t nbi_port,
 		uint32_t phys_port)
 {
-	struct nfp_flower_cmsg_mac_repr *msg;
-
-	msg = (struct nfp_flower_cmsg_mac_repr *)nfp_flower_cmsg_get_data(m);
 	msg->ports[idx].idx       = idx;
 	msg->ports[idx].info      = nbi & NFP_FLOWER_CMSG_MAC_REPR_NBI;
 	msg->ports[idx].nbi_port  = nbi_port;
@@ -91,6 +89,7 @@ nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower,
 	uint32_t nbi_port;
 	uint32_t phys_port;
 	struct rte_mbuf *mbuf;
+	struct nfp_flower_cmsg_mac_repr *msg;
 
 	mbuf = rte_pktmbuf_alloc(app_fw_flower->ctrl_pktmbuf_pool);
 	if (mbuf == NULL) {
@@ -101,13 +100,14 @@ nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower,
 	nfp_flower_cmsg_mac_repr_init(mbuf, app_fw_flower);
 
 	/* Fill in the mac repr cmsg */
+	msg = (struct nfp_flower_cmsg_mac_repr *)nfp_flower_cmsg_get_data(mbuf);
 	for (i = 0; i < app_fw_flower->num_phyport_reprs; i++) {
 		id = nfp_function_id_get(pf_dev, i);
 		nbi = pf_dev->nfp_eth_table->ports[id].nbi;
 		nbi_port =  pf_dev->nfp_eth_table->ports[id].base;
 		phys_port =  pf_dev->nfp_eth_table->ports[id].index;
 
-		nfp_flower_cmsg_mac_repr_fill(mbuf, i, nbi, nbi_port, phys_port);
+		nfp_flower_cmsg_mac_repr_fill(msg, i, nbi, nbi_port, phys_port);
 	}
 
 	/* Send the cmsg via the ctrl vNIC */
@@ -118,6 +118,9 @@ nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower,
 		return -EIO;
 	}
 
+	for (i = 0; i < app_fw_flower->num_phyport_reprs; i++)
+		rte_pmd_nfp_trace_cmsg_port_repr("cmsg_mac_repr", &msg->ports[i], i);
+
 	return 0;
 }
 
@@ -148,6 +151,8 @@ nfp_flower_cmsg_repr_reify(struct nfp_app_fw_flower *app_fw_flower,
 		return -EIO;
 	}
 
+	rte_pmd_nfp_trace_cmsg_port_repr_reify("cmsg_port_reify", msg);
+
 	return 0;
 }
 
@@ -179,6 +184,8 @@ nfp_flower_cmsg_port_mod(struct nfp_app_fw_flower *app_fw_flower,
 		return -EIO;
 	}
 
+	rte_pmd_nfp_trace_cmsg_port_mod("cmsg_port_mod", msg);
+
 	return 0;
 }
 
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h
index 5d23227c24..c52f01dbc7 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.h
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h
@@ -65,15 +65,17 @@ enum nfp_flower_cmsg_type {
  *            this forms NBIX.PortY notation as the NSP eth table.
  *          "Chip-wide" port (bits 7-0):
  */
+struct nfp_flower_cmsg_mac_repr_entry {
+	uint8_t idx;
+	uint8_t info;
+	uint8_t nbi_port;
+	uint8_t phys_port;
+};
+
 struct nfp_flower_cmsg_mac_repr {
 	uint8_t reserved[3];
 	uint8_t num_ports;
-	struct {
-		uint8_t idx;
-		uint8_t info;
-		uint8_t nbi_port;
-		uint8_t phys_port;
-	} ports[];
+	struct nfp_flower_cmsg_mac_repr_entry ports[];
 };
 
 /*
diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build
index eb54df5348..39bda04bc5 100644
--- a/drivers/net/nfp/meson.build
+++ b/drivers/net/nfp/meson.build
@@ -46,6 +46,7 @@ sources = files(
         'nfp_rxtx.c',
         'nfp_rxtx_vec_stub.c',
         'nfp_service.c',
+        'nfp_trace.c',
 )
 
 if arch_subdir == 'x86'
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
new file mode 100644
index 0000000000..c1f90e167f
--- /dev/null
+++ b/drivers/net/nfp/nfp_trace.c
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2024 Corigine Systems, Inc.
+ * All rights reserved.
+ */
+
+#include <rte_trace_point_register.h>
+
+#include "nfp_trace.h"
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_port_repr,
+		pmd.net.nfp.cmsg.port.repr)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_port_repr_reify,
+		pmd.net.nfp.cmsg.port.repr_reify)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_port_mod,
+		pmd.net.nfp.cmsg.port.mod)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
new file mode 100644
index 0000000000..5b8f855634
--- /dev/null
+++ b/drivers/net/nfp/nfp_trace.h
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2024 Corigine Systems, Inc.
+ * All rights reserved.
+ */
+
+#ifndef __NFP_TRACE_H__
+#define __NFP_TRACE_H__
+
+#include <rte_trace_point.h>
+
+#include "flower/nfp_flower_cmsg.h"
+
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_port_repr,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg, uint8_t index),
+
+	rte_trace_point_emit_string(name);
+	rte_trace_point_emit_u8(index);
+
+	struct nfp_flower_cmsg_mac_repr_entry *entry = cmsg;
+	uint8_t idx = entry->idx;
+	uint8_t info = entry->info;
+	uint8_t nbi_port = entry->nbi_port;
+	uint8_t phys_port = entry->phys_port;
+
+	rte_trace_point_emit_u8(idx);
+	rte_trace_point_emit_u8(info);
+	rte_trace_point_emit_u8(nbi_port);
+	rte_trace_point_emit_u8(phys_port);
+)
+
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_port_repr_reify,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg),
+
+	rte_trace_point_emit_string(name);
+
+	struct nfp_flower_cmsg_port_reify *msg = cmsg;
+	uint32_t portnum = rte_be_to_cpu_32(msg->portnum);
+	uint16_t info = rte_be_to_cpu_16(msg->info);
+
+	rte_trace_point_emit_u32(portnum);
+	rte_trace_point_emit_u16(info);
+)
+
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_port_mod,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg),
+
+	rte_trace_point_emit_string(name);
+
+	struct nfp_flower_cmsg_port_mod *msg = cmsg;
+	uint32_t portnum = rte_be_to_cpu_32(msg->portnum);
+	uint8_t info = msg->info;
+	uint16_t mtu = rte_be_to_cpu_16(msg->mtu);
+
+	rte_trace_point_emit_u32(portnum);
+	rte_trace_point_emit_u8(info);
+	rte_trace_point_emit_u16(mtu);
+)
+
+#endif /* __NFP_TRACE_H__ */
-- 
2.39.1


  reply	other threads:[~2024-06-19 10:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 10:07 [PATCH 0/7] add trace support for control message Chaoyong He
2024-06-19 10:07 ` Chaoyong He [this message]
2024-06-19 10:07 ` [PATCH 2/7] net/nfp: add trace point about tunnel Chaoyong He
2024-06-19 10:07 ` [PATCH 3/7] net/nfp: add trace point about Qos Chaoyong He
2024-06-19 10:07 ` [PATCH 4/7] net/nfp: refactor to prepare for add flow trace point Chaoyong He
2024-06-19 10:07 ` [PATCH 5/7] net/nfp: add trace point about flow rule Chaoyong He
2024-06-19 10:07 ` [PATCH 6/7] net/nfp: add trace point about flow rule pattern Chaoyong He
2024-06-19 10:07 ` [PATCH 7/7] net/nfp: add trace point about flow rule action Chaoyong He
2024-07-07 22:43 ` [PATCH 0/7] add trace support for control message Ferruh Yigit
2024-07-08  1:42   ` Chaoyong He
2024-07-08  2:45 ` [PATCH v2 " Chaoyong He
2024-07-08  2:45   ` [PATCH v2 1/7] net/nfp: add trace points about port Chaoyong He
2024-07-08  2:45   ` [PATCH v2 2/7] net/nfp: add trace point about tunnel Chaoyong He
2024-07-08  2:45   ` [PATCH v2 3/7] net/nfp: add trace point about Qos Chaoyong He
2024-07-08  2:45   ` [PATCH v2 4/7] net/nfp: refactor to prepare for add flow trace point Chaoyong He
2024-07-08  2:45   ` [PATCH v2 5/7] net/nfp: add trace point about flow rule Chaoyong He
2024-07-08  2:45   ` [PATCH v2 6/7] net/nfp: add trace point about flow rule pattern Chaoyong He
2024-07-08  2:45   ` [PATCH v2 7/7] net/nfp: add trace point about flow rule action Chaoyong He
2024-07-08 11:45   ` [PATCH v2 0/7] add trace support for control message Ferruh Yigit
2024-07-09  1:15     ` Chaoyong He
2024-07-09  3:16     ` Chaoyong He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240619100754.3480077-2-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).