aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-06-17 22:55:44 +0200
committerYichen Wang <yicwang@cisco.com>2019-06-24 17:24:16 +0000
commit2605526c9b5caaa900ad21132aa118fe48ea2136 (patch)
tree8b5379c3a3c1d1cf5e7aba43dd8dc6f494c46aa5 /src/plugins
parent7abd25b3b94e4abfeea30e4e4971ba902c3fbd53 (diff)
avf: fix adminq enqueue errors
Type: fix Fixes: b4ff07a Change-Id: I2578ae3e093961fa8765568b5fedcf75ae9487f6 Signed-off-by: Damjan Marion <damarion@cisco.com> (cherry picked from commit 39488c8d3064f8940ec4f826629ebb700649e6b5)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/avf/avf.h3
-rw-r--r--src/plugins/avf/device.c11
2 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/avf/avf.h b/src/plugins/avf/avf.h
index 9836451e012..62fa9a6ecd9 100644
--- a/src/plugins/avf/avf.h
+++ b/src/plugins/avf/avf.h
@@ -22,6 +22,9 @@
#include <vlib/log.h>
+#define AVF_AQ_ENQ_SUSPEND_TIME 50e-6
+#define AVF_AQ_ENQ_MAX_WAIT_TIME 50e-3
+
#define AVF_RXD_STATUS(x) (1ULL << x)
#define AVF_RXD_STATUS_DD AVF_RXD_STATUS(0)
#define AVF_RXD_STATUS_EOP AVF_RXD_STATUS(1)
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index e4c49da8fa0..2a86bed4a7a 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -101,10 +101,9 @@ clib_error_t *
avf_aq_desc_enq (vlib_main_t * vm, avf_device_t * ad, avf_aq_desc_t * dt,
void *data, int len)
{
- avf_main_t *am = &avf_main;
clib_error_t *err = 0;
avf_aq_desc_t *d, dc;
- int n_retry = 5;
+ f64 t0, wait_time, suspend_time = AVF_AQ_ENQ_SUSPEND_TIME;
d = &ad->atq[ad->atq_next_slot];
clib_memcpy_fast (d, dt, sizeof (avf_aq_desc_t));
@@ -126,22 +125,24 @@ avf_aq_desc_enq (vlib_main_t * vm, avf_device_t * ad, avf_aq_desc_t * dt,
clib_memcpy_fast (&dc, d, sizeof (avf_aq_desc_t));
CLIB_MEMORY_BARRIER ();
- vlib_log_debug (am->log_class, "%U", format_hexdump, data, len);
ad->atq_next_slot = (ad->atq_next_slot + 1) % AVF_MBOX_LEN;
avf_reg_write (ad, AVF_ATQT, ad->atq_next_slot);
avf_reg_flush (ad);
+ t0 = vlib_time_now (vm);
retry:
- vlib_process_suspend (vm, 10e-6);
+ vlib_process_suspend (vm, suspend_time);
+ wait_time = vlib_time_now (vm) - t0;
if (((d->flags & AVF_AQ_F_DD) == 0) || ((d->flags & AVF_AQ_F_CMP) == 0))
{
- if (--n_retry == 0)
+ if (wait_time > AVF_AQ_ENQ_MAX_WAIT_TIME)
{
err = clib_error_return (0, "adminq enqueue timeout [opcode 0x%x]",
d->opcode);
goto done;
}
+ suspend_time *= 2;
goto retry;
}