diff options
| author | songyanchao <[email protected]> | 2023-12-26 07:36:01 +0000 |
|---|---|---|
| committer | songyanchao <[email protected]> | 2024-01-05 02:27:42 +0000 |
| commit | ebfbdc3f439396ef5755e6aad008ed526f1f58fa (patch) | |
| tree | 435f27c08ad7c0522ab21a3a9252bee0071b2a7b | |
| parent | e152f65e9fe68ce5bb6f375ed1d4afa86992d312 (diff) | |
🎈 perf: Delete redundant packet verification in Etherfabric ingress node.
Delete redundant packet verification in Etherfabric ingress node.
| -rw-r--r-- | service/src/node_eth_ingress.c | 9 | ||||
| -rw-r--r-- | service/src/node_etherfabric.c | 43 |
2 files changed, 18 insertions, 34 deletions
diff --git a/service/src/node_eth_ingress.c b/service/src/node_eth_ingress.c index 5315197..f620927 100644 --- a/service/src/node_eth_ingress.c +++ b/service/src/node_eth_ingress.c @@ -300,11 +300,14 @@ static int endpoint_dev_packet_handler(struct mr_dev_desc * dev_desc, struct eth return ETH_INGRESS_NEXT_PKT_DROP; } - if (likely(dst_port == G_VXLAN_DPORT)) + if (unlikely(dst_port != G_VXLAN_DPORT)) { - stat->to_ef_ingress++; - return ETH_INGRESS_NEXT_EF_INGRESS; + stat->ef_drop_for_unexpected++; + return ETH_INGRESS_NEXT_PKT_DROP; } + + stat->to_ef_ingress++; + return ETH_INGRESS_NEXT_EF_INGRESS; } else if (adapter_type == ADAPTER_TYPE_TERA) { diff --git a/service/src/node_etherfabric.c b/service/src/node_etherfabric.c index 43d9dc4..369ff40 100644 --- a/service/src/node_etherfabric.c +++ b/service/src/node_etherfabric.c @@ -436,26 +436,6 @@ static __rte_always_inline uint16_t ef_ingress_node_process(struct rte_graph * g mbufs += 1; n_left_from -= 1; - /* the packet must be like ETHER, IPV4, UDP */ - const uint16_t expect_layer_types[] = { - LAYER_TYPE_ID_ETHER, - LAYER_TYPE_ID_IPV4, - LAYER_TYPE_ID_UDP, - LAYER_TYPE_ID_G_VXLAN, - }; - - struct mrb_metadata * private_ctrlzone = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); - struct pkt_parser_result * pkt_parser_result = &private_ctrlzone->pkt_parser_result; - int expect_result = - complex_layer_type_expect(pkt_parser_result, expect_layer_types, RTE_DIM(expect_layer_types)); - - if (unlikely(expect_result < 0)) - { - stat.drop_for_unexpected++; - next_node_index = EF_INGRESS_NEXT_PKT_DROP; - goto node_enqueue; - } - /* Prepare headers */ struct rte_ether_hdr * outer_ether_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ether_hdr *, 0); struct rte_ipv4_hdr * outer_ipv4_hdr = @@ -495,16 +475,17 @@ static __rte_always_inline uint16_t ef_ingress_node_process(struct rte_graph * g link_db_match(ef_mgr->link_db_ctx, &match_field, 1, &result); /* Fill ef_peer index and dir */ - private_ctrlzone->adapter_type = ADAPTER_TYPE_EF; - private_ctrlzone->adapter_id = adapter_id; - private_ctrlzone->ef_link_id = outer_g_vxlan_hdr->link_id; - private_ctrlzone->traffic_link_id = result; - private_ctrlzone->dir = outer_g_vxlan_hdr->dir; - private_ctrlzone->ef_peer_index = (uint16_t)ef_peer_index; + struct mrb_metadata * mrb_meta = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); + mrb_meta->adapter_type = ADAPTER_TYPE_EF; + mrb_meta->adapter_id = adapter_id; + mrb_meta->ef_link_id = outer_g_vxlan_hdr->link_id; + mrb_meta->traffic_link_id = result; + mrb_meta->dir = outer_g_vxlan_hdr->dir; + mrb_meta->ef_peer_index = (uint16_t)ef_peer_index; /* Insert sid*/ uint16_t sids[1] = {ef_mgr->sid_start + adapter_id}; - if (unlikely(sid_list_prepend(&private_ctrlzone->sid_list, sids, 1) == RT_ERR)) + if (unlikely(sid_list_prepend(&mrb_meta->sid_list, sids, 1) == RT_ERR)) { stat.drop_for_append_sid_err++; next_node_index = EF_INGRESS_NEXT_PKT_DROP; @@ -514,7 +495,7 @@ static __rte_always_inline uint16_t ef_ingress_node_process(struct rte_graph * g /* Swap the outer mac and ip addr */ vxlan_encap_forwarded_pkt(mbuf); - complex_layer_adjust(pkt_parser_result, ef_encap_len); + complex_layer_adjust(&mrb_meta->pkt_parser_result, ef_encap_len); rte_pktmbuf_adj(mbuf, ef_encap_len); /* Send the pkt to classifier */ @@ -570,7 +551,7 @@ static struct rte_node_register ef_ingress_node_base = { RTE_NODE_REGISTER(ef_ingress_node_base); /* Fill Ether IPv4 Udp Vxlan hdr for the constructed packet */ -static inline int vxlan_encap_constructed_pkt(struct rte_mbuf * mbuf, struct mrb_metadata * private_ctrlzone, +static inline int vxlan_encap_constructed_pkt(struct rte_mbuf * mbuf, struct mrb_metadata * mrb_meta, struct ef_peer * ef_peer_item, struct mr_dev_desc * dev_desc) { /* construct the packet by the order of inner to outer */ @@ -582,8 +563,8 @@ static inline int vxlan_encap_constructed_pkt(struct rte_mbuf * mbuf, struct mrb /* clear the vxlan header */ memset(p_vxlan_hdr, 0, sizeof(struct g_vxlan_hdr)); - p_vxlan_hdr->dir = private_ctrlzone->dir; - p_vxlan_hdr->link_id = private_ctrlzone->ef_link_id; + p_vxlan_hdr->dir = mrb_meta->dir; + p_vxlan_hdr->link_id = mrb_meta->ef_link_id; /* then, the outer udp header */ struct rte_udp_hdr * p_udp_hdr = (struct rte_udp_hdr *)rte_pktmbuf_prepend(mbuf, sizeof(struct rte_udp_hdr)); |
