From bca76580b17bbb6227f48b9ea4a5858802656962 Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Wed, 14 Dec 2022 13:10:29 +0000 Subject: [PATCH] af_packet: move to plugin Type: improvement Signed-off-by: Mohsin Kazmi Change-Id: I3ec857adb3a9e8a778072a202a4d23f4101e83b2 --- MAINTAINERS | 7 ++++- src/plugins/af_packet/CMakeLists.txt | 36 ++++++++++++++++++++++ .../devices => plugins}/af_packet/FEATURE.yaml | 0 .../devices => plugins}/af_packet/af_packet.api | 0 .../devices => plugins}/af_packet/af_packet.c | 2 +- .../devices => plugins}/af_packet/af_packet.h | 0 .../devices => plugins}/af_packet/af_packet_api.c | 8 ++--- src/{vnet/devices => plugins}/af_packet/cli.c | 2 +- src/{vnet/devices => plugins}/af_packet/device.c | 2 +- src/{vnet/devices => plugins}/af_packet/dir.dox | 0 src/{vnet/devices => plugins}/af_packet/node.c | 2 +- src/plugins/af_packet/plugin.c | 22 +++++++++++++ src/vnet/CMakeLists.txt | 22 ------------- 13 files changed, 72 insertions(+), 31 deletions(-) create mode 100644 src/plugins/af_packet/CMakeLists.txt rename src/{vnet/devices => plugins}/af_packet/FEATURE.yaml (100%) rename src/{vnet/devices => plugins}/af_packet/af_packet.api (100%) rename src/{vnet/devices => plugins}/af_packet/af_packet.c (99%) rename src/{vnet/devices => plugins}/af_packet/af_packet.h (100%) rename src/{vnet/devices => plugins}/af_packet/af_packet_api.c (97%) rename src/{vnet/devices => plugins}/af_packet/cli.c (99%) rename src/{vnet/devices => plugins}/af_packet/device.c (99%) rename src/{vnet/devices => plugins}/af_packet/dir.dox (100%) rename src/{vnet/devices => plugins}/af_packet/node.c (99%) create mode 100644 src/plugins/af_packet/plugin.c diff --git a/MAINTAINERS b/MAINTAINERS index 9bc8be134be..5701ebdd9ff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -100,11 +100,16 @@ F: src/vnet/policer/ VNET Device Drivers I: devices -Y: src/vnet/devices/af_packet/FEATURE.yaml Y: src/vnet/devices/pipe/FEATURE.yaml M: Damjan Marion F: src/vnet/devices/ +AF PACKET Drivers +I: af_packet +Y: src/plugins/af_packet/FEATURE.yaml +M: Mohsin Kazmi +F: src/plugins/af_packet + VNET TAP Drivers I: tap Y: src/vnet/devices/tap/FEATURE.yaml diff --git a/src/plugins/af_packet/CMakeLists.txt b/src/plugins/af_packet/CMakeLists.txt new file mode 100644 index 00000000000..4b79615cae7 --- /dev/null +++ b/src/plugins/af_packet/CMakeLists.txt @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: Apache-2.0 +# 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(af_packet + SOURCES + plugin.c + af_packet.c + device.c + node.c + cli.c + af_packet_api.c + + MULTIARCH_SOURCES + node.c + device.c + + INSTALL_HEADERS + af_packet.h + + API_FILES + af_packet.api + + # API_TEST_SOURCES + #af_packet_test_api.c +) diff --git a/src/vnet/devices/af_packet/FEATURE.yaml b/src/plugins/af_packet/FEATURE.yaml similarity index 100% rename from src/vnet/devices/af_packet/FEATURE.yaml rename to src/plugins/af_packet/FEATURE.yaml diff --git a/src/vnet/devices/af_packet/af_packet.api b/src/plugins/af_packet/af_packet.api similarity index 100% rename from src/vnet/devices/af_packet/af_packet.api rename to src/plugins/af_packet/af_packet.api diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/plugins/af_packet/af_packet.c similarity index 99% rename from src/vnet/devices/af_packet/af_packet.c rename to src/plugins/af_packet/af_packet.c index f5493dd088e..b2f860e658d 100644 --- a/src/vnet/devices/af_packet/af_packet.c +++ b/src/plugins/af_packet/af_packet.c @@ -35,7 +35,7 @@ #include #include -#include +#include af_packet_main_t af_packet_main; diff --git a/src/vnet/devices/af_packet/af_packet.h b/src/plugins/af_packet/af_packet.h similarity index 100% rename from src/vnet/devices/af_packet/af_packet.h rename to src/plugins/af_packet/af_packet.h diff --git a/src/vnet/devices/af_packet/af_packet_api.c b/src/plugins/af_packet/af_packet_api.c similarity index 97% rename from src/vnet/devices/af_packet/af_packet_api.c rename to src/plugins/af_packet/af_packet_api.c index 6ca79f9705e..ede057659e8 100644 --- a/src/vnet/devices/af_packet/af_packet_api.c +++ b/src/plugins/af_packet/af_packet_api.c @@ -22,11 +22,11 @@ #include #include -#include +#include #include -#include -#include +#include +#include #define REPLY_MSG_ID_BASE msg_id_base #include @@ -230,7 +230,7 @@ vl_api_af_packet_dump_t_handler (vl_api_af_packet_dump_t * mp) vec_free (out_af_packet_ifs); } -#include +#include static clib_error_t * af_packet_api_hookup (vlib_main_t * vm) { diff --git a/src/vnet/devices/af_packet/cli.c b/src/plugins/af_packet/cli.c similarity index 99% rename from src/vnet/devices/af_packet/cli.c rename to src/plugins/af_packet/cli.c index d20ef61a09d..6a8377540d8 100644 --- a/src/vnet/devices/af_packet/cli.c +++ b/src/plugins/af_packet/cli.c @@ -30,7 +30,7 @@ #include #include -#include +#include /** * @file diff --git a/src/vnet/devices/af_packet/device.c b/src/plugins/af_packet/device.c similarity index 99% rename from src/vnet/devices/af_packet/device.c rename to src/plugins/af_packet/device.c index 17291f76b71..b38d58cced1 100644 --- a/src/vnet/devices/af_packet/device.c +++ b/src/plugins/af_packet/device.c @@ -33,7 +33,7 @@ #include #include -#include +#include #include #define foreach_af_packet_tx_func_error \ diff --git a/src/vnet/devices/af_packet/dir.dox b/src/plugins/af_packet/dir.dox similarity index 100% rename from src/vnet/devices/af_packet/dir.dox rename to src/plugins/af_packet/dir.dox diff --git a/src/vnet/devices/af_packet/node.c b/src/plugins/af_packet/node.c similarity index 99% rename from src/vnet/devices/af_packet/node.c rename to src/plugins/af_packet/node.c index 724924f5f4b..0ea4b3dfea7 100644 --- a/src/vnet/devices/af_packet/node.c +++ b/src/plugins/af_packet/node.c @@ -27,7 +27,7 @@ #include #include -#include +#include #include #define foreach_af_packet_input_error \ diff --git a/src/plugins/af_packet/plugin.c b/src/plugins/af_packet/plugin.c new file mode 100644 index 00000000000..0146dd3e740 --- /dev/null +++ b/src/plugins/af_packet/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 +#include +#include + +VLIB_PLUGIN_REGISTER () = { + .version = VPP_BUILD_VER, + .description = "af-packet", +}; diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt index 7006bd50e67..963e000807c 100644 --- a/src/vnet/CMakeLists.txt +++ b/src/vnet/CMakeLists.txt @@ -1007,7 +1007,6 @@ list(APPEND VNET_HEADERS list(APPEND VNET_MULTIARCH_SOURCES devices/virtio/node.c - devices/af_packet/node.c devices/virtio/device.c ) @@ -1106,27 +1105,6 @@ list(APPEND VNET_HEADERS tls/tls_test.h ) -############################################################################## -# Linux packet interface -############################################################################## - -list(APPEND VNET_SOURCES - devices/af_packet/af_packet.c - devices/af_packet/device.c - devices/af_packet/node.c - devices/af_packet/cli.c - devices/af_packet/af_packet_api.c -) - -list(APPEND VNET_MULTIARCH_SOURCES - devices/af_packet/device.c -) - -list(APPEND VNET_HEADERS - devices/af_packet/af_packet.h -) - -list(APPEND VNET_API_FILES devices/af_packet/af_packet.api) ############################################################################## # Driver feature graph arc support -- 2.16.6