Fix remaining 32-bit compile issues
Change-Id: I9664214652229b663c3e3ba7406b4ede96bfb123
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/Makefile b/Makefile
index 8240e78..b344f37 100644
--- a/Makefile
+++ b/Makefile
@@ -263,9 +263,9 @@
TEST_DIR=$(WS_ROOT)/test \
VPP_TEST_BUILD_DIR=$(BR)/build-$(2)-native \
VPP_TEST_BIN=$(BR)/install-$(2)-native/vpp/bin/vpp \
- VPP_TEST_PLUGIN_PATH=$(BR)/install-$(2)-native/vpp/lib64/vpp_plugins \
+ VPP_TEST_PLUGIN_PATH=$(wildcard $(BR)/install-$(2)-native/vpp/lib*/vpp_plugins) \
VPP_TEST_INSTALL_PATH=$(BR)/install-$(2)-native/ \
- LD_LIBRARY_PATH=$(BR)/install-$(2)-native/vpp/lib64/ \
+ LD_LIBRARY_PATH=$(subst $(subst ,, ),:,$(wildcard $(BR)/install-$(2)-native/vpp/lib*/)) \
EXTENDED_TESTS=$(EXTENDED_TESTS) \
PYTHON=$(PYTHON) \
$(3)
@@ -325,12 +325,12 @@
@echo "WARNING: STARTUP_CONF not defined or file doesn't exist."
@echo " Running with minimal startup config: $(MINIMAL_STARTUP_CONF)\n"
@cd $(STARTUP_DIR) && \
- sudo $(2) $(1)/vpp/bin/vpp $(MINIMAL_STARTUP_CONF) plugin_path $(1)/vpp/lib64/vpp_plugins
+ sudo $(2) $(1)/vpp/bin/vpp $(MINIMAL_STARTUP_CONF) plugin_path $(wildcard $(1)/vpp/lib*/vpp_plugins)
endef
else
define run
@cd $(STARTUP_DIR) && \
- sudo $(2) $(1)/vpp/bin/vpp $(shell cat $(STARTUP_CONF) | sed -e 's/#.*//') plugin_path $(1)/vpp/lib64/vpp_plugins
+ sudo $(2) $(1)/vpp/bin/vpp $(shell cat $(STARTUP_CONF) | sed -e 's/#.*//') plugin_path $(wildcard $(1)/vpp/lib*/vpp_plugins)
endef
endif
diff --git a/build-data/platforms/vpp.mk b/build-data/platforms/vpp.mk
index 5aafdd7..4577fa2 100644
--- a/build-data/platforms/vpp.mk
+++ b/build-data/platforms/vpp.mk
@@ -46,6 +46,11 @@
# vpp_dpdk_lib_dir = /usr/lib
# vpp_dpdk_shared_lib = yes
+# load balancer plugin is not portable on 32 bit platform
+ifeq ($(MACHINE),i686)
+vpp_configure_args_vpp = --disable-lb-plugin
+endif
+
vpp_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
-fstack-protector-all -fPIC -Werror
vpp_debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index c80b3fa..2d4762a 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -455,8 +455,8 @@
uword save_vpm_start, save_vpm_end, save_vpm_size;
struct rte_mempool_memhdr *memhdr;
- this_pool_start = ~0ULL;
- this_pool_end = 0LL;
+ this_pool_start = ~0;
+ this_pool_end = 0;
STAILQ_FOREACH (memhdr, &rmp->mem_list, next)
{
@@ -465,7 +465,7 @@
if (((uword) memhdr->addr) < this_pool_start)
this_pool_start = (uword) (memhdr->addr);
}
- ASSERT (this_pool_start < ~0ULL && this_pool_end > 0);
+ ASSERT (this_pool_start < ~0 && this_pool_end > 0);
this_pool_size = this_pool_end - this_pool_start;
if (CLIB_DEBUG > 1)
diff --git a/src/plugins/ixge/ixge.c b/src/plugins/ixge/ixge.c
index 08f5b69..0d28725 100644
--- a/src/plugins/ixge/ixge.c
+++ b/src/plugins/ixge/ixge.c
@@ -20,7 +20,7 @@
* Please use supported DPDK driver instead.
*/
-#if __x86_64__
+#if __x86_64__ || __i386__
#include <vppinfra/vector.h>
#ifndef CLIB_HAVE_VEC128
@@ -2929,7 +2929,6 @@
break;
}
}
-#endif
/* *INDENT-OFF* */
VLIB_PLUGIN_REGISTER () = {
@@ -2937,8 +2936,10 @@
.default_disabled = 1,
.description = "Intel 82599 Family Native Driver (experimental)",
};
+#endif
/* *INDENT-ON* */
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/svm/svm.c b/src/svm/svm.c
index 97add5a..c96135c 100644
--- a/src/svm/svm.c
+++ b/src/svm/svm.c
@@ -491,7 +491,7 @@
return (0);
}
- rp = mmap ((void *) a->baseva, a->size,
+ rp = mmap (uword_to_pointer (a->baseva, void *), a->size,
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, svm_fd, 0);
if (rp == (svm_region_t *) MAP_FAILED)
@@ -533,9 +533,10 @@
rp->virtual_size = a->size;
rp->region_heap =
- mheap_alloc_with_flags ((void *) (a->baseva + MMAP_PAGESIZE),
- (a->pvt_heap_size != 0) ?
- a->pvt_heap_size : SVM_PVT_MHEAP_SIZE,
+ mheap_alloc_with_flags (uword_to_pointer
+ (a->baseva + MMAP_PAGESIZE, void *),
+ (a->pvt_heap_size !=
+ 0) ? a->pvt_heap_size : SVM_PVT_MHEAP_SIZE,
MHEAP_FLAG_DISABLE_VM);
oldheap = svm_push_pvt_heap (rp);
@@ -661,7 +662,7 @@
a->size = rp->virtual_size;
munmap (rp, MMAP_PAGESIZE);
- rp = (void *) mmap ((void *) a->baseva, a->size,
+ rp = (void *) mmap (uword_to_pointer (a->baseva, void *), a->size,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED, svm_fd, 0);
if ((uword) rp == (uword) MAP_FAILED)
diff --git a/src/svm/svmtool.c b/src/svm/svmtool.c
index b319551..01ae422 100644
--- a/src/svm/svmtool.c
+++ b/src/svm/svmtool.c
@@ -172,7 +172,7 @@
a->size = rp->virtual_size;
munmap (rp, MMAP_PAGESIZE);
- rp = (void *) mmap ((void *) a->baseva, a->size,
+ rp = (void *) mmap (uword_to_pointer (a->baseva, void *), a->size,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED, svm_fd, 0);
if ((uword) rp == (uword) MAP_FAILED)
@@ -401,7 +401,7 @@
a->size = root_rp->virtual_size;
munmap (root_rp, MMAP_PAGESIZE);
- root_rp = (void *) mmap ((void *) a->baseva, a->size,
+ root_rp = (void *) mmap (uword_to_pointer (a->baseva, void *), a->size,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED, svm_fd, 0);
if ((uword) root_rp == (uword) MAP_FAILED)
diff --git a/src/tools/vppapigen/gram.y b/src/tools/vppapigen/gram.y
index 9cea602..52bb65c 100644
--- a/src/tools/vppapigen/gram.y
+++ b/src/tools/vppapigen/gram.y
@@ -53,9 +53,9 @@
| defn {$$ = $1;}
;
-flist: flist flag {$$ = (YYSTYPE)(unsigned long long)
- ((unsigned long long) $1
- | (unsigned long long) $2);}
+flist: flist flag {$$ = (YYSTYPE)(unsigned long)
+ ((unsigned long) $1
+ | (unsigned long) $2);}
| flag {$$ = $1;}
;
diff --git a/src/tools/vppapigen/node.c b/src/tools/vppapigen/node.c
index 9f23403..15868ee 100644
--- a/src/tools/vppapigen/node.c
+++ b/src/tools/vppapigen/node.c
@@ -397,7 +397,7 @@
fprintf(fp, ",\n");
}
indent_me(fp);
- fprintf (fp, "{\"crc\" : \"0x%08x\"}\n", (u32)(u64)CDATA3);
+ fprintf (fp, "{\"crc\" : \"0x%08x\"}\n", (u32)(uword)CDATA3);
indent -= 4;
indent_me(fp);
fprintf(fp, "]");
@@ -1219,7 +1219,7 @@
if (!(np->flags & NODE_FLAG_TYPEONLY)) {
fprintf (fp, "\\\n_(VL_API_%s, %s, %08x) ",
uppercase (np->data[0]), (i8 *) np->data[0],
- (u32)(u64)np->data[3]);
+ (u32)(uword)np->data[3]);
}
}
np = np->peer;
diff --git a/src/uri/uri_tcp_test.c b/src/uri/uri_tcp_test.c
index b15fd6c..22f246e 100755
--- a/src/uri/uri_tcp_test.c
+++ b/src/uri/uri_tcp_test.c
@@ -262,7 +262,8 @@
}
utm->our_event_queue =
- (unix_shared_memory_queue_t *) mp->app_event_queue_address;
+ uword_to_pointer (mp->app_event_queue_address,
+ unix_shared_memory_queue_t *);
utm->state = STATE_ATTACHED;
}
@@ -524,8 +525,9 @@
return;
}
- utm->vpp_event_queue = (unix_shared_memory_queue_t *)
- mp->vpp_event_queue_address;
+ utm->vpp_event_queue =
+ uword_to_pointer (mp->vpp_event_queue_address,
+ unix_shared_memory_queue_t *);
/*
* Setup session
@@ -534,9 +536,9 @@
pool_get (utm->sessions, session);
session_index = session - utm->sessions;
- rx_fifo = (svm_fifo_t *) mp->server_rx_fifo;
+ rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
rx_fifo->client_session_index = session_index;
- tx_fifo = (svm_fifo_t *) mp->server_tx_fifo;
+ tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
tx_fifo->client_session_index = session_index;
session->server_rx_fifo = rx_fifo;
@@ -858,16 +860,17 @@
ip_str = format (0, "%U", format_ip46_address, &mp->ip, mp->is_ip4);
clib_warning ("Accepted session from: %s:%d", ip_str,
clib_net_to_host_u16 (mp->port));
- utm->vpp_event_queue = (unix_shared_memory_queue_t *)
- mp->vpp_event_queue_address;
+ utm->vpp_event_queue =
+ uword_to_pointer (mp->vpp_event_queue_address,
+ unix_shared_memory_queue_t *);
/* Allocate local session and set it up */
pool_get (utm->sessions, session);
session_index = session - utm->sessions;
- rx_fifo = (svm_fifo_t *) mp->server_rx_fifo;
+ rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
rx_fifo->client_session_index = session_index;
- tx_fifo = (svm_fifo_t *) mp->server_tx_fifo;
+ tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
tx_fifo->client_session_index = session_index;
session->server_rx_fifo = rx_fifo;
diff --git a/src/uri/uri_udp_test.c b/src/uri/uri_udp_test.c
index 266215c..8fb12ed 100644
--- a/src/uri/uri_udp_test.c
+++ b/src/uri/uri_udp_test.c
@@ -232,7 +232,8 @@
}
utm->our_event_queue =
- (unix_shared_memory_queue_t *) mp->app_event_queue_address;
+ uword_to_pointer (mp->app_event_queue_address,
+ unix_shared_memory_queue_t *);
}
static void
@@ -581,7 +582,8 @@
vec_free (a->segment_name);
- client_q = (unix_shared_memory_queue_t *) mp->client_queue_address;
+ client_q =
+ uword_to_pointer (mp->client_queue_address, unix_shared_memory_queue_t *);
vl_msg_api_send_shmem (client_q, (u8 *) & rmp);
}
@@ -608,14 +610,15 @@
if (start_time == 0.0)
start_time = clib_time_now (&utm->clib_time);
- utm->vpp_event_queue = (unix_shared_memory_queue_t *)
- mp->vpp_event_queue_address;
+ utm->vpp_event_queue =
+ uword_to_pointer (mp->vpp_event_queue_address,
+ unix_shared_memory_queue_t *);
pool_get (utm->sessions, session);
- rx_fifo = (svm_fifo_t *) mp->server_rx_fifo;
+ rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
rx_fifo->client_session_index = session - utm->sessions;
- tx_fifo = (svm_fifo_t *) mp->server_tx_fifo;
+ tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
tx_fifo->client_session_index = session - utm->sessions;
session->server_rx_fifo = rx_fifo;
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 28b227b..495b660 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1037,7 +1037,7 @@
i32 retval = ntohl (mp->retval);
vam->retval = retval;
- vam->shmem_result = (u8 *) mp->reply_in_shmem;
+ vam->shmem_result = uword_to_pointer (mp->reply_in_shmem, u8 *);
vam->result_ready = 1;
}
@@ -1058,7 +1058,7 @@
pthread_mutex_lock (&am->vlib_rp->mutex);
oldheap = svm_push_data_heap (am->vlib_rp);
- reply = (u8 *) (mp->reply_in_shmem);
+ reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
vec_free (reply);
svm_pop_heap (oldheap);
@@ -2405,7 +2405,7 @@
if (retval != 0)
return;
- reply = (u8 *) (mp->reply_in_shmem);
+ reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
pvt_copy = vec_dup (reply);
/* Toss the shared-memory original... */
@@ -2456,7 +2456,7 @@
vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
vat_json_object_add_uint (&node, "reply_in_shmem", mp->reply_in_shmem);
- reply = (u8 *) (mp->reply_in_shmem);
+ reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
/* Toss the shared-memory original... */
pthread_mutex_lock (&am->vlib_rp->mutex);
@@ -4959,7 +4959,7 @@
svm_pop_heap (oldheap);
pthread_mutex_unlock (&am->vlib_rp->mutex);
- mp->cmd_in_shmem = (u64) cmd;
+ mp->cmd_in_shmem = pointer_to_uword (cmd);
S (mp);
timeout = vat_time_now (vam) + 10.0;
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 4a111f8..9ccfd3a 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -1125,7 +1125,7 @@
VLIB_EARLY_CONFIG_FUNCTION (cpu_config, "cpu");
-#if !defined (__x86_64__) && !defined (__aarch64__) && !defined (__powerpc64__) && !defined(__arm__)
+#if !defined (__x86_64__) && !defined (__i386__) && !defined (__aarch64__) && !defined (__powerpc64__) && !defined(__arm__)
void
__sync_fetch_and_add_8 (void)
{
diff --git a/src/vlibmemory/memory_client.c b/src/vlibmemory/memory_client.c
index d48a4fa..a162d6b 100644
--- a/src/vlibmemory/memory_client.c
+++ b/src/vlibmemory/memory_client.c
@@ -137,7 +137,7 @@
am->msg_index_by_name_and_crc = hash_create_string (0, sizeof (uword));
/* Recreate the vnet-side API message handler table */
- tblv = (u8 *) mp->message_table;
+ tblv = uword_to_pointer (mp->message_table, u8 *);
serialize_open_vector (sm, tblv);
unserialize_integer (sm, &nmsgs, sizeof (u32));
diff --git a/src/vlibmemory/memory_vlib.c b/src/vlibmemory/memory_vlib.c
index 29a5c2c..acba8b3 100644
--- a/src/vlibmemory/memory_vlib.c
+++ b/src/vlibmemory/memory_vlib.c
@@ -216,7 +216,8 @@
am->shmem_hdr->application_restarts);
rp->context = mp->context;
rp->response = ntohl (rv);
- rp->message_table = (u64) am->serialized_message_table_in_shmem;
+ rp->message_table =
+ pointer_to_uword (am->serialized_message_table_in_shmem);
vl_msg_api_send_shmem (q, (u8 *) & rp);
}
diff --git a/src/vnet/devices/virtio/vhost-user.c b/src/vnet/devices/virtio/vhost-user.c
index acc7bf8..6ccc0d8 100644
--- a/src/vnet/devices/virtio/vhost-user.c
+++ b/src/vnet/devices/virtio/vhost-user.c
@@ -719,7 +719,7 @@
}
if (is_host_address)
{
- addr = (u64) map_user_mem (vui, (uword) addr);
+ addr = pointer_to_uword (map_user_mem (vui, (uword) addr));
}
if (PREDICT_FALSE ((addr + len - 1) / VHOST_LOG_PAGE / 8 >= vui->log_size))
{
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index ad44baa..f74b0cf 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -247,7 +247,7 @@
a->session_cb_vft)))
return rv;
- a->app_event_queue_address = (u64) app->event_queue;
+ a->app_event_queue_address = pointer_to_uword (app->event_queue);
sm = segment_manager_get (app->first_segment_manager);
segment_manager_get_segment_info (sm->segment_indices[0],
&seg_name, &a->segment_size);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 5a02a08..8266922 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -102,9 +102,9 @@
tc = tp_vft->get_connection (s->connection_index, s->thread_index);
mp->listener_handle = listen_session_get_handle (listener);
mp->handle = stream_session_handle (s);
- mp->server_rx_fifo = (u64) s->server_rx_fifo;
- mp->server_tx_fifo = (u64) s->server_tx_fifo;
- mp->vpp_event_queue_address = (u64) vpp_queue;
+ mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
mp->port = tc->rmt_port;
mp->is_ip4 = tc->is_ip4;
clib_memcpy (&mp->ip, &tc->rmt_ip, sizeof (tc->rmt_ip));
@@ -172,10 +172,10 @@
if (!is_fail)
{
vpp_queue = session_manager_get_vpp_event_queue (s->thread_index);
- mp->server_rx_fifo = (u64) s->server_rx_fifo;
- mp->server_tx_fifo = (u64) s->server_tx_fifo;
+ mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
mp->handle = stream_session_handle (s);
- mp->vpp_event_queue_address = (u64) vpp_queue;
+ mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
mp->retval = 0;
}
else
@@ -225,7 +225,7 @@
}
/* Tell the server the client's API queue address, so it can reply */
- mp->client_queue_address = (u64) client_q;
+ mp->client_queue_address = pointer_to_uword (client_q);
app = application_lookup (mp->client_index);
if (!app)
{
diff --git a/src/vnet/tcp/builtin_client.c b/src/vnet/tcp/builtin_client.c
index 32d69a9..6f89087 100644
--- a/src/vnet/tcp/builtin_client.c
+++ b/src/vnet/tcp/builtin_client.c
@@ -274,11 +274,12 @@
return;
}
- tm->our_event_queue = (unix_shared_memory_queue_t *)
- mp->vpp_event_queue_address;
-
- tm->vpp_event_queue = (unix_shared_memory_queue_t *)
- mp->vpp_event_queue_address;
+ tm->our_event_queue =
+ uword_to_pointer (mp->vpp_event_queue_address,
+ unix_shared_memory_queue_t *);
+ tm->vpp_event_queue =
+ uword_to_pointer (mp->vpp_event_queue_address,
+ unix_shared_memory_queue_t *);
/*
* Setup session
@@ -288,9 +289,11 @@
session_index = session - tm->sessions;
session->bytes_to_receive = session->bytes_to_send = tm->bytes_to_send;
- session->server_rx_fifo = (svm_fifo_t *) mp->server_rx_fifo;
+ session->server_rx_fifo =
+ uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
session->server_rx_fifo->client_session_index = session_index;
- session->server_tx_fifo = (svm_fifo_t *) mp->server_tx_fifo;
+ session->server_tx_fifo =
+ uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
session->server_tx_fifo->client_session_index = session_index;
session->vpp_session_handle = mp->handle;
@@ -321,7 +324,7 @@
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = VL_API_MEMCLNT_CREATE;
mp->context = 0xFEEDFACE;
- mp->input_queue = (u64) tm->vl_input_queue;
+ mp->input_queue = pointer_to_uword (tm->vl_input_queue);
strncpy ((char *) mp->name, "tcp_tester", sizeof (mp->name) - 1);
vl_api_memclnt_create_t_handler (mp);
diff --git a/src/vnet/tcp/builtin_server.c b/src/vnet/tcp/builtin_server.c
index 3468269..621ce02 100644
--- a/src/vnet/tcp/builtin_server.c
+++ b/src/vnet/tcp/builtin_server.c
@@ -244,7 +244,7 @@
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = VL_API_MEMCLNT_CREATE;
mp->context = 0xFEEDFACE;
- mp->input_queue = (u64) bsm->vl_input_queue;
+ mp->input_queue = pointer_to_uword (bsm->vl_input_queue);
strncpy ((char *) mp->name, "tcp_test_server", sizeof (mp->name) - 1);
vl_api_memclnt_create_t_handler (mp);
diff --git a/src/vppinfra/mheap.c b/src/vppinfra/mheap.c
index b8828f9..192732d 100644
--- a/src/vppinfra/mheap.c
+++ b/src/vppinfra/mheap.c
@@ -304,7 +304,7 @@
uword mask;
/* $$$$ ELIOT FIXME: add Altivec version of this routine */
-#if !defined (CLIB_HAVE_VEC128) || defined (__ALTIVEC__)
+#if !defined (CLIB_HAVE_VEC128) || defined (__ALTIVEC__) || defined (__i386__)
mask = 0;
#else
u8x16 b = u8x16_splat (bin);