icmpr_memif_delete ()
{
int err;
- /* disconenct then delete memif connection */
+ /* disconnect then delete memif connection */
err = memif_delete (&(&memif_connection)->conn);
if (err != MEMIF_ERR_SUCCESS)
INFO ("memif_delete: %s", memif_strerror (err));
memif_connection_t *c = &memif_connection;
int err;
uint16_t r;
- /* set data pointer to shared memory and set buffer_len to shared mmeory buffer len */
+ /* set data pointer to shared memory and set buffer_len to shared memory buffer len */
err = memif_buffer_alloc (c->conn, qid, c->tx_bufs, n, &r, 0);
if (err != MEMIF_ERR_SUCCESS)
{
&(c->tx_bufs + i)->len, c->ip_addr);
}
- uint16_t fb;
/* mark memif buffers and shared memory buffers as free */
err = memif_refill_queue (c->conn, qid, rx, 0);
- c->rx_buf_num -= fb;
+ /*
+ * In this example we can assert that c->conn points to valid connection
+ * and 'rx <= c->rx_buf_num'.
+ */
+ c->rx_buf_num -= rx;
DBG ("freed %d buffers. %u/%u alloc/free buffers",
- fb, c->rx_buf_num, MAX_MEMIF_BUFS - c->rx_buf_num);
+ rx, c->rx_buf_num, MAX_MEMIF_BUFS - c->rx_buf_num);
icmpr_tx_burst (c->tx_qid);
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 -= fb;
+ c->rx_buf_num -= rx;
DBG ("freed %d buffers. %u/%u alloc/free buffers",
- fb, c->rx_buf_num, MAX_MEMIF_BUFS - c->rx_buf_num);
+ rx, c->rx_buf_num, MAX_MEMIF_BUFS - c->rx_buf_num);
return 0;
}
{
/* setting memif connection arguments */
memif_conn_args_t args;
- int fd = -1;
memset (&args, 0, sizeof (args));
args.is_master = is_master;
args.log2_ring_size = 10;