diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-04-19 11:38:49 +0200 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-05-03 12:07:41 +0200 |
commit | 98b5448ee9b39f4e92d781d14a27819074e3c1da (patch) | |
tree | e443374985cf6fc499efb2674482334d0bec3f18 | |
parent | 305e7617be61d21ebd0dee043588c469bc28ad3b (diff) |
[HICN-180] Updating plugin to run on vpp 19.04
Change-Id: I23d44747edf65b9cbf1cd7cb174541dce55152aa
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
-rw-r--r-- | cmake/Modules/FindVpp.cmake | 9 | ||||
-rw-r--r-- | hicn-plugin/README.md | 2 | ||||
-rw-r--r-- | hicn-plugin/src/data_fwd.h | 38 | ||||
-rw-r--r-- | hicn-plugin/src/data_fwd_node.c | 11 | ||||
-rw-r--r-- | hicn-plugin/src/interest_hitcs_node.c | 4 | ||||
-rw-r--r-- | hicn-plugin/src/pg.c | 8 | ||||
-rw-r--r-- | libtransport/CMakeLists.txt | 2 | ||||
-rw-r--r-- | scripts/build-packages.sh | 16 |
8 files changed, 40 insertions, 50 deletions
diff --git a/cmake/Modules/FindVpp.cmake b/cmake/Modules/FindVpp.cmake index ae11c8019..7d8d16d13 100644 --- a/cmake/Modules/FindVpp.cmake +++ b/cmake/Modules/FindVpp.cmake @@ -60,8 +60,15 @@ find_library(VPP_LIBRARY_VLIB DOC "Find the Vpp vlib library" ) +find_library(VPP_LIBRARY_VPPAPICLIENT + NAMES vppapiclient + HINTS ${VPP_SEARCH_PATH_LIST} + PATH_SUFFIXES lib lib64 + DOC "Find the Vpp vlib library" +) + set(VPP_LIBRARIES ${VPP_LIBRARY_MEMORYCLIENT} ${VPP_LIBRARY_SVM} ${VPP_LIBRARY_INFRA} ${VPP_LIBRARY_VATPLUGIN} ${VPP_LIBRARY_VLIB}) set(VPP_INCLUDE_DIRS ${VPP_INCLUDE_DIR} ${VPP_INCLUDE_DIR}/vpp_plugins) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Vpp DEFAULT_MSG VPP_LIBRARIES VPP_INCLUDE_DIRS)
\ No newline at end of file +find_package_handle_standard_args(Vpp DEFAULT_MSG VPP_LIBRARIES VPP_INCLUDE_DIRS) diff --git a/hicn-plugin/README.md b/hicn-plugin/README.md index e0e0580de..22e38a015 100644 --- a/hicn-plugin/README.md +++ b/hicn-plugin/README.md @@ -65,7 +65,7 @@ hICN-plugin has been tested in: Build dependencies: -- VPP 19.01 +- VPP 19.04 - DEB packages: - vpp - vpp-lib diff --git a/hicn-plugin/src/data_fwd.h b/hicn-plugin/src/data_fwd.h index 4e37e6087..742bb2882 100644 --- a/hicn-plugin/src/data_fwd.h +++ b/hicn-plugin/src/data_fwd.h @@ -20,17 +20,6 @@ #include "pcs.h" -/* - * Node context data; we think this is per-thread/instance - */ -typedef struct hicn_data_fwd_runtime_s -{ - vlib_combined_counter_main_t repm_counters; - - /* per-cpu vector of cloned packets */ - u32 **clones; -} hicn_data_fwd_runtime_t; - /* Trace context struct */ typedef struct { @@ -86,9 +75,8 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers, } return n_buffers; } - n_buffers = vlib_buffer_alloc_from_free_list (vm, buffers, n_buffers, - vlib_buffer_get_free_list_index - (s)); + n_buffers = vlib_buffer_alloc_from_pool (vm, buffers, n_buffers, + s->buffer_pool_index); for (i = 0; i < n_buffers; i++) { @@ -96,8 +84,6 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers, d->current_data = s->current_data; d->current_length = head_end_offset; d->trace_index = s->trace_index; - vlib_buffer_set_free_list_index (d, - vlib_buffer_get_free_list_index (s)); d->total_length_not_including_first_buffer = s->current_length - head_end_offset; @@ -116,11 +102,11 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers, d->next_buffer = src_buffer; } vlib_buffer_advance (s, head_end_offset); - s->n_add_refs = n_buffers - 1; + s->ref_count = n_buffers - 1; while (s->flags & VLIB_BUFFER_NEXT_PRESENT) { s = vlib_get_buffer (vm, s->next_buffer); - s->n_add_refs = n_buffers - 1; + s->ref_count = n_buffers - 1; } return n_buffers; @@ -129,7 +115,7 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers, /** * @brief Create multiple clones of buffer and store them * in the supplied array. Unlike the function in the vlib library, - * we allow src_buffer to have n_add_refs != 0. + * we allow src_buffer to have ref_count != 0. * * @param vm - (vlib_main_t *) vlib main data structure pointer * @param src_buffer - (u32) source buffer index @@ -154,13 +140,13 @@ vlib_buffer_clone2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers, s->total_length_not_including_first_buffer = 0; u16 n_cloned = 0; - u8 n_clone_src = 255 - s->n_add_refs; + u8 n_clone_src = 255 - s->ref_count; /* * We need to copy src for all the clones that cannot be chained in * the src_buffer */ - /* MAX(n_add_refs) = 256 */ + /* MAX(ref_count) = 256 */ if (n_buffers > n_clone_src) { vlib_buffer_t *copy; @@ -174,25 +160,25 @@ vlib_buffer_clone2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers, n_buffers -= n_cloned; } /* - * vlib_buffer_clone_256 check if n_add_refs is 0. We force it to be + * vlib_buffer_clone_256 check if ref_count is 0. We force it to be * 0 before calling the function and we retore it to the right value * after the function has been called */ - u8 tmp_n_add_refs = s->n_add_refs; + u8 tmp_ref_count = s->ref_count; - s->n_add_refs = 0; + s->ref_count = 0; /* * The regular vlib_buffer_clone_256 does copy if we need to clone * only one packet. While this is not a problem per se, it adds * complexity to the code, especially because we need to add 1 to - * n_add_refs when the packet is cloned. + * ref_count when the packet is cloned. */ n_cloned += vlib_buffer_clone_256_2 (vm, src_buffer, (buffers + n_cloned), n_buffers, head_end_offset); - s->n_add_refs += tmp_n_add_refs; + s->ref_count += tmp_ref_count; return n_cloned; } diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c index efb98164d..0b8685ff2 100644 --- a/hicn-plugin/src/data_fwd_node.c +++ b/hicn-plugin/src/data_fwd_node.c @@ -271,7 +271,7 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, * longer in any frame. The vlib_buffer will be freed when * all its cloned vlib_buffer will be freed. */ - b0->n_add_refs--; + b0->ref_count--; } /* Delete the PIT entry */ @@ -294,7 +294,7 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, * longer in any frame. The vlib_buffer will be freed when * all its cloned vlib_buffer will be freed. */ - b0->n_add_refs--; + b0->ref_count--; } /* Delete the PIT entry */ @@ -403,12 +403,12 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0, else { /* Add one reference to maintain the buffer in the CS. - * b0->n_add_refs == 0 has two meaning: it has 1 buffer or no buffer chained to it. + * b0->ref_count == 0 has two meaning: it has 1 buffer or no buffer chained to it. * vlib_buffer_clone2 add a number of reference equalt to pitp->u.pit.faces.n_faces - 1 * as vlib_buffer_clone does. So after all the packet are forwarded the buffer stored in - * the CS will have n_add_refs == 0; + * the CS will have ref_count == 0; */ - b0->n_add_refs++; + b0->ref_count++; } found = n_left_from = @@ -621,7 +621,6 @@ VLIB_REGISTER_NODE(hicn_data_fwd_node) = .function = hicn_data_node_fn, .name = "hicn-data-fwd", .vector_size = sizeof(u32), - .runtime_data_bytes = sizeof(hicn_data_fwd_runtime_t), .format_trace = hicn_data_fwd_format_trace, .type = VLIB_NODE_TYPE_INTERNAL, .n_errors = ARRAY_LEN(hicn_data_fwd_error_strings), diff --git a/hicn-plugin/src/interest_hitcs_node.c b/hicn-plugin/src/interest_hitcs_node.c index 8ddd4f59e..aad7ed74e 100644 --- a/hicn-plugin/src/interest_hitcs_node.c +++ b/hicn-plugin/src/interest_hitcs_node.c @@ -60,12 +60,12 @@ clone_from_cs (vlib_main_t * vm, u32 * bi0_cs, vlib_buffer_t * dest, u8 isv6) else { vlib_buffer_advance (cs_buf, -buffer_advance); - if (PREDICT_FALSE (cs_buf->n_add_refs == 255)) + if (PREDICT_FALSE (cs_buf->ref_count == 255)) { vlib_buffer_t *cs_buf2 = vlib_buffer_copy (vm, cs_buf); vlib_buffer_advance (cs_buf, buffer_advance); *bi0_cs = vlib_get_buffer_index (vm, cs_buf2); - cs_buf->n_add_refs--; + cs_buf->ref_count--; cs_buf = cs_buf2; } diff --git a/hicn-plugin/src/pg.c b/hicn-plugin/src/pg.c index 643aff2be..8181d865e 100644 --- a/hicn-plugin/src/pg.c +++ b/hicn-plugin/src/pg.c @@ -1056,9 +1056,7 @@ convert_interest_to_data_v4 (vlib_main_t * vm, vlib_buffer_t * b0, bytes_to_copy = 1500 - pkt_len; } /* Add content to the data packet */ - vlib_buffer_add_data (vm, - VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX, &bi0, - rb->data, bytes_to_copy); + vlib_buffer_add_data (vm, &bi0, rb->data, bytes_to_copy); b0 = vlib_get_buffer (vm, bi0); @@ -1094,9 +1092,7 @@ convert_interest_to_data_v6 (vlib_main_t * vm, vlib_buffer_t * b0, bytes_to_copy = 1500 - pkt_len; } /* Add content to the data packet */ - vlib_buffer_add_data (vm, - VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX, &bi0, - rb->data, bytes_to_copy); + vlib_buffer_add_data (vm, &bi0, rb->data, bytes_to_copy); b0 = vlib_get_buffer (vm, bi0); diff --git a/libtransport/CMakeLists.txt b/libtransport/CMakeLists.txt index 1cc4c3539..5cd33cfdc 100644 --- a/libtransport/CMakeLists.txt +++ b/libtransport/CMakeLists.txt @@ -111,7 +111,7 @@ list(APPEND LIBRARIES ${LIBPARC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${HICN_LIBRARIES} - ${VPP_LIBRARIES} + ${VPP_LIBRARY_VPPAPICLIENT} ${ANDROID_LIBRARIES} ${OPENSSL_LIBRARIES} ${WINDOWS_LIBRARIES} diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh index 70c41d1e1..4ff49b0aa 100644 --- a/scripts/build-packages.sh +++ b/scripts/build-packages.sh @@ -22,17 +22,18 @@ PACKAGECLOUD_RELEASE_REPO_DEB="https://packagecloud.io/install/repositories/fdio PACKAGECLOUD_RELEASE_REPO_RPM="https://packagecloud.io/install/repositories/fdio/release/script.rpm.sh" VPP_GIT_REPO="https://git.fd.io/vpp" -VPP_BRANCH="stable/1901" +VPP_BRANCH="stable/1904" -VPP_VERSION_DEB="19.01.1-release" -VPP_VERSION_RPM="19.01.1-release.x86_64" +VPP_VERSION_DEB="19.04-release" +VPP_VERSION_RPM="19.04-release.x86_64" BUILD_TOOLS_UBUNTU="build-essential doxygen" LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev" -DEPS_UBUNTU="libparc-dev libasio-dev libcurl4-openssl-dev vpp-dev=${VPP_VERSION_DEB} vpp-lib=${VPP_VERSION_DEB}" +DEPS_UBUNTU="libparc-dev libasio-dev libcurl4-openssl-dev vpp-dev=${VPP_VERSION_DEB} libvppinfra=${VPP_VERSION_DEB} libvppinfra-dev=${VPP_VERSION_DEB} vpp-plugin-core=${VPP_VERSION_DEB}" # BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} vpp-lib-${VPP_VERSION_RPM} libparc-devel libcurl-devel asio-devel centos-release-scl devtoolset-7" +DEPS_CENTOS_NOVERSION="vpp-devel vpp-lib libparc-devel libcurl-devel asio-devel centos-release-scl devtoolset-7" LATEST_EPEL_REPO="http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" install_cmake() { @@ -41,7 +42,7 @@ install_cmake() { fi cat /etc/resolv.conf - +`` CMAKE_INSTALL_SCRIPT_URL="https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.sh" CMAKE_INSTALL_SCRIPT="/tmp/install_cmake.sh" curl ${CMAKE_INSTALL_SCRIPT_URL} > ${CMAKE_INSTALL_SCRIPT} @@ -59,6 +60,7 @@ setup_fdio_repo() { DISTRIB_ID=${1} if [ "${DISTRIB_ID}" == "ubuntu" ]; then + rm -r /etc/apt/sources.list.d/* curl -s ${PACKAGECLOUD_RELEASE_REPO_DEB} | sudo bash elif [ "${DISTRIB_ID}" == "centos" ]; then curl -s ${PACKAGECLOUD_RELEASE_REPO_RPM} | sudo bash @@ -122,10 +124,10 @@ setup() { ${CC_COMPILER} --version export CC=${CC_COMPILER} CXX=${CXX_COMPILER} - - build_libmemif_static fi + build_libmemif_static + # do nothing but check compiler version c++ --version } |