diff options
author | Jim Gibson <gibson+fdio@cisco.com> | 2017-06-01 15:30:03 -0400 |
---|---|---|
committer | Jim Gibson <gibson+fdio@cisco.com> | 2017-06-02 16:51:22 -0400 |
commit | 716eb01c0b25f7b5bd74e91ec3a1c8d51d402c00 (patch) | |
tree | 919b6c07dd9a4a9bf6c430e382efed18e9162916 /cicn-plugin | |
parent | 2c8098d53b946eec9526dbb5cb4086efb6fa3366 (diff) |
Update cicn-plugin for vpp v17.04 (from v17.01)Vpp-plugin-v17.04
1. Changes for cicn-plugin to build under v17.04:
- update build files to v17.04, including
- no longer need/want plugin to include dpdk headers (though
still link in dpdk plugin)
- vpp include changes
- relocation of vpe.api.h
- relocation of pneum.h
- for modprobe, replace igb_uio with uio_pci_generic
- vnet/ip/udp.h => vnet/udp/udp.h
- update cicn vpp plugin registration per vpp changes
- use new VLIB_PLUGIN_REGISTER() macro
- delete no-loger-supported vlib_plugin_register() function,
moving contents of latter to cicn_init
- remove sm->ethernet_main, which was not used and is no longer part of
plugin boilerplate.
- cicn_api_test_plugin.so (plugin for vpp_api_test)
- update per 17.04 updated requirements:
vat_api_hookup => cicn_vat_api_hookup
- buffering/cloning changes needed for building
- CICN_FEATURE_VPP_VLIB_CLONING hard-coded enabled and removed,
- CICN_FEATURE_DPDK_RTEMBUF_CLONING removed
- Small indentation updates from vpp checkstyle.sh
2. Updates for new vlib_buffer_attach_clone() API now exported by vpp
- remove code to manage rte_mbuf: cicn plugin now longer depends
on dpdk being present.
- remove use of indirect header for cloned cs entry: new scheme
supports having hdr buffer point directly to shared buffer rather
that requiring hdr buffer to poitn to indirect header that
points to cs buffer
- cicn_rte_mbuf_inlines.h replaced by much smaller cicn_infra_inlines.h
- report new characteristic of whether cloning replication is enabled
- "cicn show internal" (dbg cli), "cicn_api_node_params_get"
(vpp_api_test)
- update output accordingly
- cicn_show: other tweaks to output
3. In node.c, in code for dropping possibly multiple buffers
- delete ifdef'd-out code block for dropping using the drop node
[this codepath possibly had buffer problems.]
- retain code that instead drops by freeing buffers directly.
[this codepath has been robust with respect to buffer management]
Change-Id: I6e3d18153f52d8b94773332a39cc452873589baf
Signed-off-by: Jim Gibson <gibson+fdio@cisco.com>
Diffstat (limited to 'cicn-plugin')
-rw-r--r-- | cicn-plugin/.gitignore | 1 | ||||
-rwxr-xr-x | cicn-plugin/CMakeLists.txt | 10 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn.api | 3 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn.c | 30 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_api_test.c | 12 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_face.c | 4 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_fib.c | 3 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_hello.c | 2 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_infra.h | 4 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_infra_inlines.h | 43 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_mgmt.c | 14 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_params.h | 7 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_parser.c | 1 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_parser.h | 2 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_rte_mbuf.h | 69 | ||||
-rw-r--r-- | cicn-plugin/cicn/cicn_rte_mbuf_inlines.h | 451 | ||||
-rw-r--r-- | cicn-plugin/cicn/node.c | 93 | ||||
-rw-r--r-- | cicn-plugin/cicn/test/test_cicn.c | 1 | ||||
-rw-r--r-- | cicn-plugin/cicn/test/test_cicn.h | 1 | ||||
-rw-r--r-- | cicn-plugin/cmake/Modules/FindVpp.cmake | 4 | ||||
-rw-r--r-- | cicn-plugin/cmake/Modules/FindVppDpdk.cmake | 37 | ||||
-rw-r--r-- | cicn-plugin/scripts/build-package.sh | 10 |
22 files changed, 94 insertions, 708 deletions
diff --git a/cicn-plugin/.gitignore b/cicn-plugin/.gitignore index b354d71a..fe47da41 100644 --- a/cicn-plugin/.gitignore +++ b/cicn-plugin/.gitignore @@ -27,5 +27,4 @@ Makefile *.swp libtool *~ -*.pyc .idea diff --git a/cicn-plugin/CMakeLists.txt b/cicn-plugin/CMakeLists.txt index 90a55575..c9ac3c12 100755 --- a/cicn-plugin/CMakeLists.txt +++ b/cicn-plugin/CMakeLists.txt @@ -18,7 +18,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Dependencies find_package(Vpp REQUIRED) -find_package(VppDpdk REQUIRED) set(CICN_PLUGIN_SOURCE_FILES cicn/cicn.c @@ -41,7 +40,6 @@ set(CICN_PLUGIN_HEADER_FILES cicn/cicn_mgmt.h cicn/cicn_params.h cicn/cicn_pcs.h - cicn/cicn_rte_mbuf_inlines.h cicn/cicn_std.h cicn/cicn_api.h cicn/cicn_face.h @@ -50,7 +48,6 @@ set(CICN_PLUGIN_HEADER_FILES cicn/cicn_infra.h cicn/cicn_msg_enum.h cicn/cicn_parser.h - cicn/cicn_rte_mbuf.h cicn/cicn_siphash.h cicn/cicn_types.h) @@ -82,7 +79,6 @@ include_directories(SYSTEM) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(./) include_directories(cicn/test) -include_directories(${VPP_DPDK_INCLUDE_DIRS}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -march=native -O3") add_library(cicn_api_test_plugin SHARED @@ -90,7 +86,7 @@ add_library(cicn_api_test_plugin SHARED ${CICN_API_TEST_HEADER_FILES} ${CMAKE_CURRENT_BINARY_DIR}/cicn/cicn.api.h) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDPDK=1 -DCICN_VPP_PLUGIN=1") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCICN_VPP_PLUGIN=1") add_library(cicn_plugin SHARED ${CICN_PLUGIN_SOURCE_FILES} ${CICN_PLUGIN_HEADER_FILES} @@ -145,13 +141,13 @@ if (DEB_PACKAGE) SET(TYPE "DEBIAN") SET(GENERATOR "DEB") SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}") - SET(CPACK_${TYPE}_PACKAGE_DEPENDS "vpp (= 17.01), vpp-lib (= 17.01), vpp-dpdk-dkms (= 17.01)") + SET(CPACK_${TYPE}_PACKAGE_DEPENDS "vpp (>> 17.01), vpp-lib (>> 17.01)") elseif (RPM_PACKAGE) SET(TYPE "RPM") SET(GENERATOR "RPM") SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}") SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages") - SET(CPACK_${TYPE}_PACKAGE_REQUIRES "vpp = 17.01, vpp-dpdk-devel = 17.01") + SET(CPACK_${TYPE}_PACKAGE_REQUIRES "vpp > 17.01, vpp-lib > 17.01") else () RETURN() endif () diff --git a/cicn-plugin/cicn/cicn.api b/cicn-plugin/cicn/cicn.api index ac76f388..cc9239bb 100644 --- a/cicn-plugin/cicn/cicn.api +++ b/cicn-plugin/cicn/cicn.api @@ -76,8 +76,7 @@ define cicn_api_node_params_get_reply { /* compile-time plugin features */ u8 feature_multithread; u8 feature_cs; - u8 feature_dpdk_rtembuf_cloning; - u8 feature_vpp_vlib_cloning; + u8 feature_clone_replication; /* Number of VPP workers */ u32 worker_count; diff --git a/cicn-plugin/cicn/cicn.c b/cicn-plugin/cicn/cicn.c index d44eeb6f..9beea5d5 100644 --- a/cicn-plugin/cicn/cicn.c +++ b/cicn-plugin/cicn/cicn.c @@ -441,30 +441,10 @@ cicn_init (vlib_main_t * vm) { clib_error_t *error = 0; - error = cicn_api_plugin_hookup (vm); - - return error; -} - -VLIB_INIT_FUNCTION (cicn_init); - -/* - * This routine exists to convince the vlib plugin framework that - * we haven't accidentally copied a random .dll into the plugin directory. - * - * Also collects global variable pointers passed from the vpp engine - */ - -clib_error_t * -vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h, - int from_early_init) -{ cicn_main_t *sm = &cicn_main; - clib_error_t *error = 0; sm->vlib_main = vm; - sm->vnet_main = h->vnet_main; - sm->ethernet_main = h->ethernet_main; + sm->vnet_main = vnet_get_main (); /* Init other elements in the 'main' struct */ sm->is_enabled = 0; @@ -476,6 +456,14 @@ vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h, sm->pgen_svr_enabled = 0; + error = cicn_api_plugin_hookup (vm); + return error; } +VLIB_INIT_FUNCTION (cicn_init); + +/* *INDENT-OFF* */ +VLIB_PLUGIN_REGISTER () = { +}; +/* *INDENT-ON* */ diff --git a/cicn-plugin/cicn/cicn_api_test.c b/cicn-plugin/cicn/cicn_api_test.c index 40b6fdec..d3896f3b 100644 --- a/cicn-plugin/cicn/cicn_api_test.c +++ b/cicn-plugin/cicn/cicn_api_test.c @@ -21,7 +21,7 @@ #include <vlibmemory/api.h> #include <vlibsocket/api.h> #include <vppinfra/error.h> -#include <vnet/ip/udp.h> +#include <vnet/udp/udp.h> #include <cicn/cicn_api.h> uword unformat_sw_if_index (unformat_input_t * input, va_list * args); @@ -252,16 +252,14 @@ static void fformat (vam->ofp, "Enabled %d\n" - " Features: multithreading:%d, cs:%d, dpdk-cloning:%d, " - "vlib-cloning:%d\n", + " Features: multithreading:%d, cs:%d, clone-replication:%d\n" " Workers %d, FIB size %d PIT size %d\n" " PIT lifetime dflt %.3f, min %.3f, max %.3f\n" " CS size %d\n", mp->is_enabled, mp->feature_multithread, mp->feature_cs, - mp->feature_dpdk_rtembuf_cloning, - mp->feature_vpp_vlib_cloning, + mp->feature_clone_replication, clib_net_to_host_u32 (mp->worker_count), clib_net_to_host_u32 (mp->fib_max_size), clib_net_to_host_u32 (mp->pit_max_size), @@ -1047,7 +1045,7 @@ _(cicn_api_face_events_subscribe, "enable|disable") \ _(cicn_api_test_run_get, "testsuite <ID>") void -vat_api_hookup (vat_main_t * vam) +cicn_vat_api_hookup (vat_main_t * vam) { cicn_test_main_t *sm = &cicn_test_main; /* Hook up handlers for replies from the data plane plug-in */ @@ -1086,7 +1084,7 @@ vat_plugin_register (vat_main_t * vam) sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name); if (sm->msg_id_base != (u16) ~ 0) - vat_api_hookup (vam); + cicn_vat_api_hookup (vam); vec_free (name); diff --git a/cicn-plugin/cicn/cicn_face.c b/cicn-plugin/cicn/cicn_face.c index 2bb90253..d8494ea0 100644 --- a/cicn-plugin/cicn/cicn_face.c +++ b/cicn-plugin/cicn/cicn_face.c @@ -94,9 +94,7 @@ cicn_face_db_add (uint32_t src_addr, uint16_t src_port, goto done; } is_dpdk_driver = !strcmp (dev_class->name, "dpdk"); - cloning_supported = - CICN_FEATURE_VPP_VLIB_CLONING || - (CICN_FEATURE_DPDK_RTEMBUF_CLONING && is_dpdk_driver); + cloning_supported = CICN_INFRA_CLONE_REPLICATION; if (cicn_face_db.entry_count >= CICN_PARAM_FACES_MAX) { diff --git a/cicn-plugin/cicn/cicn_fib.c b/cicn-plugin/cicn/cicn_fib.c index a8e1e642..5e320ca0 100644 --- a/cicn-plugin/cicn/cicn_fib.c +++ b/cicn-plugin/cicn/cicn_fib.c @@ -793,6 +793,3 @@ int done: return (rv); } - - - diff --git a/cicn-plugin/cicn/cicn_hello.c b/cicn-plugin/cicn/cicn_hello.c index 0117a413..0f20ef5b 100644 --- a/cicn-plugin/cicn/cicn_hello.c +++ b/cicn-plugin/cicn/cicn_hello.c @@ -23,7 +23,7 @@ #include <vlibmemory/api.h> #include <vlibsocket/api.h> -#include <vnet/ip/udp.h> +#include <vnet/udp/udp.h> #include <cicn/cicn.h> #include <cicn/cicn_hello_inlines.h> diff --git a/cicn-plugin/cicn/cicn_infra.h b/cicn-plugin/cicn/cicn_infra.h index 3013e1eb..39bf9b59 100644 --- a/cicn-plugin/cicn/cicn_infra.h +++ b/cicn-plugin/cicn/cicn_infra.h @@ -40,7 +40,6 @@ typedef struct cicn_main_s /* Convenience */ vlib_main_t *vlib_main; vnet_main_t *vnet_main; - ethernet_main_t *ethernet_main; /* Global FIB instance */ cicn_fib_t fib; @@ -157,6 +156,9 @@ extern cicn_infra_shard_t cicn_infra_gshard; #define CICN_INFRA_CFG_GEN_INCR() (cicn_infra_gshard.cfg_generation++) +/* VPP >= 17.04 supports clone-based replication */ +#define CICN_INFRA_CLONE_REPLICATION 1 + /* Fixed array for worker threads, to be indexed by worker index */ #define CICN_INFRA_WORKERS_MAX 24 extern cicn_infra_shard_t cicn_infra_shards[CICN_INFRA_WORKERS_MAX]; diff --git a/cicn-plugin/cicn/cicn_infra_inlines.h b/cicn-plugin/cicn/cicn_infra_inlines.h new file mode 100644 index 00000000..c9333f53 --- /dev/null +++ b/cicn-plugin/cicn/cicn_infra_inlines.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 by Cisco Systems Inc. All Rights Reserved. + * + */ +#ifndef _CICN_INFRA_INLINES_H_ +#define _CICN_INFRA_INLINES_H_ 1 + +#if !CICN_VPP_PLUGIN +#error "cicn-internal file included externally" +#endif + +#include <vlib/vlib.h> + +/* + * Wrapper for buffer allocation that returns pointer rather than index + */ +static inline vlib_buffer_t * +cicn_infra_vlib_buffer_alloc (vlib_main_t * vm) +{ + vlib_buffer_t *b0; + u32 bi0; + if (vlib_buffer_alloc (vm, &bi0, 1) != 1) + { + b0 = 0; + goto done; + } + b0 = vlib_get_buffer (vm, bi0); + +done: + return (b0); +} + +/* + * Wrapper for buffer free that uses pointer rather than index + */ +static inline void +cicn_infra_vlib_buffer_free (vlib_buffer_t * b0, vlib_main_t * vm) +{ + u32 bi0 = vlib_get_buffer_index (vm, b0); + vlib_buffer_free_one (vm, bi0); +} + +#endif // CICN_INFRA_INLINES_H_ diff --git a/cicn-plugin/cicn/cicn_mgmt.c b/cicn-plugin/cicn/cicn_mgmt.c index 18f03530..76fd7baa 100644 --- a/cicn-plugin/cicn/cicn_mgmt.c +++ b/cicn-plugin/cicn/cicn_mgmt.c @@ -28,7 +28,7 @@ #include <vlibmemory/api.h> #include <vlibsocket/api.h> -#include <vnet/ip/udp.h> // port registration +#include <vnet/udp/udp.h> // port registration #include <cicn/cicn.h> @@ -206,8 +206,7 @@ vl_api_cicn_api_node_params_get_t_handler (vl_api_cicn_api_node_params_get_t * rmp->feature_multithread = CICN_FEATURE_MULTITHREAD; rmp->feature_cs = CICN_FEATURE_CS; - rmp->feature_dpdk_rtembuf_cloning = CICN_FEATURE_DPDK_RTEMBUF_CLONING; - rmp->feature_vpp_vlib_cloning = CICN_FEATURE_VPP_VLIB_CLONING; + rmp->feature_clone_replication = CICN_INFRA_CLONE_REPLICATION; rmp->worker_count = clib_host_to_net_u32 (sm->worker_count); @@ -1722,7 +1721,7 @@ cicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input, vlib_cli_output (vm, //compare vl_api_cicn_api_node_stats_get_reply_t_handler block " PIT entries (now): %d\n" " CS entries (now): %d\n" - " Forwarding statistics:" + " Forwarding statistics:\n" " pkts_processed: %d\n" " pkts_interest_count: %d\n" " pkts_data_count: %d\n" @@ -1786,12 +1785,11 @@ done: if (all_p && internal_p) { vlib_cli_output (vm, - " Features: multithreading:%d, cs:%d, dpdk-cloning:%d, " - "vlib-cloning:%d\n", + "Plugin features: multithreading:%d, cs:%d, " + "clone_replication:%d\n", CICN_FEATURE_MULTITHREAD, CICN_FEATURE_CS, - CICN_FEATURE_DPDK_RTEMBUF_CLONING, - CICN_FEATURE_VPP_VLIB_CLONING); + CICN_INFRA_CLONE_REPLICATION); } return (0); } diff --git a/cicn-plugin/cicn/cicn_params.h b/cicn-plugin/cicn/cicn_params.h index 4110351e..a2ef4aef 100644 --- a/cicn-plugin/cicn/cicn_params.h +++ b/cicn-plugin/cicn/cicn_params.h @@ -27,10 +27,8 @@ /* * Features */ -#define CICN_FEATURE_MULTITHREAD 0 // multiple worker support enabled? -#define CICN_FEATURE_CS 1 // tri-valued:see cicn_cs_enabled() -#define CICN_FEATURE_DPDK_RTEMBUF_CLONING 1 // dpdk rtembuf cloning enabled? -#define CICN_FEATURE_VPP_VLIB_CLONING 0 // vpp vlib cloning enabled? +#define CICN_FEATURE_MULTITHREAD 0 // multiple worker support enabled? +#define CICN_FEATURE_CS 1 // tri-valued:see cicn_cs_enabled() /* * API compile-time parameters @@ -114,4 +112,3 @@ extern int cicn_buftrc; #define GBI(vm,b0) (b0 ? vlib_get_buffer_index(vm, b0) : 0) #endif // _CICN_PARAM_H_ - diff --git a/cicn-plugin/cicn/cicn_parser.c b/cicn-plugin/cicn/cicn_parser.c index f9889af4..45e07136 100644 --- a/cicn-plugin/cicn/cicn_parser.c +++ b/cicn-plugin/cicn/cicn_parser.c @@ -109,4 +109,3 @@ cicn_parse_name_from_str (uint8_t * obuf, int obuflen, const char *str, } return (ret); } - diff --git a/cicn-plugin/cicn/cicn_parser.h b/cicn-plugin/cicn/cicn_parser.h index 58f1a11e..0fba3659 100644 --- a/cicn-plugin/cicn/cicn_parser.h +++ b/cicn-plugin/cicn/cicn_parser.h @@ -31,7 +31,7 @@ #include <cicn/cicn_std.h> #ifndef AOK -# define AOK 0 +#define AOK 0 #endif /* diff --git a/cicn-plugin/cicn/cicn_rte_mbuf.h b/cicn-plugin/cicn/cicn_rte_mbuf.h deleted file mode 100644 index 43b14506..00000000 --- a/cicn-plugin/cicn/cicn_rte_mbuf.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2017 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. - */ -/* - * Part of cicn plugin's dpdk/rte shim layer for using dpdk/rte mechanisms - * directly while hiding that fact from the bulk of the cicn plugin coce. - * - cicn plugin should not be looking at dpdk headers and should not need - * to. As of v17.01, howeverhowever, buffer cloning to support 0-copy on - * - content message replication - * - content message transmission based on CS hits - * is only available with dpdk, hence those mechanisms are used - * by cicn plugin.) - * - when vlib_buffer cloning support is provided, this shim layer - * can be deprecated/deleted, and cicn plugin will be simpler and will - * be able to run with a vpp that does not include dpdk. - * This is a shim file for including dpdk (rte) headers - * - The purpose of this header shimming includes (in addition to - * cicn_rte_mbuf_inlines.h that has the relevant code) is that - * as of v17.01, including dpdk rte headers works poorly due to conflicts - * between dpdk headers and vpp headers. - */ -#ifndef _CICN_RTE_MBUF_H_ -#define _CICN_RTE_MBUF_H_ 1 - -#include "cicn_params.h" - -#if !CICN_VPP_PLUGIN -#error "cicn-internal file included externally" -#endif - -#if !CICN_FEATURE_VPP_VLIB_CLONING // waiting for this API to cut over -#include <rte_config.h> - -#include <rte_common.h> -#include <rte_log.h> -#include <rte_memory.h> -#include <rte_memzone.h> -#include <rte_tailq.h> -#include <rte_eal.h> -#include <rte_per_lcore.h> -#include <rte_launch.h> -#include <rte_atomic.h> -#include <rte_cycles.h> -#include <rte_prefetch.h> -#include <rte_lcore.h> -#include <rte_per_lcore.h> -#include <rte_branch_prediction.h> -#include <rte_interrupts.h> -#include <rte_pci.h> -#include <rte_random.h> -#include <rte_debug.h> -#include <rte_ether.h> -#include <rte_ethdev.h> -#include <rte_ring.h> -#include <rte_mempool.h> -#include <rte_mbuf.h> -#endif // CICN_FEATURE_VPP_VLIB_CLONING -#endif // _CICN_RTE_MBUF_H_ diff --git a/cicn-plugin/cicn/cicn_rte_mbuf_inlines.h b/cicn-plugin/cicn/cicn_rte_mbuf_inlines.h deleted file mode 100644 index caf70043..00000000 --- a/cicn-plugin/cicn/cicn_rte_mbuf_inlines.h +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (c) 2017 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. - */ -/* - * Part of cicn plugin's dpdk/rte shim layer for using dpdk/rte mechanisms - * directly while hiding that fact from the bulk of the cicn plugin coce. - * - cicn plugin should not be looking at dpdk headers and should not need - * to. As of v17.01, howeverhowever, buffer cloning to support 0-copy on - * - content message replication - * - content message transmission based on CS hits - * is only available with dpdk, hence those mechanisms are used - * by cicn plugin.) - * - when vlib_buffer cloning support is provided, this shim layer - * can be deprecated/deleted, and cicn plugin will be simpler and will - * be able to run with a vpp that does not include dpdk. - * This file contains the code to use dpdk "struct rte_mbuf *" buffer - * headers for 0-copy cloning of content messages that are in CS, while - * hiding these references from the cicn plugin main code. - */ -#ifndef _CICN_RTE_MBUF_INLINES_H_ -#define _CICN_RTE_MBUF_INLINES_H_ 1 - -#if !CICN_VPP_PLUGIN -#error "cicn-internal file included externally" -#endif - -#include <cicn/cicn_rte_mbuf.h> -#include <vlib/vlib.h> - -/* - * Wrapper for buffer allocation that returns pointer rather than index - */ -static inline vlib_buffer_t * -cicn_infra_vlib_buffer_alloc (vlib_main_t * vm, vlib_buffer_free_list_t * fl, - unsigned socket_id, - cicn_face_db_entry_t * outface) -{ - vlib_buffer_t *b0; - u32 bi0; - if (vlib_buffer_alloc (vm, &bi0, 1) != 1) - { - b0 = 0; - goto done; - } - b0 = vlib_get_buffer (vm, bi0); - -done: - return (b0); -} - -/* - * Wrapper for buffer free that uses pointer rather than index - */ -static inline void -cicn_infra_vlib_buffer_free (vlib_buffer_t * b0, vlib_main_t * vm, - cicn_face_db_entry_t * outface) -{ - u32 bi0 = vlib_get_buffer_index (vm, b0); - vlib_buffer_free_one (vm, bi0); -} - -#if CICN_FEATURE_VPP_VLIB_CLONING // to cut over, need API from vpp gerrit 4872 -/* - * Long-term, vlib_buffer_clone() API will be supported and - * the cicn_rte_mbuf*.h files and all references to rte_mbuf can be removed from - * cicn plugin, which will then perform better and be linkable with vpp-lite. - * - * For a brief interim, can leave this file but - * with #define CICN_FEATURE_VPP_VLIB_CLONING 1 - * Some code below (e.g. cicn_infra_vlib_buffer_clone_attach_finalize() - * contents) must be moved to node.c. - * - * See comments on alternate definition under !CICN_FEATURE_VPP_VLIB_CLONING - */ - -/* - * not used if rte not used. - */ -static inline unsigned -cicn_infra_rte_socket_id (void) -{ - return (0); -} - -static inline void -cicn_infra_vlib_buffer_cs_prep_finalize (vlib_main_t * vm, - vlib_buffer_t * cs_b0) -{ - // No action -} - -static inline vlib_buffer_t * -cicn_infra_vlib_buffer_clone (vlib_buffer_t * src_b0, vlib_main_t * vm, - vlib_buffer_free_list_t * fl, - unsigned socket_id, - cicn_face_db_entry_t * outface) -{ - return (vlib_buffer_clone (src_b0)); -} - -/* - * Force dpdk drivers to rewalk chain that has been changed - */ -static inline void -cicn_infra_vlib_buffer_clone_attach_finalize (vlib_buffer_t * hdr_b0, - vlib_buffer_t * clone_b0) -{ - // no action -} -#else // !CICN_FEATURE_VPP_VLIB_CLONING - -/* - * Replacement for rte_mempool_get_bulk(): - * - rte_mempool_get_bulk() does not coexist with vlib_buffer_free(): vpp - * runs out of buffers (even when only 1 buffer is being allocated per call). - * - this replacement instead calls vlib_buffer_alloc(), which does coexist - * with vlib_buffer_free(). - */ -static inline int -cicn_infra_pvt_rte_mempool_get_bulk (vlib_main_t * vm, - struct rte_mempool *rmp, - void **rte_mbufs, u32 new_bufs) -{ - u32 bi_bufs[5]; - - int i; - ASSERT (new_bufs <= ARRAY_LEN (bi_bufs)); - - if (vlib_buffer_alloc (vm, bi_bufs, new_bufs) != new_bufs) - { - return -ENOENT; - } - for (i = 0; i < new_bufs; i++) - { - vlib_buffer_t *b0 = vlib_get_buffer (vm, bi_bufs[i]); - rte_mbufs[i] = rte_mbuf_from_vlib_buffer (b0); - } - return (0); -} - -// #include <vnet/dpdk_replication.h> // copied/modified below - -/* - * Modified copy of .../vpp/vnet/vnet/dpdk_replication.h: - * - maintain foreign indentation for easier comparison - * - call cicn_infra_pvt_rte_mempool_get_bulk() in place of calling - * rte_mempool_get_bulk(), avoiding the issue described at - * cicn_infra_pvt_rte_mempool_get_bulk(), above. - */ -static inline vlib_buffer_t * -cicn_infra_pvt_vlib_dpdk_copy_buffer (vlib_main_t * vm, vlib_buffer_t * b) -{ - u32 new_buffers_needed = 1; - unsigned socket_id = rte_socket_id (); - struct rte_mempool *rmp = vm->buffer_main->pktmbuf_pools[socket_id]; - struct rte_mbuf *rte_mbufs[5]; - vlib_buffer_free_list_t *fl; - vlib_buffer_t *rv; - u8 *copy_src, *copy_dst; - vlib_buffer_t *src_buf, *dst_buf; - - fl = vlib_buffer_get_free_list (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX); - - if (PREDICT_FALSE (b->flags & VLIB_BUFFER_NEXT_PRESENT)) - { - vlib_buffer_t *tmp = b; - int i; - - while (tmp->flags & VLIB_BUFFER_NEXT_PRESENT) - { - new_buffers_needed++; - tmp = vlib_get_buffer (vm, tmp->next_buffer); - } - - /* Should never happen... */ - if (PREDICT_FALSE (new_buffers_needed > ARRAY_LEN (rte_mbufs))) - { - clib_warning ("need %d buffers", new_buffers_needed); - return 0; - } - -#if 0 // bug workaround: vlib_buffer_free() of these does not work right - if (rte_mempool_get_bulk (rmp, (void **) rte_mbufs, - new_buffers_needed) < 0) - return 0; -#else - if (cicn_infra_pvt_rte_mempool_get_bulk (vm, rmp, (void **) rte_mbufs, - new_buffers_needed) < 0) - return 0; -#endif - - src_buf = b; - rv = dst_buf = vlib_buffer_from_rte_mbuf (rte_mbufs[0]); - vlib_buffer_init_for_free_list (dst_buf, fl); - copy_src = b->data + src_buf->current_data; - copy_dst = dst_buf->data + src_buf->current_data; - - for (i = 0; i < new_buffers_needed; i++) - { - clib_memcpy (copy_src, copy_dst, src_buf->current_length); - dst_buf->current_data = src_buf->current_data; - dst_buf->current_length = src_buf->current_length; - dst_buf->flags = src_buf->flags; - - if (i == 0) - { - dst_buf->total_length_not_including_first_buffer = - src_buf->total_length_not_including_first_buffer; - vnet_buffer (dst_buf)->sw_if_index[VLIB_RX] = - vnet_buffer (src_buf)->sw_if_index[VLIB_RX]; - vnet_buffer (dst_buf)->sw_if_index[VLIB_TX] = - vnet_buffer (src_buf)->sw_if_index[VLIB_TX]; - vnet_buffer (dst_buf)->l2 = vnet_buffer (b)->l2; - } - - if (i < new_buffers_needed - 1) - { - src_buf = vlib_get_buffer (vm, src_buf->next_buffer); - dst_buf = vlib_buffer_from_rte_mbuf (rte_mbufs[i + 1]); - vlib_buffer_init_for_free_list (dst_buf, fl); - copy_src = src_buf->data; - copy_dst = dst_buf->data; - } - } - return rv; - } - -#if 0 // bug workaround: vlib_buffer_free() of these does not work right - if (rte_mempool_get_bulk (rmp, (void **) rte_mbufs, 1) < 0) - return 0; -#else - if (cicn_infra_pvt_rte_mempool_get_bulk (vm, rmp, (void **) rte_mbufs, 1) < - 0) - return 0; -#endif - - rv = vlib_buffer_from_rte_mbuf (rte_mbufs[0]); - vlib_buffer_init_for_free_list (rv, fl); - - clib_memcpy (rv->data + b->current_data, b->data + b->current_data, - b->current_length); - rv->current_data = b->current_data; - rv->current_length = b->current_length; - vnet_buffer (rv)->sw_if_index[VLIB_RX] = - vnet_buffer (b)->sw_if_index[VLIB_RX]; - vnet_buffer (rv)->sw_if_index[VLIB_TX] = - vnet_buffer (b)->sw_if_index[VLIB_TX]; - vnet_buffer (rv)->l2 = vnet_buffer (b)->l2; - - return (rv); -} - -/* - * Could call rte_socket_id() wherever needed, not sure how expensive it is. - * For now, export and cache. - */ -static inline unsigned -cicn_infra_rte_socket_id (void) -{ - return (rte_socket_id ()); -} - -/* - * For cs_pref, update rte_mbuf fields to correspond to vlib_buffer fields. - * (Probably could be skipped for non-dpdk drivers that must use copying.) - */ -static inline void -cicn_infra_vlib_buffer_cs_prep_finalize (vlib_main_t * vm, - vlib_buffer_t * cs_b0) -{ - /* Adjust the dpdk buffer header, so we can use this copy for - * future cache hits. - * - if dpdk buffer header invalid (e.g. content msg arrived on veth intfc, - * initialize it. - * - effectively, advanceg the mbuf past the incoming IP and UDP headers, - * so that the buffer points to the start of the ICN payload that is - * to be replicated. - */ - struct rte_mbuf *cs_mb0; - i16 delta; - - cs_mb0 = rte_mbuf_from_vlib_buffer (cs_b0); - if ((cs_b0->flags & VNET_BUFFER_RTE_MBUF_VALID) == 0) - { - rte_pktmbuf_reset (cs_mb0); - } - - delta = vlib_buffer_length_in_chain (vm, cs_b0) - (i16) (cs_mb0->pkt_len); - - cs_mb0->data_len += delta; - cs_mb0->pkt_len += delta; - cs_mb0->data_off = (RTE_PKTMBUF_HEADROOM + cs_b0->current_data); -} - -/* - * Wrapper for buffer "cloning" that uses - * - rte_mbuf buffer cloning for dpdk drivers that support cloning - * - vlib buffer copying for non-dpdk drivers that must use copying. - * - * CICN multicast support from vpp is currently problematic. - * Three mechanisms on offer, CICN currently uses [1] for physical - * output faces and [3] for virtual output faces: - * 1. rte_mbuf's rte_pktmbuf_clone() - * - advantages - * - PIT deaggregation (multicast) case - * - high-performance creation of clone chains (relying on - * reference-counting mechanism) - * - avoids copying - * - allows parallel transmission - * - CS hit case - * - allows modular handling of sending content and deleting CS entries - * (relying on reference counting mechanism) - * - disadvantages - * - requires allocating indirect buffers, which has a cost even - * without copying (but Content messages are generally large) - * - rte_pktmbufs are a DPDK mechanism - * - not supported by non-DPDK (i.e. virtual) drivers - * - not supported by vpp-lite, which is used for unit test - * 2. recycling-based replication (recirculation) - * - advantages - * - avoids copying - * - currently approved by vpp team - * - disadvantages - * - increased latency since need to transmit copies serially since - * only one buffer - * - mechanism not quite yet fully supported: notification that - * transmission <n> has occurred and recycle for transmission <n+1> - * may start does not occur on transmission completion, but on next - * transmission on that interface - * 3. cicn_infra_pvt_vlib_dpdk_copy_buffer (was vlib_dpdk_clone_buffer()) - * - advantages - * - works in both cases, for all drivers - * - disadvantages - * - slow, due to copying - */ -static inline vlib_buffer_t * -cicn_infra_vlib_buffer_clone (vlib_buffer_t * src_b0, vlib_main_t * vm, - vlib_buffer_free_list_t * fl, - unsigned socket_id, - cicn_face_db_entry_t * outface) -{ - vlib_buffer_t *dst_b0; - - if (outface->swif_cloning_supported) - { - vlib_buffer_main_t *bm = vm->buffer_main; - struct rte_mbuf *src_mb0 = rte_mbuf_from_vlib_buffer (src_b0); - struct rte_mbuf *dst_mb0; - dst_mb0 = rte_pktmbuf_clone (src_mb0, bm->pktmbuf_pools[socket_id]); - if (dst_mb0 == 0) - { - dst_b0 = 0; - goto done; - } - - // rte_mbuf_clone uses rte_mbuf (dpdk) buffer header: - // copy relevant value to vlib_buffer_t header - dst_b0 = vlib_buffer_from_rte_mbuf (dst_mb0); - vlib_buffer_init_for_free_list (dst_b0, fl); - ASSERT (dst_b0->current_data == 0); - dst_b0->current_data = src_b0->current_data; - dst_b0->current_length = dst_mb0->data_len; - } - else - { - dst_b0 = cicn_infra_pvt_vlib_dpdk_copy_buffer (vm, src_b0); - if (dst_b0 == 0) - { - goto done; - } - } - - //TODO: af_packet device.c chain walker ignores VLIB_BUFFER_NEXT_PRESENT - // clear next_buffer to maintain buffer sanity - ASSERT ((dst_b0->flags & VLIB_BUFFER_NEXT_PRESENT) == 0); - if (!(dst_b0->flags & VLIB_BUFFER_NEXT_PRESENT)) - { - dst_b0->next_buffer = 0; - } - ASSERT ((dst_b0->flags & VNET_BUFFER_RTE_MBUF_VALID) == 0); - -done: - return (dst_b0); -} - -/* - * For clone attach, vlib_buffer chain is being changed, invalidating - * rte_mbuf chain (if present). Update the rte_mbuf chain information to - * be valid. - */ -static inline void -cicn_infra_vlib_buffer_clone_attach_finalize (vlib_buffer_t * hdr_b0, - vlib_buffer_t * clone_b0, - cicn_face_db_entry_t * outface) -{ - struct rte_mbuf *hdr_mb0; - struct rte_mbuf *clone_mb0; - int hdr_rte_mbuf_valid; - - hdr_mb0 = rte_mbuf_from_vlib_buffer (hdr_b0); - clone_mb0 = rte_mbuf_from_vlib_buffer (clone_b0); - - hdr_rte_mbuf_valid = ((hdr_b0->flags & VNET_BUFFER_RTE_MBUF_VALID) != 0); - ASSERT ((clone_b0->flags & VNET_BUFFER_RTE_MBUF_VALID) == 0); - - /* Update main rte_mbuf fields, even for non-dkdk output interfaces */ - if (!hdr_rte_mbuf_valid) - { - rte_pktmbuf_reset (hdr_mb0); - } - hdr_mb0->data_len = hdr_b0->current_length; - hdr_mb0->pkt_len = hdr_b0->current_length + - hdr_b0->total_length_not_including_first_buffer; - hdr_mb0->next = clone_mb0; - hdr_mb0->nb_segs = clone_mb0->nb_segs + 1; - - if (!outface->swif_is_dpdk_driver) - { - goto done; - } - - hdr_b0->flags |= VNET_BUFFER_RTE_MBUF_VALID; - clone_b0->flags |= VNET_BUFFER_RTE_MBUF_VALID; - - /* copy metadata from source packet (see sr_replicate.c) */ - hdr_mb0->port = clone_mb0->port; - hdr_mb0->vlan_tci = clone_mb0->vlan_tci; - hdr_mb0->vlan_tci_outer = clone_mb0->vlan_tci_outer; - hdr_mb0->tx_offload = clone_mb0->tx_offload; - hdr_mb0->hash = clone_mb0->hash; - - hdr_mb0->ol_flags = clone_mb0->ol_flags & ~(IND_ATTACHED_MBUF); - - __rte_mbuf_sanity_check (hdr_mb0, 1); - -done:; -} -#endif // !CICN_FEATURE_VPP_VLIB_CLONING - -#endif // CICN_RTE_MBUF_INLINES_H_ diff --git a/cicn-plugin/cicn/node.c b/cicn-plugin/cicn/node.c index 922ebf4b..02199829 100644 --- a/cicn-plugin/cicn/node.c +++ b/cicn-plugin/cicn/node.c @@ -16,14 +16,13 @@ * node.c - icn plug-in nodes for vpp */ -#include "cicn_rte_mbuf.h" // needed first because vlib.h defs conflict #include <vlib/vlib.h> #include <vnet/vnet.h> #include <cicn/cicn.h> #include <cicn/cicn_hashtb.h> #include <cicn/cicn_pcs.h> -#include <cicn/cicn_rte_mbuf_inlines.h> +#include <cicn/cicn_infra_inlines.h> #include <cicn/cicn_hello_inlines.h> int cicn_buftrc = 0; // make permanent or delete? Set to 1 to enable trace @@ -121,7 +120,6 @@ prep_buffer_for_cs (vlib_main_t * vm, vlib_buffer_t * b0) /* Advance the vlib buffer to the beginning of the ICN payload */ vlib_buffer_advance (b0, sizeof (ip4_header_t) + sizeof (udp_header_t)); - cicn_infra_vlib_buffer_cs_prep_finalize (vm, b0); ret = AOK; return (ret); @@ -135,10 +133,10 @@ prep_buffer_for_cs (vlib_main_t * vm, vlib_buffer_t * b0) static int cicn_clone_cs_buffer (vlib_buffer_t * hdr_b0, const cicn_pcs_entry_t * pcs, vlib_main_t * vm, vlib_buffer_free_list_t * fl, - unsigned socket_id, cicn_face_db_entry_t * outface) + cicn_face_db_entry_t * outface) { int ret = EINVAL; - vlib_buffer_t *cs_b0, *clone_b0; + vlib_buffer_t *cs_b0; BUFTRC ("CS-H-SW", GBI (vm, hdr_b0)); if (PREDICT_FALSE (pcs->u.cs.cs_pkt_buf == 0)) @@ -149,33 +147,14 @@ cicn_clone_cs_buffer (vlib_buffer_t * hdr_b0, const cicn_pcs_entry_t * pcs, cs_b0 = vlib_get_buffer (vm, pcs->u.cs.cs_pkt_buf); - /* Clone the buf held in the CS */ - clone_b0 = cicn_infra_vlib_buffer_clone (cs_b0, vm, fl, socket_id, outface); - BUFTRC ("CS-H-CL", GBI (vm, clone_b0)); - if (PREDICT_FALSE (clone_b0 == 0)) - { - /* If we can't get a buf, we can't continue */ - goto done; - } - /* At this point, the base CS buffer is pointing at the ICN payload * part of the packet, and we'll be using the other buffer * to hold the egress/tx rewrite info. */ hdr_b0->current_data = 0; hdr_b0->current_length = sizeof (ip4_header_t) + sizeof (udp_header_t); - hdr_b0->flags |= VLIB_BUFFER_NEXT_PRESENT; - if (outface->swif_is_dpdk_driver) - { - ASSERT ((hdr_b0->flags & VNET_BUFFER_RTE_MBUF_VALID) != 0); - } - hdr_b0->total_length_not_including_first_buffer = - vlib_buffer_length_in_chain (vm, cs_b0); - - /* Connect the header particle to the body */ - hdr_b0->next_buffer = vlib_get_buffer_index (vm, clone_b0); - cicn_infra_vlib_buffer_clone_attach_finalize (hdr_b0, clone_b0, outface); + vlib_buffer_attach_clone (vm, hdr_b0, cs_b0); /* Looks like success */ ret = AOK; @@ -213,7 +192,6 @@ icnfwd_node_fn (vlib_main_t * vm, cicn_prefix_hashinf_t pfxhash; f64 tnow; vlib_buffer_free_list_t *fl; - unsigned socket_id = cicn_infra_rte_socket_id (); cicn_main_t *sm = &cicn_main; fl = vlib_buffer_get_free_list (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX); @@ -281,7 +259,7 @@ icnfwd_node_fn (vlib_main_t * vm, uint16_t faceid; int clone_count; vlib_buffer_t *hdr_vec[CICN_PARAM_PIT_ENTRY_PHOPS_MAX]; - vlib_buffer_t *clone_vec[CICN_PARAM_PIT_ENTRY_PHOPS_MAX]; + vlib_buffer_t *cs_b0; cicn_face_db_entry_t *face_vec[CICN_PARAM_PIT_ENTRY_PHOPS_MAX]; u64 seq_num; int trace_p = 0; @@ -495,6 +473,7 @@ icnfwd_node_fn (vlib_main_t * vm, * the ICN payload packet buf. We also capture the tx faceid. */ ret = AOK; + cs_b0 = b0; for (clone_count = 0, i = 0; i < CICN_PARAM_PIT_ENTRY_PHOPS_MAX; i++) { @@ -516,25 +495,11 @@ icnfwd_node_fn (vlib_main_t * vm, face_vec[clone_count] = outface; hdr_vec[clone_count] = - cicn_infra_vlib_buffer_alloc (vm, fl, socket_id, - outface); - if (!cicn_cs_enabled (&rt->pitcs) && clone_count == 0) - { - clone_vec[clone_count] = b0; - } - else - { - clone_vec[clone_count] = - cicn_infra_vlib_buffer_clone (b0, vm, fl, - socket_id, outface); - } + cicn_infra_vlib_buffer_alloc (vm); BUFTRC ("CLN-HDR", GBI (vm, hdr_vec[clone_count])); - BUFTRC ("CLN-CLN", GBI (vm, clone_vec[clone_count])); - if (PREDICT_FALSE ((hdr_vec[clone_count] == NULL) || - (clone_vec[clone_count] == NULL))) + if (PREDICT_FALSE (hdr_vec[clone_count] == NULL)) { - /* Need to check this index in the arrays in * the error-handling code below. */ @@ -554,17 +519,10 @@ icnfwd_node_fn (vlib_main_t * vm, for (i = 0; i < clone_count; i++) { BUFTRC ("ERR-FRE", - vlib_get_buffer_index (vm, - clone_vec[clone_count])); + vlib_get_buffer_index (vm, hdr_vec[i])); if (hdr_vec[i]) { - cicn_infra_vlib_buffer_free (hdr_vec[i], vm, - face_vec[i]); - } - if (clone_vec[i]) - { - cicn_infra_vlib_buffer_free (hdr_vec[i], vm, - face_vec[i]); + cicn_infra_vlib_buffer_free (hdr_vec[i], vm); } } @@ -675,10 +633,8 @@ icnfwd_node_fn (vlib_main_t * vm, */ for (i = 0; i < clone_count; i++) { - vlib_buffer_t *cs_b0; b0 = hdr_vec[i]; - cs_b0 = clone_vec[i]; outface = face_vec[i]; if (PREDICT_FALSE (trace_p != 0)) @@ -691,16 +647,7 @@ icnfwd_node_fn (vlib_main_t * vm, b0->current_data = 0; b0->current_length = (sizeof (ip4_header_t) + sizeof (udp_header_t)); - b0->flags |= VLIB_BUFFER_NEXT_PRESENT; - - b0->total_length_not_including_first_buffer = - vlib_buffer_length_in_chain (vm, cs_b0); - - /* Connect the header particle to the body */ - b0->next_buffer = vlib_get_buffer_index (vm, cs_b0); - - cicn_infra_vlib_buffer_clone_attach_finalize (b0, cs_b0, - outface); + vlib_buffer_attach_clone (vm, b0, cs_b0); /* Refresh the ip and udp headers * before the final part of the rewrite @@ -991,7 +938,7 @@ icnfwd_node_fn (vlib_main_t * vm, * Clone the CS packet, and prepare the incoming request * packet to hold the rewrite info as a particle. */ - if (cicn_clone_cs_buffer (b0, pitp, vm, fl, socket_id, + if (cicn_clone_cs_buffer (b0, pitp, vm, fl, inface /*outface */ ) != AOK) { no_bufs_count++; @@ -1526,23 +1473,7 @@ cicn_trim_cs_lru (vlib_main_t * vm, vlib_node_runtime_t * node, BUFTRC ("CS-TRIM-ALL", bufcount); if (bufcount > 0) { -#if 1 //$$$XXX TODO: does this work better than drop-node approach? seems so(?) vlib_buffer_free (vm, buf_list, bufcount); -#else - /* This ought to work, not limited to a single frame size. It has - * the nice property that we get to set a stat/error code for - * the bufs we're freeing. Note that we specify the 'next index' - * in terms of our own node's array of 'nexts'. - * - * Seems to work but can replace with - * vlib_buffer_free (vm, buf_list, bufcount); - * if willing to give up the counter. - */ - vlib_error_drop_buffers (vm, node, buf_list, 1 /*stride */ , - bufcount, - ICNFWD_NEXT_ERROR_DROP /*next index */ , - icnfwd_node.index, ICNFWD_ERROR_CS_LRU); -#endif } } diff --git a/cicn-plugin/cicn/test/test_cicn.c b/cicn-plugin/cicn/test/test_cicn.c index 77eff120..5b0a5bf8 100644 --- a/cicn-plugin/cicn/test/test_cicn.c +++ b/cicn-plugin/cicn/test/test_cicn.c @@ -136,4 +136,3 @@ test_cicn_init (vlib_main_t * vm) } VLIB_INIT_FUNCTION (test_cicn_init); - diff --git a/cicn-plugin/cicn/test/test_cicn.h b/cicn-plugin/cicn/test/test_cicn.h index ddc14b08..82db7109 100644 --- a/cicn-plugin/cicn/test/test_cicn.h +++ b/cicn-plugin/cicn/test/test_cicn.h @@ -41,4 +41,3 @@ test_cicn_result_record (cicn_api_test_suite_results_t * tr, int rc, int test_cicn_hash_suite (cicn_api_test_suite_results_t * tr, test_cicn_running_t * running); - diff --git a/cicn-plugin/cmake/Modules/FindVpp.cmake b/cicn-plugin/cmake/Modules/FindVpp.cmake index a930a946..33fe95e5 100644 --- a/cicn-plugin/cmake/Modules/FindVpp.cmake +++ b/cicn-plugin/cmake/Modules/FindVpp.cmake @@ -26,7 +26,7 @@ set(VPP_SEARCH_PATH_LIST /opt /usr) -find_path(VPP_INCLUDE_DIR vpp-api/vpe.api.h +find_path(VPP_INCLUDE_DIR vpp/api/vpe.api.h HINTS ${VPP_SEARCH_PATH_LIST} PATH_SUFFIXES include DOC "Find the VPP includes") @@ -34,7 +34,7 @@ find_path(VPP_INCLUDE_DIR vpp-api/vpe.api.h set(VPP_INCLUDE_DIRS ${VPP_INCLUDE_DIR} ${VPP_INCLUDE_DIR}/vpp-api - ${VPP_INCLUDE_DIR}/pneum + ${VPP_INCLUDE_DIR}/vpp-api/pneum ${VPP_INCLUDE_DIR}/vlibmemory ${VPP_INCLUDE_DIR}/vat ${VPP_INCLUDE_DIR}/vlibapi diff --git a/cicn-plugin/cmake/Modules/FindVppDpdk.cmake b/cicn-plugin/cmake/Modules/FindVppDpdk.cmake deleted file mode 100644 index 5c6bd62a..00000000 --- a/cicn-plugin/cmake/Modules/FindVppDpdk.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2017 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. - -######################################## -# -# Find the VPP libraries and includes -# This module sets: -# VPP_DPDK_FOUND: True if VPP was found -# VPP_DPDK_INCLUDE_DIR: The VPP include dir -# - -set(VPP_DPDK_SEARCH_PATH_LIST - ${VPP_DPDK_ROOT} - $ENV{VPP_DODK_ROOT} - /usr/local - /opt - /usr) - -find_path(VPP_DPDK_INCLUDE_DIR vpp-dpdk/rte_version.h - HINTS ${VPP_DPDK_SEARCH_PATH_LIST} - PATH_SUFFIXES include - DOC "Find the VPP-DPDK includes") - -set(VPP_DPDK_INCLUDE_DIRS ${VPP_DPDK_INCLUDE_DIR} ${VPP_DPDK_INCLUDE_DIR}/vpp-dpdk) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(VppDpdk DEFAULT_MSG VPP_DPDK_INCLUDE_DIR) diff --git a/cicn-plugin/scripts/build-package.sh b/cicn-plugin/scripts/build-package.sh index 5af305ce..8265300b 100644 --- a/cicn-plugin/scripts/build-package.sh +++ b/cicn-plugin/scripts/build-package.sh @@ -9,12 +9,12 @@ apt_get=${APT_PATH:-"/usr/local/bin/apt-get"} BUILD_TOOLS_UBUNTU="build-essential cmake" LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev" -DEPS_UBUNTU="vpp-dev vpp-dpdk-dev vpp-lib" +DEPS_UBUNTU="vpp-dev vpp-lib" BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" BUILD_TOOLS_SINGLE_CENTOS="cmake" LIBSSL_LIBEVENT_CENTOS="libevent-devel openssl-devel" -DEPS_CENTOS="vpp-dev vpp-dpdk-dev vpp-lib" +DEPS_CENTOS="vpp-devel" # Parameters: # $1 = Distribution [Trusty / CentOS] @@ -81,9 +81,9 @@ update_fdio_repo() { if [ "$DISTRIB_ID" == "Ubuntu" ]; then if [ "$DISTRIB_CODENAME" == "xenial" ]; then - REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1701.ubuntu.xenial.main/" + REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1704.ubuntu.xenial.main/" elif [ "$DISTRIB_CODENAME" == "trusty" ]; then - REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1701.ubuntu.trusty.main/" + REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1704.ubuntu.trusty.main/" else echo "Distribution $DISTRIB_CODENAME is not supported" exit -1 @@ -92,7 +92,7 @@ update_fdio_repo() { echo "deb ${REPO_VPP_URL} ./" | sudo tee /etc/apt/sources.list.d/99fd.io.list elif [ "$DISTRIB_ID" == "CentOS" ]; then - REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1701.centos7/" + REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1704.centos7/" REPO=${REPO_NAME:-"master.centos7"} REPO_CICN_URL="${NEXUS_PROXY}/content/repositories/fd.io.${REPO}" |