dpdk: don't drop packets if l4 checksum is flagged as bad
[vpp.git] / vnet / vnet / interface_funcs.h
index 735d47e..b84d151 100644 (file)
@@ -92,6 +92,59 @@ vnet_get_device_class (vnet_main_t * vnm, u32 dev_class_index)
                           dev_class_index);
 }
 
+static inline u8 *
+vnet_get_sw_interface_tag (vnet_main_t * vnm, u32 sw_if_index)
+{
+  uword *p;
+  p = hash_get (vnm->interface_tag_by_sw_if_index, sw_if_index);
+  if (p)
+    return ((u8 *) p[0]);
+  return 0;
+}
+
+static inline void
+vnet_set_sw_interface_tag (vnet_main_t * vnm, u8 * tag, u32 sw_if_index)
+{
+  uword *p;
+  p = hash_get (vnm->interface_tag_by_sw_if_index, sw_if_index);
+  if (p)
+    {
+      u8 *oldtag = (u8 *) p[0];
+      hash_unset (vnm->interface_tag_by_sw_if_index, sw_if_index);
+      vec_free (oldtag);
+    }
+
+  hash_set (vnm->interface_tag_by_sw_if_index, sw_if_index, tag);
+}
+
+static inline void
+vnet_clear_sw_interface_tag (vnet_main_t * vnm, u32 sw_if_index)
+{
+  uword *p;
+  p = hash_get (vnm->interface_tag_by_sw_if_index, sw_if_index);
+  if (p)
+    {
+      u8 *oldtag = (u8 *) p[0];
+      hash_unset (vnm->interface_tag_by_sw_if_index, sw_if_index);
+      vec_free (oldtag);
+    }
+}
+
+/**
+ * Call back walk type for walking SW indices on a HW interface
+ */
+typedef void (*vnet_hw_sw_interface_walk_t) (vnet_main_t * vnm,
+                                            u32 sw_if_index, void *ctx);
+
+/**
+ * @brief
+ * Walk the SW interfaces on a HW interface - this is the super
+ * interface and any sub-interfaces.
+ */
+void vnet_hw_interface_walk_sw (vnet_main_t * vnm,
+                               u32 hw_if_index,
+                               vnet_hw_sw_interface_walk_t fn, void *ctx);
+
 /* Register a hardware interface instance. */
 u32 vnet_register_interface (vnet_main_t * vnm,
                             u32 dev_class_index,
@@ -128,6 +181,22 @@ vnet_hw_interface_get_flags (vnet_main_t * vnm, u32 hw_if_index)
   return hw->flags;
 }
 
+always_inline uword
+vnet_hw_interface_get_mtu (vnet_main_t * vnm, u32 hw_if_index,
+                          vlib_rx_or_tx_t dir)
+{
+  vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
+  return hw->max_l3_packet_bytes[dir];
+}
+
+always_inline uword
+vnet_sw_interface_get_mtu (vnet_main_t * vnm, u32 sw_if_index,
+                          vlib_rx_or_tx_t dir)
+{
+  vnet_hw_interface_t *hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
+  return (hw->max_l3_packet_bytes[dir]);
+}
+
 always_inline uword
 vnet_hw_interface_is_link_up (vnet_main_t * vnm, u32 hw_if_index)
 {
@@ -173,6 +242,11 @@ void vnet_hw_interface_init_for_class (vnet_main_t * vnm, u32 hw_if_index,
 clib_error_t *vnet_rename_interface (vnet_main_t * vnm, u32 hw_if_index,
                                     char *new_name);
 
+/* Change interface mac address*/
+clib_error_t *vnet_hw_interface_change_mac_address (vnet_main_t * vnm,
+                                                   u32 hw_if_index,
+                                                   u64 mac_address);
+
 /* Formats sw/hw interface. */
 format_function_t format_vnet_hw_interface;
 format_function_t format_vnet_sw_interface;
@@ -200,7 +274,7 @@ typedef struct
 
 /* Interface output functions. */
 void *vnet_interface_output_node_multiarch_select (void);
-void *vnet_interface_output_node_no_flatten_multiarch_select (void);
+void *vnet_interface_output_node_flatten_multiarch_select (void);
 
 word vnet_sw_interface_compare (vnet_main_t * vnm, uword sw_if_index0,
                                uword sw_if_index1);
@@ -209,10 +283,7 @@ word vnet_hw_interface_compare (vnet_main_t * vnm, uword hw_if_index0,
 
 typedef enum
 {
-#define _(sym,str) VNET_INTERFACE_OUTPUT_NEXT_##sym,
-  foreach_intf_output_feat
-#undef _
-    VNET_INTERFACE_OUTPUT_NEXT_DROP,
+  VNET_INTERFACE_OUTPUT_NEXT_DROP,
   VNET_INTERFACE_OUTPUT_NEXT_TX,
 } vnet_interface_output_next_t;