diff options
author | Damjan Marion <damarion@cisco.com> | 2016-02-25 23:17:38 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2016-02-26 13:17:30 +0100 |
commit | e936bbe5945ca3c0f522f6c0abdfbdaa407bcb84 (patch) | |
tree | 28ccdd0be90ff9236fc57cf058a42d378ddbb250 | |
parent | 7f620976e2cb900fa5e0dccdbb769e3cc208841d (diff) |
Add support for native vpp_lite (non-dpdk) platform
Change-Id: Icaa71957f67b923bc9795baa78c7495055615672
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | build-data/packages/vlib.mk | 13 | ||||
-rw-r--r-- | build-data/packages/vnet.mk | 8 | ||||
-rw-r--r-- | build-data/packages/vpp.mk | 9 | ||||
-rw-r--r-- | build-data/platforms/virl.mk | 2 | ||||
-rw-r--r-- | build-data/platforms/vpp.mk | 2 | ||||
-rw-r--r-- | build-data/platforms/vpp_lite.mk | 36 | ||||
-rw-r--r-- | vlib/vlib/threads.c | 3 | ||||
-rw-r--r-- | vnet/Makefile.am | 4 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_neighbor.c | 4 | ||||
-rw-r--r-- | vnet/vnet/ipsec/esp.h | 2 | ||||
-rw-r--r-- | vnet/vnet/ipsec/ikev2.c | 29 | ||||
-rw-r--r-- | vnet/vnet/ipsec/ikev2_payload.c | 2 | ||||
-rw-r--r-- | vnet/vnet/ipsec/ipsec.h | 7 | ||||
-rw-r--r-- | vnet/vnet/ipsec/ipsec_output.c | 21 | ||||
-rw-r--r-- | vnet/vnet/lawful-intercept/node.c | 6 | ||||
-rw-r--r-- | vnet/vnet/policer/node_funcs.c | 3 | ||||
-rw-r--r-- | vnet/vnet/policer/policer.c | 1 | ||||
-rw-r--r-- | vnet/vnet/policer/xlate.c | 1 | ||||
-rw-r--r-- | vpp/api/api.c | 2 |
19 files changed, 105 insertions, 50 deletions
diff --git a/build-data/packages/vlib.mk b/build-data/packages/vlib.mk index 11bb1c7a..8b72b602 100644 --- a/build-data/packages/vlib.mk +++ b/build-data/packages/vlib.mk @@ -1,6 +1,11 @@ -vlib_configure_depend = vppinfra-install dpdk-install +vlib_configure_depend = vppinfra-install -vlib_configure_args += --with-dpdk +vlib_CPPFLAGS = $(call installed_includes_fn, vppinfra) +vlib_LDFLAGS = $(call installed_libs_fn, vppinfra) -vlib_CPPFLAGS = $(call installed_includes_fn, vppinfra dpdk) -vlib_LDFLAGS = $(call installed_libs_fn, vppinfra dpdk) +ifeq ($($(PLATFORM)_uses_dpdk),yes) +vlib_configure_depend += dpdk-install +vlib_configure_args += --with-dpdk +vlib_CPPFLAGS += $(call installed_includes_fn, dpdk) +vlib_LDFLAGS += $(call installed_libs_fn, dpdk) +endif diff --git a/build-data/packages/vnet.mk b/build-data/packages/vnet.mk index 4aa29613..ca3523cc 100644 --- a/build-data/packages/vnet.mk +++ b/build-data/packages/vnet.mk @@ -1,13 +1,11 @@ vnet_configure_depend = \ vppinfra-install \ - dpdk-install \ svm-install \ vlib-api-install \ vlib-install vnet_CPPFLAGS = $(call installed_includes_fn, \ vppinfra \ - dpdk \ openssl \ svm \ vlib \ @@ -15,7 +13,6 @@ vnet_CPPFLAGS = $(call installed_includes_fn, \ vnet_LDFLAGS = $(call installed_libs_fn, \ vppinfra \ - dpdk \ openssl \ svm \ vlib \ @@ -24,3 +21,8 @@ vnet_LDFLAGS = $(call installed_libs_fn, \ # Platform dependent configure flags vnet_configure_args += $(vnet_configure_args_$(PLATFORM)) +ifeq ($($(PLATFORM)_uses_dpdk),yes) +vnet_configure_depend += dpdk-install +vnet_CPPFLAGS += $(call installed_includes_fn, dpdk) +vnet_LDFLAGS += $(call installed_libs_fn, dpdk) +endif diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk index 02aca4e6..54aa5484 100644 --- a/build-data/packages/vpp.mk +++ b/build-data/packages/vpp.mk @@ -1,6 +1,5 @@ vpp_configure_depend = \ vppinfra-install \ - dpdk-install \ svm-install \ vlib-api-install \ vlib-install \ @@ -15,7 +14,6 @@ vpp_configure_args += $(vpp_configure_args_$(PLATFORM)) vpp_CPPFLAGS = $(call installed_includes_fn, \ vppinfra \ - dpdk \ openssl \ svm \ vlib \ @@ -24,9 +22,14 @@ vpp_CPPFLAGS = $(call installed_includes_fn, \ vpp_LDFLAGS = $(call installed_libs_fn, \ vppinfra \ - dpdk \ openssl \ svm \ vlib \ vlib-api \ vnet) + +ifeq ($($(PLATFORM)_uses_dpdk),yes) +vpp_configure_depend += dpdk-install +vpp_CPPFLAGS += $(call installed_includes_fn, dpdk) +vpp_LDFLAGS += $(call installed_libs_fn, dpdk) +endif diff --git a/build-data/platforms/virl.mk b/build-data/platforms/virl.mk index 40f79418..29b47dad 100644 --- a/build-data/platforms/virl.mk +++ b/build-data/platforms/virl.mk @@ -15,6 +15,8 @@ virl_arch = native virl_native_tools = vppapigen +virl_uses_dpdk = yes + virl_root_packages = vpp vlib vlib-api vnet svm dpdk vpp-api-test \ vpp-japi diff --git a/build-data/platforms/vpp.mk b/build-data/platforms/vpp.mk index 555147df..6b1ba82f 100644 --- a/build-data/platforms/vpp.mk +++ b/build-data/platforms/vpp.mk @@ -15,6 +15,8 @@ vpp_arch = native vpp_native_tools = vppapigen +vpp_uses_dpdk = yes + vpp_root_packages = vpp vlib vlib-api vnet svm dpdk vpp-api-test \ vpp-japi gmod diff --git a/build-data/platforms/vpp_lite.mk b/build-data/platforms/vpp_lite.mk new file mode 100644 index 00000000..9376aa35 --- /dev/null +++ b/build-data/platforms/vpp_lite.mk @@ -0,0 +1,36 @@ +# Copyright (c) 2016 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. + +# vector packet processor +vpp_lite_arch = native +vpp_lite_native_tools = vppapigen + +vpp_lite_uses_dpdk = no + +vpp_lite_root_packages = vpp vlib vlib-api vnet svm vpp-api-test \ + vpp-japi gmod + +vlib_configure_args_vpp_lite = --with-pre-data=128 + +vnet_configure_args_vpp_lite = --without-vcgn +vpp_configure_args_vpp_lite = --without-vcgn + +vpp_lite_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \ + -fstack-protector-all -fPIC -Werror +vpp_lite_debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \ + -fstack-protector-all -fPIC -Werror + +vpp_lite_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -march=$(MARCH) \ + -fstack-protector -fPIC -Werror +vpp_lite_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -march=$(MARCH) \ + -fstack-protector -fPIC -Werror diff --git a/vlib/vlib/threads.c b/vlib/vlib/threads.c index 72102561..1f3c141b 100644 --- a/vlib/vlib/threads.c +++ b/vlib/vlib/threads.c @@ -1142,6 +1142,7 @@ show_threads_fn (vlib_main_t * vm, w->registration ? w->registration->name : "", w->lwp); +#if DPDK==1 int lcore = w->dpdk_lcore_id; if (lcore > -1) { @@ -1165,7 +1166,7 @@ show_threads_fn (vlib_main_t * vm, line = format(line, "unknown"); } } - +#endif vlib_cli_output(vm, "%v", line); vec_free(line); } diff --git a/vnet/Makefile.am b/vnet/Makefile.am index 411dce3b..cf1fb1e0 100644 --- a/vnet/Makefile.am +++ b/vnet/Makefile.am @@ -299,7 +299,6 @@ libvnet_la_SOURCES += \ vnet/ipsec/ipsec.c \ vnet/ipsec/ipsec_cli.c \ vnet/ipsec/ipsec_format.c \ - vnet/ipsec/ipsec_output.c \ vnet/ipsec/ipsec_input.c \ vnet/ipsec/ipsec_if.c \ vnet/ipsec/ipsec_if_in.c \ @@ -313,6 +312,9 @@ libvnet_la_SOURCES += \ vnet/ipsec/ikev2_format.c endif +libvnet_la_SOURCES += \ + vnet/ipsec/ipsec_output.c + nobase_include_HEADERS += \ vnet/ipsec/ipsec.h \ vnet/ipsec/esp.h \ diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c index 3eb9710d..70d77a5f 100644 --- a/vnet/vnet/ip/ip6_neighbor.c +++ b/vnet/vnet/ip/ip6_neighbor.c @@ -284,10 +284,10 @@ typedef struct { ip6_address_t addr; } ip6_neighbor_set_unset_rpc_args_t; +#if DPDK > 0 static void ip6_neighbor_set_unset_rpc_callback ( ip6_neighbor_set_unset_rpc_args_t * a); -#if DPDK > 0 static void set_unset_ip6_neighbor_rpc (vlib_main_t * vm, u32 sw_if_index, @@ -458,6 +458,7 @@ vnet_unset_ip6_ethernet_neighbor (vlib_main_t * vm, return rv; } +#if DPDK > 0 static void ip6_neighbor_set_unset_rpc_callback ( ip6_neighbor_set_unset_rpc_args_t * a) { @@ -469,6 +470,7 @@ static void ip6_neighbor_set_unset_rpc_callback vnet_unset_ip6_ethernet_neighbor (vm, a->sw_if_index, &a->addr, a->link_layer_address, 6); } +#endif static int ip6_neighbor_sort (void *a1, void *a2) diff --git a/vnet/vnet/ipsec/esp.h b/vnet/vnet/ipsec/esp.h index 3d46a013..b44c26e1 100644 --- a/vnet/vnet/ipsec/esp.h +++ b/vnet/vnet/ipsec/esp.h @@ -12,7 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#if DPDK==1 #include <vnet/devices/dpdk/dpdk.h> +#endif #include <openssl/hmac.h> #include <openssl/rand.h> diff --git a/vnet/vnet/ipsec/ikev2.c b/vnet/vnet/ipsec/ikev2.c index ab2277f5..70dd58bd 100644 --- a/vnet/vnet/ipsec/ikev2.c +++ b/vnet/vnet/ipsec/ikev2.c @@ -26,29 +26,6 @@ static int ikev2_delete_tunnel_interface(vnet_main_t * vnm, ikev2_sa_t *sa, ikev2_child_sa_t * child); -static void hexdump(u8 buffer[], int len) -{ -#define HEXDUMP_LINE_LEN 16 - int i; - char s[HEXDUMP_LINE_LEN+1]; - bzero(s, HEXDUMP_LINE_LEN+1); - - for(i=0; i < len; i++) { - if (!(i%HEXDUMP_LINE_LEN)) { - if (s[0]) - printf("[%s]",s); - printf("\n%05x: ", i); - bzero(s, HEXDUMP_LINE_LEN); - } - s[i%HEXDUMP_LINE_LEN]=isprint(buffer[i])?buffer[i]:'.'; - printf("%02x ", buffer[i]); - } - while(i++%HEXDUMP_LINE_LEN) - printf(" "); - - printf("[%s]\n", s); -} - #define ikev2_set_state(sa, v) do { \ (sa)->state = v; \ clib_warning("sa state changed to " #v); \ @@ -458,7 +435,6 @@ ikev2_calc_child_keys(ikev2_sa_t *sa, ikev2_child_sa_t * child) int len = ctr_encr->key_len * 2 + ctr_integ->key_len * 2; keymat = ikev2_calc_prfplus(tr_prf, sa->sk_d, s, len); - hexdump(keymat, vec_len(keymat)); int pos = 0; @@ -1884,7 +1860,6 @@ ikev2_node_fn (vlib_main_t * vm, ike0->exchange, format_ip4_address, ip40->src_address.as_u8, format_ip4_address, ip40->dst_address.as_u8); - hexdump((u8 *) ip40, b0->current_length); } dispatch0: @@ -1899,10 +1874,6 @@ dispatch0: b0->current_length = len + sizeof(ip4_header_t) + sizeof(udp_header_t); ip40->length = clib_host_to_net_u16(b0->current_length); ip40->checksum = ip4_header_checksum (ip40); -#if 0 - clib_warning("sending response:"); - hexdump(vlib_buffer_get_current (b0), b0->current_length); -#endif } /* delete sa */ if (sa0 && (sa0->state == IKEV2_STATE_DELETED || diff --git a/vnet/vnet/ipsec/ikev2_payload.c b/vnet/vnet/ipsec/ikev2_payload.c index f523fa81..a1ee5192 100644 --- a/vnet/vnet/ipsec/ikev2_payload.c +++ b/vnet/vnet/ipsec/ikev2_payload.c @@ -13,6 +13,8 @@ * limitations under the License. */ +#include <ctype.h> + #include <vnet/vnet.h> #include <vnet/api_errno.h> #include <vnet/ip/ip.h> diff --git a/vnet/vnet/ipsec/ipsec.h b/vnet/vnet/ipsec/ipsec.h index 6ef36d02..b755976f 100644 --- a/vnet/vnet/ipsec/ipsec.h +++ b/vnet/vnet/ipsec/ipsec.h @@ -12,7 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#if DPDK==1 #include <vnet/devices/dpdk/dpdk.h> +#endif #define foreach_ipsec_policy_action \ _(0, BYPASS, "bypass") \ @@ -237,9 +239,12 @@ int ipsec_set_interface_key(vnet_main_t * vnm, u32 hw_if_index, ipsec_if_set_key always_inline void ipsec_alloc_empty_buffers(vlib_main_t * vm, ipsec_main_t *im) { +#if DPDK==1 dpdk_main_t * dm = &dpdk_main; u32 free_list_index = dm->vlib_buffer_free_list_index; - +#else + u32 free_list_index = VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX; +#endif uword l = vec_len (im->empty_buffers); uword n_alloc = 0; diff --git a/vnet/vnet/ipsec/ipsec_output.c b/vnet/vnet/ipsec/ipsec_output.c index ac5968b9..fd804fae 100644 --- a/vnet/vnet/ipsec/ipsec_output.c +++ b/vnet/vnet/ipsec/ipsec_output.c @@ -21,6 +21,7 @@ #include <vnet/ipsec/ipsec.h> +#if IPSEC > 0 #define foreach_ipsec_output_next \ _(DROP, "error-drop") \ @@ -403,3 +404,23 @@ VLIB_REGISTER_NODE (ipsec_output_node) = { #undef _ }, }; + +#else /* IPSEC > 1 */ + +/* Dummy ipsec output node, in case when IPSec is disabled */ + +static uword +ipsec_output_node_fn (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) +{ + clib_warning ("IPSec disabled"); + return 0; +} + +VLIB_REGISTER_NODE (ipsec_output_node) = { + .vector_size = sizeof (u32), + .function = ipsec_output_node_fn, + .name = "ipsec-output", +}; +#endif diff --git a/vnet/vnet/lawful-intercept/node.c b/vnet/vnet/lawful-intercept/node.c index 8a47aa32..26514cc5 100644 --- a/vnet/vnet/lawful-intercept/node.c +++ b/vnet/vnet/lawful-intercept/node.c @@ -290,12 +290,6 @@ VLIB_REGISTER_NODE (li_hit_node) = { .name = "li-hit", }; -VLIB_REGISTER_NODE (ipsec_output_node) = { - .vector_size = sizeof (u32), - .function = li_hit_node_fn, - .name = "ipsec-output", -}; - static clib_error_t * li_init (vlib_main_t * vm) { diff --git a/vnet/vnet/policer/node_funcs.c b/vnet/vnet/policer/node_funcs.c index b85418fe..8a76e869 100644 --- a/vnet/vnet/policer/node_funcs.c +++ b/vnet/vnet/policer/node_funcs.c @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include <stdint.h> + #include <vlib/vlib.h> #include <vnet/vnet.h> #include <vnet/policer/policer.h> diff --git a/vnet/vnet/policer/policer.c b/vnet/vnet/policer/policer.c index 310c5f59..a43dc751 100644 --- a/vnet/vnet/policer/policer.c +++ b/vnet/vnet/policer/policer.c @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include <stdint.h> #include <vnet/policer/policer.h> u8 * format_policer_instance (u8 * s, va_list * va) diff --git a/vnet/vnet/policer/xlate.c b/vnet/vnet/policer/xlate.c index 6e8c324a..d1eab304 100644 --- a/vnet/vnet/policer/xlate.c +++ b/vnet/vnet/policer/xlate.c @@ -17,6 +17,7 @@ #include <stdio.h> #include <assert.h> #include <math.h> +#include <stdint.h> #include <vlib/vlib.h> #include <vnet/vnet.h> diff --git a/vpp/api/api.c b/vpp/api/api.c index f51fa0a3..2c0b4b3c 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -75,10 +75,10 @@ #undef __included_bihash_template_h__ #include <vnet/l2/l2_fib.h> -#if DPDK > 0 #if IPSEC > 0 #include <vnet/ipsec/ipsec.h> #endif /* IPSEC */ +#if DPDK > 0 #include <vnet/devices/virtio/vhost-user.h> #endif |