Add 3 trace points of control message related with representor port, also modify the needed logic.
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 | 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