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
This commit is contained in:
Steven Luong
2022-10-24 09:10:59 -07:00
committed by Dave Wallace
parent dd2eff6d06
commit 8bd4db5996
18 changed files with 77 additions and 39 deletions

View File

@ -288,9 +288,10 @@ F: src/vnet/udp
VNET VXLAN
I: vxlan
Y: src/plugins/vxlan/FEATURE.yaml
M: John Lo <lojultra2020@outlook.com>
M: Steven Luong <sluong@cisco.com>
F: src/vnet/vxlan/
F: src/plugins/vxlan/
VNET VXLAN-GPE
I: vxlan-gpe

View File

@ -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>

View File

@ -8,6 +8,7 @@ features:
- NSH Proxy
- NSH OAM
- NSH Metadata
- Requires vxlan_plugin.so to run
description: "NSH for SFC"
state: production

View File

@ -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,

View File

@ -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>

View File

@ -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
)

View File

@ -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
};

View File

@ -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>

View File

@ -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 Ciscos 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 Ciscos
* 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",
};

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -296,30 +296,6 @@ list(APPEND VNET_HEADERS
snap/snap.h
)
##############################################################################
# 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
##############################################################################