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;
u8 boundary;
u8 disabled;
u8 resources;
-} crypto_alg_t __attribute__ ((aligned (8)));
+} crypto_alg_t;
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;
/*
* 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)
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;
typedef struct
{
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
/* ring data */
memif_ring_t *ring;
memif_log2_ring_size_t log2_ring_size;
typedef struct
{
+ CLIB_ALIGN_MARK (pad, 16); /* align up to 16 bytes for 32bit builds */
void *data;
u32 data_len;
i16 buffer_offset;
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)
;
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);
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);
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;
{
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;
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
}
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)
{
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;
}
}
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);
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)
{
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)
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);
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));
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;
_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;
_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;
_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;
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;
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;
}
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;
}
{
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;
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;
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;
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;
}
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;
}
}
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;
}
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
&vcl_cfg->heapsize))
{
VCFG_DBG (0, "VCL<%d>: configured heapsize %lu", getpid (),
- vcl_cfg->heapsize);
+ (unsigned long) vcl_cfg->heapsize);
}
else
if (unformat
&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))
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))
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 "
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))
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;
_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);
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;
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;
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;
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;
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;
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;
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;
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)
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++;
}
}));
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++;
}
}));
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
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++)
typedef struct
{
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
/* Mask to apply after skipping N vectors */
u32x4 *mask;
/* Buckets and entries */
typedef struct
{
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
struct vring_desc *desc;
struct vring_used *used;
struct vring_avail *avail;
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,
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;
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);
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
u32 app_wrk_index, session_index;
app_worker_t *server_wrk;
local_session_t *ls;
- uword client_key;
+ u64 client_key;
u64 value;
/* Header */
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;
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;
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;
}
}
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)
{
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:
#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
{
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
} 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);
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;
ms = (mstate)msp;
this_seg = &ms->seg;
- *addrp = (unsigned long long) this_seg->base;
+ *addrp = this_seg->base;
*sizep = this_seg->size;
}
}
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;
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;
* 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);
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;
}
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)
#endif
{
- unsigned long long where_now, delta;
+ unsigned long where_now, delta;
where_now = (searchp + align_offset) % align;
delta = align - where_now;
}
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;
}
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
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);
}
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 */