diff options
Diffstat (limited to 'service/include/sc_trace.h')
| -rw-r--r-- | service/include/sc_trace.h | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/service/include/sc_trace.h b/service/include/sc_trace.h index 1b39b28..084eae2 100644 --- a/service/include/sc_trace.h +++ b/service/include/sc_trace.h @@ -8,6 +8,8 @@ #include "sc_common.h" #include <mrb_define.h> +#define MR_TRACE_APPSYM "mrzcpd" + int mr_dp_trace_init(struct sc_main * sc); void dp_trace_config_update(struct sc_main * sc); void hook_rte_pktmbuf_free(struct rte_mbuf * m); @@ -16,7 +18,7 @@ void hook_rte_pktmbuf_free_bulk(struct rte_mbuf ** mbufs, unsigned int count); /* Generate and store the trace information for pkt parser */ static inline void gen_store_trace_info_pkt_parser(struct rte_node * node, struct rte_mbuf * mbuf) { - struct dp_trace_record_meta meta = {.module = node->name}; + struct dp_trace_record_meta meta = {.appsym=MR_TRACE_APPSYM, .module=node->name}; struct mrb_metadata * mrb_meta = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); struct pkt_parser_result * pkt_parser_result = &mrb_meta->pkt_parser_result; @@ -43,7 +45,7 @@ static inline void gen_store_trace_info_pkt_parser(struct rte_node * node, struc /* Generate and store the trace information for rte mbuf */ static inline void gen_store_trace_info_rte_mbuf(struct rte_node * node, struct rte_mbuf * mbuf) { - struct dp_trace_record_meta meta = {.module = node->name}; + struct dp_trace_record_meta meta = {.appsym=MR_TRACE_APPSYM, .module=node->name}; /* Populate the rte mbuf information */ char str_record[MR_STRING_MAX]; @@ -63,7 +65,7 @@ static inline void gen_store_trace_info_rte_mbuf(struct rte_node * node, struct /* Generate and store the trace information for Sid list */ static inline void gen_store_trace_info_sid_list(struct rte_node * node, struct rte_mbuf * mbuf) { - struct dp_trace_record_meta meta = {.module = node->name}; + struct dp_trace_record_meta meta = {.appsym=MR_TRACE_APPSYM, .module=node->name}; /* Populate the Sid list */ struct mrb_metadata * mrb_meta = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); @@ -71,7 +73,7 @@ static inline void gen_store_trace_info_sid_list(struct rte_node * node, struct int nr_sids = sid_list_get(&mrb_meta->sid_list, sids, RTE_DIM(mrb_meta->sid_list.sids)); char str_record[MR_STRING_MAX]; - int len = snprintf(str_record, sizeof(str_record), "nr:%u, sids:[", nr_sids); + int len = snprintf(str_record, sizeof(str_record), "sids:[nr:%u, [", nr_sids); for (int i = 0; i < nr_sids; i++) { @@ -80,17 +82,39 @@ static inline void gen_store_trace_info_sid_list(struct rte_node * node, struct len += snprintf(str_record + len, sizeof(str_record) - len, ","); } - len += snprintf(str_record + len, sizeof(str_record) - len, "]"); + len += snprintf(str_record + len, sizeof(str_record) - len, "]]"); /* Emit the trace record */ dp_trace_record_emit_str(sc_main_get()->trace, mbuf, rte_lcore_id(), &meta, str_record); } +/* Embed Sid information into input string parameters */ +static inline int embed_sid_info(struct rte_mbuf * mbuf, char * str_record, int maxlen) +{ + struct mrb_metadata * mrb_meta = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); + uint16_t sids[RTE_DIM(mrb_meta->sid_list.sids)]; + int nr_sids = sid_list_get(&mrb_meta->sid_list, sids, RTE_DIM(mrb_meta->sid_list.sids)); + + int len = snprintf(str_record, maxlen, ", sids:[nr:%u, [", nr_sids); + + for (int i = 0; i < nr_sids; i++) + { + len += snprintf(str_record + len, maxlen - len, "%u", sids[i]); + if (i < nr_sids - 1) + len += snprintf(str_record + len, maxlen - len, ","); + } + + len += snprintf(str_record + len, maxlen - len, "]]"); + + return len; +} + + /* Generate and store the trace information for rx */ static inline void gen_store_trace_info_rx(struct rte_node * node, struct rte_mbuf * mbuf, struct mr_dev_desc * dev_desc, uint16_t queue_id) { - struct dp_trace_record_meta meta = {.module = node->name}; + struct dp_trace_record_meta meta = {.appsym=MR_TRACE_APPSYM, .module=node->name}; /* Populate the next node information */ char str_record[MR_STRING_MAX]; @@ -120,7 +144,7 @@ static inline void gen_store_trace_info_rx(struct rte_node * node, struct rte_mb static inline void gen_store_trace_info_tx(struct rte_node * node, struct rte_mbuf * mbuf, struct mr_dev_desc * dev_desc, uint16_t queue_id) { - struct dp_trace_record_meta meta = {.module = node->name}; + struct dp_trace_record_meta meta = {.appsym=MR_TRACE_APPSYM, .module=node->name}; /* Populate the port information */ char str_record[MR_STRING_MAX]; |
