* [PATCH 1/7] net/nfp: add trace points about port
2024-06-19 10:07 [PATCH 0/7] add trace support for control message Chaoyong He
@ 2024-06-19 10:07 ` Chaoyong He
2024-06-19 10:07 ` [PATCH 2/7] net/nfp: add trace point about tunnel Chaoyong He
` (7 subsequent siblings)
8 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-06-19 10:07 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/7] net/nfp: add trace point about tunnel
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 ` Chaoyong He
2024-06-19 10:07 ` [PATCH 3/7] net/nfp: add trace point about Qos Chaoyong He
` (6 subsequent siblings)
8 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-06-19 10:07 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 3/7] net/nfp: add trace point about Qos
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 ` Chaoyong He
2024-06-19 10:07 ` [PATCH 4/7] net/nfp: refactor to prepare for add flow trace point Chaoyong He
` (5 subsequent siblings)
8 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-06-19 10:07 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Add 1 trace point of control message related with Qos.
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 | 4 ++++
drivers/net/nfp/nfp_trace.c | 3 +++
drivers/net/nfp/nfp_trace.h | 29 ++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 30ce68b42d..b07cea9921 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -528,6 +528,8 @@ nfp_flower_cmsg_qos_add(struct nfp_app_fw_flower *app_fw_flower,
return -EIO;
}
+ rte_pmd_nfp_trace_cmsg_qos_rule("cmsg_qos_add", msg);
+
return 0;
}
@@ -558,6 +560,8 @@ nfp_flower_cmsg_qos_delete(struct nfp_app_fw_flower *app_fw_flower,
return -EIO;
}
+ rte_pmd_nfp_trace_cmsg_qos_rule("cmsg_qos_delete", msg);
+
return 0;
}
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index 730ffaa32e..529399e1a8 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -33,3 +33,6 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_pre_tun,
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_mac,
pmd.net.nfp.cmsg.tun.mac_rule)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_qos_rule,
+ pmd.net.nfp.cmsg.qos.rule)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index 48a14efd3a..5f8f3c373b 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -192,4 +192,33 @@ RTE_TRACE_POINT(
rte_trace_point_emit_blob(addr_bytes, len);
)
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_qos_rule,
+ RTE_TRACE_POINT_ARGS(const char *name, void *cmsg),
+
+ rte_trace_point_emit_string(name);
+
+ struct nfp_profile_conf *msg = cmsg;
+ uint32_t bkt_tkn_p = rte_be_to_cpu_32(msg->bkt_tkn_p);
+ uint32_t bkt_tkn_c = rte_be_to_cpu_32(msg->bkt_tkn_c);
+ uint32_t pbs = rte_be_to_cpu_32(msg->pbs);
+ uint32_t cbs = rte_be_to_cpu_32(msg->cbs);
+ uint32_t pir = rte_be_to_cpu_32(msg->pir);
+ uint32_t cir = rte_be_to_cpu_32(msg->cir);
+
+ struct nfp_cfg_head *head = &msg->head;
+ uint32_t flags_opts = rte_be_to_cpu_32(head->flags_opts);
+ uint32_t profile_id = rte_be_to_cpu_32(head->profile_id);
+
+ rte_trace_point_emit_u32(flags_opts);
+ rte_trace_point_emit_u32(profile_id);
+
+ rte_trace_point_emit_u32(bkt_tkn_p);
+ rte_trace_point_emit_u32(bkt_tkn_c);
+ rte_trace_point_emit_u32(pbs);
+ rte_trace_point_emit_u32(cbs);
+ rte_trace_point_emit_u32(pir);
+ rte_trace_point_emit_u32(cir);
+)
+
#endif /* __NFP_TRACE_H__ */
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 4/7] net/nfp: refactor to prepare for add flow trace point
2024-06-19 10:07 [PATCH 0/7] add trace support for control message Chaoyong He
` (2 preceding siblings ...)
2024-06-19 10:07 ` [PATCH 3/7] net/nfp: add trace point about Qos Chaoyong He
@ 2024-06-19 10:07 ` Chaoyong He
2024-06-19 10:07 ` [PATCH 5/7] net/nfp: add trace point about flow rule Chaoyong He
` (4 subsequent siblings)
8 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-06-19 10:07 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Refactor 'nfp_flower_flow' module, move some macro into the header file
in order to prepare for flow trace points.
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_flow.c | 46 ------------------------
drivers/net/nfp/flower/nfp_flower_flow.h | 46 ++++++++++++++++++++++++
2 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index 8aafbe4c86..9f410515e6 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -16,21 +16,6 @@
#include "nfp_logs.h"
#include "nfp_mtr.h"
-#define NFP_FLOWER_LAYER_EXT_META RTE_BIT32(0)
-#define NFP_FLOWER_LAYER_PORT RTE_BIT32(1)
-#define NFP_FLOWER_LAYER_MAC RTE_BIT32(2)
-#define NFP_FLOWER_LAYER_TP RTE_BIT32(3)
-#define NFP_FLOWER_LAYER_IPV4 RTE_BIT32(4)
-#define NFP_FLOWER_LAYER_IPV6 RTE_BIT32(5)
-#define NFP_FLOWER_LAYER_CT RTE_BIT32(6)
-#define NFP_FLOWER_LAYER_VXLAN RTE_BIT32(7)
-
-#define NFP_FLOWER_LAYER2_GRE RTE_BIT32(0)
-#define NFP_FLOWER_LAYER2_QINQ RTE_BIT32(4)
-#define NFP_FLOWER_LAYER2_GENEVE RTE_BIT32(5)
-#define NFP_FLOWER_LAYER2_GENEVE_OP RTE_BIT32(6)
-#define NFP_FLOWER_LAYER2_TUN_IPV6 RTE_BIT32(7)
-
/* Compressed HW representation of TCP Flags */
#define NFP_FL_TCP_FLAG_FIN RTE_BIT32(0)
#define NFP_FL_TCP_FLAG_SYN RTE_BIT32(1)
@@ -55,37 +40,6 @@
/* GRE Tunnel flags */
#define NFP_FL_GRE_FLAG_KEY (1 << 2)
-/* Action opcodes */
-#define NFP_FL_ACTION_OPCODE_OUTPUT 0
-#define NFP_FL_ACTION_OPCODE_PUSH_VLAN 1
-#define NFP_FL_ACTION_OPCODE_POP_VLAN 2
-#define NFP_FL_ACTION_OPCODE_PUSH_MPLS 3
-#define NFP_FL_ACTION_OPCODE_POP_MPLS 4
-#define NFP_FL_ACTION_OPCODE_USERSPACE 5
-#define NFP_FL_ACTION_OPCODE_SET_TUNNEL 6
-#define NFP_FL_ACTION_OPCODE_SET_ETHERNET 7
-#define NFP_FL_ACTION_OPCODE_SET_MPLS 8
-#define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS 9
-#define NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS 10
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC 11
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_DST 12
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL 13
-#define NFP_FL_ACTION_OPCODE_SET_UDP 14
-#define NFP_FL_ACTION_OPCODE_SET_TCP 15
-#define NFP_FL_ACTION_OPCODE_PRE_LAG 16
-#define NFP_FL_ACTION_OPCODE_PRE_TUNNEL 17
-#define NFP_FL_ACTION_OPCODE_PRE_GS 18
-#define NFP_FL_ACTION_OPCODE_GS 19
-#define NFP_FL_ACTION_OPCODE_PUSH_NSH 20
-#define NFP_FL_ACTION_OPCODE_POP_NSH 21
-#define NFP_FL_ACTION_OPCODE_SET_QUEUE 22
-#define NFP_FL_ACTION_OPCODE_CONNTRACK 23
-#define NFP_FL_ACTION_OPCODE_METER 24
-#define NFP_FL_ACTION_OPCODE_CT_NAT_EXT 25
-#define NFP_FL_ACTION_OPCODE_PUSH_GENEVE 26
-#define NFP_FL_ACTION_OPCODE_SET_PARTIAL 27
-#define NFP_FL_ACTION_OPCODE_NUM 32
-
#define NFP_FL_OUT_FLAGS_LAST RTE_BIT32(15)
/* Tunnel ports */
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.h b/drivers/net/nfp/flower/nfp_flower_flow.h
index f54ad6cf55..c1c8014699 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.h
+++ b/drivers/net/nfp/flower/nfp_flower_flow.h
@@ -9,6 +9,52 @@
#include "../nfp_net_common.h"
#include "nfp_flower.h"
+#define NFP_FLOWER_LAYER_EXT_META RTE_BIT32(0)
+#define NFP_FLOWER_LAYER_PORT RTE_BIT32(1)
+#define NFP_FLOWER_LAYER_MAC RTE_BIT32(2)
+#define NFP_FLOWER_LAYER_TP RTE_BIT32(3)
+#define NFP_FLOWER_LAYER_IPV4 RTE_BIT32(4)
+#define NFP_FLOWER_LAYER_IPV6 RTE_BIT32(5)
+#define NFP_FLOWER_LAYER_CT RTE_BIT32(6)
+#define NFP_FLOWER_LAYER_VXLAN RTE_BIT32(7)
+
+#define NFP_FLOWER_LAYER2_GRE RTE_BIT32(0)
+#define NFP_FLOWER_LAYER2_QINQ RTE_BIT32(4)
+#define NFP_FLOWER_LAYER2_GENEVE RTE_BIT32(5)
+#define NFP_FLOWER_LAYER2_GENEVE_OP RTE_BIT32(6)
+#define NFP_FLOWER_LAYER2_TUN_IPV6 RTE_BIT32(7)
+
+/* Action opcodes */
+#define NFP_FL_ACTION_OPCODE_OUTPUT 0
+#define NFP_FL_ACTION_OPCODE_PUSH_VLAN 1
+#define NFP_FL_ACTION_OPCODE_POP_VLAN 2
+#define NFP_FL_ACTION_OPCODE_PUSH_MPLS 3
+#define NFP_FL_ACTION_OPCODE_POP_MPLS 4
+#define NFP_FL_ACTION_OPCODE_USERSPACE 5
+#define NFP_FL_ACTION_OPCODE_SET_TUNNEL 6
+#define NFP_FL_ACTION_OPCODE_SET_ETHERNET 7
+#define NFP_FL_ACTION_OPCODE_SET_MPLS 8
+#define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS 9
+#define NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS 10
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC 11
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_DST 12
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL 13
+#define NFP_FL_ACTION_OPCODE_SET_UDP 14
+#define NFP_FL_ACTION_OPCODE_SET_TCP 15
+#define NFP_FL_ACTION_OPCODE_PRE_LAG 16
+#define NFP_FL_ACTION_OPCODE_PRE_TUNNEL 17
+#define NFP_FL_ACTION_OPCODE_PRE_GS 18
+#define NFP_FL_ACTION_OPCODE_GS 19
+#define NFP_FL_ACTION_OPCODE_PUSH_NSH 20
+#define NFP_FL_ACTION_OPCODE_POP_NSH 21
+#define NFP_FL_ACTION_OPCODE_SET_QUEUE 22
+#define NFP_FL_ACTION_OPCODE_CONNTRACK 23
+#define NFP_FL_ACTION_OPCODE_METER 24
+#define NFP_FL_ACTION_OPCODE_CT_NAT_EXT 25
+#define NFP_FL_ACTION_OPCODE_PUSH_GENEVE 26
+#define NFP_FL_ACTION_OPCODE_SET_PARTIAL 27
+#define NFP_FL_ACTION_OPCODE_NUM 32
+
/* The firmware expects lengths in units of long words */
#define NFP_FL_LW_SIZ 2
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 5/7] net/nfp: add trace point about flow rule
2024-06-19 10:07 [PATCH 0/7] add trace support for control message Chaoyong He
` (3 preceding siblings ...)
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 ` Chaoyong He
2024-06-19 10:07 ` [PATCH 6/7] net/nfp: add trace point about flow rule pattern Chaoyong He
` (3 subsequent siblings)
8 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-06-19 10:07 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Add the trace point of control message related with flow rule meta data.
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 | 12 ++++++++++++
drivers/net/nfp/nfp_trace.c | 6 ++++++
drivers/net/nfp/nfp_trace.h | 22 ++++++++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index b07cea9921..9035a9df4f 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -189,6 +189,14 @@ nfp_flower_cmsg_port_mod(struct nfp_app_fw_flower *app_fw_flower,
return 0;
}
+static void
+nfp_flower_trace_cmsg_flow(const char *msg,
+ struct nfp_fl_payload *payload)
+{
+ rte_pmd_nfp_trace_cmsg_flow(msg);
+ rte_pmd_nfp_trace_cmsg_flow_meta(payload->meta);
+}
+
int
nfp_flower_cmsg_flow_delete(struct nfp_app_fw_flower *app_fw_flower,
struct rte_flow *flow)
@@ -221,6 +229,8 @@ nfp_flower_cmsg_flow_delete(struct nfp_app_fw_flower *app_fw_flower,
return -EIO;
}
+ nfp_flower_trace_cmsg_flow("cmsg_flow_delete", &flow->payload);
+
return 0;
}
@@ -256,6 +266,8 @@ nfp_flower_cmsg_flow_add(struct nfp_app_fw_flower *app_fw_flower,
return -EIO;
}
+ nfp_flower_trace_cmsg_flow("cmsg_flow_add", &flow->payload);
+
return 0;
}
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index 529399e1a8..d49fb85259 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -36,3 +36,9 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_mac,
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_qos_rule,
pmd.net.nfp.cmsg.qos.rule)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_meta,
+ pmd.net.nfp.cmsg.flow.meta)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow,
+ pmd.net.nfp.cmsg.flow)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index 5f8f3c373b..e0b8b0cee9 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -221,4 +221,26 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u32(cir);
)
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_meta,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_rule_metadata *meta = cmsg;
+ rte_trace_point_emit_u8(meta->key_len);
+ rte_trace_point_emit_u8(meta->mask_len);
+ rte_trace_point_emit_u8(meta->act_len);
+ rte_trace_point_emit_u8(meta->flags);
+ rte_trace_point_emit_u32(meta->host_ctx_id);
+ rte_trace_point_emit_u64(meta->host_cookie);
+ rte_trace_point_emit_u64(meta->flow_version);
+ rte_trace_point_emit_u32(meta->shortcut);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow,
+ RTE_TRACE_POINT_ARGS(const char *name),
+
+ rte_trace_point_emit_string(name);
+)
+
#endif /* __NFP_TRACE_H__ */
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 6/7] net/nfp: add trace point about flow rule pattern
2024-06-19 10:07 [PATCH 0/7] add trace support for control message Chaoyong He
` (4 preceding siblings ...)
2024-06-19 10:07 ` [PATCH 5/7] net/nfp: add trace point about flow rule Chaoyong He
@ 2024-06-19 10:07 ` Chaoyong He
2024-06-19 10:07 ` [PATCH 7/7] net/nfp: add trace point about flow rule action Chaoyong He
` (2 subsequent siblings)
8 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-06-19 10:07 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Add 11 trace points of control message related with flow rule pattern.
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 | 152 +++++++++++++++++
drivers/net/nfp/nfp_trace.c | 33 ++++
drivers/net/nfp/nfp_trace.h | 199 +++++++++++++++++++++++
3 files changed, 384 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 9035a9df4f..3b492c94ce 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -189,12 +189,164 @@ nfp_flower_cmsg_port_mod(struct nfp_app_fw_flower *app_fw_flower,
return 0;
}
+static bool
+nfp_flower_trace_cmsg_flow_has_tunnel(uint8_t nfp_flow_key_layer,
+ uint32_t nfp_flow_key_layer2)
+{
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_VXLAN) != 0)
+ return true;
+
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META) == 0)
+ return false;
+
+ if ((nfp_flow_key_layer2 & (NFP_FLOWER_LAYER2_GENEVE | NFP_FLOWER_LAYER2_GRE)) != 0)
+ return true;
+
+ return false;
+}
+
+static void
+nfp_flower_trace_cmsg_flow_pattern(char *cmsg,
+ char *end)
+{
+ char *start_p = cmsg;
+
+ if (cmsg >= end) {
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern parameter error");
+ return;
+ }
+
+ struct nfp_flower_meta_tci *meta_tci = (struct nfp_flower_meta_tci *)cmsg;
+ uint8_t nfp_flow_key_layer = meta_tci->nfp_flow_key_layer;
+ uint32_t nfp_flow_key_layer2 = 0;
+
+ rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci(start_p);
+ start_p += sizeof(struct nfp_flower_meta_tci);
+ if (start_p >= end)
+ goto pattern_exit;
+
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META) != 0) {
+ struct nfp_flower_ext_meta *ext_meta = (struct nfp_flower_ext_meta *)start_p;
+ nfp_flow_key_layer2 = rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2);
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ext_meta(start_p);
+ start_p += sizeof(struct nfp_flower_ext_meta);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ rte_pmd_nfp_trace_cmsg_flow_pattern_in_port(start_p);
+ start_p += sizeof(struct nfp_flower_in_port);
+ if (start_p >= end)
+ goto pattern_exit;
+
+ /* L2 layer */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_MAC) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_mac(start_p);
+ start_p += sizeof(struct nfp_flower_mac_mpls);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ /* L4 layer comes first */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_TP) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_tp(start_p);
+ start_p += sizeof(struct nfp_flower_tp_ports);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ /* No tunnel, then L3 layer */
+ if (!nfp_flower_trace_cmsg_flow_has_tunnel(nfp_flow_key_layer, nfp_flow_key_layer2)) {
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4(start_p);
+ start_p += sizeof(struct nfp_flower_ipv4);
+ if (start_p != end)
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern IPv4 length error");
+ } else {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6(start_p);
+ start_p += sizeof(struct nfp_flower_ipv6);
+ if (start_p != end)
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern IPv6 length error");
+ }
+
+ return;
+ }
+
+ /* Tunnel layer */
+ if ((nfp_flow_key_layer2 & NFP_FLOWER_LAYER2_TUN_IPV6) != 0) {
+ if ((nfp_flow_key_layer2 & NFP_FLOWER_LAYER2_GRE) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_gre_tun(start_p);
+ start_p += sizeof(struct nfp_flower_ipv6_gre_tun);
+ if (start_p >= end)
+ goto pattern_exit;
+ } else {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_udp_tun(start_p);
+ start_p += sizeof(struct nfp_flower_ipv6_udp_tun);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+ } else {
+ if ((nfp_flow_key_layer2 & NFP_FLOWER_LAYER2_GRE) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_gre_tun(start_p);
+ start_p += sizeof(struct nfp_flower_ipv4_gre_tun);
+ if (start_p >= end)
+ goto pattern_exit;
+ } else {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_udp_tun(start_p);
+ start_p += sizeof(struct nfp_flower_ipv4_udp_tun);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+ }
+
+ /* Inner L2 layer */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_MAC) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_mac(start_p);
+ start_p += sizeof(struct nfp_flower_mac_mpls);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ /* Inner L4 layer comes first */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_TP) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_tp(start_p);
+ start_p += sizeof(struct nfp_flower_tp_ports);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ /* Inner L3 layer */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4(start_p);
+ start_p += sizeof(struct nfp_flower_ipv4);
+ if (start_p != end) {
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern IPv4 length error");
+ return;
+ }
+ } else {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6(start_p);
+ start_p += sizeof(struct nfp_flower_ipv6);
+ if (start_p != end) {
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern IPv6 length error");
+ return;
+ }
+ }
+
+ return;
+
+pattern_exit:
+ if (start_p != end)
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern overlap");
+}
+
static void
nfp_flower_trace_cmsg_flow(const char *msg,
struct nfp_fl_payload *payload)
{
rte_pmd_nfp_trace_cmsg_flow(msg);
rte_pmd_nfp_trace_cmsg_flow_meta(payload->meta);
+ nfp_flower_trace_cmsg_flow_pattern(payload->unmasked_data, payload->mask_data);
+ nfp_flower_trace_cmsg_flow_pattern(payload->mask_data, payload->action_data);
}
int
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index d49fb85259..61162f7563 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -40,5 +40,38 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_qos_rule,
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_meta,
pmd.net.nfp.cmsg.flow.meta)
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci,
+ pmd.net.nfp.cmsg.flow.pattern.meta_tci)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ext_meta,
+ pmd.net.nfp.cmsg.flow.pattern.ext_meta)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_in_port,
+ pmd.net.nfp.cmsg.flow.pattern.in_port)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_mac,
+ pmd.net.nfp.cmsg.flow.pattern.mac)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_tp,
+ pmd.net.nfp.cmsg.flow.pattern.tp)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4,
+ pmd.net.nfp.cmsg.flow.pattern.ipv4)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6,
+ pmd.net.nfp.cmsg.flow.pattern.ipv6)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_gre_tun,
+ pmd.net.nfp.cmsg.flow.pattern.ipv4_gre_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_udp_tun,
+ pmd.net.nfp.cmsg.flow.pattern.ipv4_udp_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_gre_tun,
+ pmd.net.nfp.cmsg.flow.pattern.ipv6_gre_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_udp_tun,
+ pmd.net.nfp.cmsg.flow.pattern.ipv6_udp_tun)
+
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow,
pmd.net.nfp.cmsg.flow)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index e0b8b0cee9..a5a7cc8faf 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -236,6 +236,205 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u32(meta->shortcut);
)
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_meta_tci *msg = cmsg;
+
+ uint8_t nfp_flow_key_layer = msg->nfp_flow_key_layer;
+ uint8_t mask_id = msg->mask_id;
+ uint16_t tci = rte_be_to_cpu_16(msg->tci);
+
+ rte_trace_point_emit_u8(nfp_flow_key_layer);
+ rte_trace_point_emit_u8(mask_id);
+ rte_trace_point_emit_u16(tci);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ext_meta,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ext_meta *msg = cmsg;
+
+ uint32_t nfp_flow_key_layer2 = rte_be_to_cpu_32(msg->nfp_flow_key_layer2);
+
+ rte_trace_point_emit_u32(nfp_flow_key_layer2);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_in_port,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_in_port *msg = cmsg;
+
+ uint32_t in_port = rte_be_to_cpu_32(msg->in_port);
+
+ rte_trace_point_emit_u32(in_port);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_mac,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_mac_mpls *msg = cmsg;
+
+ uint8_t mac_dst_len = RTE_ETHER_ADDR_LEN;
+ uint8_t mac_src_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *mac_dst = &msg->mac_dst[0];
+ uint8_t *mac_src = &msg->mac_src[0];
+ uint32_t mpls_lse = rte_be_to_cpu_32(msg->mpls_lse);
+
+ rte_trace_point_emit_blob(mac_dst, mac_dst_len);
+ rte_trace_point_emit_blob(mac_src, mac_src_len);
+ rte_trace_point_emit_u32(mpls_lse);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_tp,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_tp_ports *msg = cmsg;
+
+ uint16_t port_src = rte_be_to_cpu_16(msg->port_src);
+ uint16_t port_dst = rte_be_to_cpu_16(msg->port_dst);
+
+ rte_trace_point_emit_u16(port_src);
+ rte_trace_point_emit_u16(port_dst);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv4 *msg = cmsg;
+
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t proto = msg->ip_ext.proto;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint8_t flags = msg->ip_ext.flags;
+ uint32_t ipv4_src = rte_be_to_cpu_16(msg->ipv4_src);
+ uint32_t ipv4_dst = rte_be_to_cpu_16(msg->ipv4_dst);
+
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(proto);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u8(flags);
+ rte_trace_point_emit_u32(ipv4_src);
+ rte_trace_point_emit_u32(ipv4_dst);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv6 *msg = cmsg;
+
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t proto = msg->ip_ext.proto;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint8_t flags = msg->ip_ext.flags;
+ uint8_t ipv6_src_len = 16;
+ uint8_t *ipv6_src = &msg->ipv6_src[0];
+ uint8_t ipv6_dst_len = 16;
+ uint8_t *ipv6_dst = &msg->ipv6_dst[0];
+
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(proto);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u8(flags);
+ rte_trace_point_emit_blob(ipv6_src, ipv6_src_len);
+ rte_trace_point_emit_blob(ipv6_dst, ipv6_dst_len);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_gre_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv4_gre_tun *msg = cmsg;
+
+ uint32_t src = rte_be_to_cpu_32(msg->ipv4.src);
+ uint32_t dst = rte_be_to_cpu_32(msg->ipv4.dst);
+ uint16_t tun_flags = rte_be_to_cpu_16(msg->tun_flags);
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint16_t ethertype = rte_be_to_cpu_16(msg->ethertype);
+ uint32_t tun_key = rte_be_to_cpu_32(msg->tun_key);
+
+ rte_trace_point_emit_u32(src);
+ rte_trace_point_emit_u32(dst);
+ rte_trace_point_emit_u16(tun_flags);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u16(ethertype);
+ rte_trace_point_emit_u32(tun_key);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_udp_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv4_udp_tun *msg = cmsg;
+
+ uint32_t src = rte_be_to_cpu_32(msg->ipv4.src);
+ uint32_t dst = rte_be_to_cpu_32(msg->ipv4.dst);
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint32_t tun_id = rte_be_to_cpu_32(msg->tun_id);
+
+ rte_trace_point_emit_u32(src);
+ rte_trace_point_emit_u32(dst);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u32(tun_id);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_gre_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv6_gre_tun *msg = cmsg;
+
+ uint8_t ipv6_src_len = 16;
+ uint8_t *ipv6_src = &msg->ipv6.ipv6_src[0];
+ uint8_t ipv6_dst_len = 16;
+ uint8_t *ipv6_dst = &msg->ipv6.ipv6_dst[0];
+ uint16_t tun_flags = rte_be_to_cpu_16(msg->tun_flags);
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint16_t ethertype = rte_be_to_cpu_16(msg->ethertype);
+ uint32_t tun_key = rte_be_to_cpu_32(msg->tun_key);
+
+ rte_trace_point_emit_blob(ipv6_src, ipv6_src_len);
+ rte_trace_point_emit_blob(ipv6_dst, ipv6_dst_len);
+ rte_trace_point_emit_u16(tun_flags);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u16(ethertype);
+ rte_trace_point_emit_u32(tun_key);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_udp_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv6_udp_tun *msg = cmsg;
+
+ uint8_t ipv6_src_len = 16;
+ uint8_t *ipv6_src = &msg->ipv6.ipv6_src[0];
+ uint8_t ipv6_dst_len = 16;
+ uint8_t *ipv6_dst = &msg->ipv6.ipv6_dst[0];
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint32_t tun_id = rte_be_to_cpu_32(msg->tun_id);
+
+ rte_trace_point_emit_blob(ipv6_src, ipv6_src_len);
+ rte_trace_point_emit_blob(ipv6_dst, ipv6_dst_len);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u32(tun_id);
+)
+
RTE_TRACE_POINT(
rte_pmd_nfp_trace_cmsg_flow,
RTE_TRACE_POINT_ARGS(const char *name),
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 7/7] net/nfp: add trace point about flow rule action
2024-06-19 10:07 [PATCH 0/7] add trace support for control message Chaoyong He
` (5 preceding siblings ...)
2024-06-19 10:07 ` [PATCH 6/7] net/nfp: add trace point about flow rule pattern Chaoyong He
@ 2024-06-19 10:07 ` Chaoyong He
2024-07-07 22:43 ` [PATCH 0/7] add trace support for control message Ferruh Yigit
2024-07-08 2:45 ` [PATCH v2 " Chaoyong He
8 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-06-19 10:07 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Add 13 trace points of control message related with flow rule action
list.
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 | 78 ++++++
drivers/net/nfp/nfp_trace.c | 39 +++
drivers/net/nfp/nfp_trace.h | 298 +++++++++++++++++++++++
3 files changed, 415 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 3b492c94ce..bd1fa71d9b 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -339,14 +339,92 @@ nfp_flower_trace_cmsg_flow_pattern(char *cmsg,
PMD_DRV_LOG(ERR, "Cmsg flow pattern overlap");
}
+static void
+nfp_flower_trace_cmsg_flow_action(char *cmsg,
+ uint8_t len)
+{
+ uint8_t len_tmp;
+
+ if (len == 0) {
+ PMD_DRV_LOG(ERR, "Cmsg flow action length is 0");
+ return;
+ }
+
+ for (len_tmp = 0; len_tmp < len;) {
+ struct nfp_fl_act_head *head = (struct nfp_fl_act_head *)(cmsg + len_tmp);
+
+ switch (head->jump_id) {
+ case NFP_FL_ACTION_OPCODE_OUTPUT:
+ rte_pmd_nfp_trace_cmsg_flow_action_output(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_PUSH_VLAN:
+ rte_pmd_nfp_trace_cmsg_flow_action_push_vlan(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_POP_VLAN:
+ rte_pmd_nfp_trace_cmsg_flow_action_pop_vlan(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_TUNNEL:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_tun(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_ETHERNET:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_eth(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_addr(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_ttl_tos(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_IPV6_SRC:
+ /* FALLTHROUGH */
+ case NFP_FL_ACTION_OPCODE_SET_IPV6_DST:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_addr(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_tc_hl_fl(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_TCP:
+ /* FALLTHROUGH */
+ case NFP_FL_ACTION_OPCODE_SET_UDP:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_tp(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_PRE_TUNNEL:
+ rte_pmd_nfp_trace_cmsg_flow_action_pre_tun(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_METER:
+ rte_pmd_nfp_trace_cmsg_flow_action_meter(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_PARTIAL:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_partial(head);
+ break;
+ default:
+ PMD_DRV_LOG(ERR, "Cmsg flow action not support");
+ return;
+ }
+
+ len_tmp += head->len_lw << NFP_FL_LW_SIZ;
+ }
+
+ if (len_tmp > len) {
+ PMD_DRV_LOG(ERR, "Cmsg flow action length error");
+ return;
+ }
+}
+
static void
nfp_flower_trace_cmsg_flow(const char *msg,
struct nfp_fl_payload *payload)
{
+ struct nfp_fl_rule_metadata *nfp_flow_meta;
+
rte_pmd_nfp_trace_cmsg_flow(msg);
rte_pmd_nfp_trace_cmsg_flow_meta(payload->meta);
nfp_flower_trace_cmsg_flow_pattern(payload->unmasked_data, payload->mask_data);
nfp_flower_trace_cmsg_flow_pattern(payload->mask_data, payload->action_data);
+
+ nfp_flow_meta = payload->meta;
+ nfp_flower_trace_cmsg_flow_action(payload->action_data,
+ nfp_flow_meta->act_len << NFP_FL_LW_SIZ);
}
int
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index 61162f7563..9cca76e32c 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -73,5 +73,44 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_gre_tun,
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_udp_tun,
pmd.net.nfp.cmsg.flow.pattern.ipv6_udp_tun)
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_output,
+ pmd.net.nfp.cmsg.flow.action.output)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_push_vlan,
+ pmd.net.nfp.cmsg.flow.action.push_vlan)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_pop_vlan,
+ pmd.net.nfp.cmsg.flow.action.pop_vlan)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_tun,
+ pmd.net.nfp.cmsg.flow.action.set_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_eth,
+ pmd.net.nfp.cmsg.flow.action.set_eth)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_addr,
+ pmd.net.nfp.cmsg.flow.action.set_ipv4_addr)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_ttl_tos,
+ pmd.net.nfp.cmsg.flow.action.set_ipv4_ttl_tos)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_addr,
+ pmd.net.nfp.cmsg.flow.action.set_ipv6_addr)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_tc_hl_fl,
+ pmd.net.nfp.cmsg.flow.action.set_ipv6_tc_hl_fl)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_tp,
+ pmd.net.nfp.cmsg.flow.action.set_tp)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_pre_tun,
+ pmd.net.nfp.cmsg.flow.action.pre_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_meter,
+ pmd.net.nfp.cmsg.flow.action.meter)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_partial,
+ pmd.net.nfp.cmsg.flow.action.set_partial)
+
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow,
pmd.net.nfp.cmsg.flow)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index a5a7cc8faf..576cb37c3a 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -435,6 +435,304 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u32(tun_id);
)
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_output,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_output *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint16_t flags = rte_be_to_cpu_16(msg->flags);
+ uint32_t port = rte_be_to_cpu_32(msg->port);
+
+ rte_trace_point_emit_u16(flags);
+ rte_trace_point_emit_u32(port);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_push_vlan,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_push_vlan *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint16_t vlan_tpid = rte_be_to_cpu_16(msg->vlan_tpid);
+ uint16_t vlan_tci = rte_be_to_cpu_16(msg->vlan_tci);
+
+ rte_trace_point_emit_u16(vlan_tpid);
+ rte_trace_point_emit_u16(vlan_tci);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_pop_vlan,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_pop_vlan *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_tun *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint64_t tun_id = rte_be_to_cpu_64(msg->tun_id);
+ uint32_t tun_type_index = rte_be_to_cpu_32(msg->tun_type_index);
+ uint16_t tun_flags = rte_be_to_cpu_16(msg->tun_flags);
+ uint8_t ttl = msg->ttl;
+ uint8_t tos = msg->tos;
+ uint8_t tun_len = msg->tun_len;
+ uint16_t tun_proto = rte_be_to_cpu_16(msg->tun_proto);
+
+ rte_trace_point_emit_u64(tun_id);
+ rte_trace_point_emit_u32(tun_type_index);
+ rte_trace_point_emit_u16(tun_flags);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(tun_len);
+ rte_trace_point_emit_u16(tun_proto);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_eth,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_eth *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint8_t dst_mask_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *dst_mask = &msg->eth_addr_mask[0];
+ uint8_t src_mask_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *src_mask = &msg->eth_addr_mask[RTE_ETHER_ADDR_LEN];
+ uint8_t dst_addr_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *dst_addr = &msg->eth_addr[0];
+ uint8_t src_addr_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *src_addr = &msg->eth_addr[RTE_ETHER_ADDR_LEN];
+
+ rte_trace_point_emit_blob(dst_mask, dst_mask_len);
+ rte_trace_point_emit_blob(src_mask, src_mask_len);
+ rte_trace_point_emit_blob(dst_addr, dst_addr_len);
+ rte_trace_point_emit_blob(src_addr, src_addr_len);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_addr,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_ip4_addrs *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint32_t ipv4_src_mask = rte_be_to_cpu_32(msg->ipv4_src_mask);
+ uint32_t ipv4_src = rte_be_to_cpu_32(msg->ipv4_src);
+ uint32_t ipv4_dst_mask = rte_be_to_cpu_32(msg->ipv4_dst_mask);
+ uint32_t ipv4_dst = rte_be_to_cpu_32(msg->ipv4_dst);
+
+ rte_trace_point_emit_u32(ipv4_src_mask);
+ rte_trace_point_emit_u32(ipv4_src);
+ rte_trace_point_emit_u32(ipv4_dst_mask);
+ rte_trace_point_emit_u32(ipv4_dst);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_ttl_tos,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_ip4_ttl_tos *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint8_t ipv4_ttl_mask = msg->ipv4_ttl_mask;
+ uint8_t ipv4_tos_mask = msg->ipv4_tos_mask;
+ uint8_t ipv4_ttl = msg->ipv4_ttl;
+ uint8_t ipv4_tos = msg->ipv4_tos;
+
+ rte_trace_point_emit_u8(ipv4_ttl_mask);
+ rte_trace_point_emit_u8(ipv4_tos_mask);
+ rte_trace_point_emit_u8(ipv4_ttl);
+ rte_trace_point_emit_u8(ipv4_tos);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_addr,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_ipv6_addr *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint32_t ipv6_0_mask = rte_be_to_cpu_32(msg->ipv6[0].mask);
+ uint32_t ipv6_0_exact = rte_be_to_cpu_32(msg->ipv6[0].exact);
+ uint32_t ipv6_1_mask = rte_be_to_cpu_32(msg->ipv6[1].mask);
+ uint32_t ipv6_1_exact = rte_be_to_cpu_32(msg->ipv6[1].exact);
+ uint32_t ipv6_2_mask = rte_be_to_cpu_32(msg->ipv6[2].mask);
+ uint32_t ipv6_2_exact = rte_be_to_cpu_32(msg->ipv6[2].exact);
+ uint32_t ipv6_3_mask = rte_be_to_cpu_32(msg->ipv6[3].mask);
+ uint32_t ipv6_3_exact = rte_be_to_cpu_32(msg->ipv6[3].exact);
+
+ rte_trace_point_emit_u32(ipv6_0_mask);
+ rte_trace_point_emit_u32(ipv6_0_exact);
+ rte_trace_point_emit_u32(ipv6_1_mask);
+ rte_trace_point_emit_u32(ipv6_1_exact);
+ rte_trace_point_emit_u32(ipv6_2_mask);
+ rte_trace_point_emit_u32(ipv6_2_exact);
+ rte_trace_point_emit_u32(ipv6_3_mask);
+ rte_trace_point_emit_u32(ipv6_3_exact);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_tc_hl_fl,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_ipv6_tc_hl_fl *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint8_t ipv6_tc_mask = msg->ipv6_tc_mask;
+ uint8_t ipv6_hop_limit_mask = msg->ipv6_hop_limit_mask;
+ uint8_t ipv6_tc = msg->ipv6_tc;
+ uint8_t ipv6_hop_limit = msg->ipv6_hop_limit;
+
+ rte_trace_point_emit_u8(ipv6_tc_mask);
+ rte_trace_point_emit_u8(ipv6_hop_limit_mask);
+ rte_trace_point_emit_u8(ipv6_tc);
+ rte_trace_point_emit_u8(ipv6_hop_limit);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_tp,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_tport *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint16_t src_port_mask = rte_be_to_cpu_16(msg->src_port_mask);
+ uint16_t dst_port_mask = rte_be_to_cpu_16(msg->dst_port_mask);
+ uint16_t src_port = rte_be_to_cpu_16(msg->src_port);
+ uint16_t dst_port = rte_be_to_cpu_16(msg->dst_port);
+
+ rte_trace_point_emit_u16(src_port_mask);
+ rte_trace_point_emit_u16(dst_port_mask);
+ rte_trace_point_emit_u16(src_port);
+ rte_trace_point_emit_u16(dst_port);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_pre_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_pre_tun *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint16_t flags = rte_be_to_cpu_16(msg->flags);
+ uint32_t ipv4_dst = rte_be_to_cpu_32(msg->ipv4_dst);
+ uint8_t ipv6_dst_len = 16;
+ uint8_t *ipv6_dst = msg->ipv6_dst;
+
+ rte_trace_point_emit_u16(flags);
+ if ((flags & NFP_FL_PRE_TUN_IPV6) != 0)
+ rte_trace_point_emit_blob(ipv6_dst, ipv6_dst_len);
+ else
+ rte_trace_point_emit_u32(ipv4_dst);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_meter,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_meter *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint32_t profile_id = rte_be_to_cpu_32(msg->profile_id);
+
+ rte_trace_point_emit_u32(profile_id);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_partial,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_mark *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint32_t mark = rte_be_to_cpu_32(msg->mark);
+
+ rte_trace_point_emit_u32(mark);
+
+ if (len_lw > sizeof(struct nfp_fl_act_mark) >> NFP_FL_LW_SIZ) {
+ struct nfp_fl_act_partial *partial = cmsg;
+
+ uint8_t flag = partial->flag;
+ uint16_t queue_id = rte_be_to_cpu_16(partial->queue_id);
+
+ rte_trace_point_emit_u8(flag);
+ rte_trace_point_emit_u16(queue_id);
+ }
+)
+
RTE_TRACE_POINT(
rte_pmd_nfp_trace_cmsg_flow,
RTE_TRACE_POINT_ARGS(const char *name),
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/7] add trace support for control message
2024-06-19 10:07 [PATCH 0/7] add trace support for control message Chaoyong He
` (6 preceding siblings ...)
2024-06-19 10:07 ` [PATCH 7/7] net/nfp: add trace point about flow rule action Chaoyong He
@ 2024-07-07 22:43 ` Ferruh Yigit
2024-07-08 1:42 ` Chaoyong He
2024-07-08 2:45 ` [PATCH v2 " Chaoyong He
8 siblings, 1 reply; 21+ messages in thread
From: Ferruh Yigit @ 2024-07-07 22:43 UTC (permalink / raw)
To: Chaoyong He, dev; +Cc: oss-drivers
On 6/19/2024 11:07 AM, Chaoyong He wrote:
> This patch series add trace support for control message send
> to flower firmware.
>
> Chaoyong He (7):
> net/nfp: add trace points about port
> net/nfp: add trace point about tunnel
> net/nfp: add trace point about Qos
> net/nfp: refactor to prepare for add flow trace point
> net/nfp: add trace point about flow rule
> net/nfp: add trace point about flow rule pattern
> net/nfp: add trace point about flow rule action
>
Hi Chaoyong,
After this patch github action reports crash on testpmd.
CI seems not run with this patch as it fails to apply. Can you please
check the CI and send a new version of the patch?
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH 0/7] add trace support for control message
2024-07-07 22:43 ` [PATCH 0/7] add trace support for control message Ferruh Yigit
@ 2024-07-08 1:42 ` Chaoyong He
0 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 1:42 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: oss-drivers
> On 6/19/2024 11:07 AM, Chaoyong He wrote:
> > This patch series add trace support for control message send to flower
> > firmware.
> >
> > Chaoyong He (7):
> > net/nfp: add trace points about port
> > net/nfp: add trace point about tunnel
> > net/nfp: add trace point about Qos
> > net/nfp: refactor to prepare for add flow trace point
> > net/nfp: add trace point about flow rule
> > net/nfp: add trace point about flow rule pattern
> > net/nfp: add trace point about flow rule action
> >
>
> Hi Chaoyong,
>
> After this patch github action reports crash on testpmd.
> CI seems not run with this patch as it fails to apply. Can you please check the CI
> and send a new version of the patch?
Yes, we might have sent too many patches at a time, which might mess up the CI.
I will check the CI and send new version patches out (also rebase if needed).
Thanks for remind.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 0/7] add trace support for control message
2024-06-19 10:07 [PATCH 0/7] add trace support for control message Chaoyong He
` (7 preceding siblings ...)
2024-07-07 22:43 ` [PATCH 0/7] add trace support for control message Ferruh Yigit
@ 2024-07-08 2:45 ` Chaoyong He
2024-07-08 2:45 ` [PATCH v2 1/7] net/nfp: add trace points about port Chaoyong He
` (7 more replies)
8 siblings, 8 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 2:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He
This patch series add trace support for control message send
to flower firmware.
---
v2: rebase to the latest main branch.
---
Chaoyong He (7):
net/nfp: add trace points about port
net/nfp: add trace point about tunnel
net/nfp: add trace point about Qos
net/nfp: refactor to prepare for add flow trace point
net/nfp: add trace point about flow rule
net/nfp: add trace point about flow rule pattern
net/nfp: add trace point about flow rule action
drivers/net/nfp/flower/nfp_flower_cmsg.c | 277 ++++++++-
drivers/net/nfp/flower/nfp_flower_cmsg.h | 14 +-
drivers/net/nfp/flower/nfp_flower_flow.c | 46 --
drivers/net/nfp/flower/nfp_flower_flow.h | 46 ++
drivers/net/nfp/meson.build | 1 +
drivers/net/nfp/nfp_trace.c | 116 ++++
drivers/net/nfp/nfp_trace.h | 743 +++++++++++++++++++++++
7 files changed, 1186 insertions(+), 57 deletions(-)
create mode 100644 drivers/net/nfp/nfp_trace.c
create mode 100644 drivers/net/nfp/nfp_trace.h
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 1/7] net/nfp: add trace points about port
2024-07-08 2:45 ` [PATCH v2 " Chaoyong He
@ 2024-07-08 2:45 ` Chaoyong He
2024-07-08 2:45 ` [PATCH v2 2/7] net/nfp: add trace point about tunnel Chaoyong He
` (6 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 2:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
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 d805644ec5..b7e5beffb0 100644
--- a/drivers/net/nfp/meson.build
+++ b/drivers/net/nfp/meson.build
@@ -44,6 +44,7 @@ sources = files(
'nfp_net_meta.c',
'nfp_rxtx.c',
'nfp_service.c',
+ 'nfp_trace.c',
)
deps += ['hash', 'security', 'common_nfp']
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 2/7] net/nfp: add trace point about tunnel
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
2024-07-08 2:45 ` [PATCH v2 3/7] net/nfp: add trace point about Qos Chaoyong He
` (5 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 2:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 3/7] net/nfp: add trace point about Qos
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 ` Chaoyong He
2024-07-08 2:45 ` [PATCH v2 4/7] net/nfp: refactor to prepare for add flow trace point Chaoyong He
` (4 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 2:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Add 1 trace point of control message related with Qos.
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 | 4 ++++
drivers/net/nfp/nfp_trace.c | 3 +++
drivers/net/nfp/nfp_trace.h | 29 ++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 30ce68b42d..b07cea9921 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -528,6 +528,8 @@ nfp_flower_cmsg_qos_add(struct nfp_app_fw_flower *app_fw_flower,
return -EIO;
}
+ rte_pmd_nfp_trace_cmsg_qos_rule("cmsg_qos_add", msg);
+
return 0;
}
@@ -558,6 +560,8 @@ nfp_flower_cmsg_qos_delete(struct nfp_app_fw_flower *app_fw_flower,
return -EIO;
}
+ rte_pmd_nfp_trace_cmsg_qos_rule("cmsg_qos_delete", msg);
+
return 0;
}
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index 730ffaa32e..529399e1a8 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -33,3 +33,6 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_pre_tun,
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_mac,
pmd.net.nfp.cmsg.tun.mac_rule)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_qos_rule,
+ pmd.net.nfp.cmsg.qos.rule)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index 48a14efd3a..5f8f3c373b 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -192,4 +192,33 @@ RTE_TRACE_POINT(
rte_trace_point_emit_blob(addr_bytes, len);
)
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_qos_rule,
+ RTE_TRACE_POINT_ARGS(const char *name, void *cmsg),
+
+ rte_trace_point_emit_string(name);
+
+ struct nfp_profile_conf *msg = cmsg;
+ uint32_t bkt_tkn_p = rte_be_to_cpu_32(msg->bkt_tkn_p);
+ uint32_t bkt_tkn_c = rte_be_to_cpu_32(msg->bkt_tkn_c);
+ uint32_t pbs = rte_be_to_cpu_32(msg->pbs);
+ uint32_t cbs = rte_be_to_cpu_32(msg->cbs);
+ uint32_t pir = rte_be_to_cpu_32(msg->pir);
+ uint32_t cir = rte_be_to_cpu_32(msg->cir);
+
+ struct nfp_cfg_head *head = &msg->head;
+ uint32_t flags_opts = rte_be_to_cpu_32(head->flags_opts);
+ uint32_t profile_id = rte_be_to_cpu_32(head->profile_id);
+
+ rte_trace_point_emit_u32(flags_opts);
+ rte_trace_point_emit_u32(profile_id);
+
+ rte_trace_point_emit_u32(bkt_tkn_p);
+ rte_trace_point_emit_u32(bkt_tkn_c);
+ rte_trace_point_emit_u32(pbs);
+ rte_trace_point_emit_u32(cbs);
+ rte_trace_point_emit_u32(pir);
+ rte_trace_point_emit_u32(cir);
+)
+
#endif /* __NFP_TRACE_H__ */
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 4/7] net/nfp: refactor to prepare for add flow trace point
2024-07-08 2:45 ` [PATCH v2 " Chaoyong He
` (2 preceding siblings ...)
2024-07-08 2:45 ` [PATCH v2 3/7] net/nfp: add trace point about Qos Chaoyong He
@ 2024-07-08 2:45 ` Chaoyong He
2024-07-08 2:45 ` [PATCH v2 5/7] net/nfp: add trace point about flow rule Chaoyong He
` (3 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 2:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Refactor 'nfp_flower_flow' module, move some macro into the header file
in order to prepare for flow trace points.
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_flow.c | 46 ------------------------
drivers/net/nfp/flower/nfp_flower_flow.h | 46 ++++++++++++++++++++++++
2 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index 92e8d08d94..d127171fdb 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -16,21 +16,6 @@
#include "nfp_logs.h"
#include "nfp_mtr.h"
-#define NFP_FLOWER_LAYER_EXT_META RTE_BIT32(0)
-#define NFP_FLOWER_LAYER_PORT RTE_BIT32(1)
-#define NFP_FLOWER_LAYER_MAC RTE_BIT32(2)
-#define NFP_FLOWER_LAYER_TP RTE_BIT32(3)
-#define NFP_FLOWER_LAYER_IPV4 RTE_BIT32(4)
-#define NFP_FLOWER_LAYER_IPV6 RTE_BIT32(5)
-#define NFP_FLOWER_LAYER_CT RTE_BIT32(6)
-#define NFP_FLOWER_LAYER_VXLAN RTE_BIT32(7)
-
-#define NFP_FLOWER_LAYER2_GRE RTE_BIT32(0)
-#define NFP_FLOWER_LAYER2_QINQ RTE_BIT32(4)
-#define NFP_FLOWER_LAYER2_GENEVE RTE_BIT32(5)
-#define NFP_FLOWER_LAYER2_GENEVE_OP RTE_BIT32(6)
-#define NFP_FLOWER_LAYER2_TUN_IPV6 RTE_BIT32(7)
-
/* Compressed HW representation of TCP Flags */
#define NFP_FL_TCP_FLAG_FIN RTE_BIT32(0)
#define NFP_FL_TCP_FLAG_SYN RTE_BIT32(1)
@@ -55,37 +40,6 @@
/* GRE Tunnel flags */
#define NFP_FL_GRE_FLAG_KEY (1 << 2)
-/* Action opcodes */
-#define NFP_FL_ACTION_OPCODE_OUTPUT 0
-#define NFP_FL_ACTION_OPCODE_PUSH_VLAN 1
-#define NFP_FL_ACTION_OPCODE_POP_VLAN 2
-#define NFP_FL_ACTION_OPCODE_PUSH_MPLS 3
-#define NFP_FL_ACTION_OPCODE_POP_MPLS 4
-#define NFP_FL_ACTION_OPCODE_USERSPACE 5
-#define NFP_FL_ACTION_OPCODE_SET_TUNNEL 6
-#define NFP_FL_ACTION_OPCODE_SET_ETHERNET 7
-#define NFP_FL_ACTION_OPCODE_SET_MPLS 8
-#define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS 9
-#define NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS 10
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC 11
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_DST 12
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL 13
-#define NFP_FL_ACTION_OPCODE_SET_UDP 14
-#define NFP_FL_ACTION_OPCODE_SET_TCP 15
-#define NFP_FL_ACTION_OPCODE_PRE_LAG 16
-#define NFP_FL_ACTION_OPCODE_PRE_TUNNEL 17
-#define NFP_FL_ACTION_OPCODE_PRE_GS 18
-#define NFP_FL_ACTION_OPCODE_GS 19
-#define NFP_FL_ACTION_OPCODE_PUSH_NSH 20
-#define NFP_FL_ACTION_OPCODE_POP_NSH 21
-#define NFP_FL_ACTION_OPCODE_SET_QUEUE 22
-#define NFP_FL_ACTION_OPCODE_CONNTRACK 23
-#define NFP_FL_ACTION_OPCODE_METER 24
-#define NFP_FL_ACTION_OPCODE_CT_NAT_EXT 25
-#define NFP_FL_ACTION_OPCODE_PUSH_GENEVE 26
-#define NFP_FL_ACTION_OPCODE_SET_PARTIAL 27
-#define NFP_FL_ACTION_OPCODE_NUM 32
-
#define NFP_FL_OUT_FLAGS_LAST RTE_BIT32(15)
/* Tunnel ports */
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.h b/drivers/net/nfp/flower/nfp_flower_flow.h
index f54ad6cf55..c1c8014699 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.h
+++ b/drivers/net/nfp/flower/nfp_flower_flow.h
@@ -9,6 +9,52 @@
#include "../nfp_net_common.h"
#include "nfp_flower.h"
+#define NFP_FLOWER_LAYER_EXT_META RTE_BIT32(0)
+#define NFP_FLOWER_LAYER_PORT RTE_BIT32(1)
+#define NFP_FLOWER_LAYER_MAC RTE_BIT32(2)
+#define NFP_FLOWER_LAYER_TP RTE_BIT32(3)
+#define NFP_FLOWER_LAYER_IPV4 RTE_BIT32(4)
+#define NFP_FLOWER_LAYER_IPV6 RTE_BIT32(5)
+#define NFP_FLOWER_LAYER_CT RTE_BIT32(6)
+#define NFP_FLOWER_LAYER_VXLAN RTE_BIT32(7)
+
+#define NFP_FLOWER_LAYER2_GRE RTE_BIT32(0)
+#define NFP_FLOWER_LAYER2_QINQ RTE_BIT32(4)
+#define NFP_FLOWER_LAYER2_GENEVE RTE_BIT32(5)
+#define NFP_FLOWER_LAYER2_GENEVE_OP RTE_BIT32(6)
+#define NFP_FLOWER_LAYER2_TUN_IPV6 RTE_BIT32(7)
+
+/* Action opcodes */
+#define NFP_FL_ACTION_OPCODE_OUTPUT 0
+#define NFP_FL_ACTION_OPCODE_PUSH_VLAN 1
+#define NFP_FL_ACTION_OPCODE_POP_VLAN 2
+#define NFP_FL_ACTION_OPCODE_PUSH_MPLS 3
+#define NFP_FL_ACTION_OPCODE_POP_MPLS 4
+#define NFP_FL_ACTION_OPCODE_USERSPACE 5
+#define NFP_FL_ACTION_OPCODE_SET_TUNNEL 6
+#define NFP_FL_ACTION_OPCODE_SET_ETHERNET 7
+#define NFP_FL_ACTION_OPCODE_SET_MPLS 8
+#define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS 9
+#define NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS 10
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC 11
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_DST 12
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL 13
+#define NFP_FL_ACTION_OPCODE_SET_UDP 14
+#define NFP_FL_ACTION_OPCODE_SET_TCP 15
+#define NFP_FL_ACTION_OPCODE_PRE_LAG 16
+#define NFP_FL_ACTION_OPCODE_PRE_TUNNEL 17
+#define NFP_FL_ACTION_OPCODE_PRE_GS 18
+#define NFP_FL_ACTION_OPCODE_GS 19
+#define NFP_FL_ACTION_OPCODE_PUSH_NSH 20
+#define NFP_FL_ACTION_OPCODE_POP_NSH 21
+#define NFP_FL_ACTION_OPCODE_SET_QUEUE 22
+#define NFP_FL_ACTION_OPCODE_CONNTRACK 23
+#define NFP_FL_ACTION_OPCODE_METER 24
+#define NFP_FL_ACTION_OPCODE_CT_NAT_EXT 25
+#define NFP_FL_ACTION_OPCODE_PUSH_GENEVE 26
+#define NFP_FL_ACTION_OPCODE_SET_PARTIAL 27
+#define NFP_FL_ACTION_OPCODE_NUM 32
+
/* The firmware expects lengths in units of long words */
#define NFP_FL_LW_SIZ 2
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 5/7] net/nfp: add trace point about flow rule
2024-07-08 2:45 ` [PATCH v2 " Chaoyong He
` (3 preceding siblings ...)
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 ` Chaoyong He
2024-07-08 2:45 ` [PATCH v2 6/7] net/nfp: add trace point about flow rule pattern Chaoyong He
` (2 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 2:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Add the trace point of control message related with flow rule meta data.
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 | 12 ++++++++++++
drivers/net/nfp/nfp_trace.c | 6 ++++++
drivers/net/nfp/nfp_trace.h | 22 ++++++++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index b07cea9921..9035a9df4f 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -189,6 +189,14 @@ nfp_flower_cmsg_port_mod(struct nfp_app_fw_flower *app_fw_flower,
return 0;
}
+static void
+nfp_flower_trace_cmsg_flow(const char *msg,
+ struct nfp_fl_payload *payload)
+{
+ rte_pmd_nfp_trace_cmsg_flow(msg);
+ rte_pmd_nfp_trace_cmsg_flow_meta(payload->meta);
+}
+
int
nfp_flower_cmsg_flow_delete(struct nfp_app_fw_flower *app_fw_flower,
struct rte_flow *flow)
@@ -221,6 +229,8 @@ nfp_flower_cmsg_flow_delete(struct nfp_app_fw_flower *app_fw_flower,
return -EIO;
}
+ nfp_flower_trace_cmsg_flow("cmsg_flow_delete", &flow->payload);
+
return 0;
}
@@ -256,6 +266,8 @@ nfp_flower_cmsg_flow_add(struct nfp_app_fw_flower *app_fw_flower,
return -EIO;
}
+ nfp_flower_trace_cmsg_flow("cmsg_flow_add", &flow->payload);
+
return 0;
}
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index 529399e1a8..d49fb85259 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -36,3 +36,9 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_tun_mac,
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_qos_rule,
pmd.net.nfp.cmsg.qos.rule)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_meta,
+ pmd.net.nfp.cmsg.flow.meta)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow,
+ pmd.net.nfp.cmsg.flow)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index 5f8f3c373b..e0b8b0cee9 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -221,4 +221,26 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u32(cir);
)
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_meta,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_rule_metadata *meta = cmsg;
+ rte_trace_point_emit_u8(meta->key_len);
+ rte_trace_point_emit_u8(meta->mask_len);
+ rte_trace_point_emit_u8(meta->act_len);
+ rte_trace_point_emit_u8(meta->flags);
+ rte_trace_point_emit_u32(meta->host_ctx_id);
+ rte_trace_point_emit_u64(meta->host_cookie);
+ rte_trace_point_emit_u64(meta->flow_version);
+ rte_trace_point_emit_u32(meta->shortcut);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow,
+ RTE_TRACE_POINT_ARGS(const char *name),
+
+ rte_trace_point_emit_string(name);
+)
+
#endif /* __NFP_TRACE_H__ */
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 6/7] net/nfp: add trace point about flow rule pattern
2024-07-08 2:45 ` [PATCH v2 " Chaoyong He
` (4 preceding siblings ...)
2024-07-08 2:45 ` [PATCH v2 5/7] net/nfp: add trace point about flow rule Chaoyong He
@ 2024-07-08 2:45 ` 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
7 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 2:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Add 11 trace points of control message related with flow rule pattern.
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 | 152 +++++++++++++++++
drivers/net/nfp/nfp_trace.c | 33 ++++
drivers/net/nfp/nfp_trace.h | 199 +++++++++++++++++++++++
3 files changed, 384 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 9035a9df4f..3b492c94ce 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -189,12 +189,164 @@ nfp_flower_cmsg_port_mod(struct nfp_app_fw_flower *app_fw_flower,
return 0;
}
+static bool
+nfp_flower_trace_cmsg_flow_has_tunnel(uint8_t nfp_flow_key_layer,
+ uint32_t nfp_flow_key_layer2)
+{
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_VXLAN) != 0)
+ return true;
+
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META) == 0)
+ return false;
+
+ if ((nfp_flow_key_layer2 & (NFP_FLOWER_LAYER2_GENEVE | NFP_FLOWER_LAYER2_GRE)) != 0)
+ return true;
+
+ return false;
+}
+
+static void
+nfp_flower_trace_cmsg_flow_pattern(char *cmsg,
+ char *end)
+{
+ char *start_p = cmsg;
+
+ if (cmsg >= end) {
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern parameter error");
+ return;
+ }
+
+ struct nfp_flower_meta_tci *meta_tci = (struct nfp_flower_meta_tci *)cmsg;
+ uint8_t nfp_flow_key_layer = meta_tci->nfp_flow_key_layer;
+ uint32_t nfp_flow_key_layer2 = 0;
+
+ rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci(start_p);
+ start_p += sizeof(struct nfp_flower_meta_tci);
+ if (start_p >= end)
+ goto pattern_exit;
+
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META) != 0) {
+ struct nfp_flower_ext_meta *ext_meta = (struct nfp_flower_ext_meta *)start_p;
+ nfp_flow_key_layer2 = rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2);
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ext_meta(start_p);
+ start_p += sizeof(struct nfp_flower_ext_meta);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ rte_pmd_nfp_trace_cmsg_flow_pattern_in_port(start_p);
+ start_p += sizeof(struct nfp_flower_in_port);
+ if (start_p >= end)
+ goto pattern_exit;
+
+ /* L2 layer */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_MAC) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_mac(start_p);
+ start_p += sizeof(struct nfp_flower_mac_mpls);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ /* L4 layer comes first */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_TP) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_tp(start_p);
+ start_p += sizeof(struct nfp_flower_tp_ports);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ /* No tunnel, then L3 layer */
+ if (!nfp_flower_trace_cmsg_flow_has_tunnel(nfp_flow_key_layer, nfp_flow_key_layer2)) {
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4(start_p);
+ start_p += sizeof(struct nfp_flower_ipv4);
+ if (start_p != end)
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern IPv4 length error");
+ } else {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6(start_p);
+ start_p += sizeof(struct nfp_flower_ipv6);
+ if (start_p != end)
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern IPv6 length error");
+ }
+
+ return;
+ }
+
+ /* Tunnel layer */
+ if ((nfp_flow_key_layer2 & NFP_FLOWER_LAYER2_TUN_IPV6) != 0) {
+ if ((nfp_flow_key_layer2 & NFP_FLOWER_LAYER2_GRE) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_gre_tun(start_p);
+ start_p += sizeof(struct nfp_flower_ipv6_gre_tun);
+ if (start_p >= end)
+ goto pattern_exit;
+ } else {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_udp_tun(start_p);
+ start_p += sizeof(struct nfp_flower_ipv6_udp_tun);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+ } else {
+ if ((nfp_flow_key_layer2 & NFP_FLOWER_LAYER2_GRE) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_gre_tun(start_p);
+ start_p += sizeof(struct nfp_flower_ipv4_gre_tun);
+ if (start_p >= end)
+ goto pattern_exit;
+ } else {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_udp_tun(start_p);
+ start_p += sizeof(struct nfp_flower_ipv4_udp_tun);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+ }
+
+ /* Inner L2 layer */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_MAC) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_mac(start_p);
+ start_p += sizeof(struct nfp_flower_mac_mpls);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ /* Inner L4 layer comes first */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_TP) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_tp(start_p);
+ start_p += sizeof(struct nfp_flower_tp_ports);
+ if (start_p >= end)
+ goto pattern_exit;
+ }
+
+ /* Inner L3 layer */
+ if ((nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) != 0) {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4(start_p);
+ start_p += sizeof(struct nfp_flower_ipv4);
+ if (start_p != end) {
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern IPv4 length error");
+ return;
+ }
+ } else {
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6(start_p);
+ start_p += sizeof(struct nfp_flower_ipv6);
+ if (start_p != end) {
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern IPv6 length error");
+ return;
+ }
+ }
+
+ return;
+
+pattern_exit:
+ if (start_p != end)
+ PMD_DRV_LOG(ERR, "Cmsg flow pattern overlap");
+}
+
static void
nfp_flower_trace_cmsg_flow(const char *msg,
struct nfp_fl_payload *payload)
{
rte_pmd_nfp_trace_cmsg_flow(msg);
rte_pmd_nfp_trace_cmsg_flow_meta(payload->meta);
+ nfp_flower_trace_cmsg_flow_pattern(payload->unmasked_data, payload->mask_data);
+ nfp_flower_trace_cmsg_flow_pattern(payload->mask_data, payload->action_data);
}
int
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index d49fb85259..61162f7563 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -40,5 +40,38 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_qos_rule,
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_meta,
pmd.net.nfp.cmsg.flow.meta)
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci,
+ pmd.net.nfp.cmsg.flow.pattern.meta_tci)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ext_meta,
+ pmd.net.nfp.cmsg.flow.pattern.ext_meta)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_in_port,
+ pmd.net.nfp.cmsg.flow.pattern.in_port)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_mac,
+ pmd.net.nfp.cmsg.flow.pattern.mac)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_tp,
+ pmd.net.nfp.cmsg.flow.pattern.tp)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4,
+ pmd.net.nfp.cmsg.flow.pattern.ipv4)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6,
+ pmd.net.nfp.cmsg.flow.pattern.ipv6)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_gre_tun,
+ pmd.net.nfp.cmsg.flow.pattern.ipv4_gre_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_udp_tun,
+ pmd.net.nfp.cmsg.flow.pattern.ipv4_udp_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_gre_tun,
+ pmd.net.nfp.cmsg.flow.pattern.ipv6_gre_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_udp_tun,
+ pmd.net.nfp.cmsg.flow.pattern.ipv6_udp_tun)
+
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow,
pmd.net.nfp.cmsg.flow)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index e0b8b0cee9..a5a7cc8faf 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -236,6 +236,205 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u32(meta->shortcut);
)
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_meta_tci *msg = cmsg;
+
+ uint8_t nfp_flow_key_layer = msg->nfp_flow_key_layer;
+ uint8_t mask_id = msg->mask_id;
+ uint16_t tci = rte_be_to_cpu_16(msg->tci);
+
+ rte_trace_point_emit_u8(nfp_flow_key_layer);
+ rte_trace_point_emit_u8(mask_id);
+ rte_trace_point_emit_u16(tci);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ext_meta,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ext_meta *msg = cmsg;
+
+ uint32_t nfp_flow_key_layer2 = rte_be_to_cpu_32(msg->nfp_flow_key_layer2);
+
+ rte_trace_point_emit_u32(nfp_flow_key_layer2);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_in_port,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_in_port *msg = cmsg;
+
+ uint32_t in_port = rte_be_to_cpu_32(msg->in_port);
+
+ rte_trace_point_emit_u32(in_port);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_mac,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_mac_mpls *msg = cmsg;
+
+ uint8_t mac_dst_len = RTE_ETHER_ADDR_LEN;
+ uint8_t mac_src_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *mac_dst = &msg->mac_dst[0];
+ uint8_t *mac_src = &msg->mac_src[0];
+ uint32_t mpls_lse = rte_be_to_cpu_32(msg->mpls_lse);
+
+ rte_trace_point_emit_blob(mac_dst, mac_dst_len);
+ rte_trace_point_emit_blob(mac_src, mac_src_len);
+ rte_trace_point_emit_u32(mpls_lse);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_tp,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_tp_ports *msg = cmsg;
+
+ uint16_t port_src = rte_be_to_cpu_16(msg->port_src);
+ uint16_t port_dst = rte_be_to_cpu_16(msg->port_dst);
+
+ rte_trace_point_emit_u16(port_src);
+ rte_trace_point_emit_u16(port_dst);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv4 *msg = cmsg;
+
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t proto = msg->ip_ext.proto;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint8_t flags = msg->ip_ext.flags;
+ uint32_t ipv4_src = rte_be_to_cpu_16(msg->ipv4_src);
+ uint32_t ipv4_dst = rte_be_to_cpu_16(msg->ipv4_dst);
+
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(proto);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u8(flags);
+ rte_trace_point_emit_u32(ipv4_src);
+ rte_trace_point_emit_u32(ipv4_dst);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv6 *msg = cmsg;
+
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t proto = msg->ip_ext.proto;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint8_t flags = msg->ip_ext.flags;
+ uint8_t ipv6_src_len = 16;
+ uint8_t *ipv6_src = &msg->ipv6_src[0];
+ uint8_t ipv6_dst_len = 16;
+ uint8_t *ipv6_dst = &msg->ipv6_dst[0];
+
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(proto);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u8(flags);
+ rte_trace_point_emit_blob(ipv6_src, ipv6_src_len);
+ rte_trace_point_emit_blob(ipv6_dst, ipv6_dst_len);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_gre_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv4_gre_tun *msg = cmsg;
+
+ uint32_t src = rte_be_to_cpu_32(msg->ipv4.src);
+ uint32_t dst = rte_be_to_cpu_32(msg->ipv4.dst);
+ uint16_t tun_flags = rte_be_to_cpu_16(msg->tun_flags);
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint16_t ethertype = rte_be_to_cpu_16(msg->ethertype);
+ uint32_t tun_key = rte_be_to_cpu_32(msg->tun_key);
+
+ rte_trace_point_emit_u32(src);
+ rte_trace_point_emit_u32(dst);
+ rte_trace_point_emit_u16(tun_flags);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u16(ethertype);
+ rte_trace_point_emit_u32(tun_key);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv4_udp_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv4_udp_tun *msg = cmsg;
+
+ uint32_t src = rte_be_to_cpu_32(msg->ipv4.src);
+ uint32_t dst = rte_be_to_cpu_32(msg->ipv4.dst);
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint32_t tun_id = rte_be_to_cpu_32(msg->tun_id);
+
+ rte_trace_point_emit_u32(src);
+ rte_trace_point_emit_u32(dst);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u32(tun_id);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_gre_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv6_gre_tun *msg = cmsg;
+
+ uint8_t ipv6_src_len = 16;
+ uint8_t *ipv6_src = &msg->ipv6.ipv6_src[0];
+ uint8_t ipv6_dst_len = 16;
+ uint8_t *ipv6_dst = &msg->ipv6.ipv6_dst[0];
+ uint16_t tun_flags = rte_be_to_cpu_16(msg->tun_flags);
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint16_t ethertype = rte_be_to_cpu_16(msg->ethertype);
+ uint32_t tun_key = rte_be_to_cpu_32(msg->tun_key);
+
+ rte_trace_point_emit_blob(ipv6_src, ipv6_src_len);
+ rte_trace_point_emit_blob(ipv6_dst, ipv6_dst_len);
+ rte_trace_point_emit_u16(tun_flags);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u16(ethertype);
+ rte_trace_point_emit_u32(tun_key);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_udp_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_flower_ipv6_udp_tun *msg = cmsg;
+
+ uint8_t ipv6_src_len = 16;
+ uint8_t *ipv6_src = &msg->ipv6.ipv6_src[0];
+ uint8_t ipv6_dst_len = 16;
+ uint8_t *ipv6_dst = &msg->ipv6.ipv6_dst[0];
+ uint8_t tos = msg->ip_ext.tos;
+ uint8_t ttl = msg->ip_ext.ttl;
+ uint32_t tun_id = rte_be_to_cpu_32(msg->tun_id);
+
+ rte_trace_point_emit_blob(ipv6_src, ipv6_src_len);
+ rte_trace_point_emit_blob(ipv6_dst, ipv6_dst_len);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u32(tun_id);
+)
+
RTE_TRACE_POINT(
rte_pmd_nfp_trace_cmsg_flow,
RTE_TRACE_POINT_ARGS(const char *name),
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 7/7] net/nfp: add trace point about flow rule action
2024-07-08 2:45 ` [PATCH v2 " Chaoyong He
` (5 preceding siblings ...)
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 ` Chaoyong He
2024-07-08 11:45 ` [PATCH v2 0/7] add trace support for control message Ferruh Yigit
7 siblings, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-08 2:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang
Add 13 trace points of control message related with flow rule action
list.
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 | 78 ++++++
drivers/net/nfp/nfp_trace.c | 39 +++
drivers/net/nfp/nfp_trace.h | 298 +++++++++++++++++++++++
3 files changed, 415 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 3b492c94ce..bd1fa71d9b 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -339,14 +339,92 @@ nfp_flower_trace_cmsg_flow_pattern(char *cmsg,
PMD_DRV_LOG(ERR, "Cmsg flow pattern overlap");
}
+static void
+nfp_flower_trace_cmsg_flow_action(char *cmsg,
+ uint8_t len)
+{
+ uint8_t len_tmp;
+
+ if (len == 0) {
+ PMD_DRV_LOG(ERR, "Cmsg flow action length is 0");
+ return;
+ }
+
+ for (len_tmp = 0; len_tmp < len;) {
+ struct nfp_fl_act_head *head = (struct nfp_fl_act_head *)(cmsg + len_tmp);
+
+ switch (head->jump_id) {
+ case NFP_FL_ACTION_OPCODE_OUTPUT:
+ rte_pmd_nfp_trace_cmsg_flow_action_output(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_PUSH_VLAN:
+ rte_pmd_nfp_trace_cmsg_flow_action_push_vlan(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_POP_VLAN:
+ rte_pmd_nfp_trace_cmsg_flow_action_pop_vlan(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_TUNNEL:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_tun(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_ETHERNET:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_eth(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_addr(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_ttl_tos(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_IPV6_SRC:
+ /* FALLTHROUGH */
+ case NFP_FL_ACTION_OPCODE_SET_IPV6_DST:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_addr(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_tc_hl_fl(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_TCP:
+ /* FALLTHROUGH */
+ case NFP_FL_ACTION_OPCODE_SET_UDP:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_tp(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_PRE_TUNNEL:
+ rte_pmd_nfp_trace_cmsg_flow_action_pre_tun(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_METER:
+ rte_pmd_nfp_trace_cmsg_flow_action_meter(head);
+ break;
+ case NFP_FL_ACTION_OPCODE_SET_PARTIAL:
+ rte_pmd_nfp_trace_cmsg_flow_action_set_partial(head);
+ break;
+ default:
+ PMD_DRV_LOG(ERR, "Cmsg flow action not support");
+ return;
+ }
+
+ len_tmp += head->len_lw << NFP_FL_LW_SIZ;
+ }
+
+ if (len_tmp > len) {
+ PMD_DRV_LOG(ERR, "Cmsg flow action length error");
+ return;
+ }
+}
+
static void
nfp_flower_trace_cmsg_flow(const char *msg,
struct nfp_fl_payload *payload)
{
+ struct nfp_fl_rule_metadata *nfp_flow_meta;
+
rte_pmd_nfp_trace_cmsg_flow(msg);
rte_pmd_nfp_trace_cmsg_flow_meta(payload->meta);
nfp_flower_trace_cmsg_flow_pattern(payload->unmasked_data, payload->mask_data);
nfp_flower_trace_cmsg_flow_pattern(payload->mask_data, payload->action_data);
+
+ nfp_flow_meta = payload->meta;
+ nfp_flower_trace_cmsg_flow_action(payload->action_data,
+ nfp_flow_meta->act_len << NFP_FL_LW_SIZ);
}
int
diff --git a/drivers/net/nfp/nfp_trace.c b/drivers/net/nfp/nfp_trace.c
index 61162f7563..9cca76e32c 100644
--- a/drivers/net/nfp/nfp_trace.c
+++ b/drivers/net/nfp/nfp_trace.c
@@ -73,5 +73,44 @@ RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_gre_tun,
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_pattern_ipv6_udp_tun,
pmd.net.nfp.cmsg.flow.pattern.ipv6_udp_tun)
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_output,
+ pmd.net.nfp.cmsg.flow.action.output)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_push_vlan,
+ pmd.net.nfp.cmsg.flow.action.push_vlan)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_pop_vlan,
+ pmd.net.nfp.cmsg.flow.action.pop_vlan)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_tun,
+ pmd.net.nfp.cmsg.flow.action.set_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_eth,
+ pmd.net.nfp.cmsg.flow.action.set_eth)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_addr,
+ pmd.net.nfp.cmsg.flow.action.set_ipv4_addr)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_ttl_tos,
+ pmd.net.nfp.cmsg.flow.action.set_ipv4_ttl_tos)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_addr,
+ pmd.net.nfp.cmsg.flow.action.set_ipv6_addr)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_tc_hl_fl,
+ pmd.net.nfp.cmsg.flow.action.set_ipv6_tc_hl_fl)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_tp,
+ pmd.net.nfp.cmsg.flow.action.set_tp)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_pre_tun,
+ pmd.net.nfp.cmsg.flow.action.pre_tun)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_meter,
+ pmd.net.nfp.cmsg.flow.action.meter)
+
+RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow_action_set_partial,
+ pmd.net.nfp.cmsg.flow.action.set_partial)
+
RTE_TRACE_POINT_REGISTER(rte_pmd_nfp_trace_cmsg_flow,
pmd.net.nfp.cmsg.flow)
diff --git a/drivers/net/nfp/nfp_trace.h b/drivers/net/nfp/nfp_trace.h
index a5a7cc8faf..576cb37c3a 100644
--- a/drivers/net/nfp/nfp_trace.h
+++ b/drivers/net/nfp/nfp_trace.h
@@ -435,6 +435,304 @@ RTE_TRACE_POINT(
rte_trace_point_emit_u32(tun_id);
)
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_output,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_output *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint16_t flags = rte_be_to_cpu_16(msg->flags);
+ uint32_t port = rte_be_to_cpu_32(msg->port);
+
+ rte_trace_point_emit_u16(flags);
+ rte_trace_point_emit_u32(port);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_push_vlan,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_push_vlan *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint16_t vlan_tpid = rte_be_to_cpu_16(msg->vlan_tpid);
+ uint16_t vlan_tci = rte_be_to_cpu_16(msg->vlan_tci);
+
+ rte_trace_point_emit_u16(vlan_tpid);
+ rte_trace_point_emit_u16(vlan_tci);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_pop_vlan,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_pop_vlan *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_tun *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint64_t tun_id = rte_be_to_cpu_64(msg->tun_id);
+ uint32_t tun_type_index = rte_be_to_cpu_32(msg->tun_type_index);
+ uint16_t tun_flags = rte_be_to_cpu_16(msg->tun_flags);
+ uint8_t ttl = msg->ttl;
+ uint8_t tos = msg->tos;
+ uint8_t tun_len = msg->tun_len;
+ uint16_t tun_proto = rte_be_to_cpu_16(msg->tun_proto);
+
+ rte_trace_point_emit_u64(tun_id);
+ rte_trace_point_emit_u32(tun_type_index);
+ rte_trace_point_emit_u16(tun_flags);
+ rte_trace_point_emit_u8(ttl);
+ rte_trace_point_emit_u8(tos);
+ rte_trace_point_emit_u8(tun_len);
+ rte_trace_point_emit_u16(tun_proto);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_eth,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_eth *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint8_t dst_mask_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *dst_mask = &msg->eth_addr_mask[0];
+ uint8_t src_mask_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *src_mask = &msg->eth_addr_mask[RTE_ETHER_ADDR_LEN];
+ uint8_t dst_addr_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *dst_addr = &msg->eth_addr[0];
+ uint8_t src_addr_len = RTE_ETHER_ADDR_LEN;
+ uint8_t *src_addr = &msg->eth_addr[RTE_ETHER_ADDR_LEN];
+
+ rte_trace_point_emit_blob(dst_mask, dst_mask_len);
+ rte_trace_point_emit_blob(src_mask, src_mask_len);
+ rte_trace_point_emit_blob(dst_addr, dst_addr_len);
+ rte_trace_point_emit_blob(src_addr, src_addr_len);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_addr,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_ip4_addrs *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint32_t ipv4_src_mask = rte_be_to_cpu_32(msg->ipv4_src_mask);
+ uint32_t ipv4_src = rte_be_to_cpu_32(msg->ipv4_src);
+ uint32_t ipv4_dst_mask = rte_be_to_cpu_32(msg->ipv4_dst_mask);
+ uint32_t ipv4_dst = rte_be_to_cpu_32(msg->ipv4_dst);
+
+ rte_trace_point_emit_u32(ipv4_src_mask);
+ rte_trace_point_emit_u32(ipv4_src);
+ rte_trace_point_emit_u32(ipv4_dst_mask);
+ rte_trace_point_emit_u32(ipv4_dst);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv4_ttl_tos,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_ip4_ttl_tos *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint8_t ipv4_ttl_mask = msg->ipv4_ttl_mask;
+ uint8_t ipv4_tos_mask = msg->ipv4_tos_mask;
+ uint8_t ipv4_ttl = msg->ipv4_ttl;
+ uint8_t ipv4_tos = msg->ipv4_tos;
+
+ rte_trace_point_emit_u8(ipv4_ttl_mask);
+ rte_trace_point_emit_u8(ipv4_tos_mask);
+ rte_trace_point_emit_u8(ipv4_ttl);
+ rte_trace_point_emit_u8(ipv4_tos);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_addr,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_ipv6_addr *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint32_t ipv6_0_mask = rte_be_to_cpu_32(msg->ipv6[0].mask);
+ uint32_t ipv6_0_exact = rte_be_to_cpu_32(msg->ipv6[0].exact);
+ uint32_t ipv6_1_mask = rte_be_to_cpu_32(msg->ipv6[1].mask);
+ uint32_t ipv6_1_exact = rte_be_to_cpu_32(msg->ipv6[1].exact);
+ uint32_t ipv6_2_mask = rte_be_to_cpu_32(msg->ipv6[2].mask);
+ uint32_t ipv6_2_exact = rte_be_to_cpu_32(msg->ipv6[2].exact);
+ uint32_t ipv6_3_mask = rte_be_to_cpu_32(msg->ipv6[3].mask);
+ uint32_t ipv6_3_exact = rte_be_to_cpu_32(msg->ipv6[3].exact);
+
+ rte_trace_point_emit_u32(ipv6_0_mask);
+ rte_trace_point_emit_u32(ipv6_0_exact);
+ rte_trace_point_emit_u32(ipv6_1_mask);
+ rte_trace_point_emit_u32(ipv6_1_exact);
+ rte_trace_point_emit_u32(ipv6_2_mask);
+ rte_trace_point_emit_u32(ipv6_2_exact);
+ rte_trace_point_emit_u32(ipv6_3_mask);
+ rte_trace_point_emit_u32(ipv6_3_exact);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_ipv6_tc_hl_fl,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_ipv6_tc_hl_fl *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint8_t ipv6_tc_mask = msg->ipv6_tc_mask;
+ uint8_t ipv6_hop_limit_mask = msg->ipv6_hop_limit_mask;
+ uint8_t ipv6_tc = msg->ipv6_tc;
+ uint8_t ipv6_hop_limit = msg->ipv6_hop_limit;
+
+ rte_trace_point_emit_u8(ipv6_tc_mask);
+ rte_trace_point_emit_u8(ipv6_hop_limit_mask);
+ rte_trace_point_emit_u8(ipv6_tc);
+ rte_trace_point_emit_u8(ipv6_hop_limit);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_tp,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_set_tport *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint16_t src_port_mask = rte_be_to_cpu_16(msg->src_port_mask);
+ uint16_t dst_port_mask = rte_be_to_cpu_16(msg->dst_port_mask);
+ uint16_t src_port = rte_be_to_cpu_16(msg->src_port);
+ uint16_t dst_port = rte_be_to_cpu_16(msg->dst_port);
+
+ rte_trace_point_emit_u16(src_port_mask);
+ rte_trace_point_emit_u16(dst_port_mask);
+ rte_trace_point_emit_u16(src_port);
+ rte_trace_point_emit_u16(dst_port);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_pre_tun,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_pre_tun *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint16_t flags = rte_be_to_cpu_16(msg->flags);
+ uint32_t ipv4_dst = rte_be_to_cpu_32(msg->ipv4_dst);
+ uint8_t ipv6_dst_len = 16;
+ uint8_t *ipv6_dst = msg->ipv6_dst;
+
+ rte_trace_point_emit_u16(flags);
+ if ((flags & NFP_FL_PRE_TUN_IPV6) != 0)
+ rte_trace_point_emit_blob(ipv6_dst, ipv6_dst_len);
+ else
+ rte_trace_point_emit_u32(ipv4_dst);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_meter,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_meter *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint32_t profile_id = rte_be_to_cpu_32(msg->profile_id);
+
+ rte_trace_point_emit_u32(profile_id);
+)
+
+RTE_TRACE_POINT(
+ rte_pmd_nfp_trace_cmsg_flow_action_set_partial,
+ RTE_TRACE_POINT_ARGS(void *cmsg),
+
+ struct nfp_fl_act_mark *msg = cmsg;
+
+ uint8_t jump_id = msg->head.jump_id;
+ uint8_t len_lw = msg->head.len_lw;
+
+ rte_trace_point_emit_u8(jump_id);
+ rte_trace_point_emit_u8(len_lw);
+
+ uint32_t mark = rte_be_to_cpu_32(msg->mark);
+
+ rte_trace_point_emit_u32(mark);
+
+ if (len_lw > sizeof(struct nfp_fl_act_mark) >> NFP_FL_LW_SIZ) {
+ struct nfp_fl_act_partial *partial = cmsg;
+
+ uint8_t flag = partial->flag;
+ uint16_t queue_id = rte_be_to_cpu_16(partial->queue_id);
+
+ rte_trace_point_emit_u8(flag);
+ rte_trace_point_emit_u16(queue_id);
+ }
+)
+
RTE_TRACE_POINT(
rte_pmd_nfp_trace_cmsg_flow,
RTE_TRACE_POINT_ARGS(const char *name),
--
2.39.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 0/7] add trace support for control message
2024-07-08 2:45 ` [PATCH v2 " Chaoyong He
` (6 preceding siblings ...)
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 ` Ferruh Yigit
2024-07-09 1:15 ` Chaoyong He
2024-07-09 3:16 ` Chaoyong He
7 siblings, 2 replies; 21+ messages in thread
From: Ferruh Yigit @ 2024-07-08 11:45 UTC (permalink / raw)
To: Chaoyong He, dev; +Cc: oss-drivers
On 7/8/2024 3:45 AM, Chaoyong He wrote:
> This patch series add trace support for control message send
> to flower firmware.
>
> ---
> v2: rebase to the latest main branch.
> ---
>
> Chaoyong He (7):
> net/nfp: add trace points about port
> net/nfp: add trace point about tunnel
> net/nfp: add trace point about Qos
> net/nfp: refactor to prepare for add flow trace point
> net/nfp: add trace point about flow rule
> net/nfp: add trace point about flow rule pattern
> net/nfp: add trace point about flow rule action
>
Still getting some github action errors, can you please check:
https://github.com/ferruhy/dpdk/actions/runs/9838241137
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 0/7] add trace support for control message
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
1 sibling, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-09 1:15 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: oss-drivers
> On 7/8/2024 3:45 AM, Chaoyong He wrote:
> > This patch series add trace support for control message send to flower
> > firmware.
> >
> > ---
> > v2: rebase to the latest main branch.
> > ---
> >
> > Chaoyong He (7):
> > net/nfp: add trace points about port
> > net/nfp: add trace point about tunnel
> > net/nfp: add trace point about Qos
> > net/nfp: refactor to prepare for add flow trace point
> > net/nfp: add trace point about flow rule
> > net/nfp: add trace point about flow rule pattern
> > net/nfp: add trace point about flow rule action
> >
>
> Still getting some github action errors, can you please check:
> https://github.com/ferruhy/dpdk/actions/runs/9838241137
Really thanks for your link to the CI workflows, we will analyze and try to solve it soon.
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 0/7] add trace support for control message
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
1 sibling, 0 replies; 21+ messages in thread
From: Chaoyong He @ 2024-07-09 3:16 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: oss-drivers
> On 7/8/2024 3:45 AM, Chaoyong He wrote:
> > This patch series add trace support for control message send to flower
> > firmware.
> >
> > ---
> > v2: rebase to the latest main branch.
> > ---
> >
> > Chaoyong He (7):
> > net/nfp: add trace points about port
> > net/nfp: add trace point about tunnel
> > net/nfp: add trace point about Qos
> > net/nfp: refactor to prepare for add flow trace point
> > net/nfp: add trace point about flow rule
> > net/nfp: add trace point about flow rule pattern
> > net/nfp: add trace point about flow rule action
> >
>
> Still getting some github action errors, can you please check:
> https://github.com/ferruhy/dpdk/actions/runs/9838241137
In short, after some debug, seems we are not using the 'trace' library as its expect, so we decide to abandon this patch series.
For details:
# The way we debug:
```
/home/hcy/dpdk-next-net-private/build/app/dpdk-testpmd -c 3 --no-huge -m 40 -d build/drivers -a 0:0.0 --vdev ne
```
# The back trace when problem occurs:
```
(gdb) bt
#0 rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci (cmsg=0x3) at ../drivers/net/nfp/nfp_trace.h:239
#1 0x00007ffff7c81879 in __rte_trace_point_register (
handle=0x7ffff02c5c98 <__rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci>,
name=0x7ffff02b36c0 <__rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci_name> "pmd.net.nfp.cmsg.flow.pattern.meta_tci", register_fn=0x7ffff029ce8c <rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci>)
at ../lib/eal/common/eal_common_trace.c:480
#2 0x00007ffff029eb0f in rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci_init ()
at ../drivers/net/nfp/nfp_trace.c:43
#3 0x00007ffff7fd11ae in call_init (env=0x7fffffffdeb0, argv=0x7fffffffde48, argc=12,
l=<optimized out>) at dl-init.c:70
#4 call_init (l=<optimized out>, argc=12, argv=0x7fffffffde48, env=0x7fffffffdeb0) at dl-init.c:26
#5 0x00007ffff7fd129c in _dl_init (main_map=0x716e10, argc=12, argv=0x7fffffffde48, env=0x7fffffffdeb0)
at dl-init.c:117
#6 0x00007ffff15cef65 in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>,
args=<optimized out>) at /usr/src/debug/glibc-2.34-60.el9.x86_64/elf/dl-error-skeleton.c:182
#7 0x00007ffff7fd7cbe in dl_open_worker (a=a@entry=0x7fffffffd730) at dl-open.c:803
#8 0x00007ffff15cef08 in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>,
args=<optimized out>) at /usr/src/debug/glibc-2.34-60.el9.x86_64/elf/dl-error-skeleton.c:208
#9 0x00007ffff7fd804f in _dl_open (file=<optimized out>, mode=-2147483646,
caller_dlopen=0x7ffff7c66e15 <eal_dlopen+318>, nsid=-2, argc=12, argv=0x7fffffffde48,
env=0x7fffffffdeb0) at dl-open.c:879
#10 0x00007ffff14d486c in dlopen_doit (a=a@entry=0x7fffffffd9a0) at dlopen.c:56
#11 0x00007ffff15cef08 in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffd900,
operate=<optimized out>, args=<optimized out>)
at /usr/src/debug/glibc-2.34-60.el9.x86_64/elf/dl-error-skeleton.c:208
#12 0x00007ffff15cefd3 in __GI__dl_catch_error (objname=0x7fffffffd958, errstring=0x7fffffffd960,
mallocedp=0x7fffffffd957, operate=<optimized out>, args=<optimized out>)
at /usr/src/debug/glibc-2.34-60.el9.x86_64/elf/dl-error-skeleton.c:227
#13 0x00007ffff14d433e in _dlerror_run (operate=operate@entry=0x7ffff14d4810 <dlopen_doit>,
args=args@entry=0x7fffffffd9a0) at dlerror.c:138
#14 0x00007ffff14d4921 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>,
file=<optimized out>) at dlopen.c:71
#15 ___dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:81
#16 0x00007ffff7c66e15 in eal_dlopen (pathname=0x6439f0 "build/drivers/librte_net_nfp.so")
at ../lib/eal/common/eal_common_options.c:506
#17 0x00007ffff7c670ff in eal_plugins_init () at ../lib/eal/common/eal_common_options.c:580
#18 0x00007ffff7c8a03c in rte_eal_init (argc=12, argv=0x7fffffffde48) at ../lib/eal/linux/eal.c:1015
#19 0x00000000004bb305 in main (argc=12, argv=0x7fffffffde48) at ../app/test-pmd/testpmd.c:4553
```
# The logic which cause the problem:
```
int
__rte_trace_point_register(rte_trace_point_t *handle, const char *name,
void (*register_fn)(void))
{
struct trace_point *tp;
uint16_t sz;
/* Sanity checks of arguments */
if (name == NULL || register_fn == NULL || handle == NULL) {
trace_err("invalid arguments");
rte_errno = EINVAL;
goto fail;
}
/* Check the size of the trace point object */
RTE_PER_LCORE(trace_point_sz) = 0;
register_fn(); // <---------- Here, call with empty parameter list
if (RTE_PER_LCORE(trace_point_sz) == 0) {
trace_err("missing rte_trace_emit_header() in register fn");
rte_errno = EBADF;
goto fail;
}
...
}
```
```
RTE_TRACE_POINT(
rte_pmd_nfp_trace_cmsg_flow_meta,
RTE_TRACE_POINT_ARGS(void *cmsg), // <--- Here, we need a parameter
struct nfp_fl_rule_metadata *meta = cmsg;
rte_trace_point_emit_u8(meta->key_len);
rte_trace_point_emit_u8(meta->mask_len);
rte_trace_point_emit_u8(meta->act_len);
rte_trace_point_emit_u8(meta->flags);
rte_trace_point_emit_u32(meta->host_ctx_id);
rte_trace_point_emit_u64(meta->host_cookie);
rte_trace_point_emit_u64(meta->flow_version);
rte_trace_point_emit_u32(meta->shortcut);
)
```
# Somehow, seems it get the parameter from the `rdi` register:
```
(gdb) info reg
rax 0x7ffff029ce8c 140737222659724
rbx 0x7ffff02c29d8 140737222814168
rcx 0x7ffff1246a40 140737239083584
rdx 0x7ffff124a000 140737239097344
rsi 0x7ffff12489e0 140737239091680
rdi 0x3 3
rbp 0x7fffffffd390 0x7fffffffd390
rsp 0x7fffffffd370 0x7fffffffd370
r8 0x0 0
r9 0x0 0
r10 0x8000 32768
r11 0x7ffff1633c80 140737243200640
r12 0x7fffffffde48 140737488346696
r13 0x7fffffffdeb0 140737488346800
r14 0x7ffff02c2a98 140737222814360
r15 0x0 0
rip 0x7ffff029ce98 0x7ffff029ce98 <rte_pmd_nfp_trace_cmsg_flow_pattern_meta_tci+12>
eflags 0x202 [ IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
k0 0x2107c 135292
k1 0xfefe0000 4278059008
k2 0xffffbfff 4294950911
k3 0x0 0
k4 0x0 0
k5 0x0 0
k6 0x0 0
k7 0x0 0
```
# And the value in `rdi` register are never changed:
```
(gdb) frame 19
#19 0x00000000004bb305 in main (argc=12, argv=0x7fffffffde48) at ../app/test-pmd/testpmd.c:4553
4553 diag = rte_eal_init(argc, argv);
(gdb) info reg
rax 0x7ffff029ce8c 140737222659724
rbx 0x0 0
rcx 0x7ffff1246a40 140737239083584
rdx 0x7ffff124a000 140737239097344
rsi 0x7ffff12489e0 140737239091680
rdi 0x3 3
rbp 0x7fffffffdd30 0x7fffffffdd30
rsp 0x7fffffffdc30 0x7fffffffdc30
r8 0x0 0
r9 0x0 0
r10 0x8000 32768
r11 0x7ffff1633c80 140737243200640
r12 0x7fffffffde48 140737488346696
r13 0x4bb19c 4960668
r14 0x526ae0 5401312
r15 0x7ffff7ffd000 140737354125312
rip 0x4bb305 0x4bb305 <main+361>
eflags 0x202 [ IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
k0 0x2107c 135292
k1 0xfefe0000 4278059008
k2 0xffffbfff 4294950911
k3 0x0 0
k4 0x0 0
k5 0x0 0
k6 0x0 0
k7 0x0 0
```
^ permalink raw reply [flat|nested] 21+ messages in thread