Add support for native vpp_lite (non-dpdk) platform 34/434/1
authorDamjan Marion <damarion@cisco.com>
Thu, 25 Feb 2016 22:17:38 +0000 (23:17 +0100)
committerDamjan Marion <damarion@cisco.com>
Fri, 26 Feb 2016 12:17:30 +0000 (13:17 +0100)
Change-Id: Icaa71957f67b923bc9795baa78c7495055615672
Signed-off-by: Damjan Marion <damarion@cisco.com>
19 files changed:
build-data/packages/vlib.mk
build-data/packages/vnet.mk
build-data/packages/vpp.mk
build-data/platforms/virl.mk
build-data/platforms/vpp.mk
build-data/platforms/vpp_lite.mk [new file with mode: 0644]
vlib/vlib/threads.c
vnet/Makefile.am
vnet/vnet/ip/ip6_neighbor.c
vnet/vnet/ipsec/esp.h
vnet/vnet/ipsec/ikev2.c
vnet/vnet/ipsec/ikev2_payload.c
vnet/vnet/ipsec/ipsec.h
vnet/vnet/ipsec/ipsec_output.c
vnet/vnet/lawful-intercept/node.c
vnet/vnet/policer/node_funcs.c
vnet/vnet/policer/policer.c
vnet/vnet/policer/xlate.c
vpp/api/api.c

index 11bb1c7..8b72b60 100644 (file)
@@ -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
index 4aa2961..ca3523c 100644 (file)
@@ -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
index 02aca4e..54aa548 100644 (file)
@@ -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
index 40f7941..29b47da 100644 (file)
@@ -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 
 
index 555147d..6b1ba82 100644 (file)
@@ -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 (file)
index 0000000..9376aa3
--- /dev/null
@@ -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
index 7210256..1f3c141 100644 (file)
@@ -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);
     }
index 411dce3..cf1fb1e 100644 (file)
@@ -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                              \
index 3eb9710..70d77a5 100644 (file)
@@ -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)
index 3d46a01..b44c26e 100644 (file)
@@ -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>
index ab2277f..70dd58b 100644 (file)
@@ -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 ||
index f523fa8..a1ee519 100644 (file)
@@ -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>
index 6ef36d0..b755976 100644 (file)
@@ -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;
 
index ac5968b..fd804fa 100644 (file)
@@ -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
index 8a47aa3..26514cc 100644 (file)
@@ -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)
 {
index b85418f..8a76e86 100644 (file)
@@ -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>
index 310c5f5..a43dc75 100644 (file)
@@ -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)
index 6e8c324..d1eab30 100644 (file)
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <assert.h>
 #include <math.h>
+#include <stdint.h>
 
 #include <vlib/vlib.h>
 #include <vnet/vnet.h>
index f51fa0a..2c0b4b3 100644 (file)
 #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