aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorDavid Johnson <davijoh3@cisco.com>2018-12-14 14:53:41 -0500
committerDavid Johnson <davijoh3@cisco.com>2019-01-02 10:55:55 -0500
commitd9818dd68c162079f3ddb5443a78d0d91d55d0fe (patch)
tree71a597e8fb2c9c7ebd70870ae78091872591e216 /src/vcl
parentd6897c1597c4f0904d5956f7d794e3f001d52f72 (diff)
Fixes for buliding for 32bit targets:
* u32/u64/uword mismatches * pointer-to-int fixes * printf formatting issues * issues with incorrect "ULL" and related suffixes * structure alignment and padding issues Change-Id: I70b989007758755fe8211c074f651150680f60b4 Signed-off-by: David Johnson <davijoh3@cisco.com>
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/ldp.c9
-rw-r--r--src/vcl/sock_test_client.c10
-rw-r--r--src/vcl/sock_test_server.c2
-rw-r--r--src/vcl/vcl_cfg.c61
-rw-r--r--src/vcl/vcl_private.h4
-rw-r--r--src/vcl/vcl_test_client.c4
-rw-r--r--src/vcl/vppcom.c37
7 files changed, 74 insertions, 53 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index 504155696fb..ee35396bc63 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -959,9 +959,12 @@ ldp_pselect (int nfds, fd_set * __restrict readfds,
sizeof (clib_bitmap_t));
rv = vppcom_select (sid_bits,
- readfds ? ldpw->rd_bitmap : NULL,
- writefds ? ldpw->wr_bitmap : NULL,
- exceptfds ? ldpw->ex_bitmap : NULL, 0);
+ readfds ? (unsigned long *) ldpw->rd_bitmap
+ : NULL,
+ writefds ? (unsigned long *) ldpw->wr_bitmap
+ : NULL,
+ exceptfds ? (unsigned long *)
+ ldpw->ex_bitmap : NULL, 0);
if (rv < 0)
{
errno = -rv;
diff --git a/src/vcl/sock_test_client.c b/src/vcl/sock_test_client.c
index 78987974ee6..fb71cd7c719 100644
--- a/src/vcl/sock_test_client.c
+++ b/src/vcl/sock_test_client.c
@@ -157,8 +157,9 @@ echo_test_client ()
_rfdset = rd_fdset;
#ifdef VCL_TEST
- rv = vppcom_select (nfds, (uint64_t *) rfdset, (uint64_t *) wfdset,
- NULL, 0);
+ rv =
+ vppcom_select (nfds, (unsigned long *) rfdset,
+ (unsigned long *) wfdset, NULL, 0);
#else
{
struct timeval timeout;
@@ -417,8 +418,9 @@ stream_test_client (vcl_test_t test)
_rfdset = rd_fdset;
#ifdef VCL_TEST
- rv = vppcom_select (nfds, (uint64_t *) rfdset, (uint64_t *) wfdset,
- NULL, 0);
+ rv =
+ vppcom_select (nfds, (unsigned long *) rfdset,
+ (unsigned long *) wfdset, NULL, 0);
#else
{
struct timeval timeout;
diff --git a/src/vcl/sock_test_server.c b/src/vcl/sock_test_server.c
index 354b9900d10..101bc487621 100644
--- a/src/vcl/sock_test_server.c
+++ b/src/vcl/sock_test_server.c
@@ -751,7 +751,7 @@ main (int argc, char **argv)
_rfdset = ssm->rd_fdset;
#ifdef VCL_TEST
- rv = vppcom_select (ssm->nfds, (uint64_t *) rfdset, NULL, NULL, 0);
+ rv = vppcom_select (ssm->nfds, (unsigned long *) rfdset, NULL, NULL, 0);
#else
{
struct timeval timeout;
diff --git a/src/vcl/vcl_cfg.c b/src/vcl/vcl_cfg.c
index 8baae82942d..12a4fd81468 100644
--- a/src/vcl/vcl_cfg.c
+++ b/src/vcl/vcl_cfg.c
@@ -35,7 +35,7 @@ vppcom_cfg_init (vppcom_cfg_t * vcl_cfg)
vcl_cfg->heapsize = (256ULL << 20);
vcl_cfg->max_workers = 16;
vcl_cfg->vpp_api_q_length = 1024;
- vcl_cfg->segment_baseva = 0x200000000ULL;
+ vcl_cfg->segment_baseva = HIGH_SEGMENT_BASEVA;
vcl_cfg->segment_size = (256 << 20);
vcl_cfg->add_segment_size = (128 << 20);
vcl_cfg->preallocated_fifo_pairs = 8;
@@ -75,7 +75,8 @@ vppcom_cfg_heapsize (char *conf_fname)
if (fp == NULL)
{
VCFG_DBG (0, "VCL<%d>: using default heapsize %lu (0x%lx)",
- getpid (), vcl_cfg->heapsize, vcl_cfg->heapsize);
+ getpid (), (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
goto defaulted;
}
@@ -83,7 +84,8 @@ vppcom_cfg_heapsize (char *conf_fname)
if (argv == NULL)
{
VCFG_DBG (0, "VCL<%d>: calloc failed, using default heapsize %lu"
- " (0x%lx)", getpid (), vcl_cfg->heapsize, vcl_cfg->heapsize);
+ " (0x%lx)", getpid (), (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
goto defaulted;
}
@@ -102,7 +104,8 @@ vppcom_cfg_heapsize (char *conf_fname)
{
VCFG_DBG (0, "VCL<%d>: realloc failed, using default "
"heapsize %lu (0x%lx)", getpid (),
- vcl_cfg->heapsize, vcl_cfg->heapsize);
+ (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
goto defaulted;
}
argv = tmp;
@@ -110,8 +113,9 @@ vppcom_cfg_heapsize (char *conf_fname)
if (arg == NULL)
{
VCFG_DBG (0, "VCL<%d>: strndup failed, using default "
- "heapsize %ld (0x%lx)", getpid (),
- vcl_cfg->heapsize, vcl_cfg->heapsize);
+ "heapsize %lu (0x%lx)", getpid (),
+ (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
goto defaulted;
}
argv[argc - 1] = arg;
@@ -125,8 +129,9 @@ vppcom_cfg_heapsize (char *conf_fname)
char **tmp = realloc (argv, (argc + 1) * sizeof (char *));
if (tmp == NULL)
{
- VCFG_DBG (0, "VCL<%d>: realloc failed, using default heapsize %ld "
- "(0x%lx)", getpid (), vcl_cfg->heapsize, vcl_cfg->heapsize);
+ VCFG_DBG (0, "VCL<%d>: realloc failed, using default heapsize %lu "
+ "(0x%lx)", getpid (), (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
goto defaulted;
}
argv = tmp;
@@ -153,8 +158,9 @@ vppcom_cfg_heapsize (char *conf_fname)
if (size == 0)
{
VCFG_DBG (0, "VCL<%d>: parse error '%s %s', using default "
- "heapsize %ld (0x%lx)", getpid (), argv[i],
- argv[i + 1], vcl_cfg->heapsize, vcl_cfg->heapsize);
+ "heapsize %lu (0x%lx)", getpid (), argv[i],
+ argv[i + 1], (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
goto defaulted;
}
@@ -165,8 +171,9 @@ vppcom_cfg_heapsize (char *conf_fname)
else
{
VCFG_DBG (0, "VCL<%d>: parse error '%s %s', using default "
- "heapsize %ld (0x%lx)", getpid (), argv[i],
- argv[i + 1], vcl_cfg->heapsize, vcl_cfg->heapsize);
+ "heapsize %lu (0x%lx)", getpid (), argv[i],
+ argv[i + 1], (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
goto defaulted;
}
}
@@ -183,10 +190,11 @@ defaulted:
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (vcl_mem == MAP_FAILED)
{
- VCFG_DBG (0, "VCL<%d>: ERROR: mmap(0, %ld == 0x%lx, "
+ VCFG_DBG (0, "VCL<%d>: ERROR: mmap(0, %lu == 0x%lx, "
"PROT_READ | PROT_WRITE,MAP_SHARED | MAP_ANONYMOUS, "
- "-1, 0) failed!", getpid (), vcl_cfg->heapsize,
- vcl_cfg->heapsize);
+ "-1, 0) failed!", getpid (),
+ (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
ASSERT (vcl_mem != MAP_FAILED);
return;
}
@@ -208,8 +216,9 @@ defaulted:
clib_memcpy (vcl_mem, &_vppcom_main, sizeof (_vppcom_main));
vcm = vcl_mem;
- VCFG_DBG (0, "VCL<%d>: allocated VCL heap = %p, size %ld (0x%lx)",
- getpid (), heap, vcl_cfg->heapsize, vcl_cfg->heapsize);
+ VCFG_DBG (0, "VCL<%d>: allocated VCL heap = %p, size %lu (0x%lx)",
+ getpid (), heap, (unsigned long) vcl_cfg->heapsize,
+ (unsigned long) vcl_cfg->heapsize);
}
void
@@ -264,7 +273,7 @@ vppcom_cfg_read_file (char *conf_fname)
&vcl_cfg->heapsize))
{
VCFG_DBG (0, "VCL<%d>: configured heapsize %lu", getpid (),
- vcl_cfg->heapsize);
+ (unsigned long) vcl_cfg->heapsize);
}
else
if (unformat
@@ -325,7 +334,7 @@ vppcom_cfg_read_file (char *conf_fname)
&vcl_cfg->segment_baseva))
{
VCFG_DBG (0, "VCL<%d>: configured segment_baseva 0x%lx",
- getpid (), vcl_cfg->segment_baseva);
+ getpid (), (unsigned long) vcl_cfg->segment_baseva);
}
else if (unformat (line_input, "segment-size 0x%x",
&vcl_cfg->segment_size))
@@ -463,9 +472,11 @@ vppcom_cfg_read_file (char *conf_fname)
else if (unformat (line_input, "namespace-secret %lu",
&vcl_cfg->namespace_secret))
{
- VCFG_DBG (0, "VCL<%d>: configured namespace_secret %lu (0x%lx)",
- getpid (), vcl_cfg->namespace_secret,
- vcl_cfg->namespace_secret);
+ VCFG_DBG (0,
+ "VCL<%d>: configured namespace_secret %llu (0x%llx)",
+ getpid (),
+ (unsigned long long) vcl_cfg->namespace_secret,
+ (unsigned long long) vcl_cfg->namespace_secret);
}
else if (unformat (line_input, "namespace-id %v",
&vcl_cfg->namespace_id))
@@ -576,7 +587,7 @@ vppcom_cfg (vppcom_cfg_t * vcl_cfg)
if (env_var_str)
{
u64 tmp;
- if (sscanf (env_var_str, "%lu", &tmp) != 1)
+ if (sscanf (env_var_str, "%llu", (unsigned long long *) &tmp) != 1)
{
VCFG_DBG (0, "VCL<%d>: WARNING: Invalid namespace secret specified"
" in the environment variable "
@@ -586,9 +597,9 @@ vppcom_cfg (vppcom_cfg_t * vcl_cfg)
else
{
vcm->cfg.namespace_secret = tmp;
- VCFG_DBG (0, "VCL<%d>: configured namespace secret (%lu) from "
+ VCFG_DBG (0, "VCL<%d>: configured namespace secret (%llu) from "
VPPCOM_ENV_APP_NAMESPACE_SECRET "!", getpid (),
- vcm->cfg.namespace_secret);
+ (unsigned long long) vcm->cfg.namespace_secret);
}
}
if (getenv (VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP))
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 3d6c85ea6f7..34098ac44f1 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -180,10 +180,10 @@ typedef struct
typedef struct vppcom_cfg_t_
{
- u64 heapsize;
+ uword heapsize;
u32 max_workers;
u32 vpp_api_q_length;
- u64 segment_baseva;
+ uword segment_baseva;
u32 segment_size;
u32 add_segment_size;
u32 preallocated_fifo_pairs;
diff --git a/src/vcl/vcl_test_client.c b/src/vcl/vcl_test_client.c
index 59286ee6725..e1d7b3b3a81 100644
--- a/src/vcl/vcl_test_client.c
+++ b/src/vcl/vcl_test_client.c
@@ -350,8 +350,8 @@ vtc_worker_loop (void *arg)
_wfdset = wrk->wr_fdset;
_rfdset = wrk->rd_fdset;
- rv = vppcom_select (wrk->max_fd_index, (uint64_t *) rfdset,
- (uint64_t *) wfdset, NULL, 0);
+ rv = vppcom_select (wrk->max_fd_index, (unsigned long *) rfdset,
+ (unsigned long *) wfdset, NULL, 0);
if (rv < 0)
{
vterr ("vppcom_select()", rv);
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index f1c58c4f2bd..be7293679f8 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1944,7 +1944,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
break;
if (sid < n_bits && read_map)
{
- clib_bitmap_set_no_check (read_map, sid, 1);
+ clib_bitmap_set_no_check ((uword *) read_map, sid, 1);
*bits_set += 1;
}
break;
@@ -1955,7 +1955,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
break;
if (sid < n_bits && write_map)
{
- clib_bitmap_set_no_check (write_map, sid, 1);
+ clib_bitmap_set_no_check ((uword *) write_map, sid, 1);
*bits_set += 1;
}
break;
@@ -1967,7 +1967,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
sid = session->session_index;
if (sid < n_bits && read_map)
{
- clib_bitmap_set_no_check (read_map, sid, 1);
+ clib_bitmap_set_no_check ((uword *) read_map, sid, 1);
*bits_set += 1;
}
break;
@@ -1978,7 +1978,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
sid = session->session_index;
if (sid < n_bits && write_map)
{
- clib_bitmap_set_no_check (write_map, sid, 1);
+ clib_bitmap_set_no_check ((uword *) write_map, sid, 1);
*bits_set += 1;
}
break;
@@ -1990,7 +1990,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
sid = session->session_index;
if (sid < n_bits && read_map)
{
- clib_bitmap_set_no_check (read_map, sid, 1);
+ clib_bitmap_set_no_check ((uword *) read_map, sid, 1);
*bits_set += 1;
}
break;
@@ -2006,7 +2006,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
sid = session->session_index;
if (sid < n_bits && except_map)
{
- clib_bitmap_set_no_check (except_map, sid, 1);
+ clib_bitmap_set_no_check ((uword *) except_map, sid, 1);
*bits_set += 1;
}
break;
@@ -2014,7 +2014,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
sid = vcl_session_reset_handler (wrk, (session_reset_msg_t *) e->data);
if (sid < n_bits && except_map)
{
- clib_bitmap_set_no_check (except_map, sid, 1);
+ clib_bitmap_set_no_check ((uword *) except_map, sid, 1);
*bits_set += 1;
}
break;
@@ -2144,30 +2144,35 @@ vppcom_select (unsigned long n_bits, unsigned long *read_map,
vcl_session_t *session = 0;
int rv, i;
- ASSERT (sizeof (clib_bitmap_t) == sizeof (long int));
+ STATIC_ASSERT (sizeof (clib_bitmap_t) == sizeof (unsigned long),
+ "vppcom bitmap size mismatch");
+ STATIC_ASSERT (sizeof (clib_bitmap_t) == sizeof (fd_mask),
+ "vppcom bitmap size mismatch");
+ STATIC_ASSERT (sizeof (clib_bitmap_t) == sizeof (uword),
+ "vppcom bitmap size mismatch");
if (n_bits && read_map)
{
clib_bitmap_validate (wrk->rd_bitmap, minbits);
clib_memcpy_fast (wrk->rd_bitmap, read_map,
- vec_len (wrk->rd_bitmap) * sizeof (clib_bitmap_t));
- memset (read_map, 0, vec_len (wrk->rd_bitmap) * sizeof (clib_bitmap_t));
+ vec_len (wrk->rd_bitmap) * sizeof (unsigned long));
+ memset (read_map, 0, vec_len (wrk->rd_bitmap) * sizeof (unsigned long));
}
if (n_bits && write_map)
{
clib_bitmap_validate (wrk->wr_bitmap, minbits);
clib_memcpy_fast (wrk->wr_bitmap, write_map,
- vec_len (wrk->wr_bitmap) * sizeof (clib_bitmap_t));
+ vec_len (wrk->wr_bitmap) * sizeof (unsigned long));
memset (write_map, 0,
- vec_len (wrk->wr_bitmap) * sizeof (clib_bitmap_t));
+ vec_len (wrk->wr_bitmap) * sizeof (unsigned long));
}
if (n_bits && except_map)
{
clib_bitmap_validate (wrk->ex_bitmap, minbits);
clib_memcpy_fast (wrk->ex_bitmap, except_map,
- vec_len (wrk->ex_bitmap) * sizeof (clib_bitmap_t));
+ vec_len (wrk->ex_bitmap) * sizeof (unsigned long));
memset (except_map, 0,
- vec_len (wrk->ex_bitmap) * sizeof (clib_bitmap_t));
+ vec_len (wrk->ex_bitmap) * sizeof (unsigned long));
}
if (!n_bits)
@@ -2188,7 +2193,7 @@ vppcom_select (unsigned long n_bits, unsigned long *read_map,
rv = svm_fifo_is_full (session->tx_fifo);
if (!rv)
{
- clib_bitmap_set_no_check (write_map, sid, 1);
+ clib_bitmap_set_no_check ((uword*)write_map, sid, 1);
bits_set++;
}
}));
@@ -2208,7 +2213,7 @@ check_rd:
rv = vppcom_session_read_ready (session);
if (rv)
{
- clib_bitmap_set_no_check (read_map, sid, 1);
+ clib_bitmap_set_no_check ((uword*)read_map, sid, 1);
bits_set++;
}
}));