From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2203-239.mail.aliyun.com (smtp2203-239.mail.aliyun.com [121.197.203.239]) by dpdk.org (Postfix) with ESMTP id 899E437AA for ; Thu, 28 May 2015 10:19:50 +0200 (CEST) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.4820169|-1; FP=0|0|0|0|0|-1|-1|-1; HT=r46d02009; MF=liw@dtdream.com; PH=DS; RN=1; RT=1; SR=0; Received: from liw0310-PC.local(mailfrom:liw@dtdream.com ip:111.198.29.132) by smtp.aliyun-inc.com(10.194.100.111); Thu, 28 May 2015 16:19:45 +0800 Date: Thu, 28 May 2015 16:19:44 +0800 From: Wei li Sender: Wei li To: dev@dpdk.org Message-ID: <8975cbf4-0f4d-4da4-8e45-6b75629072e1@liw0310-PC.local> X-Mailer: TortoiseGit MIME-Version: 1.0 Content-Type: text/plain; Subject: [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2015 08:19:52 -0000 Signed-off-by: Wei li --- lib/librte_vhost/vhost_rxtx.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 4809d32..2d3ea92 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -588,8 +588,19 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, desc = &vq->desc[head[entry_success]]; - /* Discard first buffer as it is the virtio header */ - desc = &vq->desc[desc->next]; + if (desc->flags & VRING_DESC_F_NEXT) + { + /* Discard first buffer as it is the virtio header */ + desc = &vq->desc[desc->next]; + vb_offset = 0; + vb_avail = desc->len; + } + else /* virtio header in one desc with real pkt */ + { + /* strip the virtio header */ + vb_offset = vq->vhost_hlen; + vb_avail = desc->len - vq->vhost_hlen; + } /* Buffer address translation. */ vb_addr = gpa_to_vva(dev, desc->addr); @@ -608,8 +619,6 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, vq->used->ring[used_idx].id = head[entry_success]; vq->used->ring[used_idx].len = 0; - vb_offset = 0; - vb_avail = desc->len; /* Allocate an mbuf and populate the structure. */ m = rte_pktmbuf_alloc(mbuf_pool); if (unlikely(m == NULL)) { -- 1.9.5.msysgit.1