summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extras/libmemif/src/main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
index cb07bf6eb2f..6f9ba2fe229 100644
--- a/extras/libmemif/src/main.c
+++ b/extras/libmemif/src/main.c
@@ -1258,6 +1258,7 @@ memif_init_queues (memif_connection_t *conn)
int i, j;
memif_ring_t *ring;
memif_socket_t *ms = (memif_socket_t *) conn->args.socket;
+ uint32_t ring_size = 1 << conn->run_args.log2_ring_size;
for (i = 0; i < conn->run_args.num_s2m_rings; i++)
{
@@ -1266,9 +1267,11 @@ memif_init_queues (memif_connection_t *conn)
ring->head = ring->tail = 0;
ring->cookie = MEMIF_COOKIE;
ring->flags = 0;
- for (j = 0; j < (1 << conn->run_args.log2_ring_size); j++)
+ uint32_t base = i;
+ uint32_t ring_offset = base * ring_size;
+ for (j = 0; j < ring_size; j++)
{
- uint16_t slot = i * (1 << conn->run_args.log2_ring_size) + j;
+ uint32_t slot = ring_offset + j;
ring->desc[j].region = 1;
ring->desc[j].offset =
conn->regions[1].buffer_offset +
@@ -1283,10 +1286,11 @@ memif_init_queues (memif_connection_t *conn)
ring->head = ring->tail = 0;
ring->cookie = MEMIF_COOKIE;
ring->flags = 0;
- for (j = 0; j < (1 << conn->run_args.log2_ring_size); j++)
+ uint32_t base = conn->run_args.num_s2m_rings + i;
+ uint32_t ring_offset = base * ring_size;
+ for (j = 0; j < ring_size; j++)
{
- uint16_t slot = (i + conn->run_args.num_s2m_rings) *
- (1 << conn->run_args.log2_ring_size) + j;
+ uint32_t slot = ring_offset + j;
ring->desc[j].region = 1;
ring->desc[j].offset =
conn->regions[1].buffer_offset +