#endif
static char *vhost_sock_dir = NULL; /* Location of vhost-user sockets */
-/*
- * Maximum amount of time in micro seconds to try and enqueue to vhost.
- */
-#define VHOST_ENQ_RETRY_USECS 100
+#define VHOST_ENQ_RETRY_NUM 8
static const struct rte_eth_conf port_conf = {
.rxmode = {
struct rte_mbuf **cur_pkts = (struct rte_mbuf **) pkts;
unsigned int total_pkts = cnt;
unsigned int qos_pkts = cnt;
- uint64_t start = 0;
+ int retries = 0;
qid = dev->tx_q[qid % dev->real_n_txq].map;
if (OVS_LIKELY(tx_pkts)) {
/* Packets have been sent.*/
cnt -= tx_pkts;
- /* Prepare for possible next iteration.*/
+ /* Prepare for possible retry.*/
cur_pkts = &cur_pkts[tx_pkts];
} else {
- uint64_t timeout = VHOST_ENQ_RETRY_USECS * rte_get_timer_hz() / 1E6;
- unsigned int expired = 0;
-
- if (!start) {
- start = rte_get_timer_cycles();
- }
-
- /*
- * Unable to enqueue packets to vhost interface.
- * Check available entries before retrying.
- */
- while (!rte_vring_available_entries(virtio_dev, vhost_qid)) {
- if (OVS_UNLIKELY((rte_get_timer_cycles() - start) > timeout)) {
- expired = 1;
- break;
- }
- }
- if (expired) {
- /* break out of main loop. */
- break;
- }
+ /* No packets sent - do not retry.*/
+ break;
}
- } while (cnt);
+ } while (cnt && (retries++ < VHOST_ENQ_RETRY_NUM));
rte_spinlock_unlock(&dev->tx_q[qid].tx_lock);