af_packet: move to plugin 30/37830/3
authorMohsin Kazmi <sykazmi@cisco.com>
Wed, 14 Dec 2022 13:10:29 +0000 (13:10 +0000)
committerDave Wallace <dwallacelf@gmail.com>
Wed, 21 Dec 2022 18:33:51 +0000 (18:33 +0000)
Type: improvement

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: I3ec857adb3a9e8a778072a202a4d23f4101e83b2

13 files changed:
MAINTAINERS
src/plugins/af_packet/CMakeLists.txt [new file with mode: 0644]
src/plugins/af_packet/FEATURE.yaml [moved from src/vnet/devices/af_packet/FEATURE.yaml with 100% similarity]
src/plugins/af_packet/af_packet.api [moved from src/vnet/devices/af_packet/af_packet.api with 100% similarity]
src/plugins/af_packet/af_packet.c [moved from src/vnet/devices/af_packet/af_packet.c with 99% similarity]
src/plugins/af_packet/af_packet.h [moved from src/vnet/devices/af_packet/af_packet.h with 100% similarity]
src/plugins/af_packet/af_packet_api.c [moved from src/vnet/devices/af_packet/af_packet_api.c with 97% similarity]
src/plugins/af_packet/cli.c [moved from src/vnet/devices/af_packet/cli.c with 99% similarity]
src/plugins/af_packet/device.c [moved from src/vnet/devices/af_packet/device.c with 99% similarity]
src/plugins/af_packet/dir.dox [moved from src/vnet/devices/af_packet/dir.dox with 100% similarity]
src/plugins/af_packet/node.c [moved from src/vnet/devices/af_packet/node.c with 99% similarity]
src/plugins/af_packet/plugin.c [new file with mode: 0644]
src/vnet/CMakeLists.txt

index 9bc8be1..5701ebd 100644 (file)
@@ -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 (file)
index 0000000..4b79615
--- /dev/null
@@ -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
+)
similarity index 99%
rename from src/vnet/devices/af_packet/af_packet.c
rename to src/plugins/af_packet/af_packet.c
index f5493dd..b2f860e 100644 (file)
@@ -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;
 
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 6ca79f9..ede0576 100644 (file)
 
 #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)
 {
similarity index 99%
rename from src/vnet/devices/af_packet/cli.c
rename to src/plugins/af_packet/cli.c
index d20ef61..6a83775 100644 (file)
@@ -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
similarity index 99%
rename from src/vnet/devices/af_packet/device.c
rename to src/plugins/af_packet/device.c
index 17291f7..b38d58c 100644 (file)
@@ -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               \
similarity index 99%
rename from src/vnet/devices/af_packet/node.c
rename to src/plugins/af_packet/node.c
index 724924f..0ea4b3d 100644 (file)
@@ -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 (file)
index 0000000..0146dd3
--- /dev/null
@@ -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",
+};
index 7006bd5..963e000 100644 (file)
@@ -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