crypto crypto-openssl: support hashing operations
[vpp.git] / src / plugins / af_xdp / device.c
index 48e61dd..35ba617 100644 (file)
@@ -208,6 +208,18 @@ af_xdp_create_queue (vlib_main_t * vm, af_xdp_create_if_args_t * args,
   umem_config.comp_size = args->txq_size;
   umem_config.frame_size =
     sizeof (vlib_buffer_t) + vlib_buffer_get_default_data_size (vm);
+  /*
+   * Note about headroom: for some reasons, there seem to be a discrepency
+   * between 0-copy and copy mode:
+   *   - 0-copy: XDP_PACKET_HEADROOM will be added to the user headroom
+   *   - copy: nothing is added to the user headroom
+   * We privileged 0-copy and set headroom so that frame_headroom +
+   * XDP_PACKET_HEADROOM == sizeof(vlib_buffer_t), ie data will correctly
+   * point to vlib_buffer_t->data for 0-copy. In copy mode, we have to add
+   * XDP_PACKET_HEADROOM to desc offset during refill.
+   */
+  STATIC_ASSERT (sizeof (vlib_buffer_t) >= XDP_PACKET_HEADROOM, "wrong size");
+  umem_config.frame_headroom = sizeof (vlib_buffer_t) - XDP_PACKET_HEADROOM;
   umem_config.flags = XDP_UMEM_UNALIGNED_CHUNK_FLAG;
   if (xsk_umem__create
       (umem, uword_to_pointer (vm->buffer_main->buffer_mem_start, void *),
@@ -420,7 +432,7 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args)
   sw = vnet_get_hw_sw_interface (vnm, ad->hw_if_index);
   hw = vnet_get_hw_interface (vnm, ad->hw_if_index);
   args->sw_if_index = ad->sw_if_index = sw->sw_if_index;
-  hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+  hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
 
   vnet_hw_if_set_input_node (vnm, ad->hw_if_index, af_xdp_input_node.index);