From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] virtio: Fix enqueue/dequeue can't handle chained vring descriptors. Date: Tue, 12 May 2015 12:00:58 +0200 Message-ID: <29822220.6AADzARei5@xps13> References: <1430720780-27525-1-git-send-email-changchun.ouyang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Ouyang Changchun Return-path: Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 1048E2A07 for ; Tue, 12 May 2015 12:01:41 +0200 (CEST) Received: by wgic8 with SMTP id c8so3048315wgi.1 for ; Tue, 12 May 2015 03:01:41 -0700 (PDT) In-Reply-To: <1430720780-27525-1-git-send-email-changchun.ouyang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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.