From 5c49bbb7f2e875f1cb0b758aac27110d39a2ddc6 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Fri, 6 Oct 2017 11:10:43 +0200 Subject: Moving to vpp 17.07 Change-Id: I921db3d057fe96b465c6ebbe0f2156fa8c56ab6f Signed-off-by: Alberto Compagno --- cicn-plugin/cicn/cicn_hello.c | 2 +- cicn-plugin/cicn/cicn_mgmt.c | 499 +++++++++++++++++------------------ cicn-plugin/cicn/node.c | 8 +- cicn-plugin/scripts/build-package.sh | 26 +- 4 files changed, 248 insertions(+), 287 deletions(-) diff --git a/cicn-plugin/cicn/cicn_hello.c b/cicn-plugin/cicn/cicn_hello.c index 0f20ef5b..79143ebe 100644 --- a/cicn-plugin/cicn/cicn_hello.c +++ b/cicn-plugin/cicn/cicn_hello.c @@ -280,7 +280,7 @@ cicn_hello_periodic (vlib_main_t * vm, vlib_node_runtime_t * node) /* Create the icn hello packet in bi0 */ cicn_hello_packet_build (bi0, &sm->cicn_hello_adjs[j], face_entry); - cicn_infra_shard_t *wshard = &cicn_infra_shards[vm->cpu_index]; + cicn_infra_shard_t *wshard = &cicn_infra_shards[vm->thread_index]; cicn_face_stats_t *outface_stats = &wshard->face_stats[cicn_face_db_index (face_entry)]; outface_stats->orig_interests++; diff --git a/cicn-plugin/cicn/cicn_mgmt.c b/cicn-plugin/cicn/cicn_mgmt.c index 76fd7baa..547884fb 100644 --- a/cicn-plugin/cicn/cicn_mgmt.c +++ b/cicn-plugin/cicn/cicn_mgmt.c @@ -251,20 +251,14 @@ cicn_cli_node_ctl_start_set_command_fn (vlib_main_t * vm, * [i.e. on "cicn control start\n", don't consume the following line (cmd) * while catching unexpected extra arguments on "cicn control start XXX"] */ - if (main_input->index > 0 && - main_input->buffer[main_input->index - 1] != '\n') + unformat_input_t _line_input, *line_input = &_line_input; + if (unformat_user (main_input, unformat_line_input, line_input)) { - unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) - { - return (0); - } - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) - { - return clib_error_return (0, "Unknown argument '%U'", - format_unformat_error, line_input); - } + { + return clib_error_return (0, "Unknown argument '%U'", + format_unformat_error, line_input); + } } ux_rc = cicn_infra_plugin_enable_disable (1 /*enable */ , @@ -299,15 +293,9 @@ cicn_cli_node_ctl_stop_set_command_fn (vlib_main_t * vm, /* Catch unexpected extra arguments on this line. * See comment on cicn_cli_node_ctrl_start_set_command_fn */ - if (main_input->index > 0 && - main_input->buffer[main_input->index - 1] != '\n') + unformat_input_t _line_input, *line_input = &_line_input; + if (unformat_user (main_input, unformat_line_input, line_input)) { - unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) - { - return (0); - } - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { return clib_error_return (0, "Unknown argument '%U'", @@ -366,7 +354,8 @@ cicn_cli_node_ctl_param_set_command_fn (vlib_main_t * vm, unformat_input_t _line_input, *line_input = &_line_input; if (!unformat_user (main_input, unformat_line_input, line_input)) { - return (0); + return (clib_error_return + (0, "Missing argument")); } while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) @@ -492,22 +481,20 @@ cicn_cli_node_enable_disable_set_command_fn (vlib_main_t * vm, /* Get a line of input. */ unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) - { - return (0); - } - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + if (unformat_user (main_input, unformat_line_input, line_input)) { - if (unformat (line_input, "disable")) - { - enable_disable = 0; - } - else - { - return clib_error_return (0, "Unknown argument '%U'", - format_unformat_error, line_input); - } + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "disable")) + { + enable_disable = 0; + } + else + { + return clib_error_return (0, "Unknown argument '%U'", + format_unformat_error, line_input); + } + } } ux_rc = cicn_infra_plugin_enable_disable (enable_disable, @@ -546,26 +533,24 @@ cicn_cli_node_name_set_command_fn (vlib_main_t * vm, /* Get a line of input. */ unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) - { - return (0); - } - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + if (unformat_user (main_input, unformat_line_input, line_input)) { - if (unformat (line_input, "delete")) - { - delete = 1; - } - else if (unformat (line_input, "%s", &fwdr_name)) - { - ; - } - else - { - return clib_error_return (0, "Unknown argument '%U'", - format_unformat_error, line_input); - } + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "delete")) + { + delete = 1; + } + else if (unformat (line_input, "%s", &fwdr_name)) + { + ; + } + else + { + return clib_error_return (0, "Unknown argument '%U'", + format_unformat_error, line_input); + } + } } /* Verify that the given name is not empty */ @@ -1185,82 +1170,80 @@ cicn_cli_face_set_command_fn (vlib_main_t * vm, unformat_input_t * main_input, /* Get a line of input. */ unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) - { - return (0); - } - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + if (unformat_user (main_input, unformat_line_input, line_input)) { - if (unformat (line_input, "id %d", &faceid)) - { - if (unformat (line_input, "delete")) - { - /* TODO -- handle delete case... */ - face_op = CICN_MGMT_FACE_OP_DELETE; - } - else if (unformat (line_input, "admin %s", &cfg_admin_str)) - { - face_op = CICN_MGMT_FACE_OP_ADMIN; - if (strcmp (cfg_admin_str, "up") == 0) - { - cfg_admin_up = 1; - } - else if (strcmp (cfg_admin_str, "down") == 0) - { - cfg_admin_up = 0; - } - else - { - return (clib_error_return - (0, "Unknown face state %s", cfg_admin_str)); - } - } - else if (unformat (line_input, "hello %s", &cfg_hello_str)) - { - face_op = CICN_MGMT_FACE_OP_HELLO; - if (strcmp (cfg_hello_str, "enable") == 0) - { - cfg_hello_enable = 1; - } - else if (strcmp (cfg_hello_str, "disable") == 0) - { - cfg_hello_enable = 0; - } - else - { - return (clib_error_return - (0, "Unknown hello option (%s)", cfg_hello_str)); - } - } - else - { - return clib_error_return (0, "Please specify face operation"); - } - } - else if (unformat (line_input, "add")) - { - face_op = CICN_MGMT_FACE_OP_CREATE; - if (unformat (line_input, "local %U:%d", - unformat_ip4_address, &local_addr4, &local_port)) - { - if (unformat (line_input, "remote %U:%d", - unformat_ip4_address, &remote_addr4, - &remote_port)) - { - if (unformat (line_input, "app_face")) - { - app_face = 1; - } - } - } - } - else - { - return clib_error_return (0, "Unknown input '%U'", - format_unformat_error, line_input); - break; - } + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "id %d", &faceid)) + { + if (unformat (line_input, "delete")) + { + /* TODO -- handle delete case... */ + face_op = CICN_MGMT_FACE_OP_DELETE; + } + else if (unformat (line_input, "admin %s", &cfg_admin_str)) + { + face_op = CICN_MGMT_FACE_OP_ADMIN; + if (strcmp (cfg_admin_str, "up") == 0) + { + cfg_admin_up = 1; + } + else if (strcmp (cfg_admin_str, "down") == 0) + { + cfg_admin_up = 0; + } + else + { + return (clib_error_return + (0, "Unknown face state %s", cfg_admin_str)); + } + } + else if (unformat (line_input, "hello %s", &cfg_hello_str)) + { + face_op = CICN_MGMT_FACE_OP_HELLO; + if (strcmp (cfg_hello_str, "enable") == 0) + { + cfg_hello_enable = 1; + } + else if (strcmp (cfg_hello_str, "disable") == 0) + { + cfg_hello_enable = 0; + } + else + { + return (clib_error_return + (0, "Unknown hello option (%s)", cfg_hello_str)); + } + } + else + { + return clib_error_return (0, "Please specify face operation"); + } + } + else if (unformat (line_input, "add")) + { + face_op = CICN_MGMT_FACE_OP_CREATE; + if (unformat (line_input, "local %U:%d", + unformat_ip4_address, &local_addr4, &local_port)) + { + if (unformat (line_input, "remote %U:%d", + unformat_ip4_address, &remote_addr4, + &remote_port)) + { + if (unformat (line_input, "app_face")) + { + app_face = 1; + } + } + } + } + else + { + return clib_error_return (0, "Unknown input '%U'", + format_unformat_error, line_input); + break; + } + } } if (faceid != -1) @@ -1479,38 +1462,36 @@ cicn_cli_fib_set_command_fn (vlib_main_t * vm, unformat_input_t * main_input, /* Get a line of input. */ unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) + if (unformat_user (main_input, unformat_line_input, line_input)) { - return (0); - } - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) - { - if (addpfx == -1 && unformat (line_input, "add")) - { - addpfx = 1; - } - else if (addpfx == -1 && unformat (line_input, "delete")) - { - addpfx = 0; - } - else if (addpfx != -1 && unformat (line_input, "prefix %s", &prefix)) - { - ; - } - else if (addpfx != -1 && unformat (line_input, "face %d", &faceid)) - { - ; - } - else if (addpfx == 1 && unformat (line_input, "weight %d", &weight)) - { - ; - } - else - { - return clib_error_return (0, "Unknown input '%U'", - format_unformat_error, line_input); - } + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (addpfx == -1 && unformat (line_input, "add")) + { + addpfx = 1; + } + else if (addpfx == -1 && unformat (line_input, "delete")) + { + addpfx = 0; + } + else if (addpfx != -1 && unformat (line_input, "prefix %s", &prefix)) + { + ; + } + else if (addpfx != -1 && unformat (line_input, "face %d", &faceid)) + { + ; + } + else if (addpfx == 1 && unformat (line_input, "weight %d", &weight)) + { + ; + } + else + { + return clib_error_return (0, "Unknown input '%U'", + format_unformat_error, line_input); + } + } } /* Check parse */ @@ -1558,24 +1539,22 @@ cicn_cli_hello_protocol_set_command_fn (vlib_main_t * vm, /* Get a line of input. */ unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) + if (unformat_user (main_input, unformat_line_input, line_input)) { - return (0); - } - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) - { - if (unformat (line_input, "interval %d", &interval)) - { - ; - } - else - { - return (clib_error_return - (0, "Unknown input '%U'", format_unformat_error, - line_input)); - break; - } + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "interval %d", &interval)) + { + ; + } + else + { + return (clib_error_return + (0, "Unknown input '%U'", format_unformat_error, + line_input)); + break; + } + } } /* Check that hello protocol interval > 0 */ @@ -1607,39 +1586,37 @@ cicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input, /* Get a line of input. */ unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) - { - return (0); - } - - /* TODO -- support specific args */ - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + if (unformat_user (main_input, unformat_line_input, line_input)) { - if (unformat (line_input, "face all")) - { - face_p = 1; - } - else if (unformat (line_input, "fib all")) - { - fib_p = 1; - } - else if (unformat (line_input, "detail")) - { - detail_p = 1; - } - else if (unformat (line_input, "internal")) - { - /* We consider 'internal' a superset, so include 'detail' too */ - internal_p = 1; - detail_p = 1; - } - else - { - return (clib_error_return - (0, "Unknown input '%U'", format_unformat_error, - line_input)); - break; - } + /* TODO -- support specific args */ + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "face all")) + { + face_p = 1; + } + else if (unformat (line_input, "fib all")) + { + fib_p = 1; + } + else if (unformat (line_input, "detail")) + { + detail_p = 1; + } + else if (unformat (line_input, "internal")) + { + /* We consider 'internal' a superset, so include 'detail' too */ + internal_p = 1; + detail_p = 1; + } + else + { + return (clib_error_return + (0, "Unknown input '%U'", format_unformat_error, + line_input)); + break; + } + } } /* If nothing specified, show everything */ @@ -1815,34 +1792,32 @@ cicn_cli_pgen_client_set_command_fn (vlib_main_t * vm, /* Get a line of input. */ unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) - { - return (0); - } - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + if (unformat_user (main_input, unformat_line_input, line_input)) { - if (unformat (line_input, "port %d", &local_port)) - { - ; - } - else if (unformat (line_input, "dest %U:%d", - unformat_ip4_address, &dest_addr, &dest_port)) - { - ; - } - else if (unformat (line_input, "src %U:%d", - unformat_ip4_address, &src_addr, &src_port)) - { - ; - } - else - { - return (clib_error_return - (0, "Unknown input '%U'", format_unformat_error, - line_input)); - break; - } + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "port %d", &local_port)) + { + ; + } + else if (unformat (line_input, "dest %U:%d", + unformat_ip4_address, &dest_addr, &dest_port)) + { + ; + } + else if (unformat (line_input, "src %U:%d", + unformat_ip4_address, &src_addr, &src_port)) + { + ; + } + else + { + return (clib_error_return + (0, "Unknown input '%U'", format_unformat_error, + line_input)); + break; + } + } } /* Attach our packet-gen node for ip4 udp local traffic */ @@ -1901,33 +1876,31 @@ cicn_cli_pgen_server_set_command_fn (vlib_main_t * vm, /* Get a line of input. */ unformat_input_t _line_input, *line_input = &_line_input; - if (!unformat_user (main_input, unformat_line_input, line_input)) + if (unformat_user (main_input, unformat_line_input, line_input)) { - return (0); - } - - /* Parse the arguments */ - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) - { - if (unformat (line_input, "port %d", &local_port)) - { - ; - } - else if (unformat (line_input, "size %d", &payload_size)) - { - if (payload_size > 1200) - { - return (clib_error_return (0, - "Payload size must be <= 1200 bytes...")); - } - } - else - { - return (clib_error_return - (0, "Unknown input '%U'", format_unformat_error, - line_input)); - break; - } + /* Parse the arguments */ + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "port %d", &local_port)) + { + ; + } + else if (unformat (line_input, "size %d", &payload_size)) + { + if (payload_size > 1200) + { + return (clib_error_return (0, + "Payload size must be <= 1200 bytes...")); + } + } + else + { + return (clib_error_return + (0, "Unknown input '%U'", format_unformat_error, + line_input)); + break; + } + } } /* Attach our packet-gen node for ip4 udp local traffic */ diff --git a/cicn-plugin/cicn/node.c b/cicn-plugin/cicn/node.c index bd64cbcd..b880b6b1 100644 --- a/cicn-plugin/cicn/node.c +++ b/cicn-plugin/cicn/node.c @@ -211,9 +211,9 @@ icnfwd_node_fn (vlib_main_t * vm, * number has changed */ if (cicn_infra_gshard.cfg_generation != - cicn_infra_shards[vm->cpu_index].cfg_generation) + cicn_infra_shards[vm->thread_index].cfg_generation) { - cicn_infra_shards[vm->cpu_index].cfg_generation = + cicn_infra_shards[vm->thread_index].cfg_generation = cicn_infra_gshard.cfg_generation; } @@ -375,7 +375,7 @@ icnfwd_node_fn (vlib_main_t * vm, goto trace_single; } - cicn_infra_shard_t *wshard = &cicn_infra_shards[vm->cpu_index]; + cicn_infra_shard_t *wshard = &cicn_infra_shards[vm->thread_index]; inface_stats = &wshard->face_stats[cicn_face_db_index (inface)]; /* If content, use PIT info to determine egress face */ @@ -1786,7 +1786,7 @@ icndist_node_fn (vlib_main_t * vm, * using the forwarding node on the current thread; that'd * save some work. */ - if (next_worker_index == vm->cpu_index) + if (next_worker_index == vm->thread_index) { if (n_left_to_next == 0) { diff --git a/cicn-plugin/scripts/build-package.sh b/cicn-plugin/scripts/build-package.sh index b29f2c29..e171bb23 100644 --- a/cicn-plugin/scripts/build-package.sh +++ b/cicn-plugin/scripts/build-package.sh @@ -9,25 +9,21 @@ apt_get=${APT_PATH:-"/usr/local/bin/apt-get"} BUILD_TOOLS_UBUNTU="build-essential cmake" LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev" -DEPS_UBUNTU_16="vpp-dev=17.04.2-release vpp-lib=17.04.2-release" -DEPS_UBUNTU_14="vpp-dev=17.04-release vpp-lib=17.04-release" +DEPS_UBUNTU_16="vpp-dev=17.07.01-release vpp-lib=17.07.01-release" BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" BUILD_TOOLS_SINGLE_CENTOS="cmake" LIBSSL_LIBEVENT_CENTOS="libevent-devel openssl-devel" -DEPS_CENTOS="vpp-devel-17.04.2-release vpp-lib-17.04.2-release" +DEPS_CENTOS="vpp-devel-17.07.01-release vpp-lib-17.07.01-release" # Parameters: -# $1 = Distribution [Trusty / CentOS] +# $1 = Distribution [CentOS] # update_cmake_repo() { DISTRIBUTION=$1 - if [ "$DISTRIBUTION" == "trusty" ]; then - sudo ${apt_get} install -y --allow-unauthenticated software-properties-common - sudo add-apt-repository --yes ppa:george-edison55/cmake-3.x - elif [ "$DISTRIBUTION" == "CentOS" ]; then + if [ "$DISTRIBUTION" == "CentOS" ]; then sudo cat << EOF > cmake.repo [cmake-repo] name=Repo for cmake3 @@ -53,7 +49,7 @@ EOF update_qt_repo() { DISTRIBUTION_CODENAME=$1 - if [ "$DISTRIBUTION_CODENAME" != "trusty" ] && [ "$DISTRIBUTION_CODENAME" != "xenial" ]; then + if [ "$DISTRIBUTION_CODENAME" != "xenial" ]; then echo "No valid distribution specified when calling 'update_qt_repo'. Exiting.." exit -1 fi @@ -82,9 +78,7 @@ update_fdio_repo() { if [ "$DISTRIB_ID" == "Ubuntu" ]; then if [ "$DISTRIB_CODENAME" == "xenial" ]; then - 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.1704.ubuntu.trusty.main/" + REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1707.ubuntu.xenial.main/" else echo "Distribution $DISTRIB_CODENAME is not supported" exit -1 @@ -93,7 +87,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.1704.centos7/" + REPO_VPP_URL="${NEXUS_PROXY}/content/repositories/fd.io.stable.1707.centos7/" REPO=${REPO_NAME:-"master.centos7"} REPO_CICN_URL="${NEXUS_PROXY}/content/repositories/fd.io.${REPO}" @@ -117,10 +111,6 @@ setup() { DISTRIB_CODENAME=$2 if [ "$DISTRIB_ID" == "Ubuntu" ]; then - if [ "$DISTRIB_CODENAME" == "trusty" ]; then - update_cmake_repo $DISTRIB_CODENAME - fi - update_fdio_repo $DISTRIB_ID $DISTRIB_CODENAME sudo ${apt_get} update || true @@ -178,8 +168,6 @@ build_package() { if [ $DISTRIB_ID == "Ubuntu" ]; then if [ "$DISTRIB_CODENAME" == "xenial" ]; then echo $BUILD_TOOLS_UBUNTU $DEPS_UBUNTU_16 | xargs sudo ${apt_get} install -y --allow-unauthenticated - elif [ "$DISTRIB_CODENAME" == "trusty" ]; then - echo $BUILD_TOOLS_UBUNTU $DEPS_UBUNTU_14 | xargs sudo ${apt_get} install -y --allow-unauthenticated fi elif [ $DISTRIB_ID == "CentOS" ]; then echo $BUILD_TOOLS_GROUP_CENTOS | xargs sudo yum groupinstall -y --nogpgcheck -- cgit 1.2.3-korg