Add 6 trace points of control message related with tunnel.

Signed-off-by: Chaoyong He <chaoyong...@corigine.com>
Reviewed-by: Long Wu <long...@corigine.com>
Reviewed-by: Peng Zhang <peng.zh...@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

Reply via email to