session: lookup listener with iface address
[vpp.git] / src / vnet / dpo / dpo.c
index df78456..d8342ff 100644 (file)
  * @brief
  * A Data-Path Object is an object that represents actions that are
  * applied to packets are they are switched through VPP.
- * 
+ *
  * The DPO is a base class that is specialised by other objects to provide
  * concrete actions
  *
  * The VLIB graph nodes are graph of types, the DPO graph is a graph of instances.
  */
 
+// clang-format off
+
 #include <vnet/dpo/dpo.h>
 #include <vnet/ip/lookup.h>
 #include <vnet/ip/format.h>
@@ -43,6 +45,7 @@
 #include <vnet/dpo/dvr_dpo.h>
 #include <vnet/dpo/l3_proxy_dpo.h>
 #include <vnet/dpo/ip6_ll_dpo.h>
+#include <vnet/dpo/pw_cw.h>
 
 /**
  * Array of char* names for the DPO types and protos
@@ -261,16 +264,18 @@ void
 dpo_copy (dpo_id_t *dst,
          const dpo_id_t *src)
 {
-    dpo_id_t tmp = *dst;
+    dpo_id_t tmp = {
+        .as_u64 = dst->as_u64
+    };
 
     /*
      * the destination is written in a single u64 write - hence atomically w.r.t
      * any packets inflight.
      */
-    *((u64*)dst) = *(u64*)src; 
+    dst->as_u64 = src->as_u64;
 
     dpo_lock(dst);
-    dpo_unlock(&tmp);    
+    dpo_unlock(&tmp);
 }
 
 int
@@ -278,6 +283,9 @@ dpo_is_adj (const dpo_id_t *dpo)
 {
     return ((dpo->dpoi_type == DPO_ADJACENCY) ||
            (dpo->dpoi_type == DPO_ADJACENCY_INCOMPLETE) ||
+            (dpo->dpoi_type == DPO_ADJACENCY_GLEAN) ||
+            (dpo->dpoi_type == DPO_ADJACENCY_MCAST) ||
+            (dpo->dpoi_type == DPO_ADJACENCY_MCAST_MIDCHAIN) ||
            (dpo->dpoi_type == DPO_ADJACENCY_MIDCHAIN) ||
            (dpo->dpoi_type == DPO_ADJACENCY_GLEAN));
 }
@@ -389,6 +397,18 @@ dpo_get_urpf(const dpo_id_t *dpo)
     return (~0);
 }
 
+u16
+dpo_get_mtu(const dpo_id_t *dpo)
+{
+    if (dpo_id_is_valid(dpo) &&
+        (NULL != dpo_vfts[dpo->dpoi_type].dv_get_mtu))
+    {
+        return (dpo_vfts[dpo->dpoi_type].dv_get_mtu(dpo));
+    }
+
+    return (0xffff);
+}
+
 static u32
 dpo_get_next_node (dpo_type_t child_type,
                    dpo_proto_t child_proto,
@@ -588,11 +608,17 @@ dpo_module_init (vlib_main_t * vm)
     mpls_disp_dpo_module_init();
     dvr_dpo_module_init();
     l3_proxy_dpo_module_init();
+    pw_cw_dpo_module_init();
 
     return (NULL);
 }
 
-VLIB_INIT_FUNCTION(dpo_module_init);
+/* *INDENT-OFF* */
+VLIB_INIT_FUNCTION(dpo_module_init) =
+{
+    .runs_before = VLIB_INITS ("ip_main_init"),
+};
+/* *INDENT-ON* */
 
 static clib_error_t *
 dpo_memory_show (vlib_main_t * vm,
@@ -637,3 +663,5 @@ VLIB_CLI_COMMAND (show_fib_memory, static) = {
     .short_help = "show dpo memory",
 };
 /* *INDENT-ON* */
+
+// clang-format on