[dpdk-dev] [PATCH] virtio: Fix enqueue/dequeue can't handle chained vring descriptors.
Thomas Monjalon
thomas.monjalon at 6wind.com
Tue May 12 12:00:58 CEST 2015
Hi Changchun,
Why the title begins with virtio for a patch on vhost?
Could you rephrase it in a positive form?
2015-05-04 14:26, Ouyang Changchun:
> Vring enqueue need consider the 2 cases:
> 1. Vring descriptors chained together, the first one is for virtio header, the rest are for real data;
> 2. Only one descriptor, virtio header and real data share one single descriptor;
Please explain what was not working before.
> So does vring dequeue.
>
> Signed-off-by: Changchun Ouyang <changchun.ouyang at intel.com>
> ---
> lib/librte_vhost/vhost_rxtx.c | 60 +++++++++++++++++++++++++++++++------------
> 1 file changed, 44 insertions(+), 16 deletions(-)
>
> diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
> index 510ffe8..3135883 100644
> --- a/lib/librte_vhost/vhost_rxtx.c
> +++ b/lib/librte_vhost/vhost_rxtx.c
> @@ -59,7 +59,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
> struct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0, 0, 0, 0, 0, 0}, 0};
> uint64_t buff_addr = 0;
> uint64_t buff_hdr_addr = 0;
> - uint32_t head[MAX_PKT_BURST], packet_len = 0;
> + uint32_t head[MAX_PKT_BURST];
> uint32_t head_idx, packet_success = 0;
> uint16_t avail_idx, res_cur_idx;
> uint16_t res_base_idx, res_end_idx;
> @@ -113,6 +113,10 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
> rte_prefetch0(&vq->desc[head[packet_success]]);
>
> while (res_cur_idx != res_end_idx) {
> + uint32_t offset = 0;
> + uint32_t data_len, len_to_cpy;
> + uint8_t plus_hdr = 0;
plus_hdr is not very meaningful to me
I'm not a vhost expert so I won't review the rest.
If nobody comments it in the coming days, it will be accepted.
More information about the dev
mailing list