summaryrefslogtreecommitdiffstats
path: root/extras/libmemif/examples/icmp_responder-epoll/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'extras/libmemif/examples/icmp_responder-epoll/main.c')
-rw-r--r--extras/libmemif/examples/icmp_responder-epoll/main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/extras/libmemif/examples/icmp_responder-epoll/main.c b/extras/libmemif/examples/icmp_responder-epoll/main.c
index 1dab51f4f23..fd354a38aaf 100644
--- a/extras/libmemif/examples/icmp_responder-epoll/main.c
+++ b/extras/libmemif/examples/icmp_responder-epoll/main.c
@@ -282,6 +282,7 @@ int
on_connect (memif_conn_handle_t conn, void *private_ctx)
{
INFO ("memif connected!");
+ memif_refill_queue (conn, 0, -1, 0);
enable_log = 1;
return 0;
}
@@ -384,6 +385,7 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
}
i = 0;
+ memset (c->tx_bufs, 0, sizeof (memif_buffer_t) * rx);
err = memif_buffer_alloc (c->conn, qid, c->tx_bufs, rx, &tx, 128);
if ((err != MEMIF_ERR_SUCCESS) && (err != MEMIF_ERR_NOBUF_RING))
{
@@ -404,7 +406,7 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
tx--;
}
- err = memif_refill_queue (c->conn, qid, rx);
+ err = memif_refill_queue (c->conn, qid, rx, 0);
if (err != MEMIF_ERR_SUCCESS)
INFO ("memif_buffer_free: %s", memif_strerror (err));
rx -= rx;
@@ -426,7 +428,7 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
return 0;
error:
- err = memif_refill_queue (c->conn, qid, rx);
+ err = memif_refill_queue (c->conn, qid, rx, 0);
if (err != MEMIF_ERR_SUCCESS)
INFO ("memif_buffer_free: %s", memif_strerror (err));
c->rx_buf_num -= rx;
@@ -512,7 +514,7 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
}
/* mark memif buffers and shared memory buffers as free */
/* free processed buffers */
- err = memif_refill_queue (c->conn, qid, j);
+ err = memif_refill_queue (c->conn, qid, j, 0);
if (err != MEMIF_ERR_SUCCESS)
INFO ("memif_buffer_free: %s", memif_strerror (err));
rx -= j;
@@ -538,7 +540,7 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
return 0;
error:
- err = memif_refill_queue (c->conn, qid, rx);
+ err = memif_refill_queue (c->conn, qid, rx, 0);
if (err != MEMIF_ERR_SUCCESS)
INFO ("memif_buffer_free: %s", memif_strerror (err));
c->rx_buf_num -= rx;
@@ -595,7 +597,7 @@ on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
}
}
- err = memif_refill_queue (c->conn, qid, rx);
+ err = memif_refill_queue (c->conn, qid, rx, 0);
if (err != MEMIF_ERR_SUCCESS)
INFO ("memif_buffer_free: %s", memif_strerror (err));
c->rx_buf_num -= rx;
@@ -607,7 +609,7 @@ on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
return 0;
error:
- err = memif_refill_queue (c->conn, qid, rx);
+ err = memif_refill_queue (c->conn, qid, rx, 0);
if (err != MEMIF_ERR_SUCCESS)
INFO ("memif_buffer_free: %s", memif_strerror (err));
c->rx_buf_num -= rx;