diff options
33 files changed, 162 insertions, 120 deletions
diff --git a/src/plugins/dpdk/ipsec/ipsec.h b/src/plugins/dpdk/ipsec/ipsec.h index 7d7ba564544..054fe9b0223 100644 --- a/src/plugins/dpdk/ipsec/ipsec.h +++ b/src/plugins/dpdk/ipsec/ipsec.h @@ -74,6 +74,7 @@ typedef struct typedef struct { + CLIB_ALIGN_MARK (pad, 8); /* align up to 8 bytes for 32bit builds */ char *name; enum rte_crypto_sym_xform_type type; u32 alg; @@ -83,7 +84,7 @@ typedef struct u8 boundary; u8 disabled; u8 resources; -} crypto_alg_t __attribute__ ((aligned (8))); +} crypto_alg_t; typedef struct { @@ -128,6 +129,7 @@ typedef struct typedef struct { + CLIB_ALIGN_MARK (pad, 16); /* align up to 16 bytes for 32bit builds */ struct rte_cryptodev_sym_session *session; u64 dev_mask; } crypto_session_by_drv_t; diff --git a/src/plugins/flowprobe/node.c b/src/plugins/flowprobe/node.c index 79d37f8a75e..2cd754b67bb 100644 --- a/src/plugins/flowprobe/node.c +++ b/src/plugins/flowprobe/node.c @@ -148,7 +148,7 @@ flowprobe_get_variant (flowprobe_variant_t which, /* * NTP rfc868 : 2 208 988 800 corresponds to 00:00 1 Jan 1970 GMT */ -#define NTP_TIMESTAMP 2208988800L +#define NTP_TIMESTAMP 2208988800LU static inline u32 flowprobe_common_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) diff --git a/src/plugins/lb/lbhash.h b/src/plugins/lb/lbhash.h index 5d2ff24f044..585b377b8aa 100644 --- a/src/plugins/lb/lbhash.h +++ b/src/plugins/lb/lbhash.h @@ -84,7 +84,7 @@ lb_hash_t *lb_hash_alloc(u32 buckets, u32 timeout) return NULL; // Allocate 1 more bucket for prefetch - u32 size = ((u64)&((lb_hash_t *)(0))->buckets[0]) + + u32 size = ((uword)&((lb_hash_t *)(0))->buckets[0]) + sizeof(lb_hash_bucket_t) * (buckets + 1); u8 *mem = 0; lb_hash_t *h; diff --git a/src/plugins/memif/private.h b/src/plugins/memif/private.h index 0116de3f1c3..a938b85e7da 100644 --- a/src/plugins/memif/private.h +++ b/src/plugins/memif/private.h @@ -113,6 +113,7 @@ typedef struct typedef struct { + CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); /* ring data */ memif_ring_t *ring; memif_log2_ring_size_t log2_ring_size; @@ -205,6 +206,7 @@ typedef struct typedef struct { + CLIB_ALIGN_MARK (pad, 16); /* align up to 16 bytes for 32bit builds */ void *data; u32 data_len; i16 buffer_offset; diff --git a/src/plugins/unittest/bihash_test.c b/src/plugins/unittest/bihash_test.c index 3ce41cf494d..d418ced4e6e 100644 --- a/src/plugins/unittest/bihash_test.c +++ b/src/plugins/unittest/bihash_test.c @@ -99,7 +99,7 @@ test_bihash_thread_fn (void *arg) BVT (clib_bihash_kv) kv; bihash_test_main_t *tm = &bihash_test_main; int i, j; - u32 my_thread_index = (u32) (u64) arg; + u32 my_thread_index = (uword) arg; while (tm->thread_barrier) ; @@ -150,7 +150,7 @@ test_bihash_threads (bihash_test_main_t * tm) for (i = 0; i < tm->nthreads; i++) { rv = pthread_create (&handle, NULL, test_bihash_thread_fn, - (void *) (u64) i); + (void *) (uword) i); if (rv) { clib_unix_warning ("pthread_create returned %d", rv); diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c index 73517aeb443..3e617097d26 100644 --- a/src/svm/ssvm.c +++ b/src/svm/ssvm.c @@ -177,7 +177,7 @@ map_it: return SSVM_API_ERROR_SLAVE_TIMEOUT; re_map_it: - ssvm->requested_va = (u64) sh->ssvm_va; + ssvm->requested_va = sh->ssvm_va; ssvm->ssvm_size = sh->ssvm_size; munmap (sh, MMAP_PAGESIZE); diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h index 5b2bf0d202d..59b582ecc42 100644 --- a/src/svm/ssvm.h +++ b/src/svm/ssvm.h @@ -64,9 +64,9 @@ typedef struct void *heap; /* Segment must be mapped at this address, or no supper */ - u64 ssvm_va; + uword ssvm_va; /* The actual mmap size */ - u64 ssvm_size; + uword ssvm_size; u32 master_pid; u32 slave_pid; u8 *name; diff --git a/src/svm/svm_common.h b/src/svm/svm_common.h index e523da50db6..ce07c37b24e 100644 --- a/src/svm/svm_common.h +++ b/src/svm/svm_common.h @@ -66,7 +66,7 @@ typedef struct svm_map_region_args_ { const char *root_path; /* NULL means use the truly global arena */ const char *name; - u64 baseva; + uword baseva; u64 size; u64 pvt_heap_size; uword flags; @@ -77,6 +77,16 @@ typedef struct svm_map_region_args_ int gid; } svm_map_region_args_t; +/* + * Memory mapped to high addresses for session/vppcom/vcl/etc... + */ +#if __WORDSIZE == 64 +#define HIGH_SEGMENT_BASEVA (8ULL << 30) /* 8GB */ +#elif __WORDSIZE == 32 +#define HIGH_SEGMENT_BASEVA (3584UL << 20) /* 3.5GB */ +#else +#error "unknown __WORDSIZE" +#endif /* * Memory shared across all router instances. Packet buffers, etc diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c index c72de406633..6897e0c2d51 100644 --- a/src/svm/svm_fifo_segment.c +++ b/src/svm/svm_fifo_segment.c @@ -575,8 +575,8 @@ svm_fifo_segment_num_free_fifos (svm_fifo_segment_private_t * fifo_segment, } void -svm_fifo_segment_info (svm_fifo_segment_private_t * seg, uword * address, - u64 * size) +svm_fifo_segment_info (svm_fifo_segment_private_t * seg, char **address, + size_t * size) { if (ssvm_type (&seg->ssvm) == SSVM_SEGMENT_PRIVATE) { @@ -587,14 +587,12 @@ svm_fifo_segment_info (svm_fifo_segment_private_t * seg, uword * address, heap_header = mheap_header (seg->ssvm.sh->heap); *size = heap_header->max_size; #else - mspace_get_address_and_size (seg->ssvm.sh->heap, - (unsigned long long *) address, - (unsigned long long *) size); + mspace_get_address_and_size (seg->ssvm.sh->heap, address, size); #endif } else { - *address = seg->ssvm.sh->ssvm_va; + *address = (char *) seg->ssvm.sh->ssvm_va; *size = seg->ssvm.ssvm_size; } } diff --git a/src/svm/svm_fifo_segment.h b/src/svm/svm_fifo_segment.h index a7695549d1c..caa95443b0a 100644 --- a/src/svm/svm_fifo_segment.h +++ b/src/svm/svm_fifo_segment.h @@ -116,8 +116,8 @@ u32 svm_fifo_segment_index (svm_fifo_segment_main_t * sm, u32 svm_fifo_segment_num_fifos (svm_fifo_segment_private_t * fifo_segment); u32 svm_fifo_segment_num_free_fifos (svm_fifo_segment_private_t * fifo_segment, u32 fifo_size_in_bytes); -void svm_fifo_segment_info (svm_fifo_segment_private_t * seg, uword * address, - u64 * size); +void svm_fifo_segment_info (svm_fifo_segment_private_t * seg, char **address, + size_t * size); svm_fifo_segment_private_t * svm_fifo_segment_segments_pool (svm_fifo_segment_main_t * sm); diff --git a/src/svm/test_svm_fifo1.c b/src/svm/test_svm_fifo1.c index 0a09916f3bf..1e63f805f6b 100644 --- a/src/svm/test_svm_fifo1.c +++ b/src/svm/test_svm_fifo1.c @@ -281,7 +281,7 @@ test_ssvm_fifo1 (unformat_input_t * input) int verbose = 0; int test_id = 0; - svm_fifo_segment_main_init (sm, 0x200000000ULL, 20); + svm_fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { diff --git a/src/tests/vnet/session/tcp_echo.c b/src/tests/vnet/session/tcp_echo.c index e553a3ac9fa..1f49ab69e77 100644 --- a/src/tests/vnet/session/tcp_echo.c +++ b/src/tests/vnet/session/tcp_echo.c @@ -1408,7 +1408,7 @@ main (int argc, char **argv) clib_time_init (&em->clib_time); init_error_string_table (em); - svm_fifo_segment_main_init (sm, 0x200000000ULL, 20); + svm_fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20); unformat_init_command_line (a, argv); while (unformat_check_input (a) != UNFORMAT_END_OF_INPUT) diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c index b8c4c5daf31..813aee22264 100644 --- a/src/tests/vnet/session/udp_echo.c +++ b/src/tests/vnet/session/udp_echo.c @@ -942,7 +942,8 @@ vl_api_unmap_segment_t_handler (vl_api_unmap_segment_t * mp) udp_echo_main_t *utm = &udp_echo_main; svm_fifo_segment_main_t *sm = &utm->segment_main; svm_fifo_segment_private_t *seg; - u64 *seg_indexp, segment_handle; + uword *seg_indexp; + u64 segment_handle; segment_handle = clib_net_to_host_u64 (mp->segment_handle); seg_indexp = hash_get (utm->segments_table, segment_handle); @@ -1220,7 +1221,7 @@ main (int argc, char **argv) clib_mem_init_thread_safe (0, 256 << 20); - svm_fifo_segment_main_init (sm, 0x200000000ULL, 20); + svm_fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20); vec_validate (utm->rx_buf, 128 << 10); utm->session_index_by_vpp_handles = hash_create (0, sizeof (uword)); 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++; } })); diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c index cb15f0c762d..1727c28cca1 100644 --- a/src/vlibmemory/memory_api.c +++ b/src/vlibmemory/memory_api.c @@ -326,8 +326,8 @@ vl_api_memclnt_delete_t_handler (vl_api_memclnt_delete_t * mp) if (am->vlib_private_rps[i] == svm) { /* Note: account for the memfd header page */ - u64 virtual_base = svm->virtual_base - MMAP_PAGESIZE; - u64 virtual_size = svm->virtual_size + MMAP_PAGESIZE; + uword virtual_base = svm->virtual_base - MMAP_PAGESIZE; + uword virtual_size = svm->virtual_size + MMAP_PAGESIZE; /* * Kill the registration pool element before we make @@ -650,8 +650,8 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now) int i; svm_region_t *dead_rp = (*regpp)->vlib_rp; /* Note: account for the memfd header page */ - u64 virtual_base = dead_rp->virtual_base - MMAP_PAGESIZE; - u64 virtual_size = dead_rp->virtual_size + MMAP_PAGESIZE; + uword virtual_base = dead_rp->virtual_base - MMAP_PAGESIZE; + uword virtual_size = dead_rp->virtual_size + MMAP_PAGESIZE; /* For horizontal scaling, add a hash table... */ for (i = 0; i < vec_len (am->vlib_private_rps); i++) diff --git a/src/vnet/classify/vnet_classify.h b/src/vnet/classify/vnet_classify.h index 4fea95d5b72..2bc1224c72e 100644 --- a/src/vnet/classify/vnet_classify.h +++ b/src/vnet/classify/vnet_classify.h @@ -149,6 +149,7 @@ typedef struct typedef struct { + CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); /* Mask to apply after skipping N vectors */ u32x4 *mask; /* Buckets and entries */ diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h index 5fc521672d9..e401f2ddcd7 100644 --- a/src/vnet/devices/virtio/virtio.h +++ b/src/vnet/devices/virtio/virtio.h @@ -73,6 +73,7 @@ typedef enum typedef struct { + CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); struct vring_desc *desc; struct vring_used *used; struct vring_avail *avail; diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c index a7ce2798f2a..f9acfeff389 100755 --- a/src/vnet/ip/ip6_neighbor.c +++ b/src/vnet/ip/ip6_neighbor.c @@ -2348,7 +2348,7 @@ create_buffer_for_rs (vlib_main_t * vm, ip6_radv_t * radv_info) rh->ip.hop_limit = 255; rh->ip.src_address = radv_info->link_local_address; /* set address ff02::2 */ - rh->ip.dst_address.as_u64[0] = clib_host_to_net_u64 (0xff02L << 48); + rh->ip.dst_address.as_u64[0] = clib_host_to_net_u64 (0xff02ULL << 48); rh->ip.dst_address.as_u64[1] = clib_host_to_net_u64 (2); rh->neighbor.icmp.checksum = ip6_tcp_udp_icmp_compute_checksum (vm, p0, diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index 01dc818216d..19c8fa2f2e0 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -1695,14 +1695,14 @@ failed: return rv; } -static uword +static u64 application_client_local_connect_key (local_session_t * ls) { - return ((uword) ls->app_wrk_index << 32 | (uword) ls->session_index); + return (((u64) ls->app_wrk_index) << 32 | (u64) ls->session_index); } static void -application_client_local_connect_key_parse (uword key, u32 * app_wrk_index, +application_client_local_connect_key_parse (u64 key, u32 * app_wrk_index, u32 * session_index) { *app_wrk_index = key >> 32; @@ -1718,7 +1718,7 @@ application_local_session_connect_notify (local_session_t * ls) application_t *client; int rv, is_fail = 0; u64 segment_handle; - uword client_key; + u64 client_key; client_wrk = app_worker_get (ls->client_wrk_index); server_wrk = app_worker_get (ls->app_wrk_index); @@ -1759,7 +1759,7 @@ application_local_session_cleanup (app_worker_t * client_wrk, svm_fifo_segment_private_t *seg; stream_session_t *listener; segment_manager_t *sm; - uword client_key; + u64 client_key; u8 has_transport; /* Retrieve listener transport type as it is the one that decides where @@ -2179,7 +2179,7 @@ app_worker_format_local_connects (app_worker_t * app, int verbose) u32 app_wrk_index, session_index; app_worker_t *server_wrk; local_session_t *ls; - uword client_key; + u64 client_key; u64 value; /* Header */ diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c index 2b8a7326ea7..e48e951722d 100644 --- a/src/vnet/session/segment_manager.c +++ b/src/vnet/session/segment_manager.c @@ -186,7 +186,7 @@ segment_manager_add_segment (segment_manager_t * sm, u32 segment_size) segment_manager_main_t *smm = &segment_manager_main; u32 rnd_margin = 128 << 10, seg_index, page_size; segment_manager_properties_t *props; - uword baseva = (u64) ~ 0, alloc_size; + uword baseva = (uword) ~ 0ULL, alloc_size; svm_fifo_segment_private_t *seg; u8 *seg_name; int rv; @@ -735,8 +735,8 @@ segment_manager_show_fn (vlib_main_t * vm, unformat_input_t * input, svm_fifo_segment_private_t *seg; segment_manager_t *sm; u8 show_segments = 0, verbose = 0; - uword address; - u64 size; + char *address; + size_t size; u32 active_fifos; u32 free_fifos; diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index d30254e5fc0..4cf0f9e7e49 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -1539,9 +1539,14 @@ clib_error_t * session_manager_main_init (vlib_main_t * vm) { session_manager_main_t *smm = &session_manager_main; - smm->session_baseva = 0x200000000ULL; - smm->session_va_space_size = (u64) 128 << 30; + smm->session_baseva = HIGH_SEGMENT_BASEVA; +#if (HIGH_SEGMENT_BASEVA > (4ULL << 30)) + smm->session_va_space_size = 128ULL << 30; smm->evt_qs_segment_size = 64 << 20; +#else + smm->session_va_space_size = 128 << 20; + smm->evt_qs_segment_size = 1 << 20; +#endif smm->is_enabled = 0; return 0; } diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index a01f01c8bcb..98965f334af 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -589,8 +589,8 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node, } ctx->snd_space = transport_connection_snd_space (ctx->tc, - vm-> - clib_time.last_cpu_time, + vm->clib_time. + last_cpu_time, ctx->snd_mss); if (ctx->snd_space == 0 || ctx->snd_mss == 0) { @@ -1008,7 +1008,8 @@ dump_thread_0_event_queue (void) case FIFO_EVENT_RPC: fformat (stdout, "[%04d] RPC call %llx with %llx\n", - i, (u64) (e->rpc_args.fp), (u64) (e->rpc_args.arg)); + i, (u64) (uword) (e->rpc_args.fp), + (u64) (uword) (e->rpc_args.arg)); break; default: diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h index 95dadd9c09d..8aec1f16beb 100644 --- a/src/vppinfra/clib.h +++ b/src/vppinfra/clib.h @@ -81,6 +81,9 @@ #define CLIB_PACKED(x) x __attribute__ ((packed)) #define CLIB_UNUSED(x) x __attribute__ ((unused)) +/* similar to CLIB_CACHE_LINE_ALIGN_MARK() but with arbitrary alignment */ +#define CLIB_ALIGN_MARK(name, alignment) u8 name[0] __attribute__((aligned(alignment))) + /* Make a string from the macro's argument */ #define CLIB_STRING_MACRO(x) #x diff --git a/src/vppinfra/crc32.h b/src/vppinfra/crc32.h index 5f4d94f3847..fec67cd9757 100644 --- a/src/vppinfra/crc32.h +++ b/src/vppinfra/crc32.h @@ -30,14 +30,14 @@ clib_crc32c (u8 * s, int len) { u32 v = 0; -#if __x86_64__ +#if defined(__x86_64__) for (; len >= 8; len -= 8, s += 8) v = _mm_crc32_u64 (v, *((u64 *) s)); #else /* workaround weird GCC bug when using _mm_crc32_u32 which happens with -O2 optimization */ #if !defined (__i686__) - volatile ("":::"memory"); + asm volatile ("":::"memory"); #endif #endif diff --git a/src/vppinfra/cuckoo_template.h b/src/vppinfra/cuckoo_template.h index eccbde108c4..c3b2bc98aaa 100644 --- a/src/vppinfra/cuckoo_template.h +++ b/src/vppinfra/cuckoo_template.h @@ -291,7 +291,7 @@ typedef struct CV (clib_cuckoo) } CVT (clib_cuckoo); void CV (clib_cuckoo_init) (CVT (clib_cuckoo) * h, const char *name, - u64 nbuckets, + uword nbuckets, void (*garbage_callback) (CVT (clib_cuckoo) *, void *), void *garbage_ctx); diff --git a/src/vppinfra/dlmalloc.c b/src/vppinfra/dlmalloc.c index 8a07621b7a5..9ed1e04f776 100644 --- a/src/vppinfra/dlmalloc.c +++ b/src/vppinfra/dlmalloc.c @@ -4089,8 +4089,7 @@ size_t destroy_mspace(mspace msp) { return freed; } -void mspace_get_address_and_size (mspace msp, unsigned long long *addrp, - unsigned long long *sizep) +void mspace_get_address_and_size (mspace msp, char **addrp, size_t *sizep) { mstate ms; msegment *this_seg; @@ -4098,7 +4097,7 @@ void mspace_get_address_and_size (mspace msp, unsigned long long *addrp, ms = (mstate)msp; this_seg = &ms->seg; - *addrp = (unsigned long long) this_seg->base; + *addrp = this_seg->base; *sizep = this_seg->size; } @@ -4157,11 +4156,11 @@ int mspace_enable_disable_trace (mspace msp, int enable) } void* mspace_get_aligned (mspace msp, - unsigned long long n_user_data_bytes, - unsigned long long align, - unsigned long long align_offset) { + unsigned long n_user_data_bytes, + unsigned long align, + unsigned long align_offset) { char *rv; - unsigned long long searchp; + unsigned long searchp; unsigned *wwp; /* "where's Waldo" pointer */ mstate ms = (mstate)msp; @@ -4183,7 +4182,7 @@ void* mspace_get_aligned (mspace msp, mchunkptr p = mem2chunk(rv); size_t psize = chunksize(p); - mheap_get_trace ((u64)rv + sizeof (unsigned), psize); + mheap_get_trace ((unsigned long)rv + sizeof (unsigned), psize); } wwp = (unsigned *)rv; @@ -4201,7 +4200,7 @@ void* mspace_get_aligned (mspace msp, * Waldo is the address of the chunk of memory returned by mspace_malloc, * which we need later to call mspace_free... */ - if (align > 4<<10 || align_offset == ~0ULL) { + if (align > 4<<10 || align_offset == ~0UL) { n_user_data_bytes -= sizeof(unsigned); assert(align_offset == 0); rv = internal_memalign(ms, (size_t)align, n_user_data_bytes); @@ -4210,7 +4209,7 @@ void* mspace_get_aligned (mspace msp, if (rv && use_trace(ms)) { mchunkptr p = mem2chunk(rv); size_t psize = chunksize(p); - mheap_get_trace ((u64)rv, psize); + mheap_get_trace ((unsigned long)rv, psize); } return rv; } @@ -4228,7 +4227,7 @@ void* mspace_get_aligned (mspace msp, return rv; /* Honor the alignment request */ - searchp = (unsigned long long)(rv + sizeof (unsigned)); + searchp = (unsigned long)(rv + sizeof (unsigned)); #if 0 /* this is the idea... */ while ((searchp + align_offset) % align) @@ -4236,7 +4235,7 @@ void* mspace_get_aligned (mspace msp, #endif { - unsigned long long where_now, delta; + unsigned long where_now, delta; where_now = (searchp + align_offset) % align; delta = align - where_now; @@ -4245,13 +4244,13 @@ void* mspace_get_aligned (mspace msp, } wwp = (unsigned *)(searchp - sizeof(unsigned)); - *wwp = (searchp - (((unsigned long long) rv) + sizeof (*wwp))); + *wwp = (searchp - (((unsigned long) rv) + sizeof (*wwp))); assert (*wwp < align); if (use_trace(ms)) { mchunkptr p = mem2chunk(rv); size_t psize = chunksize(p); - mheap_get_trace ((u64)rv, psize); + mheap_get_trace ((unsigned long)rv, psize); } return (void *) searchp; } @@ -4276,7 +4275,7 @@ void mspace_put (mspace msp, void *p_arg) mchunkptr p = mem2chunk(object_header); size_t psize = chunksize(p); - mheap_put_trace ((u64)p_arg, psize); + mheap_put_trace ((unsigned long)p_arg, psize); } #if CLIB_DEBUG > 0 @@ -4300,7 +4299,7 @@ void mspace_put_no_offset (mspace msp, void *p_arg) mchunkptr p = mem2chunk(p_arg); size_t psize = chunksize(p); - mheap_put_trace ((u64)p_arg, psize); + mheap_put_trace ((unsigned long)p_arg, psize); } mspace_free (msp, p_arg); } diff --git a/src/vppinfra/dlmalloc.h b/src/vppinfra/dlmalloc.h index b7a8eea80a0..216df4737ca 100644 --- a/src/vppinfra/dlmalloc.h +++ b/src/vppinfra/dlmalloc.h @@ -1448,22 +1448,20 @@ DLMALLOC_EXPORT int mspace_trim(mspace msp, size_t pad); DLMALLOC_EXPORT int mspace_mallopt(int, int); DLMALLOC_EXPORT void* mspace_get_aligned (mspace msp, - unsigned long long n_user_data_bytes, - unsigned long long align, - unsigned long long align_offset); + unsigned long n_user_data_bytes, + unsigned long align, + unsigned long align_offset); DLMALLOC_EXPORT int mspace_is_heap_object (mspace msp, void *p); -DLMALLOC_EXPORT void mspace_get_address_and_size (mspace msp, - unsigned long long *addrp, - unsigned long long *sizep); +DLMALLOC_EXPORT void mspace_get_address_and_size (mspace msp, char **addrp, size_t *sizep); DLMALLOC_EXPORT void mspace_put (mspace msp, void *p); DLMALLOC_EXPORT void mspace_put_no_offset (mspace msp, void *p); DLMALLOC_EXPORT size_t mspace_usable_size_with_delta (const void *p); DLMALLOC_EXPORT void mspace_disable_expand (mspace msp); DLMALLOC_EXPORT void *mspace_least_addr (mspace msp); -DLMALLOC_EXPORT void mheap_get_trace (u64 offset, u64 size); -DLMALLOC_EXPORT void mheap_put_trace (u64 offset, u64 size); +DLMALLOC_EXPORT void mheap_get_trace (uword offset, uword size); +DLMALLOC_EXPORT void mheap_put_trace (uword offset, uword size); DLMALLOC_EXPORT int mspace_enable_disable_trace (mspace msp, int enable); #endif /* MSPACES */ |