diff options
| author | tongzongzhen <[email protected]> | 2024-05-20 19:15:16 +0800 |
|---|---|---|
| committer | tongzongzhen <[email protected]> | 2024-05-20 19:15:16 +0800 |
| commit | f7657b3f6561bbac7973e3f86c11d3f322f9c051 (patch) | |
| tree | 6a8495e210fde8bcc8126d118dfc9ab42d7c0e40 /service | |
| parent | 3245c8e795341123f1f1ac24705490259f9cc8ac (diff) | |
add arp pkt measurement
Diffstat (limited to 'service')
| -rw-r--r-- | service/src/node_bridge.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/service/src/node_bridge.c b/service/src/node_bridge.c index 1851d9d..058270a 100644 --- a/service/src/node_bridge.c +++ b/service/src/node_bridge.c @@ -244,19 +244,19 @@ static __rte_always_inline void gen_store_trace_info_original(struct rte_node * } /* Generate and store the trace information for clone pkt */ -static __rte_always_inline void gen_store_trace_info_clone(struct rte_node * node, struct rte_mbuf * mbuf, - uint16_t next_node_index) +static __rte_always_inline void gen_store_trace_info_copy(struct rte_node * node, struct rte_mbuf * mbuf, + uint16_t next_node_index, uint8_t measurement_type) { /* Populate the next node infomation */ char str_record[MR_STRING_MAX]; struct mrb_metadata * mrb_meta = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); - snprintf(str_record, sizeof(str_record), "next node:%s, rsn:broadcast cloned packet, tx:%u", + snprintf(str_record, sizeof(str_record), "created by copy. next node:%s, rsn:broadcast cloned packet, tx:%u", node->nodes[next_node_index]->name, mrb_meta->port_egress); /* Emit the trace record */ struct dp_trace_record_meta meta = { - .measurement_type = DP_TRACE_MEASUREMENT_TYPE_TRACE, .appsym = MR_TRACE_APPSYM, .module = node->name}; + .measurement_type = measurement_type, .appsym = MR_TRACE_APPSYM, .module = node->name}; dp_trace_record_emit_str(sc_main_get()->trace, mbuf, rte_lcore_id(), &meta, str_record); } @@ -350,8 +350,7 @@ static __rte_always_inline uint16_t bridge_node_process(struct rte_graph * graph continue; } - /* Clone pkt */ - // struct rte_mbuf * mbuf_clone = rte_pktmbuf_clone(mbuf, bridge_main->direct_pool); + /* copy pkt */ struct rte_mbuf * mbuf_copy = rte_pktmbuf_copy(mbuf, bridge_main->direct_pool, 0, UINT32_MAX); if (unlikely(mbuf_copy == NULL)) { @@ -368,9 +367,14 @@ static __rte_always_inline uint16_t bridge_node_process(struct rte_graph * graph dp_trace_filter_exec(sc_main_get()->trace, mbuf_copy, 0, rte_lcore_id()); /* Check if tracing is enabled for the current Mbuf */ + if (unlikely(dp_trace_record_can_emit(mbuf_copy, DP_TRACE_MEASUREMENT_TYPE_TELEMETRY))) + { + gen_store_trace_info_copy(node, mbuf_copy, BRIDGE_NEXT_ETH_EGRESS, DP_TRACE_MEASUREMENT_TYPE_TELEMETRY); + } + if (unlikely(dp_trace_record_can_emit(mbuf_copy, DP_TRACE_MEASUREMENT_TYPE_TRACE))) { - gen_store_trace_info_clone(node, mbuf_copy, BRIDGE_NEXT_ETH_EGRESS); + gen_store_trace_info_copy(node, mbuf_copy, BRIDGE_NEXT_ETH_EGRESS, DP_TRACE_MEASUREMENT_TYPE_TRACE); } /* Send clone pkt */ |
