Allow DPDK per interface startup config to enable/disable VLAN stripping
[vpp.git] / vnet / vnet / devices / dpdk / node.c
index 0d45308..942274b 100644 (file)
@@ -58,21 +58,13 @@ static char * dpdk_error_strings[] = {
 always_inline int
 dpdk_mbuf_is_ip4(struct rte_mbuf *mb)
 {
-#if RTE_VERSION >= RTE_VERSION_NUM(2, 1, 0, 0)
   return RTE_ETH_IS_IPV4_HDR(mb->packet_type) != 0;
-#else
-  return (mb_flags & (PKT_RX_IPV4_HDR | PKT_RX_IPV4_HDR_EXT)) != 0;
-#endif
 }
 
 always_inline int
 dpdk_mbuf_is_ip6(struct rte_mbuf *mb)
 {
-#if RTE_VERSION >= RTE_VERSION_NUM(2, 1, 0, 0)
   return RTE_ETH_IS_IPV6_HDR(mb->packet_type) != 0;
-#else
-  return (mb_flags & (PKT_RX_IPV6_HDR | PKT_RX_IPV6_HDR_EXT)) != 0;
-#endif
 }
 
 always_inline int
@@ -439,7 +431,6 @@ static inline u32 dpdk_device_input ( dpdk_main_t * dm,
             }
 
           vlib_buffer_init_for_free_list (b0, fl);
-          b0->clone_count = 0;
           
           bi0 = vlib_get_buffer_index (vm, b0);
 
@@ -490,7 +481,6 @@ static inline u32 dpdk_device_input ( dpdk_main_t * dm,
 
              b_seg = vlib_buffer_from_rte_mbuf(mb_seg);
              vlib_buffer_init_for_free_list (b_seg, fl);
-              b_seg->clone_count = 0;
 
              ASSERT((b_seg->flags & VLIB_BUFFER_NEXT_PRESENT) == 0);
              ASSERT(b_seg->current_data == 0);
@@ -568,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 <code>struct rte_mbuf</code> metadata,
+    Depending on the resulting metadata: adjust <code>b->current_data,
+    b->current_length </code> 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:
+    - <code>struct rte_mbuf mb->ol_flags</code>
+        - PKT_EXT_RX_PKT_ERROR, PKT_EXT_RX_BAD_FCS
+        PKT_RX_IP_CKSUM_BAD, PKT_RX_L4_CKSUM_BAD
+    - <code> RTE_ETH_IS_xxx_HDR(mb->packet_type) </code>
+        - packet classification result
+
+    @em Sets:
+    - <code>b->error</code> if the packet is to be dropped immediately
+    - <code>b->current_data, b->current_length</code>
+        - adjusted as needed to skip the L2 header in  direct-dispatch cases
+    - <code>vnet_buffer(b)->sw_if_index[VLIB_RX]</code>
+        - rx interface sw_if_index
+    - <code>vnet_buffer(b)->sw_if_index[VLIB_TX] = ~0</code>
+        - required by ipX-lookup
+    - <code>b->flags</code>
+        - to indicate multi-segment pkts (VLIB_BUFFER_NEXT_PRESENT), etc.
+
+    <em>Next Nodes:</em>
+    - Static arcs to: error-drop, ethernet-input,
+      ip4-input-no-checksum, ip6-input, mpls-gre-input 
+    - per-interface redirection, controlled by
+      <code>xd->per_interface_next_index</code>
+*/
+
 static uword
 dpdk_input (vlib_main_t * vm,
            vlib_node_runtime_t * node,