[ovs-dev] [PATCH] netdev-dpdk: Add vhost enqueue retries.
Pravin Shelar
pshelar at nicira.com
Tue May 12 16:24:02 UTC 2015
On Mon, May 11, 2015 at 5:28 AM, Kevin Traynor <kevin.traynor at intel.com> wrote:
> The max allowed burst size for a single vhost enqueue is 32.
> This code facilitates trying to send greater than the burst
> size of packets to the vhost interface by adding a retry loop
> and calling vhost enqueue multiple times. As this could
> potentially block, a timeout is added.
>
> Signed-off-by: Kevin Traynor <kevin.traynor at intel.com>
> ---
> lib/netdev-dpdk.c | 43 +++++++++++++++++++++++++++++++++++++------
> 1 files changed, 37 insertions(+), 6 deletions(-)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index cbb266d..3ab5995 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -104,6 +104,11 @@ BUILD_ASSERT_DECL((MAX_NB_MBUF / ROUND_DOWN_POW2(MAX_NB_MBUF/MIN_NB_MBUF))
> /* Character device cuse_dev_name. */
> char *cuse_dev_name = NULL;
>
> +/*
> + * Maximum amount of time in micro seconds to try and enqueue to vhost.
> + */
> +#define VHOST_ENQ_RETRY_USECS 100
> +
> static const struct rte_eth_conf port_conf = {
> .rxmode = {
> .mq_mode = ETH_MQ_RX_RSS,
> @@ -901,7 +906,12 @@ __netdev_dpdk_vhost_send(struct netdev *netdev, struct dp_packet **pkts,
> {
> struct netdev_dpdk *vhost_dev = netdev_dpdk_cast(netdev);
> struct virtio_net *virtio_dev = netdev_dpdk_get_virtio(vhost_dev);
> - int tx_pkts, i;
> + struct rte_mbuf **cur_pkts = (struct rte_mbuf **) pkts;
> + unsigned int total_pkts = cnt;
> + unsigned int tx_pkts, i;
> + unsigned int expired = 0;
> + uint64_t start;
> + uint64_t timeout = VHOST_ENQ_RETRY_USECS * rte_get_timer_hz() / 1E6;
>
I changed the transmit function a bit to avoid the division on every
transmit call and pushed patch to master.
Thanks.
More information about the dev
mailing list