libmemif: version 3.0

Add support for multi-thread connection establishment.

- control_fd_update() callback now passes private context
  associated with updated file descriptor. File descriptor
  can belong to memif socket, memif connection or timerfd.
  In case of timerfd the context is NULL.

- memif_create_socket() new API. Creates memif socket
  handle to be passed to memif_create() in memif_conn_args_t.
  This API allows to pass private context whenever the file
  descriptor is updated.

- memif_delete_socket() new API. Deletes memif socket.
  Socket must not be in use by any interface.

Type: feature

Change-Id: I7ca4e4349595d4477195f1c32403d3e3a6eb5361
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
diff --git a/extras/libmemif/examples/icmp_responder-epoll/main.c b/extras/libmemif/examples/icmp_responder-epoll/main.c
index ecc05a4..0e9d96e 100644
--- a/extras/libmemif/examples/icmp_responder-epoll/main.c
+++ b/extras/libmemif/examples/icmp_responder-epoll/main.c
@@ -304,7 +304,7 @@
 /* user needs to watch new fd or stop watching fd that is about to be closed.
     control fd will be modified during connection establishment to minimize CPU usage */
 int
-control_fd_update (int fd, uint8_t events)
+control_fd_update (int fd, uint8_t events, void *ctx)
 {
   /* convert memif event definitions to epoll events */
   if (events & MEMIF_FD_EVENT_DEL)
@@ -436,7 +436,7 @@
     INFO ("memif_buffer_free: %s", memif_strerror (err));
   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;
 }
 
@@ -521,7 +521,7 @@
 	  rx -= j;
 
 	  DBG ("freed %d buffers. %u/%u alloc/free buffers",
-	       fb, rx, MAX_MEMIF_BUFS - rx);
+	       rx, rx, MAX_MEMIF_BUFS - rx);
 
 	  /* transmit allocated buffers */
 	  err = memif_tx_burst (c->conn, qid, c->tx_bufs, j, &tx);
@@ -545,7 +545,7 @@
     INFO ("memif_buffer_free: %s", memif_strerror (err));
   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;
 }
 
@@ -612,7 +612,7 @@
     INFO ("memif_buffer_free: %s", memif_strerror (err));
   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;
 }