summaryrefslogtreecommitdiffstats
path: root/src/svm
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-12-11 14:27:53 -0800
committerDave Barach <openvpp@barachs.net>2019-12-12 17:38:30 +0000
commitef4f3e7fea359f651c548182a7597abc066ca372 (patch)
treebf66226604821074452caaac343868784d261d55 /src/svm
parent38277e407148dca4ca79784a2e8c29d486425829 (diff)
session svm: support for segments larger than 4GB
Type: feature Change-Id: I7d3017bbb369261d74f51807a226f2c12f45291c Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/svm')
-rw-r--r--src/svm/fifo_segment.c14
-rw-r--r--src/svm/fifo_segment.h6
-rw-r--r--src/svm/ssvm.c3
-rw-r--r--src/svm/ssvm.h2
4 files changed, 12 insertions, 13 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index 95b88836ddb..01fa65623c5 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -25,7 +25,7 @@
* @param fs fifo segment
* @return number of free bytes
*/
-static u32
+static uword
fs_free_space (fifo_segment_t * fs)
{
struct dlmallinfo dlminfo;
@@ -870,7 +870,7 @@ fifo_segment_update_free_bytes (fifo_segment_t * fs)
clib_atomic_store_rel_n (&fsh->n_free_bytes, fs_free_space (fs));
}
-u32
+uword
fifo_segment_free_bytes (fifo_segment_t * fs)
{
return fsh_n_free_bytes (fs->h);
@@ -943,11 +943,11 @@ format_fifo_segment_type (u8 * s, va_list * args)
u8 *
format_fifo_segment (u8 * s, va_list * args)
{
- u32 count, indent, active_fifos, free_fifos, fifo_hdr = 0, chunk_size;
+ u32 count, indent, active_fifos, free_fifos, fifo_hdr = 0;
fifo_segment_t *fs = va_arg (*args, fifo_segment_t *);
int verbose __attribute__ ((unused)) = va_arg (*args, int);
- u32 est_chunk_bytes, est_free_seg_bytes, free_chunks;
- uword chunk_bytes = 0, free_seg_bytes;
+ uword est_chunk_bytes, est_free_seg_bytes, free_chunks;
+ uword chunk_bytes = 0, free_seg_bytes, chunk_size;
fifo_segment_header_t *fsh;
fifo_segment_slice_t *fss;
svm_fifo_chunk_t *c;
@@ -1020,11 +1020,11 @@ format_fifo_segment (u8 * s, va_list * args)
fifo_segment_update_free_bytes (fs);
free_seg_bytes = fifo_segment_free_bytes (fs);
- s = format (s, "\n%Useg free bytes: %U (%u) estimated: %U (%u)\n",
+ s = format (s, "\n%Useg free bytes: %U (%lu) estimated: %U (%lu)\n",
format_white_space, indent + 2, format_memory_size,
free_seg_bytes, free_seg_bytes, format_memory_size,
est_free_seg_bytes, est_free_seg_bytes);
- s = format (s, "%Uchunk free bytes: %U (%lu) estimated: %U (%u)\n",
+ s = format (s, "%Uchunk free bytes: %U (%lu) estimated: %U (%lu)\n",
format_white_space, indent + 2, format_memory_size, chunk_bytes,
chunk_bytes, format_memory_size, est_chunk_bytes,
est_chunk_bytes);
diff --git a/src/svm/fifo_segment.h b/src/svm/fifo_segment.h
index ff36f45c4f2..d363c6058a7 100644
--- a/src/svm/fifo_segment.h
+++ b/src/svm/fifo_segment.h
@@ -42,7 +42,7 @@ typedef struct fifo_segment_slice_
svm_fifo_t *fifos; /**< Linked list of active RX fifos */
svm_fifo_t *free_fifos; /**< Freelists by fifo size */
svm_fifo_chunk_t **free_chunks; /**< Freelists by chunk size */
- u32 n_fl_chunk_bytes; /**< Chunk bytes on freelist */
+ uword n_fl_chunk_bytes; /**< Chunk bytes on freelist */
} fifo_segment_slice_t;
typedef struct
@@ -66,7 +66,7 @@ typedef struct
typedef struct
{
fifo_segment_t *segments; /**< pool of fifo segments */
- u64 next_baseva; /**< Where to put the next one */
+ uword next_baseva; /**< Where to put the next one */
u32 timeout_in_seconds; /**< Time to wait during attach */
} fifo_segment_main_t;
@@ -186,7 +186,7 @@ int fifo_segment_collect_fifo_chunks (fifo_segment_t * fs, svm_fifo_t * f);
* @param fs fifo segment
* @return free bytes estimate
*/
-u32 fifo_segment_free_bytes (fifo_segment_t * fs);
+uword fifo_segment_free_bytes (fifo_segment_t * fs);
/**
* Update fifo segment free bytes estimate
diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c
index a16965e5e67..737d2344402 100644
--- a/src/svm/ssvm.c
+++ b/src/svm/ssvm.c
@@ -347,9 +347,8 @@ ssvm_delete_memfd (ssvm_private_t * memfd)
int
ssvm_master_init_private (ssvm_private_t * ssvm)
{
+ uword pagesize = clib_mem_get_page_size (), rnd_size = 0;
ssvm_shared_header_t *sh;
- u32 pagesize = clib_mem_get_page_size ();
- u32 rnd_size = 0;
u8 *heap;
rnd_size = clib_max (ssvm->ssvm_size + (pagesize - 1), ssvm->ssvm_size);
diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h
index 60e0cc61ca4..82951d614b0 100644
--- a/src/svm/ssvm.h
+++ b/src/svm/ssvm.h
@@ -82,7 +82,7 @@ typedef struct
typedef struct
{
ssvm_shared_header_t *sh;
- u64 ssvm_size;
+ uword ssvm_size;
u32 my_pid;
u8 *name;
uword requested_va;