aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/device.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-11-23 17:41:05 +0100
committerNeale Ranns <nranns@cisco.com>2017-11-23 17:39:02 +0000
commit7172cec2384e107a8127a2cb8cc346ef9216d425 (patch)
tree5b750d27eec998ff14d1c73f9943b8b96443ca94 /src/plugins/memif/device.c
parent63118b1afd58501377684b800dc86326a3c6038e (diff)
memif: try harder to transmit packets
Change-Id: I1e57a86b8872798a888e7d6128d9c4537a8090e6 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/memif/device.c')
-rw-r--r--src/plugins/memif/device.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index fa3a4eda40d..5f670563fcb 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -31,8 +31,7 @@
#define foreach_memif_tx_func_error \
_(NO_FREE_SLOTS, "no free tx slots") \
_(TRUNC_PACKET, "packet > buffer size -- truncated in tx ring") \
-_(PENDING_MSGS, "pending msgs in tx ring") \
-_(NO_TX_QUEUES, "no tx queues")
+_(PENDING_MSGS, "pending msgs in tx ring")
typedef enum
{
@@ -173,13 +172,7 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 thread_index = vlib_get_thread_index ();
u8 tx_queues = vec_len (mif->tx_queues);
memif_queue_t *mq;
-
- if (PREDICT_FALSE (tx_queues == 0))
- {
- vlib_error_count (vm, node->node_index, MEMIF_TX_ERROR_NO_TX_QUEUES,
- n_left);
- goto error;
- }
+ int n_retries = 5;
if (tx_queues < vec_len (vlib_mains))
{
@@ -187,13 +180,13 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
clib_spinlock_lock_if_init (&mif->lockp);
}
else
- {
- qid = thread_index;
- }
+ qid = thread_index;
+
mq = vec_elt_at_index (mif->tx_queues, qid);
ring = mq->ring;
ring_size = 1 << mq->log2_ring_size;
mask = ring_size - 1;
+retry:
/* free consumed buffers */
@@ -237,6 +230,9 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
CLIB_MEMORY_STORE_BARRIER ();
ring->head = head;
+ if (n_left && n_retries--)
+ goto retry;
+
clib_spinlock_unlock_if_init (&mif->lockp);
if (n_left)
@@ -252,7 +248,6 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
mq->int_count++;
}
-error:
vlib_buffer_free (vm, vlib_frame_args (frame), frame->n_vectors);
return frame->n_vectors;