From 182d8b2ddba098f99029ed82e44960f3dfd18987 Mon Sep 17 00:00:00 2001 From: Scott Hutton Date: Fri, 3 May 2024 07:40:42 -0700 Subject: [PATCH] sr: move srmpls to a plugin Move sr_mpls folder under vnet to the plugin folder, update cmake configuration and header paths, and add plugin.c to register plugin. JIRA: VPP-2054 Type: improvement Change-Id: I1ad6f287f67eb0c35588c339bcd51218fadf5f8e Signed-off-by: Scott Hutton --- MAINTAINERS | 2 +- docs/developer/corefeatures/sr/sr_mpls.rst | 2 +- docs/spelling_wordlist.txt | 1 + src/plugins/srmpls/CMakeLists.txt | 30 +++++++++++++++++++++++++ src/{vnet => plugins}/srmpls/FEATURE.yaml | 0 src/{vnet => plugins}/srmpls/dir.dox | 0 src/plugins/srmpls/plugin.c | 26 +++++++++++++++++++++ src/{vnet => plugins}/srmpls/sr_doc.rst | 0 src/{vnet => plugins}/srmpls/sr_mpls.api | 0 src/{vnet => plugins}/srmpls/sr_mpls.h | 0 src/{vnet => plugins}/srmpls/sr_mpls_api.c | 17 +++++++------- src/{vnet => plugins}/srmpls/sr_mpls_policy.c | 2 +- src/{vnet => plugins}/srmpls/sr_mpls_steering.c | 2 +- src/{vnet => plugins}/srmpls/sr_mpls_test.c | 8 +++---- src/vnet/CMakeLists.txt | 19 ---------------- 15 files changed, 73 insertions(+), 36 deletions(-) create mode 100644 src/plugins/srmpls/CMakeLists.txt rename src/{vnet => plugins}/srmpls/FEATURE.yaml (100%) rename src/{vnet => plugins}/srmpls/dir.dox (100%) create mode 100644 src/plugins/srmpls/plugin.c rename src/{vnet => plugins}/srmpls/sr_doc.rst (100%) rename src/{vnet => plugins}/srmpls/sr_mpls.api (100%) rename src/{vnet => plugins}/srmpls/sr_mpls.h (100%) rename src/{vnet => plugins}/srmpls/sr_mpls_api.c (96%) rename src/{vnet => plugins}/srmpls/sr_mpls_policy.c (99%) rename src/{vnet => plugins}/srmpls/sr_mpls_steering.c (99%) rename src/{vnet => plugins}/srmpls/sr_mpls_test.c (95%) diff --git a/MAINTAINERS b/MAINTAINERS index abc7faf7be2..fd456c04a6c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -192,7 +192,7 @@ I: sr M: Pablo Camarillo M: Ahmed Abdelsalam F: src/vnet/srv6/ -F: src/vnet/srmpls/ +F: src/plugin/srmpls/ F: src/examples/srv6-sample-localsid/ VNET IPSec diff --git a/docs/developer/corefeatures/sr/sr_mpls.rst b/docs/developer/corefeatures/sr/sr_mpls.rst index d2fe4025326..9e676db4f07 120000 --- a/docs/developer/corefeatures/sr/sr_mpls.rst +++ b/docs/developer/corefeatures/sr/sr_mpls.rst @@ -1 +1 @@ -../../../../src/vnet/srmpls/sr_doc.rst \ No newline at end of file +../../../../src/plugins/srmpls/sr_doc.rst \ No newline at end of file diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 2348c8dc391..f90ffa89216 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -1047,6 +1047,7 @@ srcIP srcPortDefinition srcUP srh +srmpls Srmpls srtp SRTP diff --git a/src/plugins/srmpls/CMakeLists.txt b/src/plugins/srmpls/CMakeLists.txt new file mode 100644 index 00000000000..25905d31e1b --- /dev/null +++ b/src/plugins/srmpls/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (c) 2024 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(srmpls + SOURCES + sr_mpls_policy.c + sr_mpls_steering.c + sr_mpls_api.c + plugin.c + + INSTALL_HEADERS + sr_mpls.h + + API_FILES + sr_mpls.api + + # This might need to be VAT_AUTO_TEST? Not documented + API_TEST_SOURCES + sr_mpls_test.c +) diff --git a/src/vnet/srmpls/FEATURE.yaml b/src/plugins/srmpls/FEATURE.yaml similarity index 100% rename from src/vnet/srmpls/FEATURE.yaml rename to src/plugins/srmpls/FEATURE.yaml diff --git a/src/vnet/srmpls/dir.dox b/src/plugins/srmpls/dir.dox similarity index 100% rename from src/vnet/srmpls/dir.dox rename to src/plugins/srmpls/dir.dox diff --git a/src/plugins/srmpls/plugin.c b/src/plugins/srmpls/plugin.c new file mode 100644 index 00000000000..af87607764f --- /dev/null +++ b/src/plugins/srmpls/plugin.c @@ -0,0 +1,26 @@ +/* + * plugin.c: srmpls + * + * Copyright (c) 2024 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. + */ + +#include +#include +#include + +// register a plugin +VLIB_PLUGIN_REGISTER () = { + .version = VPP_BUILD_VER, + .description = "Segment Routing for MPLS plugin", +}; diff --git a/src/vnet/srmpls/sr_doc.rst b/src/plugins/srmpls/sr_doc.rst similarity index 100% rename from src/vnet/srmpls/sr_doc.rst rename to src/plugins/srmpls/sr_doc.rst diff --git a/src/vnet/srmpls/sr_mpls.api b/src/plugins/srmpls/sr_mpls.api similarity index 100% rename from src/vnet/srmpls/sr_mpls.api rename to src/plugins/srmpls/sr_mpls.api diff --git a/src/vnet/srmpls/sr_mpls.h b/src/plugins/srmpls/sr_mpls.h similarity index 100% rename from src/vnet/srmpls/sr_mpls.h rename to src/plugins/srmpls/sr_mpls.h diff --git a/src/vnet/srmpls/sr_mpls_api.c b/src/plugins/srmpls/sr_mpls_api.c similarity index 96% rename from src/vnet/srmpls/sr_mpls_api.c rename to src/plugins/srmpls/sr_mpls_api.c index 920856acff6..3e89017dbc1 100644 --- a/src/vnet/srmpls/sr_mpls_api.c +++ b/src/plugins/srmpls/sr_mpls_api.c @@ -17,7 +17,7 @@ */ #include -#include +#include "sr_mpls.h" #include #include @@ -26,28 +26,27 @@ #include #include -#include -#include - +#include +#include #define vl_api_version(n, v) static u32 api_version = v; -#include +#include #undef vl_api_version #define vl_endianfun -#include +#include #undef vl_endianfun #define vl_calcsizefun -#include +#include #undef vl_calcsizefun #define vl_printfun -#include +#include #undef vl_printfun #define vl_msg_name_crc_list -#include +#include #undef vl_msg_name_crc_list #define REPLY_MSG_ID_BASE msg_id_base diff --git a/src/vnet/srmpls/sr_mpls_policy.c b/src/plugins/srmpls/sr_mpls_policy.c similarity index 99% rename from src/vnet/srmpls/sr_mpls_policy.c rename to src/plugins/srmpls/sr_mpls_policy.c index 41cb71601e9..af24acd8cf6 100644 --- a/src/vnet/srmpls/sr_mpls_policy.c +++ b/src/plugins/srmpls/sr_mpls_policy.c @@ -31,7 +31,7 @@ #include #include -#include +#include "sr_mpls.h" #include #include #include diff --git a/src/vnet/srmpls/sr_mpls_steering.c b/src/plugins/srmpls/sr_mpls_steering.c similarity index 99% rename from src/vnet/srmpls/sr_mpls_steering.c rename to src/plugins/srmpls/sr_mpls_steering.c index e8920df542b..24c8b0e2d9f 100644 --- a/src/vnet/srmpls/sr_mpls_steering.c +++ b/src/plugins/srmpls/sr_mpls_steering.c @@ -31,7 +31,7 @@ #include #include -#include +#include "sr_mpls.h" #include #include #include diff --git a/src/vnet/srmpls/sr_mpls_test.c b/src/plugins/srmpls/sr_mpls_test.c similarity index 95% rename from src/vnet/srmpls/sr_mpls_test.c rename to src/plugins/srmpls/sr_mpls_test.c index e5d68462443..7aff4c32b06 100644 --- a/src/vnet/srmpls/sr_mpls_test.c +++ b/src/plugins/srmpls/sr_mpls_test.c @@ -25,11 +25,11 @@ /* Declare message IDs */ #include -#include -#include +#include +#include #define vl_endianfun /* define message structures */ -#include +#include #undef vl_endianfun typedef struct @@ -163,7 +163,7 @@ api_sr_mpls_policy_del (vat_main_t *vam) return ret; } -#include +#include /* * fd.io coding-style-patch-verification: ON diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt index fb8d294009d..ad5f44846cc 100644 --- a/src/vnet/CMakeLists.txt +++ b/src/vnet/CMakeLists.txt @@ -812,24 +812,6 @@ list(APPEND VNET_API_FILES srv6/sr_pt.api ) -############################################################################## -# mpls segment routing -############################################################################## - -list(APPEND VNET_SOURCES - srmpls/sr_mpls_policy.c - srmpls/sr_mpls_steering.c - srmpls/sr_mpls_api.c -) - -list(APPEND VNET_HEADERS - srmpls/sr_mpls.h -) - -list(APPEND VNET_API_FILES - srmpls/sr_mpls.api -) - ############################################################################## # IPFIX / netflow v10 ############################################################################## @@ -1460,7 +1442,6 @@ add_vat_test_library(vnet ip/ip_test.c arp/arp_test.c ip6-nd/ip6_nd_test.c - srmpls/sr_mpls_test.c session/session_test.c l2/l2_test.c ipsec/ipsec_test.c -- 2.16.6