diff --git a/extras/libmemif/examples/icmp_responder-epoll/main.c b/extras/libmemif/examples/icmp_responder-epoll/main.c
index 80a7f7e..634e180 100644
--- a/extras/libmemif/examples/icmp_responder-epoll/main.c
+++ b/extras/libmemif/examples/icmp_responder-epoll/main.c
@@ -185,6 +185,10 @@
 	{
 	  printf ("\t\tqueue id: %u\n", md.rx_queues[e].qid);
 	  printf ("\t\tring size: %u\n", md.rx_queues[e].ring_size);
+	  printf ("\t\tring rx mode: %s\n",
+		  md.rx_queues[e].flags ? "polling" : "interrupt");
+	  printf ("\t\tring head: %u\n", md.rx_queues[e].head);
+	  printf ("\t\tring tail: %u\n", md.rx_queues[e].tail);
 	  printf ("\t\tbuffer size: %u\n", md.rx_queues[e].buffer_size);
 	}
       printf ("\ttx queues:\n");
@@ -192,6 +196,10 @@
 	{
 	  printf ("\t\tqueue id: %u\n", md.tx_queues[e].qid);
 	  printf ("\t\tring size: %u\n", md.tx_queues[e].ring_size);
+	  printf ("\t\tring rx mode: %s\n",
+		  md.tx_queues[e].flags ? "polling" : "interrupt");
+	  printf ("\t\tring head: %u\n", md.tx_queues[e].head);
+	  printf ("\t\tring tail: %u\n", md.tx_queues[e].tail);
 	  printf ("\t\tbuffer size: %u\n", md.tx_queues[e].buffer_size);
 	}
       printf ("\tlink: ");
@@ -1213,7 +1221,7 @@
     }
   else
     {
-      DBG ("unknown command: %s", ui);
+      INFO ("unknown command: %s", ui);
       goto done;
     }
 
diff --git a/extras/libmemif/src/libmemif.h b/extras/libmemif/src/libmemif.h
index 3fc0648..796d121 100644
--- a/extras/libmemif/src/libmemif.h
+++ b/extras/libmemif/src/libmemif.h
@@ -200,14 +200,21 @@
 /** \brief Memif queue details
     @param qid - queue id
     @param ring_size - size of ring buffer in sharem memory
+    @param flags - ring flags
+    @param head - ring head pointer
+    @param tail - ring tail pointer
     @param buffer_size - buffer size on sharem memory
 */
 typedef struct
 {
   uint8_t qid;
   uint32_t ring_size;
+/** if set queue is in polling mode, else in interrupt mode */
+#define MEMIF_QUEUE_FLAG_POLLING 1
+  uint16_t flags;
+  uint16_t head;
+  uint16_t tail;
   uint16_t buffer_size;
-  /* add ring information */
 } memif_queue_details_t;
 
 /** \brief Memif details
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
index 2e2602e..9b5bdd2 100644
--- a/extras/libmemif/src/main.c
+++ b/extras/libmemif/src/main.c
@@ -524,8 +524,8 @@
   if (conn == NULL)
     return MEMIF_ERR_NOCONN;
   uint8_t num =
-    (conn->args.is_master) ? conn->run_args.num_s2m_rings : conn->run_args.
-    num_m2s_rings;
+    (conn->args.is_master) ? conn->run_args.num_s2m_rings : conn->
+    run_args.num_m2s_rings;
   if (qid >= num)
     return MEMIF_ERR_QID;
 
@@ -859,21 +859,20 @@
 	  if (((memif_connection_t *) e->data_struct)->on_interrupt != NULL)
 	    {
 	      num =
-		(((memif_connection_t *) e->data_struct)->args.
-		 is_master) ? ((memif_connection_t *) e->data_struct)->
-		run_args.num_s2m_rings : ((memif_connection_t *) e->
-					  data_struct)->run_args.
-		num_m2s_rings;
+		(((memif_connection_t *) e->data_struct)->
+		 args.is_master) ? ((memif_connection_t *) e->
+				    data_struct)->run_args.
+		num_s2m_rings : ((memif_connection_t *) e->data_struct)->
+		run_args.num_m2s_rings;
 	      for (i = 0; i < num; i++)
 		{
-		  if (((memif_connection_t *) e->data_struct)->rx_queues[i].
-		      int_fd == fd)
+		  if (((memif_connection_t *) e->data_struct)->
+		      rx_queues[i].int_fd == fd)
 		    {
-		      ((memif_connection_t *) e->
-		       data_struct)->on_interrupt ((void *) e->data_struct,
-						   ((memif_connection_t *)
-						    e->data_struct)->
-						   private_ctx, i);
+		      ((memif_connection_t *) e->data_struct)->
+			on_interrupt ((void *) e->data_struct,
+				      ((memif_connection_t *) e->
+				       data_struct)->private_ctx, i);
 		      return MEMIF_ERR_SUCCESS;
 		    }
 		}
@@ -900,24 +899,24 @@
 	  if (events & MEMIF_FD_EVENT_READ)
 	    {
 	      err =
-		((memif_connection_t *) e->data_struct)->read_fn (e->
-								  data_struct);
+		((memif_connection_t *) e->data_struct)->
+		read_fn (e->data_struct);
 	      if (err != MEMIF_ERR_SUCCESS)
 		return err;
 	    }
 	  if (events & MEMIF_FD_EVENT_WRITE)
 	    {
 	      err =
-		((memif_connection_t *) e->data_struct)->write_fn (e->
-								   data_struct);
+		((memif_connection_t *) e->data_struct)->
+		write_fn (e->data_struct);
 	      if (err != MEMIF_ERR_SUCCESS)
 		return err;
 	    }
 	  if (events & MEMIF_FD_EVENT_ERROR)
 	    {
 	      err =
-		((memif_connection_t *) e->data_struct)->error_fn (e->
-								   data_struct);
+		((memif_connection_t *) e->data_struct)->
+		error_fn (e->data_struct);
 	      if (err != MEMIF_ERR_SUCCESS)
 		return err;
 	    }
@@ -1034,8 +1033,8 @@
   if (c->tx_queues != NULL)
     {
       num =
-	(c->args.is_master) ? c->run_args.num_m2s_rings : c->run_args.
-	num_s2m_rings;
+	(c->args.is_master) ? c->run_args.num_m2s_rings : c->
+	run_args.num_s2m_rings;
       for (i = 0; i < num; i++)
 	{
 	  mq = &c->tx_queues[i];
@@ -1055,8 +1054,8 @@
   if (c->rx_queues != NULL)
     {
       num =
-	(c->args.is_master) ? c->run_args.num_s2m_rings : c->run_args.
-	num_m2s_rings;
+	(c->args.is_master) ? c->run_args.num_s2m_rings : c->
+	run_args.num_m2s_rings;
       for (i = 0; i < num; i++)
 	{
 	  mq = &c->rx_queues[i];
@@ -1208,8 +1207,8 @@
     }
 
   num =
-    (c->args.is_master) ? c->run_args.num_m2s_rings : c->run_args.
-    num_s2m_rings;
+    (c->args.is_master) ? c->run_args.num_m2s_rings : c->
+    run_args.num_s2m_rings;
   for (i = 0; i < num; i++)
     {
       mq = &c->tx_queues[i];
@@ -1226,8 +1225,8 @@
 	}
     }
   num =
-    (c->args.is_master) ? c->run_args.num_s2m_rings : c->run_args.
-    num_m2s_rings;
+    (c->args.is_master) ? c->run_args.num_s2m_rings : c->
+    run_args.num_m2s_rings;
   for (i = 0; i < num; i++)
     {
       mq = &c->rx_queues[i];
@@ -1388,8 +1387,8 @@
   if (c->fd < 0)
     return MEMIF_ERR_DISCONNECTED;
   uint8_t num =
-    (c->args.is_master) ? c->run_args.num_m2s_rings : c->run_args.
-    num_s2m_rings;
+    (c->args.is_master) ? c->run_args.num_m2s_rings : c->
+    run_args.num_s2m_rings;
   if (qid >= num)
     return MEMIF_ERR_QID;
   memif_queue_t *mq = &c->tx_queues[qid];
@@ -1408,8 +1407,8 @@
   /* calculate number of chain buffers */
   if (size > ring->desc[0].buffer_length)
     {
-      chain_buf = size / ring->desc[s0].buffer_length;
-      if (((size % ring->desc[s0].buffer_length) != 0) || (size == 0))
+      chain_buf = size / ring->desc[0].buffer_length;
+      if (((size % ring->desc[0].buffer_length) != 0) || (size == 0))
 	chain_buf++;
     }
 
@@ -1499,8 +1498,8 @@
   if (c->fd < 0)
     return MEMIF_ERR_DISCONNECTED;
   uint8_t num =
-    (c->args.is_master) ? c->run_args.num_s2m_rings : c->run_args.
-    num_m2s_rings;
+    (c->args.is_master) ? c->run_args.num_s2m_rings : c->
+    run_args.num_m2s_rings;
   if (qid >= num)
     return MEMIF_ERR_QID;
   libmemif_main_t *lm = &libmemif_main;
@@ -1522,14 +1521,14 @@
 	  b0 = (bufs + *count_out);
 	  b1 = (bufs + *count_out + 1);
 	  chain_buf0 =
-	    b0->buffer_len / ring->desc[b0->desc_index].buffer_length;
-	  if ((b0->buffer_len % ring->desc[b0->desc_index].buffer_length) !=
-	      0)
+	    b0->buffer_len / ring->desc[b0->desc_index & mask].buffer_length;
+	  if ((b0->buffer_len %
+	       ring->desc[b0->desc_index & mask].buffer_length) != 0)
 	    chain_buf0++;
 	  chain_buf1 =
-	    b1->buffer_len / ring->desc[b1->desc_index].buffer_length;
-	  if ((b1->buffer_len % ring->desc[b1->desc_index].buffer_length) !=
-	      0)
+	    b1->buffer_len / ring->desc[b1->desc_index & mask].buffer_length;
+	  if ((b1->buffer_len %
+	       ring->desc[b1->desc_index & mask].buffer_length) != 0)
 	    chain_buf1++;
 	  tail = b1->desc_index + chain_buf1;
 	  b0->data = NULL;
@@ -1540,8 +1539,10 @@
 	  mq->alloc_bufs -= chain_buf0 + chain_buf1;
 	}
       b0 = (bufs + *count_out);
-      chain_buf0 = b0->buffer_len / ring->desc[b0->desc_index].buffer_length;
-      if ((b0->buffer_len % ring->desc[b0->desc_index].buffer_length) != 0)
+      chain_buf0 =
+	b0->buffer_len / ring->desc[b0->desc_index & mask].buffer_length;
+      if ((b0->buffer_len %
+	   ring->desc[b0->desc_index & mask].buffer_length) != 0)
 	chain_buf0++;
       tail = b0->desc_index + chain_buf0;
       b0->data = NULL;
@@ -1567,8 +1568,8 @@
   if (c->fd < 0)
     return MEMIF_ERR_DISCONNECTED;
   uint8_t num =
-    (c->args.is_master) ? c->run_args.num_m2s_rings : c->run_args.
-    num_s2m_rings;
+    (c->args.is_master) ? c->run_args.num_m2s_rings : c->
+    run_args.num_s2m_rings;
   if (qid >= num)
     return MEMIF_ERR_QID;
   memif_queue_t *mq = &c->tx_queues[qid];
@@ -1588,15 +1589,15 @@
 	  b0 = (bufs + curr_buf);
 	  b1 = (bufs + curr_buf + 1);
 	  chain_buf0 =
-	    b0->buffer_len / ring->desc[b0->desc_index].buffer_length;
-	  if ((b0->buffer_len % ring->desc[b0->desc_index].buffer_length) !=
-	      0)
+	    b0->buffer_len / ring->desc[b0->desc_index & mask].buffer_length;
+	  if ((b0->buffer_len %
+	       ring->desc[b0->desc_index & mask].buffer_length) != 0)
 	    chain_buf0++;
 
 	  chain_buf1 =
-	    b1->buffer_len / ring->desc[b1->desc_index].buffer_length;
-	  if ((b1->buffer_len % ring->desc[b1->desc_index].buffer_length) !=
-	      0)
+	    b1->buffer_len / ring->desc[b1->desc_index & mask].buffer_length;
+	  if ((b1->buffer_len %
+	       ring->desc[b1->desc_index & mask].buffer_length) != 0)
 	    chain_buf1++;
 
 	  for (i = 0; i < memif_min (chain_buf0, chain_buf1); i++)
@@ -1702,7 +1703,7 @@
 		}
 	    }
 
-	  head = (b1->desc_index + chain_buf1) & mask;
+	  head = b1->desc_index + chain_buf1;
 
 	  b0->data = NULL;
 #ifdef MEMIF_DBG
@@ -1721,8 +1722,10 @@
 	}
 
       b0 = (bufs + curr_buf);
-      chain_buf0 = b0->buffer_len / ring->desc[b0->desc_index].buffer_length;
-      if ((b0->buffer_len % ring->desc[b0->desc_index].buffer_length) != 0)
+      chain_buf0 =
+	b0->buffer_len / ring->desc[b0->desc_index & mask].buffer_length;
+      if ((b0->buffer_len %
+	   ring->desc[b0->desc_index & mask].buffer_length) != 0)
 	chain_buf0++;
 
       for (i = 0; i < chain_buf0; i++)
@@ -1747,7 +1750,7 @@
 #endif /* MEMIF_DBG_SHM */
 	}
 
-      head = (b0->desc_index + chain_buf0) & mask;
+      head = b0->desc_index + chain_buf0;
 
       b0->data = NULL;
 #ifdef MEMIF_DBG
@@ -1788,8 +1791,8 @@
   if (c->fd < 0)
     return MEMIF_ERR_DISCONNECTED;
   uint8_t num =
-    (c->args.is_master) ? c->run_args.num_s2m_rings : c->run_args.
-    num_m2s_rings;
+    (c->args.is_master) ? c->run_args.num_s2m_rings : c->
+    run_args.num_m2s_rings;
   if (qid >= num)
     return MEMIF_ERR_QID;
   memif_queue_t *mq = &c->rx_queues[qid];
@@ -1829,19 +1832,23 @@
 	  i = 0;
 	  print_bytes (b0->data +
 		       ring->desc[b0->desc_index & mask].buffer_length * i++,
-		       ring->desc[b0->desc_index & mask].buffer_length, DBG_TX_BUF);
+		       ring->desc[b0->desc_index & mask].buffer_length,
+		       DBG_TX_BUF);
 #endif /* MEMIF_DBG_SHM */
 	  ns--;
 	  *rx += 1;
-	  while (ring->desc[mq->last_head & mask].flags & MEMIF_DESC_FLAG_NEXT)
+	  while (ring->desc[mq->last_head & mask].
+		 flags & MEMIF_DESC_FLAG_NEXT)
 	    {
 	      ring->desc[mq->last_head & mask].flags &= ~MEMIF_DESC_FLAG_NEXT;
 	      mq->last_head++;
 	      b0->data_len += ring->desc[mq->last_head & mask].length;
-	      b0->buffer_len += ring->desc[mq->last_head & mask].buffer_length;
+	      b0->buffer_len +=
+		ring->desc[mq->last_head & mask].buffer_length;
 #ifdef MEMIF_DBG_SHM
 	      print_bytes (b0->data +
-			   ring->desc[b0->desc_index & mask].buffer_length * i++,
+			   ring->desc[b0->desc_index & mask].buffer_length *
+			   i++,
 			   ring->desc[b0->desc_index & mask].buffer_length,
 			   DBG_TX_BUF);
 #endif /* MEMIF_DBG_SHM */
@@ -1858,19 +1865,23 @@
 	  i = 0;
 	  print_bytes (b1->data +
 		       ring->desc[b1->desc_index & mask].buffer_length * i++,
-		       ring->desc[b1->desc_index & mask].buffer_length, DBG_TX_BUF);
+		       ring->desc[b1->desc_index & mask].buffer_length,
+		       DBG_TX_BUF);
 #endif /* MEMIF_DBG_SHM */
 	  ns--;
 	  *rx += 1;
-	  while (ring->desc[mq->last_head & mask].flags & MEMIF_DESC_FLAG_NEXT)
+	  while (ring->desc[mq->last_head & mask].
+		 flags & MEMIF_DESC_FLAG_NEXT)
 	    {
 	      ring->desc[mq->last_head & mask].flags &= ~MEMIF_DESC_FLAG_NEXT;
 	      mq->last_head++;
 	      b1->data_len += ring->desc[mq->last_head & mask].length;
-	      b1->buffer_len += ring->desc[mq->last_head & mask].buffer_length;
+	      b1->buffer_len +=
+		ring->desc[mq->last_head & mask].buffer_length;
 #ifdef MEMIF_DBG_SHM
 	      print_bytes (b1->data +
-			   ring->desc[b1->desc_index & mask].buffer_length * i++,
+			   ring->desc[b1->desc_index & mask].buffer_length *
+			   i++,
 			   ring->desc[b1->desc_index & mask].buffer_length,
 			   DBG_TX_BUF);
 #endif /* MEMIF_DBG_SHM */
@@ -1889,10 +1900,11 @@
       b0->data_len = ring->desc[mq->last_head & mask].length;
       b0->buffer_len = ring->desc[mq->last_head & mask].buffer_length;
 #ifdef MEMIF_DBG_SHM
-	  i = 0;
+      i = 0;
       print_bytes (b0->data +
 		   ring->desc[b0->desc_index & mask].buffer_length * i++,
-		   ring->desc[b0->desc_index & mask].buffer_length, DBG_TX_BUF);
+		   ring->desc[b0->desc_index & mask].buffer_length,
+		   DBG_TX_BUF);
 #endif /* MEMIF_DBG_SHM */
       ns--;
       *rx += 1;
@@ -1906,7 +1918,8 @@
 #ifdef MEMIF_DBG_SHM
 	  print_bytes (b0->data +
 		       ring->desc[b0->desc_index & mask].buffer_length * i++,
-		       ring->desc[b0->desc_index & mask].buffer_length, DBG_TX_BUF);
+		       ring->desc[b0->desc_index & mask].buffer_length,
+		       DBG_TX_BUF);
 #endif /* MEMIF_DBG_SHM */
 	  ns--;
 	  *rx += 1;
@@ -2007,8 +2020,8 @@
     err = MEMIF_ERR_NOBUF_DET;
 
   md->rx_queues_num =
-    (c->args.is_master) ? c->run_args.num_s2m_rings : c->run_args.
-    num_m2s_rings;
+    (c->args.is_master) ? c->run_args.num_s2m_rings : c->
+    run_args.num_m2s_rings;
 
   l1 = sizeof (memif_queue_details_t) * md->rx_queues_num;
   if (l0 + l1 <= buflen)
@@ -2023,12 +2036,15 @@
     {
       md->rx_queues[i].qid = i;
       md->rx_queues[i].ring_size = (1 << c->rx_queues[i].log2_ring_size);
+      md->rx_queues[i].flags = c->rx_queues[i].ring->flags;
+      md->rx_queues[i].head = c->rx_queues[i].ring->head;
+      md->rx_queues[i].tail = c->rx_queues[i].ring->tail;
       md->rx_queues[i].buffer_size = c->run_args.buffer_size;
     }
 
   md->tx_queues_num =
-    (c->args.is_master) ? c->run_args.num_m2s_rings : c->run_args.
-    num_s2m_rings;
+    (c->args.is_master) ? c->run_args.num_m2s_rings : c->
+    run_args.num_s2m_rings;
 
   l1 = sizeof (memif_queue_details_t) * md->tx_queues_num;
   if (l0 + l1 <= buflen)
@@ -2043,6 +2059,9 @@
     {
       md->tx_queues[i].qid = i;
       md->tx_queues[i].ring_size = (1 << c->tx_queues[i].log2_ring_size);
+      md->tx_queues[i].flags = c->tx_queues[i].ring->flags;
+      md->tx_queues[i].head = c->tx_queues[i].ring->head;
+      md->tx_queues[i].tail = c->tx_queues[i].ring->tail;
       md->tx_queues[i].buffer_size = c->run_args.buffer_size;
     }
 
@@ -2061,8 +2080,8 @@
   if (c->fd < 0)
     return MEMIF_ERR_DISCONNECTED;
   uint8_t num =
-    (c->args.is_master) ? c->run_args.num_s2m_rings : c->run_args.
-    num_m2s_rings;
+    (c->args.is_master) ? c->run_args.num_s2m_rings : c->
+    run_args.num_m2s_rings;
   if (qid >= num)
     return MEMIF_ERR_QID;
 
