aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2022-12-14 13:10:29 +0000
committerDave Wallace <dwallacelf@gmail.com>2022-12-21 18:33:51 +0000
commitbca76580b17bbb6227f48b9ea4a5858802656962 (patch)
treeba8df625df7a4de1ea5fd970493d7cda74deedb7
parentbb98aac4223f506ec18109f9836daa6ef0d61180 (diff)
af_packet: move to plugin
Type: improvement Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I3ec857adb3a9e8a778072a202a4d23f4101e83b2
-rw-r--r--MAINTAINERS7
-rw-r--r--src/plugins/af_packet/CMakeLists.txt36
-rw-r--r--src/plugins/af_packet/FEATURE.yaml (renamed from src/vnet/devices/af_packet/FEATURE.yaml)0
-rw-r--r--src/plugins/af_packet/af_packet.api (renamed from src/vnet/devices/af_packet/af_packet.api)0
-rw-r--r--src/plugins/af_packet/af_packet.c (renamed from src/vnet/devices/af_packet/af_packet.c)2
-rw-r--r--src/plugins/af_packet/af_packet.h (renamed from src/vnet/devices/af_packet/af_packet.h)0
-rw-r--r--src/plugins/af_packet/af_packet_api.c (renamed from src/vnet/devices/af_packet/af_packet_api.c)8
-rw-r--r--src/plugins/af_packet/cli.c (renamed from src/vnet/devices/af_packet/cli.c)2
-rw-r--r--src/plugins/af_packet/device.c (renamed from src/vnet/devices/af_packet/device.c)2
-rw-r--r--src/plugins/af_packet/dir.dox (renamed from src/vnet/devices/af_packet/dir.dox)0
-rw-r--r--src/plugins/af_packet/node.c (renamed from src/vnet/devices/af_packet/node.c)2
-rw-r--r--src/plugins/af_packet/plugin.c22
-rw-r--r--src/vnet/CMakeLists.txt22
13 files changed, 72 insertions, 31 deletions
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 <damarion@cisco.com>
F: src/vnet/devices/
+AF PACKET Drivers
+I: af_packet
+Y: src/plugins/af_packet/FEATURE.yaml
+M: Mohsin Kazmi <sykazmi@cisco.com>
+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
index 4a11ea2beb5..4a11ea2beb5 100644
--- a/src/vnet/devices/af_packet/FEATURE.yaml
+++ b/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
index a12da37796a..a12da37796a 100644
--- a/src/vnet/devices/af_packet/af_packet.api
+++ b/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
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 <vnet/interface/rx_queue_funcs.h>
#include <vnet/interface/tx_queue_funcs.h>
-#include <vnet/devices/af_packet/af_packet.h>
+#include <af_packet/af_packet.h>
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
index 7aa5e6d5b9a..7aa5e6d5b9a 100644
--- a/src/vnet/devices/af_packet/af_packet.h
+++ b/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
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 <vnet/interface.h>
#include <vnet/api_errno.h>
-#include <vnet/devices/af_packet/af_packet.h>
+#include <af_packet/af_packet.h>
#include <vnet/format_fns.h>
-#include <vnet/devices/af_packet/af_packet.api_enum.h>
-#include <vnet/devices/af_packet/af_packet.api_types.h>
+#include <af_packet/af_packet.api_enum.h>
+#include <af_packet/af_packet.api_types.h>
#define REPLY_MSG_ID_BASE msg_id_base
#include <vlibapi/api_helper_macros.h>
@@ -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 <vnet/devices/af_packet/af_packet.api.c>
+#include <af_packet/af_packet.api.c>
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
index d20ef61a09d..6a8377540d8 100644
--- a/src/vnet/devices/af_packet/cli.c
+++ b/src/plugins/af_packet/cli.c
@@ -30,7 +30,7 @@
#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/devices/af_packet/af_packet.h>
+#include <af_packet/af_packet.h>
/**
* @file
diff --git a/src/vnet/devices/af_packet/device.c b/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 <vnet/tcp/tcp_packet.h>
#include <vnet/udp/udp_packet.h>
-#include <vnet/devices/af_packet/af_packet.h>
+#include <af_packet/af_packet.h>
#include <vnet/devices/virtio/virtio_std.h>
#define foreach_af_packet_tx_func_error \
diff --git a/src/vnet/devices/af_packet/dir.dox b/src/plugins/af_packet/dir.dox
index 78991c6d97f..78991c6d97f 100644
--- a/src/vnet/devices/af_packet/dir.dox
+++ b/src/plugins/af_packet/dir.dox
diff --git a/src/vnet/devices/af_packet/node.c b/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 <vnet/feature/feature.h>
#include <vnet/ethernet/packet.h>
-#include <vnet/devices/af_packet/af_packet.h>
+#include <af_packet/af_packet.h>
#include <vnet/devices/virtio/virtio_std.h>
#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 <vlib/vlib.h>
+#include <vnet/plugin/plugin.h>
+#include <vpp/app/version.h>
+
+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