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 v2 2/7] net/nfp: add trace point about tunnel
Date: Mon,  8 Jul 2024 10:45:38 +0800	[thread overview]
Message-ID: <20240708024543.77126-3-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240708024543.77126-1-chaoyong.he@corigine.com>

Add 6 trace points of control message related with tunnel.

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 |  14 +++
 drivers/net/nfp/nfp_trace.c              |  18 +++
 drivers/net/nfp/nfp_trace.h              | 133 +++++++++++++++++++++++
 3 files changed, 165 insertions(+)

diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index ff20938b69..30ce68b42d 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -288,6 +288,8 @@ nfp_flower_cmsg_tun_neigh_v4_rule(struct nfp_app_fw_flower *app_fw_flower,
 		return -EIO;
 	}
 
+	rte_pmd_nfp_trace_cmsg_tun_neigh_v4("cmsg_tun_neigh_v4", msg);
+
 	return 0;
 }
 
@@ -320,6 +322,8 @@ nfp_flower_cmsg_tun_neigh_v6_rule(struct nfp_app_fw_flower *app_fw_flower,
 		return -EIO;
 	}
 
+	rte_pmd_nfp_trace_cmsg_tun_neigh_v6("cmsg_tun_neigh_v6", msg);
+
 	return 0;
 }
 
@@ -363,6 +367,9 @@ nfp_flower_cmsg_tun_off_v4(struct nfp_app_fw_flower *app_fw_flower)
 		return -EIO;
 	}
 
+	for (uint32_t i = 0; i < count; i++)
+		rte_pmd_nfp_trace_cmsg_tun_off_v4("cmsg_tun_off_v4", &msg->ipv4_addr[i], i);
+
 	return 0;
 }
 
@@ -406,6 +413,9 @@ nfp_flower_cmsg_tun_off_v6(struct nfp_app_fw_flower *app_fw_flower)
 		return -EIO;
 	}
 
+	for (uint32_t i = 0; i < count; i++)
+		rte_pmd_nfp_trace_cmsg_tun_off_v6("cmsg_tun_off_v6", &msg->ipv6_addr[i * 16], i);
+
 	return 0;
 }
 
@@ -449,6 +459,8 @@ nfp_flower_cmsg_pre_tunnel_rule(struct nfp_app_fw_flower *app_fw_flower,
 		return -EIO;
 	}
 
+	rte_pmd_nfp_trace_cmsg_pre_tun("cmsg_pre_tun_rule", msg);
+
 	return 0;
 }
 
@@ -484,6 +496,8 @@ nfp_flower_cmsg_tun_mac_rule(struct nfp_app_fw_flower *app_fw_flower,
 		return -EIO;
 	}
 
+	rte_pmd_nfp_trace_cmsg_tun_mac("cmsg_tun_mac", msg);
+
 	return 0;
 }
 
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index c1f90e167f..730ffaa32e 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -15,3 +15,21 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_port_repr_reify,
 
 RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_port_mod,
 		pmd.net.nfp.cmsg.port.mod)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_neigh_v4,
+		pmd.net.nfp.cmsg.tun.neigh_v4)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_neigh_v6,
+		pmd.net.nfp.cmsg.tun.neigh_v6)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_off_v4,
+		pmd.net.nfp.cmsg.tun.off_v4)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_off_v6,
+		pmd.net.nfp.cmsg.tun.off_v6)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_pre_tun,
+		pmd.net.nfp.cmsg.tun.pre_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_mac,
+		pmd.net.nfp.cmsg.tun.mac_rule)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index 5b8f855634..48a14efd3a 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -59,4 +59,137 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_u16(mtu);
 )
 
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_tun_neigh_v4,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg),
+
+	rte_trace_point_emit_string(name);
+
+	struct nfp_flower_cmsg_tun_neigh_v4 *msg = cmsg;
+	uint32_t dst_ipv4 = rte_be_to_cpu_32(msg->dst_ipv4);
+	uint32_t src_ipv4 = rte_be_to_cpu_32(msg->src_ipv4);
+
+	rte_trace_point_emit_u32(dst_ipv4);
+	rte_trace_point_emit_u32(src_ipv4);
+
+	struct nfp_flower_tun_neigh *common = &msg->common;
+	uint8_t dst_mac_len = RTE_ETHER_ADDR_LEN;
+	uint8_t src_mac_len = RTE_ETHER_ADDR_LEN;
+	uint8_t *dst_mac = &common->dst_mac[0];
+	uint8_t *src_mac = &common->src_mac[0];
+	uint32_t port_id = rte_be_to_cpu_32(common->port_id);
+
+	rte_trace_point_emit_blob(dst_mac, dst_mac_len);
+	rte_trace_point_emit_blob(src_mac, src_mac_len);
+	rte_trace_point_emit_u32(port_id);
+
+	struct nfp_flower_tun_neigh_ext *ext = &msg->ext;
+	uint16_t vlan_tpid = rte_be_to_cpu_16(ext->vlan_tpid);
+	uint16_t vlan_tci = rte_be_to_cpu_16(ext->vlan_tci);
+	uint32_t host_ctx = rte_be_to_cpu_32(ext->host_ctx);
+
+	rte_trace_point_emit_u16(vlan_tpid);
+	rte_trace_point_emit_u16(vlan_tci);
+	rte_trace_point_emit_u32(host_ctx);
+)
+
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_tun_neigh_v6,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg),
+
+	rte_trace_point_emit_string(name);
+
+	struct nfp_flower_cmsg_tun_neigh_v6 *msg = cmsg;
+	uint8_t dst_ipv6_len = 16;
+	uint8_t src_ipv6_len = 16;
+	uint8_t *dst_ipv6 = &msg->dst_ipv6[0];
+	uint8_t *src_ipv6 = &msg->src_ipv6[0];
+
+	rte_trace_point_emit_blob(dst_ipv6, dst_ipv6_len);
+	rte_trace_point_emit_blob(src_ipv6, src_ipv6_len);
+
+	struct nfp_flower_tun_neigh *common = &msg->common;
+	uint8_t dst_mac_len = RTE_ETHER_ADDR_LEN;
+	uint8_t src_mac_len = RTE_ETHER_ADDR_LEN;
+	uint8_t *dst_mac = &common->dst_mac[0];
+	uint8_t *src_mac = &common->src_mac[0];
+	uint32_t port_id = rte_be_to_cpu_32(common->port_id);
+
+	rte_trace_point_emit_blob(dst_mac, dst_mac_len);
+	rte_trace_point_emit_blob(src_mac, src_mac_len);
+	rte_trace_point_emit_u32(port_id);
+
+	struct nfp_flower_tun_neigh_ext *ext = &msg->ext;
+	uint16_t vlan_tpid = rte_be_to_cpu_16(ext->vlan_tpid);
+	uint16_t vlan_tci = rte_be_to_cpu_16(ext->vlan_tci);
+	uint32_t host_ctx = rte_be_to_cpu_32(ext->host_ctx);
+
+	rte_trace_point_emit_u16(vlan_tpid);
+	rte_trace_point_emit_u16(vlan_tci);
+	rte_trace_point_emit_u32(host_ctx);
+)
+
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_tun_off_v4,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg, uint32_t idx),
+
+	rte_trace_point_emit_string(name);
+	rte_trace_point_emit_u32(idx);
+
+	rte_be32_t *msg = cmsg;
+	uint32_t ipv4_addr = rte_be_to_cpu_32(*msg);
+
+	rte_trace_point_emit_u32(ipv4_addr);
+)
+
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_tun_off_v6,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg, uint32_t idx),
+
+	rte_trace_point_emit_string(name);
+	rte_trace_point_emit_u32(idx);
+
+	uint8_t *ipv6_addr = cmsg;
+	uint8_t len = 16;
+
+	rte_trace_point_emit_blob(ipv6_addr, len);
+)
+
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_pre_tun,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg),
+
+	rte_trace_point_emit_string(name);
+
+	struct nfp_flower_cmsg_pre_tun_rule *msg = cmsg;
+	uint32_t flags = rte_be_to_cpu_32(msg->flags);
+	uint16_t port_idx = rte_be_to_cpu_16(msg->port_idx);
+	uint16_t vlan_tci = rte_be_to_cpu_16(msg->vlan_tci);
+	uint32_t host_ctx_id = rte_be_to_cpu_32(msg->host_ctx_id);
+
+	rte_trace_point_emit_u32(flags);
+	rte_trace_point_emit_u16(port_idx);
+	rte_trace_point_emit_u16(vlan_tci);
+	rte_trace_point_emit_u32(host_ctx_id);
+)
+
+RTE_TRACE_POINT(
+	rte_pmd_nfp_trace_cmsg_tun_mac,
+	RTE_TRACE_POINT_ARGS(const char *name, void *cmsg),
+
+	rte_trace_point_emit_string(name);
+
+	struct nfp_flower_cmsg_tun_mac *msg = cmsg;
+	uint16_t flags = rte_be_to_cpu_16(msg->flags);
+	uint16_t count = rte_be_to_cpu_16(msg->count);
+	uint16_t index = rte_be_to_cpu_16(msg->index);
+	uint8_t len = RTE_ETHER_ADDR_LEN;
+	uint8_t *addr_bytes = &msg->addr.addr_bytes[0];
+
+	rte_trace_point_emit_u16(flags);
+	rte_trace_point_emit_u16(count);
+	rte_trace_point_emit_u16(index);
+	rte_trace_point_emit_blob(addr_bytes, len);
+)
+
 #endif /* __NFP_TRACE_H__ */
-- 
2.39.1


  parent reply	other threads:[~2024-07-08  2:46 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 ` [PATCH 1/7] net/nfp: add trace points about port Chaoyong He
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   ` Chaoyong He [this message]
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=20240708024543.77126-3-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).