summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-12-09 12:51:13 -0800
committerDamjan Marion <dmarion@me.com>2020-12-26 16:58:10 +0000
commitaf588825ba4586fadbdb742953ca640e94cd59ef (patch)
treefc4e36bd9b9ef760247ec6e8ab41ba70f9e84152 /src/plugins
parent2c1084a69bccac812bf2d763b113d1e5b7f08686 (diff)
svm: change fifo pointers to offsets
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I113a630d6db4741f54e508f7e0ed77be139df0e4
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/unittest/session_test.c2
-rw-r--r--src/plugins/unittest/svm_fifo_test.c21
2 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c
index 862d81f4acb..f54ed9ff1ac 100644
--- a/src/plugins/unittest/session_test.c
+++ b/src/plugins/unittest/session_test.c
@@ -1850,7 +1850,7 @@ session_test_mq_speed (vlib_main_t * vm, unformat_input_t * input)
s.rx_fifo = rx_fifo;
s.tx_fifo = tx_fifo;
s.session_state = SESSION_STATE_READY;
- counter = (u64 *) rx_fifo->shr->head_chunk->data;
+ counter = (u64 *) f_head_cptr (rx_fifo)->data;
start = vlib_time_now (vm);
pid = fork ();
diff --git a/src/plugins/unittest/svm_fifo_test.c b/src/plugins/unittest/svm_fifo_test.c
index 978dc10ff99..b798cc8baa9 100644
--- a/src/plugins/unittest/svm_fifo_test.c
+++ b/src/plugins/unittest/svm_fifo_test.c
@@ -1412,13 +1412,13 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (rv == 2, "should have 2 chunks has %u", rv);
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
- c = f->shr->head_chunk;
+ c = f_head_cptr (f);
SFIFO_TEST (c->start_byte == 0, "head start byte should be %u", 0);
SFIFO_TEST (c->length == 4096, "head chunk length should be %u", 4096);
SFIFO_TEST (f->shr->tail_chunk == 0, "no tail chunk");
SFIFO_TEST (f->ooo_enq == 0, "should have no ooo enq chunk");
SFIFO_TEST (f->ooo_deq == 0, "should have no ooo deq chunk");
- c = f->shr->end_chunk;
+ c = f_end_cptr (f);
SFIFO_TEST (c->start_byte == last_start_byte, "end chunk start byte should"
" be %u", last_start_byte);
SFIFO_TEST (c->length == 4096, "end chunk length should be %u", 4096);
@@ -1466,7 +1466,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (f->shr->tail_chunk != 0, "should have no tail chunk");
SFIFO_TEST (f->ooo_enq != 0, "should have an ooo enq chunk");
- c = f->shr->end_chunk;
+ c = f_end_cptr (f);
SFIFO_TEST (c->start_byte == last_start_byte,
"end chunk should start at %u", last_start_byte);
SFIFO_TEST (c->length == 8192, "end chunk length should be %u", 8192);
@@ -1580,7 +1580,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (f->shr->tail_chunk != 0, "should have no tail chunk");
SFIFO_TEST (f->ooo_enq != 0, "should have an ooo enq chunk");
- c = f->shr->end_chunk;
+ c = f_end_cptr (f);
SFIFO_TEST (c->start_byte == last_start_byte,
"end chunk should start at %u", last_start_byte);
SFIFO_TEST (c->length == 16384, "end chunk length should be %u", 16384);
@@ -1623,7 +1623,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
last_start_byte += 16384;
- c = f->shr->end_chunk;
+ c = f_end_cptr (f);
SFIFO_TEST (c->start_byte == last_start_byte,
"end chunk should start at %u", last_start_byte);
SFIFO_TEST (c->length == 4096, "end chunk length should be %u", 4096);
@@ -1673,7 +1673,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
last_start_byte += 4096;
- c = f->shr->end_chunk;
+ c = f_end_cptr (f);
SFIFO_TEST (c->start_byte == last_start_byte,
"end chunk should start at %u", last_start_byte);
SFIFO_TEST (c->length == 16384, "end chunk length should be %u", 16384);
@@ -1941,12 +1941,13 @@ sfifo_test_fifo_indirect (vlib_main_t * vm, unformat_input_t * input)
svm_fifo_set_size (f, fifo_size);
validate_test_and_buf_vecs (&test_data, &data_buf, fifo_size);
- c = f->shr->start_chunk;
+ c = f_start_cptr (f);
SFIFO_TEST (c->next == 0, "no next");
svm_fifo_fill_chunk_list (f);
SFIFO_TEST (c->next != 0, "new chunk should've been allocated");
- SFIFO_TEST (c->next->length == 4 << 20, "new chunk should be 4MB");
+ SFIFO_TEST (f_cptr (f, c->next)->length == 4 << 20,
+ "new chunk should be 4MB");
rv = svm_fifo_max_write_chunk (f);
SFIFO_TEST (rv == 4096, "max write chunk %u", rv);
@@ -1958,7 +1959,7 @@ sfifo_test_fifo_indirect (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
c = svm_fifo_tail_chunk (f);
- SFIFO_TEST (c == f->shr->end_chunk, "tail is end chunk");
+ SFIFO_TEST (c == f_end_cptr (f), "tail is end chunk");
/* Initialize head chunk */
rv = svm_fifo_max_read_chunk (f);
@@ -1972,7 +1973,7 @@ sfifo_test_fifo_indirect (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (rv == 4096, "dequeue should work");
c = svm_fifo_head_chunk (f);
- SFIFO_TEST (c == f->shr->end_chunk, "head chunk should be last");
+ SFIFO_TEST (c == f_end_cptr (f), "head chunk should be last");
rv = svm_fifo_max_read_chunk (f);
SFIFO_TEST (rv == 0, "max read chunk %u", rv);