summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2022-10-24 09:10:59 -0700
committerDave Wallace <dwallacelf@gmail.com>2023-01-19 21:37:25 +0000
commit8bd4db5996ba1144f659ea5341f1c2727c650bcd (patch)
tree05ebf7985499bf10b842faf68af2c1d4a5d7c138 /src
parentdd2eff6d060c787e4a49863c9b97bde7215f7740 (diff)
vxlan: convert vxlan to a plugin
per https://jira.fd.io/browse/VPP-2058 Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ica0828de218d25ada2d0d1491e373c3b78179ac1
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dpdk/device/flow.c2
-rw-r--r--src/plugins/nsh/FEATURE.yaml1
-rw-r--r--src/plugins/nsh/nsh.c16
-rw-r--r--src/plugins/nsh/nsh_pop.c1
-rw-r--r--src/plugins/vxlan/CMakeLists.txt29
-rw-r--r--src/plugins/vxlan/FEATURE.yaml (renamed from src/vnet/vxlan/FEATURE.yaml)0
-rw-r--r--src/plugins/vxlan/decap.c (renamed from src/vnet/vxlan/decap.c)8
-rw-r--r--src/plugins/vxlan/dir.dox (renamed from src/vnet/vxlan/dir.dox)0
-rw-r--r--src/plugins/vxlan/encap.c (renamed from src/vnet/vxlan/encap.c)2
-rw-r--r--src/plugins/vxlan/plugin.c22
-rw-r--r--src/plugins/vxlan/vxlan.api (renamed from src/vnet/vxlan/vxlan.api)0
-rw-r--r--src/plugins/vxlan/vxlan.c (renamed from src/vnet/vxlan/vxlan.c)2
-rw-r--r--src/plugins/vxlan/vxlan.h (renamed from src/vnet/vxlan/vxlan.h)4
-rw-r--r--src/plugins/vxlan/vxlan_api.c (renamed from src/vnet/vxlan/vxlan_api.c)2
-rw-r--r--src/plugins/vxlan/vxlan_error.def (renamed from src/vnet/vxlan/vxlan_error.def)0
-rw-r--r--src/plugins/vxlan/vxlan_packet.h (renamed from src/vnet/vxlan/vxlan_packet.h)0
-rw-r--r--src/vnet/CMakeLists.txt24
17 files changed, 75 insertions, 38 deletions
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index 9f765a6f845..ae76b3df169 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -21,7 +21,7 @@
#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ethernet/arp_packet.h>
-#include <vnet/vxlan/vxlan.h>
+#include <vxlan/vxlan.h>
#include <dpdk/device/dpdk.h>
#include <dpdk/device/dpdk_priv.h>
#include <vppinfra/error.h>
diff --git a/src/plugins/nsh/FEATURE.yaml b/src/plugins/nsh/FEATURE.yaml
index a6ef3749952..986008e41a5 100644
--- a/src/plugins/nsh/FEATURE.yaml
+++ b/src/plugins/nsh/FEATURE.yaml
@@ -8,6 +8,7 @@ features:
- NSH Proxy
- NSH OAM
- NSH Metadata
+ - Requires vxlan_plugin.so to run
description: "NSH for SFC"
state: production
diff --git a/src/plugins/nsh/nsh.c b/src/plugins/nsh/nsh.c
index ea084e4a553..391fa8dbac5 100644
--- a/src/plugins/nsh/nsh.c
+++ b/src/plugins/nsh/nsh.c
@@ -19,7 +19,7 @@
#include <vnet/plugin/plugin.h>
#include <nsh/nsh.h>
#include <vnet/gre/gre.h>
-#include <vnet/vxlan/vxlan.h>
+#include <vxlan/vxlan.h>
#include <vnet/vxlan-gpe/vxlan_gpe.h>
#include <vnet/l2/l2_classify.h>
#include <vnet/adj/adj.h>
@@ -188,6 +188,7 @@ nsh_init (vlib_main_t * vm)
nsh_main_t *nm = &nsh_main;
clib_error_t *error = 0;
uword next_node;
+ vlib_node_registration_t *vxlan4_input, *vxlan6_input;
/* Init the main structures from VPP */
nm->vlib_main = vm;
@@ -250,8 +251,17 @@ nsh_init (vlib_main_t * vm)
nsh_aware_vnf_proxy_node.index);
/* Add NSH-Proxy support */
- vlib_node_add_next (vm, vxlan4_input_node.index, nm->nsh_proxy_node_index);
- vlib_node_add_next (vm, vxlan6_input_node.index, nm->nsh_proxy_node_index);
+ vxlan4_input =
+ vlib_get_plugin_symbol ("vxlan_plugin.so", "vxlan4_input_node");
+ vxlan6_input =
+ vlib_get_plugin_symbol ("vxlan_plugin.so", "vxlan6_input_node");
+ if (vxlan4_input == 0 || vxlan6_input == 0)
+ {
+ error = clib_error_return (0, "vxlan_plugin.so is not loaded");
+ return error;
+ }
+ vlib_node_add_next (vm, vxlan4_input->index, nm->nsh_proxy_node_index);
+ vlib_node_add_next (vm, vxlan6_input->index, nm->nsh_proxy_node_index);
/* Add NSH-Classifier support */
vlib_node_add_next (vm, ip4_classify_node.index,
diff --git a/src/plugins/nsh/nsh_pop.c b/src/plugins/nsh/nsh_pop.c
index 90b8a73b5fb..8de319e158b 100644
--- a/src/plugins/nsh/nsh_pop.c
+++ b/src/plugins/nsh/nsh_pop.c
@@ -19,7 +19,6 @@
#include <vnet/plugin/plugin.h>
#include <nsh/nsh.h>
#include <vnet/gre/packet.h>
-#include <vnet/vxlan/vxlan.h>
#include <vnet/vxlan-gpe/vxlan_gpe.h>
#include <vnet/l2/l2_classify.h>
diff --git a/src/plugins/vxlan/CMakeLists.txt b/src/plugins/vxlan/CMakeLists.txt
new file mode 100644
index 00000000000..bd0272a868e
--- /dev/null
+++ b/src/plugins/vxlan/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright (c) 2022 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.
+
+add_vpp_plugin(vxlan
+ SOURCES
+ vxlan.c
+ encap.c
+ decap.c
+ vxlan_api.c
+ plugin.c
+ vxlan.h
+ vxlan_packet.h
+
+ MULTIARCH_SOURCES
+ encap.c
+
+ API_FILES
+ vxlan.api
+)
diff --git a/src/vnet/vxlan/FEATURE.yaml b/src/plugins/vxlan/FEATURE.yaml
index dc7d21b010e..dc7d21b010e 100644
--- a/src/vnet/vxlan/FEATURE.yaml
+++ b/src/plugins/vxlan/FEATURE.yaml
diff --git a/src/vnet/vxlan/decap.c b/src/plugins/vxlan/decap.c
index 729293fb3e5..f5d1efa2b86 100644
--- a/src/vnet/vxlan/decap.c
+++ b/src/plugins/vxlan/decap.c
@@ -16,12 +16,12 @@
*/
#include <vlib/vlib.h>
-#include <vnet/vxlan/vxlan.h>
+#include <vxlan/vxlan.h>
#include <vnet/udp/udp_local.h>
#ifndef CLIB_MARCH_VARIANT
-vlib_node_registration_t vxlan4_input_node;
-vlib_node_registration_t vxlan6_input_node;
+__clib_export vlib_node_registration_t vxlan4_input_node;
+__clib_export vlib_node_registration_t vxlan6_input_node;
#endif
typedef struct
@@ -408,7 +408,7 @@ VLIB_NODE_FN (vxlan6_input_node) (vlib_main_t * vm,
static char *vxlan_error_strings[] = {
#define vxlan_error(n,s) s,
-#include <vnet/vxlan/vxlan_error.def>
+#include <vxlan/vxlan_error.def>
#undef vxlan_error
};
diff --git a/src/vnet/vxlan/dir.dox b/src/plugins/vxlan/dir.dox
index 31a9e2b6112..31a9e2b6112 100644
--- a/src/vnet/vxlan/dir.dox
+++ b/src/plugins/vxlan/dir.dox
diff --git a/src/vnet/vxlan/encap.c b/src/plugins/vxlan/encap.c
index 0961a27942d..e4103ec0083 100644
--- a/src/vnet/vxlan/encap.c
+++ b/src/plugins/vxlan/encap.c
@@ -19,7 +19,7 @@
#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/interface_output.h>
-#include <vnet/vxlan/vxlan.h>
+#include <vxlan/vxlan.h>
#include <vnet/qos/qos_types.h>
#include <vnet/adj/rewrite.h>
diff --git a/src/plugins/vxlan/plugin.c b/src/plugins/vxlan/plugin.c
new file mode 100644
index 00000000000..aaeafb03a3b
--- /dev/null
+++ b/src/plugins/vxlan/plugin.c
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright (c) 2022 Cisco Systems, Inc.
+ * License: Cisco Proprietary Closed Source License - Cisco Internal.
+ * The software, documentation and any fonts accompanying this License whether
+ * on disk, in read only memory, on any other media or in any other form (col-
+ * lectively the “Software”) are licensed, not sold, to you by Cisco, Inc.
+ * (“Cisco”) for use only under the terms of this License, and Cisco reserves
+ * all rights not expressly granted to you. The rights granted herein are
+ * limited to Cisco’s intel- lectual property rights in the Cisco Software and
+ * do not include any other patents or intellectual property rights. You own
+ * the media on which the Cisco Software is recorded but Cisco and/or Cisco’s
+ * licensor(s) retain ownership of the Software itself.
+ */
+
+#include <vlib/vlib.h>
+#include <vnet/plugin/plugin.h>
+#include <vpp/app/version.h>
+
+VLIB_PLUGIN_REGISTER () = {
+ .version = VPP_BUILD_VER,
+ .description = "VxLan Tunnels",
+};
diff --git a/src/vnet/vxlan/vxlan.api b/src/plugins/vxlan/vxlan.api
index b7e678595d8..b7e678595d8 100644
--- a/src/vnet/vxlan/vxlan.api
+++ b/src/plugins/vxlan/vxlan.api
diff --git a/src/vnet/vxlan/vxlan.c b/src/plugins/vxlan/vxlan.c
index 1871e5d71d2..f1ab7a7cb8b 100644
--- a/src/vnet/vxlan/vxlan.c
+++ b/src/plugins/vxlan/vxlan.c
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <vnet/vxlan/vxlan.h>
+#include <vxlan/vxlan.h>
#include <vnet/ip/format.h>
#include <vnet/fib/fib_entry.h>
#include <vnet/fib/fib_table.h>
diff --git a/src/vnet/vxlan/vxlan.h b/src/plugins/vxlan/vxlan.h
index fa47605e42d..72d82e79cf5 100644
--- a/src/vnet/vxlan/vxlan.h
+++ b/src/plugins/vxlan/vxlan.h
@@ -26,7 +26,7 @@
#include <vnet/l2/l2_output.h>
#include <vnet/l2/l2_bd.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/vxlan/vxlan_packet.h>
+#include <vxlan/vxlan_packet.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/udp/udp_packet.h>
@@ -152,7 +152,7 @@ typedef enum
typedef enum
{
#define vxlan_error(n,s) VXLAN_ERROR_##n,
-#include <vnet/vxlan/vxlan_error.def>
+#include <vxlan/vxlan_error.def>
#undef vxlan_error
VXLAN_N_ERROR,
} vxlan_input_error_t;
diff --git a/src/vnet/vxlan/vxlan_api.c b/src/plugins/vxlan/vxlan_api.c
index 56fd654951f..8fd0928cc63 100644
--- a/src/vnet/vxlan/vxlan_api.c
+++ b/src/plugins/vxlan/vxlan_api.c
@@ -23,7 +23,7 @@
#include <vnet/interface.h>
#include <vnet/api_errno.h>
#include <vnet/feature/feature.h>
-#include <vnet/vxlan/vxlan.h>
+#include <vxlan/vxlan.h>
#include <vnet/fib/fib_table.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/udp/udp_local.h>
diff --git a/src/vnet/vxlan/vxlan_error.def b/src/plugins/vxlan/vxlan_error.def
index 17f905950f5..17f905950f5 100644
--- a/src/vnet/vxlan/vxlan_error.def
+++ b/src/plugins/vxlan/vxlan_error.def
diff --git a/src/vnet/vxlan/vxlan_packet.h b/src/plugins/vxlan/vxlan_packet.h
index d1d1ed813e5..d1d1ed813e5 100644
--- a/src/vnet/vxlan/vxlan_packet.h
+++ b/src/plugins/vxlan/vxlan_packet.h
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 963e000807c..c1c9acc41a0 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -297,30 +297,6 @@ list(APPEND VNET_HEADERS
)
##############################################################################
-# Layer 2 / vxlan
-##############################################################################
-list(APPEND VNET_SOURCES
- vxlan/vxlan.c
- vxlan/encap.c
- vxlan/decap.c
- vxlan/vxlan_api.c
-)
-
-list(APPEND VNET_MULTIARCH_SOURCES
- vxlan/encap.c
-)
-
-list(APPEND VNET_HEADERS
- vxlan/vxlan.h
- vxlan/vxlan_packet.h
- vxlan/vxlan_error.def
-)
-
-list(APPEND VNET_MULTIARCH_SOURCES vxlan/decap.c)
-
-list(APPEND VNET_API_FILES vxlan/vxlan.api)
-
-##############################################################################
# Layer 2 / Bonding
##############################################################################
list(APPEND VNET_SOURCES