From: Noa Ezra Date: Thu, 20 Jun 2019 06:33:03 +0000 (+0000) Subject: net/vhost: fix redundant queue state event X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f2f0577eff3d13e761996c7390a244963b433bdc;p=dpdk.git net/vhost: fix redundant queue state event In some situations, when a virtual machine is starting, vring_state_changed can be called while there was no change in the queue state. This fix makes sure that there was really a change in the queue state before calling the callback for EVENT_QUEUE_STATE. Fixes: ee584e9710b9 ("vhost: add driver on top of the library") Cc: stable@dpdk.org Signed-off-by: Noa Ezra Reviewed-by: Matan Azrad Reviewed-by: Maxime Coquelin --- diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index c3ba602767..5de21f1434 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -853,6 +853,10 @@ vring_state_changed(int vid, uint16_t vring, int enable) /* won't be NULL */ state = vring_states[eth_dev->data->port_id]; rte_spinlock_lock(&state->lock); + if (state->cur[vring] == enable) { + rte_spinlock_unlock(&state->lock); + return 0; + } state->cur[vring] = enable; state->max_vring = RTE_MAX(vring, state->max_vring); rte_spinlock_unlock(&state->lock);