Add extern to *_main global variable declarations in header files.
[vpp.git] / src / vnet / devices / af_packet / af_packet.c
index 62bb228..d0a241e 100644 (file)
 #include <sys/types.h>
 #include <fcntl.h>
 
+#include <vppinfra/linux/sysfs.h>
 #include <vlib/vlib.h>
 #include <vlib/unix/unix.h>
-#include <vlib/linux/sysfs.h>
 #include <vnet/ip/ip.h>
 #include <vnet/ethernet/ethernet.h>
 
 #include <vnet/devices/af_packet/af_packet.h>
 
+af_packet_main_t af_packet_main;
+
 #define AF_PACKET_DEBUG_SOCKET         0
 
 #define AF_PACKET_TX_FRAMES_PER_BLOCK  1024
@@ -75,7 +77,7 @@ af_packet_eth_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi,
     {
       s = format (0, "/sys/class/net/%s/mtu%c", apif->host_if_name, 0);
 
-      error = vlib_sysfs_write ((char *) s, "%d", hi->max_packet_bytes);
+      error = clib_sysfs_write ((char *) s, "%d", hi->max_packet_bytes);
       vec_free (s);
 
       if (error)
@@ -406,6 +408,22 @@ af_packet_delete_if (vlib_main_t * vm, u8 * host_if_name)
   return 0;
 }
 
+int
+af_packet_set_l4_cksum_offload (vlib_main_t * vm, u32 sw_if_index, u8 set)
+{
+  vnet_main_t *vnm = vnet_get_main ();
+  vnet_hw_interface_t *hw;
+
+  hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
+
+  if (set)
+    hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+  else
+    hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+
+  return 0;
+}
+
 static clib_error_t *
 af_packet_init (vlib_main_t * vm)
 {