aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/l3xc/l3xc.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-05-22 13:26:39 +0000
committerDamjan Marion <dmarion@me.com>2019-06-05 11:33:12 +0000
commit59fa121f8953f7b07f0cc02149ca28182f959f42 (patch)
tree51249a3bf2da047a791b7446af09f15df91118a6 /src/plugins/l3xc/l3xc.h
parente6be702362299566990678f505512b1b74b49112 (diff)
L3 cross connect
- all packets input on interface X are load-balanced over the set of paths provided. Change-Id: Ic27cb88c4cd5d6d3462570632daff7a43d5a652d Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/l3xc/l3xc.h')
-rw-r--r--src/plugins/l3xc/l3xc.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/plugins/l3xc/l3xc.h b/src/plugins/l3xc/l3xc.h
new file mode 100644
index 00000000000..d5e1d372a86
--- /dev/null
+++ b/src/plugins/l3xc/l3xc.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2019 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A L3 cross connect will send all traffic that is received on the input
+ * interface to the [set of] paths requested.
+ * It is a much more memory efficient solution than using a separate IP table
+ * for each input interface and much faster than an ABF match all rule.
+ */
+
+#ifndef __L3XC_H__
+#define __L3XC_H__
+
+#include <vnet/fib/fib_node.h>
+
+#define L3XC_PLUGIN_VERSION_MAJOR 1
+#define L3XC_PLUGIN_VERSION_MINOR 0
+
+/**
+ */
+typedef struct l3xc_t_
+{
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
+ /**
+ * Linkage into the FIB graph
+ */
+ fib_node_t l3xc_node;
+
+ /**
+ * The path-list describing how to forward in case of a match
+ */
+ fib_node_index_t l3xc_pl;
+
+ fib_protocol_t l3xc_proto;
+
+ /**
+ * Sibling index on the path-list
+ */
+ u32 l3xc_sibling;
+
+ /**
+ * The input interface
+ */
+ u32 l3xc_sw_if_index;
+
+ /**
+ * DPO for forwarding
+ */
+ dpo_id_t l3xc_dpo;
+} l3xc_t;
+
+/**
+ * Create or update an L3XC Policy
+ *
+ * @param sw_if_index_index the input interface
+ * @param rpaths The set of paths to add to the forwarding set
+ * @return error code
+ */
+extern int l3xc_update (u32 sw_if_index,
+ u8 is_ip6, const fib_route_path_t * rpaths);
+
+/**
+ * Delete an L3XC.
+ *
+ * @param sw_if_index_index the input interface
+ */
+extern int l3xc_delete (u32 sw_if_index, u8 is_ip6);
+
+/**
+ * Callback function invoked during a walk of all policies
+ */
+typedef int (*l3xc_walk_cb_t) (index_t l3xci, void *ctx);
+
+/**
+ * Walk/visit each of the L3XC policies
+ */
+extern void l3xc_walk (l3xc_walk_cb_t cb, void *ctx);
+
+/**
+ * Find a L3 XC object from an interfce and FIB protocol
+ */
+extern index_t l3xc_find (u32 sw_if_index, fib_protocol_t fproto);
+
+/**
+ * Data-plane functions
+ */
+extern l3xc_t *l3xc_pool;
+
+static_always_inline l3xc_t *
+l3xc_get (u32 index)
+{
+ return (pool_elt_at_index (l3xc_pool, index));
+}
+
+extern vlib_node_registration_t l3xc_ip4_node;
+extern vlib_node_registration_t l3xc_ip6_node;
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
+
+#endif