DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc
@ 2015-05-28  8:19 Wei li
  2015-05-28 13:32 ` Ouyang, Changchun
  2015-05-28 14:50 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Wei li @ 2015-05-28  8:19 UTC (permalink / raw)
  To: dev

Signed-off-by: Wei li <liw@dtdream.com>
---
 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc
  2015-05-28  8:19 [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc Wei li
@ 2015-05-28 13:32 ` Ouyang, Changchun
  2015-05-28 14:50 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Ouyang, Changchun @ 2015-05-28 13:32 UTC (permalink / raw)
  To: Wei li, dev

I have sent out another patch which has already included such fix,
That patch also fix other issue in rx path, and it is in reworking,
I will send out the v2 version soon.
Accordingly, this patch is a duplicated one.
Thanks
Changchun

 
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei li
> Sent: Thursday, May 28, 2015 4:20 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc
> 
> Signed-off-by: Wei li <liw@dtdream.com>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc
  2015-05-28  8:19 [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc Wei li
  2015-05-28 13:32 ` Ouyang, Changchun
@ 2015-05-28 14:50 ` Stephen Hemminger
  2015-05-28 15:22   ` Ouyang, Changchun
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2015-05-28 14:50 UTC (permalink / raw)
  To: Wei li; +Cc: dev

On Thu, 28 May 2015 16:19:44 +0800
Wei li <liw@dtdream.com> wrote:

> +		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;
> +
This code looks correct, but please follow the same style as
other code in the driver. The virtio driver uses Linux/BSD
style:
	if () {
	} else {
	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc
  2015-05-28 14:50 ` Stephen Hemminger
@ 2015-05-28 15:22   ` Ouyang, Changchun
  0 siblings, 0 replies; 4+ messages in thread
From: Ouyang, Changchun @ 2015-05-28 15:22 UTC (permalink / raw)
  To: Stephen Hemminger, Wei li; +Cc: dev

Pls see the patch: "Fix vhost enqueue/dequeue issue" for more fixing on the vhost enqueue/dequeue.
We don't need this duplicated fix and it only fixes partial issue.
Thanks
Changchun


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Thursday, May 28, 2015 10:51 PM
> To: Wei li
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc
> 
> On Thu, 28 May 2015 16:19:44 +0800
> Wei li <liw@dtdream.com> wrote:
> 
> > +		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;
> > +
> This code looks correct, but please follow the same style as other code in the
> driver. The virtio driver uses Linux/BSD
> style:
> 	if () {
> 	} else {
> 	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-28 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28  8:19 [dpdk-dev] [PATCH] vhost: tcp pkt with virtio header in one desc Wei li
2015-05-28 13:32 ` Ouyang, Changchun
2015-05-28 14:50 ` Stephen Hemminger
2015-05-28 15:22   ` Ouyang, Changchun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).