aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fontaine <christophe.fontaine@qosmos.com>2016-04-09 12:38:49 +0900
committerDave Barach <openvpp@barachs.net>2016-04-18 13:20:57 +0000
commitfef15b4bb88c61248393b93d13b1f79bb628def0 (patch)
tree0f34cc14987dde62a32201101c29b24b023fd36b
parent7a2a378d2dcdba900651b02859b686cafe6dfd22 (diff)
Add support for AArch32
gcc version 4.9.2 (Raspbian 4.9.2-10) Tested on Linux raspberrypi 4.4.6-v7+ #875 SMP Tue Apr 12 16:33:02 BST 2016 armv7l GNU/Linux CPUs may be little or big endian, detect with gcc flags, not the processor architecture Add a new flag $(PLATFORM)_uses_openssl which allows to disable the link with openssl lib. vlib/vlib/threads.c: startup.conf must: - specify the heapsize as we don't have hugepages on raspbian cpu { main-core 3 } heapsize 64M Corrects in various files the assumption uword == u64 and replaces 'u64' cast with 'pointer_to_uword' and 'uword_to_pointer' where appropriate. 256 CPUs may create an OOM when testing with small memory footprint ( heapsize 64M ), allows the number of VLIB_MAX_CPUS to be set in platforms/*.mk vppinfra/vppinfra/longjmp.S: ARM - copy r1 (1st parameter of the setjmp call) to r0 (return value) vppinfra/vppinfra/time.h: On ARMv7 in AArch32 mode, we can access to a 64bit register to retreive the cycles count. gcc on rpi only declare ARM_ARCH 6. Override this info, and check if it is possible to use 'mrrc'. /!\ the time function will NOT work without allowing the user mode access to the PMU. You may download the source of the kmod here: https://github.com/christophefontaine/arm_rdtsc Change-Id: I8142606436d9671a184133b935398427f08a8bd2 Signed-off-by: Christophe Fontaine <christophe.fontaine@qosmos.com>
-rw-r--r--build-data/packages/vnet.mk8
-rw-r--r--build-data/packages/vpp.mk8
-rw-r--r--build-data/platforms/arm32.mk37
-rw-r--r--svm/ssvm.c10
-rw-r--r--svm/ssvm.h2
-rw-r--r--vlib-api/vlibmemory/memory_vlib.c6
-rw-r--r--vlib/vlib/buffer.h2
-rw-r--r--vlib/vlib/threads.c33
-rw-r--r--vlib/vlib/threads.h2
-rw-r--r--vlib/vlib/unix/cj.c4
-rw-r--r--vlib/vlib/unix/physmem.c4
-rw-r--r--vnet/vnet/classify/vnet_classify.h4
-rw-r--r--vnet/vnet/devices/dpdk/vhost_user.c4
-rw-r--r--vnet/vnet/devices/ssvm/node.c8
-rw-r--r--vnet/vnet/devices/ssvm/ssvm_eth.c10
-rw-r--r--vnet/vnet/devices/ssvm/ssvm_eth.h2
-rw-r--r--vnet/vnet/ip/lookup.h4
-rw-r--r--vnet/vnet/l2/l2_flood.c4
-rw-r--r--vpp/api/api.c16
-rw-r--r--vpp/api/gmon.c2
-rw-r--r--vppapigen/node.c4
-rw-r--r--vppinfra/vppinfra/byte_order.h2
-rw-r--r--vppinfra/vppinfra/cache.h2
-rw-r--r--vppinfra/vppinfra/hash.c4
-rw-r--r--vppinfra/vppinfra/hash.h2
-rw-r--r--vppinfra/vppinfra/longjmp.S4
-rw-r--r--vppinfra/vppinfra/macros.c2
-rw-r--r--vppinfra/vppinfra/random_isaac.c2
-rw-r--r--vppinfra/vppinfra/test_vec.c4
-rw-r--r--vppinfra/vppinfra/time.h10
-rw-r--r--vppinfra/vppinfra/vector.h2
31 files changed, 142 insertions, 66 deletions
diff --git a/build-data/packages/vnet.mk b/build-data/packages/vnet.mk
index 46d3c1d42dc..cafb93933bd 100644
--- a/build-data/packages/vnet.mk
+++ b/build-data/packages/vnet.mk
@@ -6,14 +6,12 @@ vnet_configure_depend = \
vnet_CPPFLAGS = $(call installed_includes_fn, \
vppinfra \
- openssl \
svm \
vlib \
vlib-api)
vnet_LDFLAGS = $(call installed_libs_fn, \
vppinfra \
- openssl \
svm \
vlib \
vlib-api)
@@ -25,6 +23,12 @@ endif
# Platform dependent configure flags
vnet_configure_args += $(vnet_configure_args_$(PLATFORM))
+# include & link with openssl only if needed
+ifneq ($($(PLATFORM)_uses_openssl),no)
+vnet_CPPFLAGS += $(call installed_includes_fn, openssl)
+vnet_LDFLAGS += $(call installed_libs_fn, openssl)
+endif
+
ifneq ($($(PLATFORM)_uses_dpdk),no)
ifeq ($($(PLATFORM)_uses_external_dpdk),yes)
vnet_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir)
diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk
index f96235f4f0c..be10e17d200 100644
--- a/build-data/packages/vpp.mk
+++ b/build-data/packages/vpp.mk
@@ -18,7 +18,6 @@ vpp_configure_args += $(vpp_configure_args_$(PLATFORM))
vpp_CPPFLAGS = $(call installed_includes_fn, \
vppinfra \
- openssl \
svm \
vlib \
vlib-api \
@@ -26,12 +25,17 @@ vpp_CPPFLAGS = $(call installed_includes_fn, \
vpp_LDFLAGS = $(call installed_libs_fn, \
vppinfra \
- openssl \
svm \
vlib \
vlib-api \
vnet)
+# include & link with openssl only if needed
+ifneq ($($(PLATFORM)_uses_openssl),no)
+vpp_CPPFLAGS += $(call installed_includes_fn, openssl)
+vpp_LDFLAGS += $(call installed_libs_fn, openssl)
+endif
+
ifneq ($($(PLATFORM)_uses_dpdk),no)
ifeq ($($(PLATFORM)_uses_external_dpdk),yes)
vpp_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir)
diff --git a/build-data/platforms/arm32.mk b/build-data/platforms/arm32.mk
new file mode 100644
index 00000000000..fecc5bbcadb
--- /dev/null
+++ b/build-data/platforms/arm32.mk
@@ -0,0 +1,37 @@
+# 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
+arm32_arch = native
+arm32_native_tools = vppapigen
+
+arm32_uses_dpdk = no
+arm32_uses_openssl = no
+
+arm32_root_packages = vpp vlib vlib-api vnet svm vpp-api-test \
+ vpp-japi gmod
+
+vlib_configure_args_arm32 = --with-pre-data=128
+
+vnet_configure_args_arm32 = --without-vcgn --without-ipsec --without-ipv6sr
+vpp_configure_args_arm32 = --without-vcgn --without-ipsec --without-ipv6sr
+
+arm32_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -DVLIB_MAX_CPUS=4 -march=armv7-a \
+ -fstack-protector-all -fPIC -Werror
+arm32_debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -DVLIB_MAX_CPUS=4 -march=armv7-a \
+ -fstack-protector-all -fPIC -Werror
+
+arm32_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -DVLIB_MAX_CPUS=4 -march=armv7-a \
+ -fstack-protector -fPIC -Werror
+arm32_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -DVLIB_MAX_CPUS=4 -march=armv7-a \
+ -fstack-protector -fPIC -Werror
diff --git a/svm/ssvm.c b/svm/ssvm.c
index b9c6ef9fd0b..92d86e6d1e4 100644
--- a/svm/ssvm.c
+++ b/svm/ssvm.c
@@ -59,10 +59,10 @@ int ssvm_master_init (ssvm_private_t * ssvm, u32 master_index)
if (ssvm->requested_va)
ssvm->requested_va += randomize_baseva;
- sh = ssvm->sh = (void *) mmap((void *)ssvm->requested_va, ssvm->ssvm_size,
+ sh = ssvm->sh = (ssvm_shared_header_t *) mmap((void *)ssvm->requested_va, ssvm->ssvm_size,
PROT_READ | PROT_WRITE, flags, ssvm_fd, 0);
- if ((u64) ssvm->sh == (u64) MAP_FAILED)
+ if (ssvm->sh == MAP_FAILED)
{
clib_unix_warning ("mmap");
close(ssvm_fd);
@@ -78,7 +78,7 @@ int ssvm_master_init (ssvm_private_t * ssvm, u32 master_index)
(((u8 *)sh) + MMAP_PAGESIZE, ssvm->ssvm_size - MMAP_PAGESIZE,
MHEAP_FLAG_DISABLE_VM | MHEAP_FLAG_THREAD_SAFE);
- sh->ssvm_va = (u64) sh;
+ sh->ssvm_va = pointer_to_uword(sh);
sh->master_index = master_index;
oldheap = ssvm_push_heap (sh);
@@ -123,7 +123,7 @@ int ssvm_slave_init (ssvm_private_t * ssvm, int timeout_in_seconds)
map_it:
sh = (void *) mmap (0, MMAP_PAGESIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
ssvm_fd, 0);
- if ((u64) sh == (u64) MAP_FAILED)
+ if (sh == MAP_FAILED)
{
clib_unix_warning ("slave research mmap");
close (ssvm_fd);
@@ -150,7 +150,7 @@ int ssvm_slave_init (ssvm_private_t * ssvm, int timeout_in_seconds)
MAP_SHARED | MAP_FIXED,
ssvm_fd, 0);
- if ((u64) sh == (u64) MAP_FAILED)
+ if (sh == MAP_FAILED)
{
clib_unix_warning ("slave final mmap");
close (ssvm_fd);
diff --git a/svm/ssvm.h b/svm/ssvm.h
index 51164931962..cd34afd2928 100644
--- a/svm/ssvm.h
+++ b/svm/ssvm.h
@@ -73,7 +73,7 @@ typedef struct {
u32 my_pid;
u32 vlib_hw_if_index;
u8 * name;
- u64 requested_va;
+ uword requested_va;
int i_am_master;
u32 per_interface_next_index;
u32 * rx_queue;
diff --git a/vlib-api/vlibmemory/memory_vlib.c b/vlib-api/vlibmemory/memory_vlib.c
index 7ba76ec49d1..107fddc31ad 100644
--- a/vlib-api/vlibmemory/memory_vlib.c
+++ b/vlib-api/vlibmemory/memory_vlib.c
@@ -1135,8 +1135,8 @@ static void vl_api_rpc_call_t_handler (vl_api_rpc_call_t * mp)
if (mp->need_barrier_sync)
vlib_worker_thread_barrier_sync (vm);
- fp = (void *)(mp->function);
- rv = (*fp)(mp->data);
+ fp = uword_to_pointer(mp->function, int(*)(void *));
+ rv = fp(mp->data);
if (mp->need_barrier_sync)
vlib_worker_thread_barrier_release (vm);
@@ -1174,7 +1174,7 @@ void vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length)
memset (mp, 0, sizeof (*mp));
memcpy (mp->data, data, data_length);
mp->_vl_msg_id = ntohs (VL_API_RPC_CALL);
- mp->function = (u64)fp;
+ mp->function = pointer_to_uword(fp);
mp->need_barrier_sync = 1;
/* Use the "normal" control-plane mechanism for the main thread */
diff --git a/vlib/vlib/buffer.h b/vlib/vlib/buffer.h
index 9c148ef2f21..07ed85d8c31 100644
--- a/vlib/vlib/buffer.h
+++ b/vlib/vlib/buffer.h
@@ -59,7 +59,7 @@
#ifdef CLIB_HAVE_VEC128
typedef u8x16 vlib_copy_unit_t;
#else
-typedef uword vlib_copy_unit_t;
+typedef u64 vlib_copy_unit_t;
#endif
/** \file
diff --git a/vlib/vlib/threads.c b/vlib/vlib/threads.c
index a69e4555af0..efbef379ba9 100644
--- a/vlib/vlib/threads.c
+++ b/vlib/vlib/threads.c
@@ -12,16 +12,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#define _GNU_SOURCE
+#include <sched.h>
+
#include <signal.h>
#include <math.h>
#include <vppinfra/format.h>
#include <vlib/vlib.h>
#include <vlib/threads.h>
-#include <vlib/unix/physmem.h>
-
#include <vlib/unix/cj.h>
+
#if DPDK==1
#include <rte_config.h>
#include <rte_common.h>
@@ -175,6 +177,16 @@ vlib_thread_init (vlib_main_t * vm)
if (!tm->cpu_socket_bitmap)
tm->cpu_socket_bitmap = clib_bitmap_set(0, 0, 1);
+ /* pin main thread to main_lcore */
+#if DPDK==0
+ {
+ cpu_set_t cpuset;
+ CPU_ZERO(&cpuset);
+ CPU_SET(tm->main_lcore, &cpuset);
+ pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
+ }
+#endif
+
/* as many threads as stacks... */
vec_validate_aligned (vlib_worker_threads, vec_len(vlib_thread_stacks)-1,
CLIB_CACHE_LINE_BYTES);
@@ -486,7 +498,6 @@ void *vlib_worker_thread_bootstrap_fn (void *arg)
static int
vlib_launch_thread (void *fp, vlib_worker_thread_t *w, unsigned lcore_id)
{
- pthread_t dummy;
void *(*fp_arg)(void *) = fp;
#if DPDK==1
@@ -497,7 +508,19 @@ vlib_launch_thread (void *fp, vlib_worker_thread_t *w, unsigned lcore_id)
return -1;
else
#endif
- return pthread_create (&dummy, NULL /* attr */, fp_arg, (void *)w);
+ {
+ int ret;
+ pthread_t worker;
+ cpu_set_t cpuset;
+ CPU_ZERO(&cpuset);
+ CPU_SET(lcore_id, &cpuset);
+
+ ret = pthread_create (&worker, NULL /* attr */, fp_arg, (void *)w);
+ if(ret == 0)
+ return pthread_setaffinity_np(worker, sizeof(cpu_set_t), &cpuset);
+ else
+ return ret;
+ }
}
static clib_error_t * start_workers (vlib_main_t * vm)
@@ -1031,7 +1054,7 @@ cpu_config (vlib_main_t * vm, unformat_input_t * input)
VLIB_EARLY_CONFIG_FUNCTION (cpu_config, "cpu");
-#if !defined (__x86_64__) && !defined (__aarch64__) && !defined (__powerpc64__)
+#if !defined (__x86_64__) && !defined (__aarch64__) && !defined (__powerpc64__) && !defined(__arm__)
void __sync_fetch_and_add_8 (void)
{
fformat(stderr, "%s called\n", __FUNCTION__);
diff --git a/vlib/vlib/threads.h b/vlib/vlib/threads.h
index 5773ed05a62..ce93b2c67cb 100644
--- a/vlib/vlib/threads.h
+++ b/vlib/vlib/threads.h
@@ -48,7 +48,9 @@ typedef struct vlib_thread_registration_ {
* Make VLIB_MAX_CPUS a power-of-two, please...
*/
+#ifndef VLIB_MAX_CPUS
#define VLIB_MAX_CPUS 256
+#endif
#if VLIB_MAX_CPUS > CLIB_MAX_MHEAPS
#error Please increase number of per-cpu mheaps
diff --git a/vlib/vlib/unix/cj.c b/vlib/vlib/unix/cj.c
index 665a13fa4f5..782ddce3099 100644
--- a/vlib/vlib/unix/cj.c
+++ b/vlib/vlib/unix/cj.c
@@ -40,8 +40,8 @@ cj_log (u32 type, void * data0, void * data1)
r->time = vlib_time_now (cjm->vlib_main);
r->cpu = os_get_cpu_number();
r->type = type;
- r->data[0] = (u64) data0;
- r->data[1] = (u64) data1;
+ r->data[0] = pointer_to_uword(data0);
+ r->data[1] = pointer_to_uword(data1);
}
void cj_stop(void)
diff --git a/vlib/vlib/unix/physmem.c b/vlib/vlib/unix/physmem.c
index d7428c9b227..185483d6f14 100644
--- a/vlib/vlib/unix/physmem.c
+++ b/vlib/vlib/unix/physmem.c
@@ -158,10 +158,10 @@ static int htlb_init (vlib_main_t * vm)
/* Don't want mheap mmap/munmap with IO memory. */
MHEAP_FLAG_DISABLE_VM);
- cur = (u64) pm->mem;
+ cur = pointer_to_uword(pm->mem);
i = 0;
- while (cur < (u64) pm->mem + pm->mem_size)
+ while (cur < pointer_to_uword(pm->mem) + pm->mem_size)
{
pfn = (u64) cur / pagesize;
seek_loc = pfn * sizeof (u64);
diff --git a/vnet/vnet/classify/vnet_classify.h b/vnet/vnet/classify/vnet_classify.h
index b7056c565d7..b19704ebd0f 100644
--- a/vnet/vnet/classify/vnet_classify.h
+++ b/vnet/vnet/classify/vnet_classify.h
@@ -40,11 +40,11 @@ extern vlib_node_registration_t ip6_classify_node;
#define CLASSIFY_TRACE 0
-#ifndef __aarch64__
+#if !defined( __aarch64__) && !defined(__arm__)
#define CLASSIFY_USE_SSE //Allow usage of SSE operations
#endif
-#define U32X4_ALIGNED(p) PREDICT_TRUE((((u64)p) & 0xf) == 0)
+#define U32X4_ALIGNED(p) PREDICT_TRUE((((intptr_t)p) & 0xf) == 0)
struct _vnet_classify_main;
typedef struct _vnet_classify_main vnet_classify_main_t;
diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c
index 9db4a0ac163..9cdf664cb80 100644
--- a/vnet/vnet/devices/dpdk/vhost_user.c
+++ b/vnet/vnet/devices/dpdk/vhost_user.c
@@ -495,9 +495,9 @@ dpdk_vhost_user_set_mem_table(u32 hw_if_index, vhost_user_memory_t * vum, int fd
mem->regions[i].userspace_address = vum->regions[i].userspace_addr;
mapped_size = mem->regions[i].memory_size + vum->regions[i].mmap_offset;
- mapped_address = (uint64_t)(uintptr_t)mmap(NULL, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd[i], 0);
+ mapped_address = pointer_to_uword(mmap(NULL, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd[i], 0));
- if ((void *)mapped_address == MAP_FAILED)
+ if (uword_to_pointer(mapped_address, void*) == MAP_FAILED)
{
clib_warning("mmap error");
return 0;
diff --git a/vnet/vnet/devices/ssvm/node.c b/vnet/vnet/devices/ssvm/node.c
index b26d73d12b8..3a5709d0323 100644
--- a/vnet/vnet/devices/ssvm/node.c
+++ b/vnet/vnet/devices/ssvm/node.c
@@ -97,8 +97,8 @@ ssvm_eth_device_input (ssvm_eth_main_t * em,
uword n_trace = vlib_get_trace_count (vm, node);
/* Either side down? buh-bye... */
- if ((u64)(sh->opaque [MASTER_ADMIN_STATE_INDEX]) == 0 ||
- (u64)(sh->opaque [SLAVE_ADMIN_STATE_INDEX]) == 0)
+ if (pointer_to_uword(sh->opaque [MASTER_ADMIN_STATE_INDEX]) == 0 ||
+ pointer_to_uword(sh->opaque [SLAVE_ADMIN_STATE_INDEX]) == 0)
return 0;
if (intfc->i_am_master)
@@ -271,14 +271,14 @@ ssvm_eth_device_input (ssvm_eth_main_t * em,
ASSERT(vec_len(intfc->rx_queue) > 0);
- n_available = (u32)(u64)(sh->opaque[CHUNK_POOL_NFREE]);
+ n_available = (u32)pointer_to_uword(sh->opaque[CHUNK_POOL_NFREE]);
elt_indices = (u32 *)(sh->opaque[CHUNK_POOL_FREELIST_INDEX]);
memcpy (&elt_indices[n_available], intfc->rx_queue,
vec_len (intfc->rx_queue) * sizeof (u32));
n_available += vec_len (intfc->rx_queue);
- sh->opaque[CHUNK_POOL_NFREE] = (void *) (u64) n_available;
+ sh->opaque[CHUNK_POOL_NFREE] = uword_to_pointer(n_available, void* );
ssvm_unlock (sh);
diff --git a/vnet/vnet/devices/ssvm/ssvm_eth.c b/vnet/vnet/devices/ssvm/ssvm_eth.c
index 7d937f07937..23ec0261325 100644
--- a/vnet/vnet/devices/ssvm/ssvm_eth.c
+++ b/vnet/vnet/devices/ssvm/ssvm_eth.c
@@ -95,7 +95,7 @@ int ssvm_eth_create (ssvm_eth_main_t * em, u8 * name, int is_master)
sh->opaque [CHUNK_POOL_INDEX] = (void *) elts;
sh->opaque [CHUNK_POOL_FREELIST_INDEX] = (void *) elt_indices;
- sh->opaque [CHUNK_POOL_NFREE] = (void *) em->nbuffers;
+ sh->opaque [CHUNK_POOL_NFREE] = (void *)(uword) em->nbuffers;
ssvm_pop_heap (oldheap);
@@ -276,8 +276,8 @@ ssvm_eth_interface_tx (vlib_main_t * vm,
n_present_in_cache = vec_len (em->chunk_cache);
/* admin / link up/down check */
- if ((u64)(sh->opaque [MASTER_ADMIN_STATE_INDEX]) == 0 ||
- (u64)(sh->opaque [SLAVE_ADMIN_STATE_INDEX]) == 0)
+ if (sh->opaque [MASTER_ADMIN_STATE_INDEX] == 0 ||
+ sh->opaque [SLAVE_ADMIN_STATE_INDEX] == 0)
{
interface_down = 1;
goto out;
@@ -287,7 +287,7 @@ ssvm_eth_interface_tx (vlib_main_t * vm,
elts = (ssvm_eth_queue_elt_t *) (sh->opaque [CHUNK_POOL_INDEX]);
elt_indices = (u32 *) (sh->opaque [CHUNK_POOL_FREELIST_INDEX]);
- n_available = (u32) (u64) (sh->opaque [CHUNK_POOL_NFREE]);
+ n_available = (u32) pointer_to_uword(sh->opaque [CHUNK_POOL_NFREE]);
if (n_present_in_cache < n_left*2)
{
@@ -305,7 +305,7 @@ ssvm_eth_interface_tx (vlib_main_t * vm,
n_present_in_cache += n_allocated;
n_available -= n_allocated;
- sh->opaque [CHUNK_POOL_NFREE] = (void *) (u64) n_available;
+ sh->opaque [CHUNK_POOL_NFREE] = uword_to_pointer(n_available, void*);
_vec_len (em->chunk_cache) = n_present_in_cache;
}
diff --git a/vnet/vnet/devices/ssvm/ssvm_eth.h b/vnet/vnet/devices/ssvm/ssvm_eth.h
index 8f1f88964c2..23af7ed5ae8 100644
--- a/vnet/vnet/devices/ssvm/ssvm_eth.h
+++ b/vnet/vnet/devices/ssvm/ssvm_eth.h
@@ -114,7 +114,7 @@ static inline void ssvm_eth_validate_freelists (int need_lock)
ssvm_lock (sh, my_pid, 15);
elt_indices = (u32 *) (sh->opaque [CHUNK_POOL_FREELIST_INDEX]);
- n_available = (u32) (u64) (sh->opaque [CHUNK_POOL_NFREE]);
+ n_available = (u32) (uword) (sh->opaque [CHUNK_POOL_NFREE]);
for (i = 0; i < n_available; i++)
ASSERT (elt_indices[i] < 2048);
diff --git a/vnet/vnet/ip/lookup.h b/vnet/vnet/ip/lookup.h
index 76d803d2699..23cb02d79f4 100644
--- a/vnet/vnet/ip/lookup.h
+++ b/vnet/vnet/ip/lookup.h
@@ -198,14 +198,14 @@ vnet_ip_adjacency_signature (ip_adjacency_t * adj)
uword signature = 0xfeedfaceULL;
/* Skip heap handle, sum everything up to but not including share_count */
- signature = hash_memory64
+ signature = hash_memory
(STRUCT_MARK_PTR(adj, signature_start),
STRUCT_OFFSET_OF(ip_adjacency_t, signature_end)
- STRUCT_OFFSET_OF(ip_adjacency_t, signature_start),
signature);
/* and the rewrite */
- signature = hash_memory64 (&adj->rewrite_header, VLIB_BUFFER_PRE_DATA_SIZE,
+ signature = hash_memory (&adj->rewrite_header, VLIB_BUFFER_PRE_DATA_SIZE,
signature);
return signature;
}
diff --git a/vnet/vnet/l2/l2_flood.c b/vnet/vnet/l2/l2_flood.c
index 0d25f583bbb..e0c4bb7afac 100644
--- a/vnet/vnet/l2/l2_flood.c
+++ b/vnet/vnet/l2/l2_flood.c
@@ -174,7 +174,7 @@ l2flood_process (vlib_main_t * vm,
(!in_shg || members[0].shg != in_shg)))) {
// If more than one member then initiate replication
ctx = replication_prep (vm, b0, l2flood_node.index, 1 /* l2_packet */);
- ctx->feature_replicas = (u64) members;
+ ctx->feature_replicas = (uword) members;
ctx->feature_counter = current_member;
}
@@ -194,7 +194,7 @@ l2flood_process (vlib_main_t * vm,
ctx = replication_get_ctx (b0);
replication_clear_recycled (b0);
- members = (l2_flood_member_t *) ctx->feature_replicas;
+ members = (l2_flood_member_t *)(intptr_t) ctx->feature_replicas;
current_member = (i32)ctx->feature_counter - 1;
// Need to update input index from saved packet context
diff --git a/vpp/api/api.c b/vpp/api/api.c
index 37cd57ffc3b..b47214f049d 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -3314,7 +3314,7 @@ static void vl_api_cli_request_t_handler
rp->_vl_msg_id = ntohs(VL_API_CLI_REPLY);
rp->context = mp->context;
- unformat_init_vector (&input, (u8 *)mp->cmd_in_shmem);
+ unformat_init_vector (&input, (u8 *)(uword)mp->cmd_in_shmem);
vlib_cli_input (vm, &input, shmem_cli_output,
(uword)&shmem_vec);
@@ -5191,11 +5191,11 @@ static void
vl_api_ikev2_profile_add_del_t_handler
(vl_api_ikev2_profile_add_del_t * mp)
{
- vlib_main_t * vm = vlib_get_main();
vl_api_ikev2_profile_add_del_reply_t * rmp;
int rv = 0;
#if IPSEC > 0
+ vlib_main_t * vm = vlib_get_main();
clib_error_t * error;
u8 * tmp = format(0, "%s", mp->name);
error = ikev2_add_del_profile(vm, tmp, mp->is_add);
@@ -5213,11 +5213,11 @@ static void
vl_api_ikev2_profile_set_auth_t_handler
(vl_api_ikev2_profile_set_auth_t * mp)
{
- vlib_main_t * vm = vlib_get_main();
vl_api_ikev2_profile_set_auth_reply_t * rmp;
int rv = 0;
#if IPSEC > 0
+ vlib_main_t * vm = vlib_get_main();
clib_error_t * error;
u8 * tmp = format(0, "%s", mp->name);
u8 * data = vec_new (u8, mp->data_len);
@@ -5238,11 +5238,11 @@ static void
vl_api_ikev2_profile_set_id_t_handler
(vl_api_ikev2_profile_set_id_t * mp)
{
- vlib_main_t * vm = vlib_get_main();
- vl_api_ikev2_profile_set_id_reply_t * rmp;
+ vl_api_ikev2_profile_add_del_reply_t * rmp;
int rv = 0;
#if IPSEC > 0
+ vlib_main_t * vm = vlib_get_main();
clib_error_t * error;
u8 * tmp = format(0, "%s", mp->name);
u8 * data = vec_new (u8, mp->data_len);
@@ -5263,11 +5263,11 @@ static void
vl_api_ikev2_profile_set_ts_t_handler
(vl_api_ikev2_profile_set_ts_t * mp)
{
- vlib_main_t * vm = vlib_get_main();
vl_api_ikev2_profile_set_ts_reply_t * rmp;
int rv = 0;
#if IPSEC > 0
+ vlib_main_t * vm = vlib_get_main();
clib_error_t * error;
u8 * tmp = format(0, "%s", mp->name);
error = ikev2_set_profile_ts(vm, tmp, mp->proto, mp->start_port,
@@ -5287,11 +5287,11 @@ static void
vl_api_ikev2_set_local_key_t_handler
(vl_api_ikev2_set_local_key_t * mp)
{
- vlib_main_t * vm = vlib_get_main();
- vl_api_ikev2_set_local_key_reply_t * rmp;
+ vl_api_ikev2_profile_set_ts_reply_t * rmp;
int rv = 0;
#if IPSEC > 0
+ vlib_main_t * vm = vlib_get_main();
clib_error_t * error;
error = ikev2_set_local_key(vm, mp->key_file);
diff --git a/vpp/api/gmon.c b/vpp/api/gmon.c
index 3098423943e..32786d63b38 100644
--- a/vpp/api/gmon.c
+++ b/vpp/api/gmon.c
@@ -52,7 +52,7 @@ typedef struct {
pid_t *vpef_pid_ptr;
u64 last_sig_errors;
u64 current_sig_errors;
- u64 * sig_error_bitmap;
+ uword * sig_error_bitmap;
vlib_main_t *vlib_main;
vlib_main_t ** my_vlib_mains;
diff --git a/vppapigen/node.c b/vppapigen/node.c
index 966ff817359..3a32abec63b 100644
--- a/vppapigen/node.c
+++ b/vppapigen/node.c
@@ -285,8 +285,8 @@ void primtype_java_code (node_t * this, enum passid which, FILE *ofp,
indent_me(ofp);
fprintf(ofp, "int _i;\n");
indent_me(ofp);
- fprintf(ofp, "for (_i = 0; _i < %d; _i++) {\n",
- (int)(u64)(deeper->data[1]));
+ fprintf(ofp, "for (_i = 0; _i < %u; _i++) {\n",
+ (u64)(deeper->data[1]));
indent += 4;
indent_me(ofp);
fprintf(ofp, "mp->%s[_i] = %s(%sP[_i]);\n",
diff --git a/vppinfra/vppinfra/byte_order.h b/vppinfra/vppinfra/byte_order.h
index 4f385f152df..b2c26e5fdee 100644
--- a/vppinfra/vppinfra/byte_order.h
+++ b/vppinfra/vppinfra/byte_order.h
@@ -40,7 +40,7 @@
#include <vppinfra/clib.h>
-#if defined(__x86_64__) || defined(i386) || defined(__aarch64__)
+#if (__BYTE_ORDER__)==( __ORDER_LITTLE_ENDIAN__)
#define CLIB_ARCH_IS_BIG_ENDIAN (0)
#define CLIB_ARCH_IS_LITTLE_ENDIAN (1)
#else
diff --git a/vppinfra/vppinfra/cache.h b/vppinfra/vppinfra/cache.h
index fea111698a2..92e1e8cf777 100644
--- a/vppinfra/vppinfra/cache.h
+++ b/vppinfra/vppinfra/cache.h
@@ -45,7 +45,7 @@
*/
#ifndef CLIB_LOG2_CACHE_LINE_BYTES
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(__ARM_ARCH_7A__)
#define CLIB_LOG2_CACHE_LINE_BYTES 6
#endif
diff --git a/vppinfra/vppinfra/hash.c b/vppinfra/vppinfra/hash.c
index 9e038b4fd8c..adadf010a0c 100644
--- a/vppinfra/vppinfra/hash.c
+++ b/vppinfra/vppinfra/hash.c
@@ -88,7 +88,7 @@ static inline u64 zap64 (u64 x, word n)
return x & masks_little_endian[n];
}
-u64 hash_memory64 (void * p, word n_bytes, u64 state)
+static inline u64 hash_memory64 (void * p, word n_bytes, u64 state)
{
u64 * q = p;
u64 a, b, c, n;
@@ -155,7 +155,7 @@ static inline u32 zap32 (u32 x, word n)
return x & masks_little_endian[n];
}
-u32 hash_memory32 (void * p, word n_bytes, u32 state)
+static inline u32 hash_memory32 (void * p, word n_bytes, u32 state)
{
u32 * q = p;
u32 a, b, c, n;
diff --git a/vppinfra/vppinfra/hash.h b/vppinfra/vppinfra/hash.h
index 3c4daada48b..978230b6ca0 100644
--- a/vppinfra/vppinfra/hash.h
+++ b/vppinfra/vppinfra/hash.h
@@ -586,8 +586,6 @@ do { \
hash_v3_finalize_step_2_u32x(a,b,c); \
} while (0)
-extern u64 hash_memory64 (void * p, word n_bytes, u64 state);
-extern u32 hash_memory32 (void * p, word n_bytes, u32 state);
extern uword hash_memory (void * p, word n_bytes, uword state);
extern uword mem_key_sum (hash_t * h, uword key);
diff --git a/vppinfra/vppinfra/longjmp.S b/vppinfra/vppinfra/longjmp.S
index 9ba237d4489..d4dd4c7d916 100644
--- a/vppinfra/vppinfra/longjmp.S
+++ b/vppinfra/vppinfra/longjmp.S
@@ -478,7 +478,7 @@ clib_setjmp:
#endif
/* Give back user's return value. */
- mov r1, r0
+ mov r0, r1
bx lr
.global clib_longjmp
@@ -501,7 +501,7 @@ clib_longjmp:
#endif
/* Give back user's return value. */
- mov r1, r0
+ mov r0, r1
bx lr
.global clib_calljmp
diff --git a/vppinfra/vppinfra/macros.c b/vppinfra/vppinfra/macros.c
index 4107464e99e..f16948ef0e4 100644
--- a/vppinfra/vppinfra/macros.c
+++ b/vppinfra/vppinfra/macros.c
@@ -214,7 +214,7 @@ void clib_macro_init(macro_main_t * mm)
{
if (mm->the_builtin_eval_hash != 0)
{
- clib_warning ("mm %llx already initialized", (u64)mm);
+ clib_warning ("mm %p already initialized", mm);
return;
}
diff --git a/vppinfra/vppinfra/random_isaac.c b/vppinfra/vppinfra/random_isaac.c
index e9287402e52..ad2c165da46 100644
--- a/vppinfra/vppinfra/random_isaac.c
+++ b/vppinfra/vppinfra/random_isaac.c
@@ -110,7 +110,7 @@ void isaac2 (isaac_t * ctx, uword * results)
u32 a##n, b##n, c##n, x##n, y##n, * m##n, * mm##n, * m2##n, * r##n, * mend##n
_ (0); _ (1);
-
+ (void)mend1; /* "set but unused variable" error on mend1 with gcc 4.9 */
#undef _
#define _(n) \
diff --git a/vppinfra/vppinfra/test_vec.c b/vppinfra/vppinfra/test_vec.c
index 12c0603ec8d..80832bf52fd 100644
--- a/vppinfra/vppinfra/test_vec.c
+++ b/vppinfra/vppinfra/test_vec.c
@@ -1050,7 +1050,7 @@ int test_vec_main (unformat_input_t * input)
u8 * bigboy = 0;
u64 one_gig = (1<<30);
u64 size;
- i64 index;
+ u64 index;
fformat (stdout, "giant vector test...");
size = 5ULL * one_gig;
@@ -1090,7 +1090,7 @@ int main (int argc, char * argv[])
unformat_input_t i;
int ret;
- mheap_alloc (0, 10ULL<<30);
+ mheap_alloc (0, (uword)10ULL<<30);
verbose = (argc > 1);
unformat_init_command_line (&i, argv);
diff --git a/vppinfra/vppinfra/time.h b/vppinfra/vppinfra/time.h
index 3c481082ced..29398f3baea 100644
--- a/vppinfra/vppinfra/time.h
+++ b/vppinfra/vppinfra/time.h
@@ -113,7 +113,14 @@ always_inline u64 clib_cpu_time_now (void)
}
#elif defined (__arm__)
-
+#if defined(__ARM_ARCH_7A__)
+always_inline u64 clib_cpu_time_now (void)
+{
+ u64 tsc;
+ asm volatile("mrrc p15, 0, %Q0, %R0, c9" : "=r" (tsc));
+ return tsc;
+}
+#else
always_inline u64 clib_cpu_time_now (void)
{
u32 lo;
@@ -121,6 +128,7 @@ always_inline u64 clib_cpu_time_now (void)
: [lo] "=r" (lo));
return (u64) lo;
}
+#endif
#elif defined (__xtensa__)
diff --git a/vppinfra/vppinfra/vector.h b/vppinfra/vppinfra/vector.h
index 84c52a2836d..a6f4111e88c 100644
--- a/vppinfra/vppinfra/vector.h
+++ b/vppinfra/vppinfra/vector.h
@@ -61,7 +61,7 @@
#define _vector_size(n) __attribute__ ((vector_size (n)))
-#if defined (__aarch64__)
+#if defined (__aarch64__) || defined (__arm__)
typedef unsigned int u32x4 _vector_size (16);
#endif