diff options
| author | songyanchao <[email protected]> | 2024-05-09 07:43:38 +0000 |
|---|---|---|
| committer | songyanchao <[email protected]> | 2024-05-15 02:06:26 +0000 |
| commit | 5602c112f97e74233fe488cd64f05a3457daa187 (patch) | |
| tree | 4fe9002053215161f0ca11ebddae9206278a28ab /service/src | |
| parent | 4465a1ce74f4a6109bacff3e475a55f3ea1990d7 (diff) | |
🧪 test(DPISDN-42): Add test case for link aware injector node.
Add test case for link aware injector node.
Diffstat (limited to 'service/src')
| -rw-r--r-- | service/src/core.c | 8 | ||||
| -rw-r--r-- | service/src/node_eth_ingress.c | 14 | ||||
| -rw-r--r-- | service/src/node_etherfabric.c | 108 | ||||
| -rw-r--r-- | service/src/node_forwarder.c | 13 | ||||
| -rw-r--r-- | service/src/node_link_aware_injector.c | 76 | ||||
| -rw-r--r-- | service/src/node_phydev.c | 19 | ||||
| -rw-r--r-- | service/src/node_tera.c | 13 |
7 files changed, 209 insertions, 42 deletions
diff --git a/service/src/core.c b/service/src/core.c index 754118c..d896b33 100644 --- a/service/src/core.c +++ b/service/src/core.c @@ -977,6 +977,7 @@ extern int bridge_init(struct sc_main * sc); extern int mr_pdump_init(struct sc_main * sc); extern int http_serv_init(struct sc_main * sc_main); extern int olp_manager_init(struct sc_main * sc_main); +extern int lai_init(struct sc_main * sc); int main(int argc, char * argv[]) { @@ -1244,6 +1245,13 @@ int main(int argc, char * argv[]) goto quit; } + if (lai_init(sc) != RT_SUCCESS) + { + MR_ERROR("LAI(Link aware injector) initialization failed. "); + ret = EXIT_FAILURE; + goto quit; + } + sc_config_dump(sc); vdev_dump(sc); port_adapter_mapping_dump(); diff --git a/service/src/node_eth_ingress.c b/service/src/node_eth_ingress.c index bf3f444..77c8c06 100644 --- a/service/src/node_eth_ingress.c +++ b/service/src/node_eth_ingress.c @@ -39,8 +39,8 @@ enum eth_ingress_drop_reason /* Eth ingress drop reason string */ static const char * eth_ingress_drop_reason_str[ETH_INGR_DROP_RSN_MAX] = { - "invalid_role_type", "invalid_pkt_layers", "invalid_icmp_type", - "invalid_adapter_type", "pkt_noncompliant_with_ef", "pkt_noncompliant_with_tera", + "drop_rsn_invalid_role_type", "drop_rsn_invalid_pkt_layers", "drop_rsn_invalid_icmp_type", + "drop_rsn_invalid_adapter_type", "drop_rsn_pkt_noncompliant_with_ef", "drop_rsn_pkt_noncompliant_with_tera", }; /* Eth ingress statistics struct */ @@ -630,7 +630,7 @@ cJSON * eth_ingress_node_monit_loop(struct sc_main * sc) uint64_t to_ef_ingress[nr_graphs]; uint64_t to_eth_egress[nr_graphs]; uint64_t to_tera_ingress[nr_graphs]; - uint64_t drop_reason[nr_graphs][ETH_INGR_DROP_RSN_MAX]; + uint64_t drop_reason[ETH_INGR_DROP_RSN_MAX][nr_graphs]; for (uint32_t graph_id = 0; graph_id < nr_graphs; graph_id++) { @@ -648,7 +648,11 @@ cJSON * eth_ingress_node_monit_loop(struct sc_main * sc) to_eth_egress[graph_id] = 0; to_tera_ingress[graph_id] = 0; - memset(drop_reason[graph_id], 0, sizeof(drop_reason[graph_id])); + for (int i = 0; i < ETH_INGR_DROP_RSN_MAX; i++) + { + drop_reason[i][graph_id] = 0; + } + continue; } @@ -665,7 +669,7 @@ cJSON * eth_ingress_node_monit_loop(struct sc_main * sc) for (int i = 0; i < ETH_INGR_DROP_RSN_MAX; i++) { - drop_reason[graph_id][i] = stats->drop_reason[i]; + drop_reason[i][graph_id] = stats->drop_reason[i]; } } diff --git a/service/src/node_etherfabric.c b/service/src/node_etherfabric.c index 00adade..b49d631 100644 --- a/service/src/node_etherfabric.c +++ b/service/src/node_etherfabric.c @@ -75,6 +75,7 @@ struct node_ef_main uint32_t nr_sids; uint32_t sid_start; uint32_t sid_end; + rte_atomic64_t tl_to_ef_peer_map[65536]; struct rte_hash * ef_peer_hash; struct ef_adapter * ef_adapters; struct link_db_ctx * link_db_ctx; @@ -91,7 +92,8 @@ enum ef_ingress_drop_reason }; /* Etherfabric ingress drop reason string */ -char * ef_ingr_drop_rsn_str[EF_INGR_DROP_RSN_MAX] = {"adapter lookup miss", "sid prepend err", "ef peer lookup miss"}; +char * ef_ingr_drop_rsn_str[EF_INGR_DROP_RSN_MAX] = {"drop_rsn_adapter_lookup_miss", "drop_rsn_sid_prepend_err", + "drop_rsn_ef_peer_lookup_miss"}; /* Etherfabric ingress stats struct */ struct ef_ingress_stats @@ -111,7 +113,7 @@ enum ef_egress_drop_reason }; /* Etherfabric egress drop reason string */ -char * ef_egr_drop_rsn_str[EF_EGR_DROP_RSN_MAX] = {"tap mode", "invalid mode"}; +char * ef_egr_drop_rsn_str[EF_EGR_DROP_RSN_MAX] = {"drop_rsn_tap_mode", "drop_rsn_invalid_mode"}; /* Etherfabric egress stats struct */ struct ef_egress_stats @@ -140,6 +142,33 @@ unsigned int nr_max_ef_adapters_get() return nr_max_ef_adapters; } +uint16_t ef_nr_adapters_get() +{ + struct node_ef_main * ef_main = node_ef_main_get(); + return ef_main->nr_adapters; +} + +void ef_adapter_id_get(uint16_t * ef_adapter_ids, uint16_t nr_adapters) +{ + uint16_t adapter_count = 0; + struct node_ef_main * ef_main = node_ef_main_get(); + + for (int i = 0; i < nr_max_ef_adapters; i++) + { + struct ef_adapter * ef_adapter = &ef_main->ef_adapters[i]; + if (ef_adapter->mode != MODE_INVALID) + { + ef_adapter_ids[adapter_count] = ef_adapter->ef_adapter_id; + adapter_count++; + } + + if (adapter_count == nr_adapters) + { + return; + } + } +} + /* Etherfabric start sid get */ uint32_t ef_sid_start_get() { @@ -398,6 +427,13 @@ int ef_init(struct sc_main * sc) for (int index = 0; index < NR_EF_PEER_MEMBER; index++) rte_atomic64_init(&ef_main->ef_peers[index].state); + /* Init traffic link to ef peer map */ + for (int index = 0; index < RTE_DIM(ef_main->tl_to_ef_peer_map); index++) + { + rte_atomic64_init(&ef_main->tl_to_ef_peer_map[index]); + rte_atomic64_set(&ef_main->tl_to_ef_peer_map[index], -1); + } + return RT_SUCCESS; } @@ -485,6 +521,25 @@ int ef_peer_lookup_and_add(struct rte_hash * ef_peer_hash, struct ef_peer * ef_p return RT_ERR; } +static inline void tl_to_ef_peer_map_set(struct node_ef_main * ef_main, uint16_t traffic_link_id, int ef_peer_index) +{ + if (traffic_link_id != 65535) + { + rte_atomic64_set(&ef_main->tl_to_ef_peer_map[traffic_link_id], ef_peer_index); + } +} + +int tl_to_ef_peer_map_get(uint16_t traffic_link_id) +{ + if (traffic_link_id != 65535) + { + struct node_ef_main * ef_main = node_ef_main_get(); + return rte_atomic64_read(&ef_main->tl_to_ef_peer_map[traffic_link_id]); + } + + return -1; +} + static inline void vxlan_encap_forwarded_pkt(struct rte_mbuf * mbuf) { /* swap eth_hdr */ @@ -594,6 +649,9 @@ static __rte_always_inline uint16_t ef_ingress_node_process(struct rte_graph * g match_field.ef_ip_addr = outer_ipv4_hdr->src_addr; link_db_match(ef_main->link_db_ctx, &match_field, 1, &traffic_link_id); + /* Set the traffic link to ef peer map */ + tl_to_ef_peer_map_set(ef_main, traffic_link_id, ef_peer_index); + /* Fill ef_peer index and dir */ struct mrb_metadata * mrb_meta = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); mrb_meta->adapter_type = ADAPTER_TYPE_EF; @@ -937,7 +995,7 @@ cJSON * ef_ingress_node_monit_loop(struct sc_main * sc) uint64_t total_pkts[nr_graphs]; uint64_t pkts_per_batch[nr_graphs]; uint64_t to_classifier[nr_graphs]; - uint64_t drops_reason[nr_graphs][EF_INGR_DROP_RSN_MAX]; + uint64_t drop_reason[EF_INGR_DROP_RSN_MAX][nr_graphs]; for (uint32_t graph_id = 0; graph_id < nr_graphs; graph_id++) { @@ -948,7 +1006,11 @@ cJSON * ef_ingress_node_monit_loop(struct sc_main * sc) pkts_per_batch[graph_id] = 0; to_classifier[graph_id] = 0; - memset(drops_reason[graph_id], 0, sizeof(drops_reason[graph_id])); + for (uint32_t i = 0; i < EF_INGR_DROP_RSN_MAX; i++) + { + drop_reason[i][graph_id] = 0; + } + continue; } @@ -958,7 +1020,7 @@ cJSON * ef_ingress_node_monit_loop(struct sc_main * sc) for (uint32_t i = 0; i < EF_INGR_DROP_RSN_MAX; i++) { - drops_reason[graph_id][i] = stats->drop_reason[i]; + drop_reason[i][graph_id] = stats->drop_reason[i]; } } @@ -971,15 +1033,14 @@ cJSON * ef_ingress_node_monit_loop(struct sc_main * sc) cJSON * json_to_classifier = create_uint64_array(to_classifier, nr_graphs); cJSON_AddItemToObject(json_root, "ef_ingress, to_classifier", json_to_classifier); - cJSON * json_drops_for_adp_nonexist = create_uint64_array(drops_reason[EF_INGR_DROP_RSN_ADP_NONEXIST], nr_graphs); - cJSON_AddItemToObject(json_root, "ef_ingress, drops_for_adp_nonexist", json_drops_for_adp_nonexist); - - cJSON * json_drops_for_pre_sid_err = create_uint64_array(drops_reason[EF_INGR_DROP_RSN_PRE_SID_ERR], nr_graphs); - cJSON_AddItemToObject(json_root, "ef_ingress, drops_for_pre_sid_err", json_drops_for_pre_sid_err); + for (uint32_t i = 0; i < EF_INGR_DROP_RSN_MAX; i++) + { + char str_title[MR_STRING_MAX]; + snprintf(str_title, sizeof(str_title), "ef_ingress, %s", ef_ingr_drop_rsn_str[i]); - cJSON * json_drops_for_ef_peer_add_err = - create_uint64_array(drops_reason[EF_INGR_DROP_RSN_EF_PEER_ADD_ERR], nr_graphs); - cJSON_AddItemToObject(json_root, "ef_ingress, drops_for_ef_peer_add_err", json_drops_for_ef_peer_add_err); + cJSON * json_drops = create_uint64_array(drop_reason[i], nr_graphs); + cJSON_AddItemToObject(json_root, str_title, json_drops); + } return json_root; } @@ -993,7 +1054,7 @@ cJSON * ef_egress_node_monit_loop(struct sc_main * sc) uint64_t pkts_per_batch[nr_graphs]; uint64_t vxlan_encap[nr_graphs]; uint64_t to_eth_egress[nr_graphs]; - uint64_t drops_reason[nr_graphs][EF_EGR_DROP_RSN_MAX]; + uint64_t drop_reason[EF_EGR_DROP_RSN_MAX][nr_graphs]; for (uint32_t graph_id = 0; graph_id < nr_graphs; graph_id++) { @@ -1005,7 +1066,11 @@ cJSON * ef_egress_node_monit_loop(struct sc_main * sc) vxlan_encap[graph_id] = 0; to_eth_egress[graph_id] = 0; - memset(drops_reason[graph_id], 0, sizeof(drops_reason[graph_id])); + for (uint32_t i = 0; i < EF_EGR_DROP_RSN_MAX; i++) + { + drop_reason[i][graph_id] = 0; + } + continue; } @@ -1016,7 +1081,7 @@ cJSON * ef_egress_node_monit_loop(struct sc_main * sc) for (uint32_t i = 0; i < EF_EGR_DROP_RSN_MAX; i++) { - drops_reason[graph_id][i] = stats->drop_reason[i]; + drop_reason[i][graph_id] = stats->drop_reason[i]; } } @@ -1032,11 +1097,14 @@ cJSON * ef_egress_node_monit_loop(struct sc_main * sc) cJSON * json_to_eth_egress = create_uint64_array(to_eth_egress, nr_graphs); cJSON_AddItemToObject(json_root, "ef_egress, to_eth_egress", json_to_eth_egress); - cJSON * json_drops_for_tap_mode = create_uint64_array(drops_reason[EF_EGR_DROP_RSN_TAP_MODE], nr_graphs); - cJSON_AddItemToObject(json_root, "ef_egress, drops_for_tap_mode", json_drops_for_tap_mode); + for (uint32_t i = 0; i < EF_EGR_DROP_RSN_MAX; i++) + { + char str_title[MR_STRING_MAX]; + snprintf(str_title, sizeof(str_title), "ef_egress, %s", ef_egr_drop_rsn_str[i]); - cJSON * json_drops_for_invalid_mode = create_uint64_array(drops_reason[EF_EGR_DROP_RSN_INVALID_MODE], nr_graphs); - cJSON_AddItemToObject(json_root, "ef_egress, drops_for_invalid_mode", json_drops_for_invalid_mode); + cJSON * json_drops = create_uint64_array(drop_reason[i], nr_graphs); + cJSON_AddItemToObject(json_root, str_title, json_drops); + } return json_root; } diff --git a/service/src/node_forwarder.c b/service/src/node_forwarder.c index 87a3124..3245b24 100644 --- a/service/src/node_forwarder.c +++ b/service/src/node_forwarder.c @@ -29,7 +29,8 @@ enum forwarder_drop_reason }; /* Forwarder drop reason string */ -static const char * forwarder_drop_reason_str[FORWARDER_DROP_RSN_MAX] = {"pop_sid_err", "invalid_sid"}; +static const char * forwarder_drop_reason_str[FORWARDER_DROP_RSN_MAX] = {"drop_rsn_pop_sid_err", + "drop_rsn_invalid_sid"}; /* Forwarder stats */ struct forwarder_stats @@ -291,7 +292,7 @@ cJSON * forwarder_node_monit_loop(struct sc_main * sc) uint64_t to_ef_egress[nr_graphs]; uint64_t to_tera_egress[nr_graphs]; uint64_t to_lai[nr_graphs]; - uint64_t drop_reason[nr_graphs][FORWARDER_DROP_RSN_MAX]; + uint64_t drop_reason[FORWARDER_DROP_RSN_MAX][nr_graphs]; for (uint32_t graph_id = 0; graph_id < nr_graphs; graph_id++) { @@ -306,7 +307,11 @@ cJSON * forwarder_node_monit_loop(struct sc_main * sc) to_tera_egress[graph_id] = 0; to_lai[graph_id] = 0; - memset(drop_reason[graph_id], 0, sizeof(drop_reason[graph_id])); + for (int i = 0; i < FORWARDER_DROP_RSN_MAX; i++) + { + drop_reason[i][graph_id] = 0; + } + continue; } @@ -320,7 +325,7 @@ cJSON * forwarder_node_monit_loop(struct sc_main * sc) for (int i = 0; i < FORWARDER_DROP_RSN_MAX; i++) { - drop_reason[graph_id][i] = stats->drop_reason[i]; + drop_reason[i][graph_id] = stats->drop_reason[i]; } } diff --git a/service/src/node_link_aware_injector.c b/service/src/node_link_aware_injector.c index 1b7f5d4..bf00073 100644 --- a/service/src/node_link_aware_injector.c +++ b/service/src/node_link_aware_injector.c @@ -8,6 +8,8 @@ #include <rte_graph.h> #include <rte_graph_worker.h> +extern int tl_to_ef_peer_map_get(uint16_t traffic_link_id); + /* Link aware injector next node */ enum { @@ -22,18 +24,21 @@ enum lai_drop_reason { LAI_DROP_RSN_TLID_MISS = 0, LAI_DROP_RSN_INVALID_ADAPTER_TYPE, + LAI_DROP_RSN_EF_PEER_ID_MISS, + LAI_DROP_RSN_EF_ADAPTER_ID_MISS, LAI_DROP_RSN_MAX }; /* Link aware injector drop reason string */ -char * lai_drop_rsn_str[LAI_DROP_RSN_MAX] = {"traffic link id miss", "invalid adapter type"}; +char * lai_drop_rsn_str[LAI_DROP_RSN_MAX] = {"drop_rsn_traffic_link_id_miss", "drop_rsn_invalid_adapter_type", + "drop_rsn_ef_peer_id_miss", "drop_rsn_ef_adapter_id_miss"}; /* Link aware injector stats struct */ struct lai_stats { volatile uint64_t total_pkts; volatile uint64_t pkts_per_batch; - volatile uint64_t to_eth_egress; + volatile uint64_t to_ef_egress; volatile uint64_t to_vwire_egress; volatile uint64_t drop_reason[LAI_DROP_RSN_MAX]; } __rte_cache_aligned; @@ -44,6 +49,8 @@ struct node_lai_main uint32_t lai_sid; uint32_t ef_sid_start; uint32_t vwire_sid_start; + uint16_t nr_ef_adapters; + uint16_t * ef_adapter_ids; struct link_db_ctx * link_db_ctx; }; @@ -79,7 +86,7 @@ int lai_init(struct sc_main * sc) MESA_load_profile_uint_def(sc->local_cfgfile, "limits", "nr_max_link_dbs", &max_entries, 64); max_entries = max_entries * LINK_DB_TYPE_ALL; - lai_main->link_db_ctx = link_db_create(LINK_DB_TYPE_EF, max_entries); + lai_main->link_db_ctx = link_db_create(LINK_DB_TYPE_ALL, max_entries); if (lai_main->link_db_ctx == NULL) { MR_ERROR("In link aware injector node, link db ctx create failed."); @@ -110,6 +117,25 @@ int lai_init(struct sc_main * sc) /* Inserter sid to forwarder table */ forwarder_table_inserter(lai_main->lai_sid, FORWARDER_TYPE_LAI); + /* Get ef adapter ids */ + lai_main->nr_ef_adapters = ef_nr_adapters_get(); + if (lai_main->nr_ef_adapters != 0) + { + lai_main->ef_adapter_ids = ZMALLOC(sizeof(uint16_t) * lai_main->nr_ef_adapters); + MR_VERIFY_MALLOC(lai_main->ef_adapter_ids); + + ef_adapter_id_get(lai_main->ef_adapter_ids, lai_main->nr_ef_adapters); + char str_ef_adapter_info[MR_STRING_MAX] = {0}; + int len = snprintf(str_ef_adapter_info, sizeof(str_ef_adapter_info), + "Link aware injector node, nr ef adapters:%u, ef adapter ids:", lai_main->nr_ef_adapters); + for (int i = 0; i < lai_main->nr_ef_adapters; i++) + { + len += snprintf(str_ef_adapter_info + len, sizeof(str_ef_adapter_info) - len, " %u,", + lai_main->ef_adapter_ids[i]); + } + MR_INFO("%s", str_ef_adapter_info); + } + MR_INFO("Link aware injector node init success,link aware injector sid:%u, ef sid start: %u, vwire sid start: %u", lai_main->lai_sid, lai_main->ef_sid_start, lai_main->vwire_sid_start); @@ -159,7 +185,7 @@ static __rte_always_inline uint16_t lai_node_process(struct rte_graph * graph, s enum lai_drop_reason drop_reason = LAI_DROP_RSN_TLID_MISS; struct lai_stats stats = {}; struct node_lai_main * lai_main = node_lai_main_get(); - struct link_db_reverse_result result = {.match_result = RT_ERR}; + struct link_db_reverse_result result = {.nr_adapters = 0, .match_result = RT_ERR}; while (n_left_from > 0) { @@ -197,13 +223,45 @@ static __rte_always_inline uint16_t lai_node_process(struct rte_graph * graph, s /* Set the next node index */ if (result.type == LINK_DB_TYPE_EF) { - mrb_meta->cur_sid = lai_main->ef_sid_start + result.adapter_id; + int ef_peer_index = tl_to_ef_peer_map_get(mrb_meta->traffic_link_id); + if (ef_peer_index < 0) + { + drop_reason = LAI_DROP_RSN_EF_PEER_ID_MISS; + stats.drop_reason[drop_reason]++; + next_node_index = LAI_NEXT_PKT_DROP; + goto node_enqueue; + } + + uint16_t adapter_id; + if (result.nr_adapters == 0) + { + if (lai_main->nr_ef_adapters == 0) + { + drop_reason = LAI_DROP_RSN_EF_ADAPTER_ID_MISS; + stats.drop_reason[drop_reason]++; + next_node_index = LAI_NEXT_PKT_DROP; + goto node_enqueue; + } + else + { + adapter_id = lai_main->ef_adapter_ids[mbuf->hash.usr % lai_main->nr_ef_adapters]; + } + } + else + { + adapter_id = result.adapter_id[mbuf->hash.usr % result.nr_adapters]; + } + + mrb_meta->cur_sid = lai_main->ef_sid_start + adapter_id; + mrb_meta->ef_peer_index = ef_peer_index; + mrb_meta->ef_link_id = result.ef_link_id; + next_node_index = LAI_NEXT_EF_EGRESS; - stats.to_eth_egress++; + stats.to_ef_egress++; } else if (result.type == LINK_DB_TYPE_VWIRE) { - mrb_meta->cur_sid = lai_main->vwire_sid_start + result.adapter_id; + mrb_meta->cur_sid = lai_main->vwire_sid_start + result.adapter_id[0]; next_node_index = LAI_NEXT_VWIRE_EGRESS; stats.to_vwire_egress++; } @@ -249,7 +307,7 @@ static __rte_always_inline uint16_t lai_node_process(struct rte_graph * graph, s struct lai_stats * graph_stats = &lai_stats_per_graph[graph->id]; graph_stats->total_pkts += nb_objs; graph_stats->pkts_per_batch = nb_objs; - graph_stats->to_eth_egress += stats.to_eth_egress; + graph_stats->to_ef_egress += stats.to_ef_egress; graph_stats->to_vwire_egress += stats.to_vwire_egress; for (int i = 0; i < LAI_DROP_RSN_MAX; i++) { @@ -311,7 +369,7 @@ cJSON * lai_node_monit_loop(struct sc_main * sc) total_pkts[graph_id] = stats->total_pkts; pkts_per_batch[graph_id] = stats->pkts_per_batch; - to_eth_egress[graph_id] = stats->to_eth_egress; + to_eth_egress[graph_id] = stats->to_ef_egress; to_vwire_egress[graph_id] = stats->to_vwire_egress; for (int i = 0; i < LAI_DROP_RSN_MAX; i++) { diff --git a/service/src/node_phydev.c b/service/src/node_phydev.c index 8314854..ab5ecca 100644 --- a/service/src/node_phydev.c +++ b/service/src/node_phydev.c @@ -414,6 +414,25 @@ static __rte_always_inline uint16_t dpdk_msgpack_dev_rx_node_process(struct rte_ nr_mbufs = mbufs_msgpack_decode((struct rte_mbuf **)node->objs, nr_mbufs); node->idx = nr_mbufs; + struct pkt_parser_result * parser_results[RTE_GRAPH_BURST_SIZE]; + for (unsigned int i = 0; i < nr_mbufs; i++) + { + /* Parser Pkt */ + struct pkt_parser pkt_parser; + struct rte_mbuf * mbuf = (struct rte_mbuf *)node->objs[i]; + struct mrb_metadata * mrb_meta = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); + + pkt_parser_init(&pkt_parser, &mrb_meta->pkt_parser_result, LAYER_TYPE_ALL, MR_PKT_PARSER_LAYERS_MAX); + pkt_parser_exec(&pkt_parser, mbuf); + + parser_results[i] = &mrb_meta->pkt_parser_result; + } + + /* for test */ + struct sc_main * sc = p_dev_node_main->sc; + distributer_calculate_from_parser_results(sc->dist_object, (struct rte_mbuf **)node->objs, parser_results, + nr_mbufs); + /* Msgpack does not currently support tracing. */ #if 0 for (unsigned int i = 0; i < nr_mbufs; i++) diff --git a/service/src/node_tera.c b/service/src/node_tera.c index b5edaa9..a28c90d 100644 --- a/service/src/node_tera.c +++ b/service/src/node_tera.c @@ -43,7 +43,8 @@ enum tera_ingress_drop_reason }; /* Tera ingress drop reason string */ -static const char * tera_ingress_drop_reason_str[TERA_INGR_DROP_RSN_MAX] = {"adapter_lookup_miss", "append_sid_err"}; +static const char * tera_ingress_drop_reason_str[TERA_INGR_DROP_RSN_MAX] = {"drop_rsn_adapter_lookup_miss", + "drop_rsn_append_sid_err"}; /* Tera ingress stats struct */ struct tera_ingress_stats @@ -622,7 +623,7 @@ cJSON * tera_ingress_node_monit_loop(struct sc_main * sc) uint64_t total_pkts[nr_graphs]; uint64_t pkts_per_batch[nr_graphs]; uint64_t to_classifier[nr_graphs]; - uint64_t drop_reason[nr_graphs][TERA_INGR_DROP_RSN_MAX]; + uint64_t drop_reason[TERA_INGR_DROP_RSN_MAX][nr_graphs]; for (uint32_t graph_id = 0; graph_id < nr_graphs; graph_id++) { @@ -633,7 +634,11 @@ cJSON * tera_ingress_node_monit_loop(struct sc_main * sc) pkts_per_batch[graph_id] = 0; to_classifier[graph_id] = 0; - memset(drop_reason[graph_id], 0, sizeof(drop_reason[graph_id])); + for (int i = 0; i < TERA_INGR_DROP_RSN_MAX; i++) + { + drop_reason[i][graph_id] = 0; + } + continue; } @@ -643,7 +648,7 @@ cJSON * tera_ingress_node_monit_loop(struct sc_main * sc) for (int i = 0; i < TERA_INGR_DROP_RSN_MAX; i++) { - drop_reason[graph_id][i] = stats->drop_reason[i]; + drop_reason[i][graph_id] = stats->drop_reason[i]; } } |
