From 132d51d4d2f143bd5cd8d50137ff376944d0503a Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Thu, 7 Jul 2016 10:10:17 -0400 Subject: [PATCH] Document more nodes Change-Id: Ib8ef0559aa0573bf1229e9c794d48520197f9c8a Signed-off-by: Dave Barach --- vnet/vnet/devices/dpdk/node.c | 42 ++++++++++++++++++++++++++++ vnet/vnet/ip/ip4_forward.c | 65 +++++++++++++++++++++++++++++++++++++++++++ vnet/vnet/ip/ip4_input.c | 35 +++++++++++++++++++++++ 3 files changed, 142 insertions(+) diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c index 689e4f8709f..942274b0bf5 100644 --- a/vnet/vnet/devices/dpdk/node.c +++ b/vnet/vnet/devices/dpdk/node.c @@ -558,6 +558,48 @@ static inline void poll_rate_limit(dpdk_main_t * dm) } } +/** \brief Main DPDK input node + @node dpdk-input + + This is the main DPDK input node: across each assigned interface, + call rte_eth_rx_burst(...) or similar to obtain a vector of + packets to process. Handle early packet discard. Derive @c + vlib_buffer_t metadata from struct rte_mbuf metadata, + Depending on the resulting metadata: adjust b->current_data, + b->current_length and dispatch directly to + ip4-input-no-checksum, or ip6-input. Trace the packet if required. + + @param vm vlib_main_t corresponding to the current thread + @param node vlib_node_runtime_t + @param frame vlib_frame_t input-node, not used. + + @par Graph mechanics: buffer metadata, next index usage + + @em Uses: + - struct rte_mbuf mb->ol_flags + - PKT_EXT_RX_PKT_ERROR, PKT_EXT_RX_BAD_FCS + PKT_RX_IP_CKSUM_BAD, PKT_RX_L4_CKSUM_BAD + - RTE_ETH_IS_xxx_HDR(mb->packet_type) + - packet classification result + + @em Sets: + - b->error if the packet is to be dropped immediately + - b->current_data, b->current_length + - adjusted as needed to skip the L2 header in direct-dispatch cases + - vnet_buffer(b)->sw_if_index[VLIB_RX] + - rx interface sw_if_index + - vnet_buffer(b)->sw_if_index[VLIB_TX] = ~0 + - required by ipX-lookup + - b->flags + - to indicate multi-segment pkts (VLIB_BUFFER_NEXT_PRESENT), etc. + + Next Nodes: + - Static arcs to: error-drop, ethernet-input, + ip4-input-no-checksum, ip6-input, mpls-gre-input + - per-interface redirection, controlled by + xd->per_interface_next_index +*/ + static uword dpdk_input (vlib_main_t * vm, vlib_node_runtime_t * node, diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c index 45699b128fe..35c42d822b7 100644 --- a/vnet/vnet/ip/ip4_forward.c +++ b/vnet/vnet/ip/ip4_forward.c @@ -2919,6 +2919,38 @@ ip4_rewrite_inline (vlib_main_t * vm, return frame->n_vectors; } + +/** \brief IPv4 transit rewrite node. + @node ip4-rewrite-transit + + This is the IPv4 transit-rewrite node: decrement TTL, fix the ipv4 + header checksum, fetch the ip adjacency, check the outbound mtu, + apply the adjacency rewrite, and send pkts to the adjacency + rewrite header's rewrite_next_index. + + @param vm vlib_main_t corresponding to the current thread + @param node vlib_node_runtime_t + @param frame vlib_frame_t whose contents should be dispatched + + @par Graph mechanics: buffer metadata, next index usage + + @em Uses: + - vnet_buffer(b)->ip.adj_index[VLIB_TX] + - the rewrite adjacency index + - adj->lookup_next_index + - Must be IP_LOOKUP_NEXT_REWRITE or IP_LOOKUP_NEXT_ARP, otherwise + the packet will be dropped. + - adj->rewrite_header + - Rewrite string length, rewrite string, next_index + + @em Sets: + - b->current_data, b->current_length + - Updated net of applying the rewrite string + + Next Indices: + - adj->rewrite_header.next_index + or @c error-drop +*/ static uword ip4_rewrite_transit (vlib_main_t * vm, vlib_node_runtime_t * node, @@ -2928,6 +2960,39 @@ ip4_rewrite_transit (vlib_main_t * vm, /* rewrite_for_locally_received_packets */ 0); } +/** \brief IPv4 local rewrite node. + @node ip4-rewrite-local + + This is the IPv4 local rewrite node. Fetch the ip adjacency, check + the outbound interface mtu, apply the adjacency rewrite, and send + pkts to the adjacency rewrite header's rewrite_next_index. Deal + with hemorrhoids of the form "some clown sends an icmp4 w/ src = + dst = interface addr." + + @param vm vlib_main_t corresponding to the current thread + @param node vlib_node_runtime_t + @param frame vlib_frame_t whose contents should be dispatched + + @par Graph mechanics: buffer metadata, next index usage + + @em Uses: + - vnet_buffer(b)->ip.adj_index[VLIB_RX] + - the rewrite adjacency index + - adj->lookup_next_index + - Must be IP_LOOKUP_NEXT_REWRITE or IP_LOOKUP_NEXT_ARP, otherwise + the packet will be dropped. + - adj->rewrite_header + - Rewrite string length, rewrite string, next_index + + @em Sets: + - b->current_data, b->current_length + - Updated net of applying the rewrite string + + Next Indices: + - adj->rewrite_header.next_index + or @c error-drop +*/ + static uword ip4_rewrite_local (vlib_main_t * vm, vlib_node_runtime_t * node, diff --git a/vnet/vnet/ip/ip4_input.c b/vnet/vnet/ip/ip4_input.c index c5281c4eb1d..1c7d327dc18 100644 --- a/vnet/vnet/ip/ip4_input.c +++ b/vnet/vnet/ip/ip4_input.c @@ -328,6 +328,41 @@ ip4_input_inline (vlib_main_t * vm, return frame->n_vectors; } +/** \brief IPv4 input node. + @node ip4-input + + This is the IPv4 input node: validates ip4 header checksums, + verifies ip header lengths, discards pkts with expired TTLs, + and sends pkts to the set of ip feature nodes configured on + the rx interface. + + @param vm vlib_main_t corresponding to the current thread + @param node vlib_node_runtime_t + @param frame vlib_frame_t whose contents should be dispatched + + @par Graph mechanics: buffer metadata, next index usage + + @em Uses: + - ip_config_main_t cm corresponding to each pkt's dst address unicast / + multicast status. + - b->current_config_index corresponding to each pkt's + rx sw_if_index. + - This sets the per-packet graph trajectory, ensuring that + each packet visits the per-interface features in order. + + - vnet_buffer(b)->sw_if_index[VLIB_RX] + - Indicates the @c sw_if_index value of the interface that the + packet was received on. + + @em Sets: + - vnet_buffer(b)->ip.adj_index[VLIB_TX] + - The lookup result adjacency index. + + Next Indices: + - Dispatches pkts to the (first) feature node: + vnet_get_config_data (... &next0 ...); + or @c error-drop +*/ static uword ip4_input (vlib_main_t * vm, vlib_node_runtime_t * node, -- 2.16.6