dpdk: rx checksum offload
[vpp.git] / src / plugins / dpdk / device / node.c
index 31ca541..a16d485 100644 (file)
@@ -144,16 +144,16 @@ dpdk_prefetch_buffer_x4 (struct rte_mbuf *mb[])
       <code>xd->per_interface_next_index</code>
 */
 
-static_always_inline u8
-dpdk_ol_flags_extract (struct rte_mbuf **mb, u8 * flags, int count)
+static_always_inline u16
+dpdk_ol_flags_extract (struct rte_mbuf **mb, u16 * flags, int count)
 {
-  u8 rv = 0;
+  u16 rv = 0;
   int i;
   for (i = 0; i < count; i++)
     {
       /* all flags we are interested in are in lower 8 bits but
          that might change */
-      flags[i] = (u8) mb[i]->ol_flags;
+      flags[i] = (u16) mb[i]->ol_flags;
       rv |= flags[i];
     }
   return rv;
@@ -161,13 +161,14 @@ dpdk_ol_flags_extract (struct rte_mbuf **mb, u8 * flags, int count)
 
 static_always_inline uword
 dpdk_process_rx_burst (vlib_main_t * vm, dpdk_per_thread_data_t * ptd,
-                      uword n_rx_packets, int maybe_multiseg, u8 * or_flagsp)
+                      uword n_rx_packets, int maybe_multiseg,
+                      u16 * or_flagsp)
 {
   u32 n_left = n_rx_packets;
   vlib_buffer_t *b[4];
   struct rte_mbuf **mb = ptd->mbufs;
   uword n_bytes = 0;
-  u8 *flags, or_flags = 0;
+  u16 *flags, or_flags = 0;
   vlib_buffer_t bt;
 
   mb = ptd->mbufs;
@@ -258,7 +259,7 @@ dpdk_process_flow_offload (dpdk_device_t * xd, dpdk_per_thread_data_t * ptd,
   /* TODO prefetch and quad-loop */
   for (n = 0; n < n_rx_packets; n++)
     {
-      if ((ptd->flags[n] & PKT_RX_FDIR) == 0)
+      if ((ptd->flags[n] & PKT_RX_FDIR_ID) == 0)
        continue;
 
       fle = pool_elt_at_index (xd->flow_lookup_entries,
@@ -292,7 +293,7 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
   struct rte_mbuf **mb;
   vlib_buffer_t *b0;
   u16 *next;
-  u8 or_flags;
+  u16 or_flags;
   u32 n;
   int single_next = 0;
 
@@ -377,7 +378,7 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
          vlib_frame_t *f;
          ethernet_input_frame_t *ef;
          nf = vlib_node_runtime_get_next_frame (vm, node, next_index);
-         f = vlib_get_frame (vm, nf->frame_index);
+         f = vlib_get_frame (vm, nf->frame);
          f->flags = ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX;
 
          ef = vlib_frame_scalar_args (f);
@@ -438,54 +439,6 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
       vlib_set_trace_count (vm, node, n_trace);
     }
 
-  /* rx pcap capture if enabled */
-  if (PREDICT_FALSE (dm->pcap[VLIB_RX].pcap_enable))
-    {
-      u32 bi0;
-
-      if (single_next)
-       vlib_get_buffer_indices_with_offset (vm, (void **) ptd->mbufs,
-                                            ptd->buffers, n_rx_packets,
-                                            sizeof (struct rte_mbuf));
-
-      n_left = n_rx_packets;
-      buffers = ptd->buffers;
-      while (n_left)
-       {
-         bi0 = buffers[0];
-         b0 = vlib_get_buffer (vm, bi0);
-         buffers++;
-
-         if (dm->pcap[VLIB_RX].pcap_sw_if_index == 0 ||
-             dm->pcap[VLIB_RX].pcap_sw_if_index
-             == vnet_buffer (b0)->sw_if_index[VLIB_RX])
-           {
-             struct rte_mbuf *mb;
-             i16 data_start;
-             i32 temp_advance;
-
-             /*
-              * Note: current_data will have advanced
-              * when we skip ethernet input.
-              * Temporarily back up to the original DMA
-              * target, so we capture a valid ethernet frame
-              */
-             mb = rte_mbuf_from_vlib_buffer (b0);
-
-             /* Figure out the original data_start */
-             data_start = (mb->buf_addr + mb->data_off) - (void *) b0->data;
-             /* Back up that far */
-             temp_advance = b0->current_data - data_start;
-             vlib_buffer_advance (b0, -temp_advance);
-             /* Trace the packet */
-             pcap_add_buffer (&dm->pcap[VLIB_RX].pcap_main, vm, bi0, 512);
-             /* and advance again */
-             vlib_buffer_advance (b0, temp_advance);
-           }
-         n_left--;
-       }
-    }
-
   vlib_increment_combined_counter
     (vnet_get_main ()->interface_main.combined_sw_if_counters
      + VNET_INTERFACE_COUNTER_RX, thread_index, xd->sw_if_index,
@@ -513,8 +466,6 @@ VLIB_NODE_FN (dpdk_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
   foreach_device_and_queue (dq, rt->devices_and_queues)
     {
       xd = vec_elt_at_index(dm->devices, dq->dev_instance);
-      if (PREDICT_FALSE (xd->flags & DPDK_DEVICE_FLAG_BOND_SLAVE))
-       continue;       /* Do not poll slave to a bonded interface */
       n_rx_packets += dpdk_device_input (vm, dm, xd, node, thread_index,
                                         dq->queue_id);
     }
@@ -527,6 +478,7 @@ VLIB_REGISTER_NODE (dpdk_input_node) = {
   .type = VLIB_NODE_TYPE_INPUT,
   .name = "dpdk-input",
   .sibling_of = "device-input",
+  .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
 
   /* Will be enabled if/when hardware is detected. */
   .state = VLIB_NODE_STATE_DISABLED,