diff --git a/modules/infra/datapath/eth_input.c b/modules/infra/datapath/eth_input.c index 84574adf..831c245a 100644 --- a/modules/infra/datapath/eth_input.c +++ b/modules/infra/datapath/eth_input.c @@ -21,7 +21,10 @@ enum { static rte_edge_t l2l3_edges[1 << 16] = {UNKNOWN_ETHER_TYPE}; -void gr_eth_input_add_type(rte_be16_t eth_type, rte_edge_t edge) { +void gr_eth_input_add_type(rte_be16_t eth_type, const char *node_name) { + rte_edge_t edge = gr_node_attach_parent("eth_input", node_name); + if (edge == RTE_EDGE_ID_INVALID) + ABORT("gr_node_attach_parent(eth_input, %s) failed", node_name); l2l3_edges[eth_type] = edge; LOG(DEBUG, "eth_input: type=0x%04x -> edge %u", rte_be_to_cpu_16(eth_type), edge); } diff --git a/modules/infra/datapath/gr_eth_input.h b/modules/infra/datapath/gr_eth_input.h index 4641dae9..a2aef941 100644 --- a/modules/infra/datapath/gr_eth_input.h +++ b/modules/infra/datapath/gr_eth_input.h @@ -13,6 +13,6 @@ GR_MBUF_PRIV_DATA_TYPE(eth_input_mbuf_data, { const struct iface *iface; }); -void gr_eth_input_add_type(rte_be16_t eth_type, rte_edge_t edge); +void gr_eth_input_add_type(rte_be16_t eth_type, const char *node_name); #endif diff --git a/modules/ip/datapath/arp_input.c b/modules/ip/datapath/arp_input.c index 77197ab7..d1cce6ae 100644 --- a/modules/ip/datapath/arp_input.c +++ b/modules/ip/datapath/arp_input.c @@ -135,10 +135,7 @@ arp_input_process(struct rte_graph *graph, struct rte_node *node, void **objs, u } static void arp_input_register(void) { - rte_edge_t edge = gr_node_attach_parent("eth_input", "arp_input"); - if (edge == RTE_EDGE_ID_INVALID) - ABORT("gr_node_attach_parent(eth_input, arp_input) failed"); - gr_eth_input_add_type(rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP), edge); + gr_eth_input_add_type(rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP), "arp_input"); } static struct rte_node_register node = { diff --git a/modules/ip/datapath/gr_ip4_datapath.h b/modules/ip/datapath/gr_ip4_datapath.h index e5355d94..b3db0999 100644 --- a/modules/ip/datapath/gr_ip4_datapath.h +++ b/modules/ip/datapath/gr_ip4_datapath.h @@ -33,7 +33,7 @@ GR_MBUF_PRIV_DATA_TYPE(ip_local_mbuf_data, { uint8_t proto; }); -void ip_input_local_add_proto(uint8_t proto, rte_edge_t edge); +void ip_input_local_add_proto(uint8_t proto, const char *node_name); void ip_output_add_tunnel(uint16_t iface_type_id, rte_edge_t edge); int arp_output_request_solicit(struct nexthop *nh); diff --git a/modules/ip/datapath/icmp_input.c b/modules/ip/datapath/icmp_input.c index dc01e51e..22014071 100644 --- a/modules/ip/datapath/icmp_input.c +++ b/modules/ip/datapath/icmp_input.c @@ -64,10 +64,7 @@ icmp_input_process(struct rte_graph *graph, struct rte_node *node, void **objs, } static void icmp_input_register(void) { - rte_edge_t edge = gr_node_attach_parent("ip_input_local", "icmp_input"); - if (edge == RTE_EDGE_ID_INVALID) - ABORT("gr_node_attach_parent(classify, icmp_input) failed"); - ip_input_local_add_proto(IPPROTO_ICMP, edge); + ip_input_local_add_proto(IPPROTO_ICMP, "icmp_input"); } static struct rte_node_register icmp_input_node = { diff --git a/modules/ip/datapath/ip_input.c b/modules/ip/datapath/ip_input.c index 5eb3a5de..0acbbf37 100644 --- a/modules/ip/datapath/ip_input.c +++ b/modules/ip/datapath/ip_input.c @@ -97,10 +97,7 @@ ip_input_process(struct rte_graph *graph, struct rte_node *node, void **objs, ui } static void ip_input_register(void) { - rte_edge_t edge = gr_node_attach_parent("eth_input", "ip_input"); - if (edge == RTE_EDGE_ID_INVALID) - ABORT("gr_node_attach_parent(eth_input, ip_input) failed"); - gr_eth_input_add_type(rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4), edge); + gr_eth_input_add_type(rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4), "ip_input"); } static struct rte_node_register input_node = { diff --git a/modules/ip/datapath/ip_local.c b/modules/ip/datapath/ip_local.c index 7de76f25..ee0f5f6f 100644 --- a/modules/ip/datapath/ip_local.c +++ b/modules/ip/datapath/ip_local.c @@ -13,7 +13,10 @@ #define UNKNOWN_PROTO 0 static rte_edge_t edges[256] = {UNKNOWN_PROTO}; -void ip_input_local_add_proto(uint8_t proto, rte_edge_t edge) { +void ip_input_local_add_proto(uint8_t proto, const char *node_name) { + rte_edge_t edge = gr_node_attach_parent("ip_input_local", node_name); + if (edge == RTE_EDGE_ID_INVALID) + ABORT("gr_node_attach_parent(ip_input_local, %s) failed", node_name); edges[proto] = edge; LOG(DEBUG, "ip_input_local: proto=%u -> edge %u", proto, edge); } diff --git a/modules/ipip/datapath_in.c b/modules/ipip/datapath_in.c index 1666f2a7..a0c4a3db 100644 --- a/modules/ipip/datapath_in.c +++ b/modules/ipip/datapath_in.c @@ -68,10 +68,7 @@ ipip_input_process(struct rte_graph *graph, struct rte_node *node, void **objs, } static void ipip_input_register(void) { - rte_edge_t edge = gr_node_attach_parent("ip_input_local", "ipip_input"); - if (edge == RTE_EDGE_ID_INVALID) - ABORT("gr_node_attach_parent(ip_input_local, ipip_input) failed"); - ip_input_local_add_proto(IPPROTO_IPIP, edge); + ip_input_local_add_proto(IPPROTO_IPIP, "ipip_input"); } static struct rte_node_register ipip_input_node = {