diff mbox

[dpdk-dev,v2] vhost: Fix packet length issue

Message ID 1414681176-13965-1-git-send-email-changchun.ouyang@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Ouyang Changchun Oct. 30, 2014, 2:59 p.m. UTC
As HW vlan strip will reduce the packet length by minus length of vlan tag,
so it need restore the packet length by plus it.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
v2 change:
 Update data length by plus offset in first segment instead of last segment.

v1 change:
 Update the packet length by plus offset.
 Use macro to replace constant; 

 examples/vhost/main.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Ouyang Changchun Nov. 4, 2014, 7:05 a.m. UTC | #1
This patch set fix packet length issue in vhost app, and enhance code by
extracting a function to replace duplicated codes in one copy and zero copy
TX function.
 
-v3 change:
 Extract a function to replace duplicated codes in one copy and zero copy TX function
 
-v2 change:
 Update data length by plus offset in first segment instead of last segment.
 
-v1 change:
 Update the packet length by plus offset;
 Use macro to replace constant.

Changchun Ouyang (2):
  Fix packet length issue in vhost.
  Extract a function to replace duplicated codes in vhost.

 examples/vhost/main.c | 137 ++++++++++++++++++++++----------------------------
 1 file changed, 61 insertions(+), 76 deletions(-)
Ouyang Changchun Nov. 5, 2014, 7:10 a.m. UTC | #2
This patch set fix packet length issue in vhost app, and enhance code by
extracting a function to replace duplicated codes in one copy and zero copy
TX function.

-v4 chang:
 Check offset value and extra bytes inside packet buffer cross page boundary.
 
-v3 change:
 Extract a function to replace duplicated codes in one copy and zero copy TX function.
 
-v2 change:
 Update data length by plus offset in first segment instead of last segment.
 
-v1 change:
 Update the packet length by plus offset;
 Use macro to replace constant.

Changchun Ouyang (3):
  Fix packet length issue in vhost.
  Extract a function to replace duplicated codes in vhost.
  Check offset value in vhost

 examples/vhost/main.c | 142 +++++++++++++++++++++++---------------------------
 1 file changed, 65 insertions(+), 77 deletions(-)
Ananyev, Konstantin Nov. 5, 2014, 9:28 a.m. UTC | #3
> From: Ouyang, Changchun
> Sent: Wednesday, November 05, 2014 7:11 AM
> To: dev@dpdk.org
> Cc: Xie, Huawei; Ananyev, Konstantin; Cao, Waterman; Ouyang, Changchun
> Subject: [PATCH v4 0/3] Fix packet length issue
> 
> This patch set fix packet length issue in vhost app, and enhance code by
> extracting a function to replace duplicated codes in one copy and zero copy
> TX function.
> 
> -v4 chang:
>  Check offset value and extra bytes inside packet buffer cross page boundary.
> 
> -v3 change:
>  Extract a function to replace duplicated codes in one copy and zero copy TX function.
> 
> -v2 change:
>  Update data length by plus offset in first segment instead of last segment.
> 
> -v1 change:
>  Update the packet length by plus offset;
>  Use macro to replace constant.
> 
> Changchun Ouyang (3):
>   Fix packet length issue in vhost.
>   Extract a function to replace duplicated codes in vhost.
>   Check offset value in vhost
> 
>  examples/vhost/main.c | 142 +++++++++++++++++++++++---------------------------
>  1 file changed, 65 insertions(+), 77 deletions(-)
> 
> --
> 1.8.4.2

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Thomas Monjalon Nov. 5, 2014, 10:07 p.m. UTC | #4
> > This patch set fix packet length issue in vhost app, and enhance code by
> > extracting a function to replace duplicated codes in one copy and zero copy
> > TX function.
> > 
> > -v4 chang:
> >  Check offset value and extra bytes inside packet buffer cross page boundary.
> > 
> > -v3 change:
> >  Extract a function to replace duplicated codes in one copy and zero copy TX function.
> > 
> > -v2 change:
> >  Update data length by plus offset in first segment instead of last segment.
> > 
> > -v1 change:
> >  Update the packet length by plus offset;
> >  Use macro to replace constant.
> > 
> > Changchun Ouyang (3):
> >   Fix packet length issue in vhost.
> >   Extract a function to replace duplicated codes in vhost.
> >   Check offset value in vhost
> > 
> >  examples/vhost/main.c | 142 +++++++++++++++++++++++---------------------------
> >  1 file changed, 65 insertions(+), 77 deletions(-)
> > 
> > --
> > 1.8.4.2
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied

Thanks
diff mbox

Patch

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 0566124..9ed48fc 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1097,7 +1097,13 @@  virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag)
 					rte_pktmbuf_free(m);
 					return;
 				}
-				offset = 4;
+
+				/*
+				 * HW vlan strip will reduce the packet length
+				 * by minus length of vlan tag, so need restore
+				 * the packet length by plus it.
+				 */
+				offset = VLAN_HLEN;
 				vlan_tag =
 				(uint16_t)
 				vlan_tags[(uint16_t)dev_ll->vdev->dev->device_fh];
@@ -1121,8 +1127,10 @@  virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag)
 	len = tx_q->len;
 
 	m->ol_flags = PKT_TX_VLAN_PKT;
-	/*FIXME: offset*/
+
 	m->data_len += offset;
+	m->pkt_len += offset;
+
 	m->vlan_tci = vlan_tag;
 
 	tx_q->m_table[len] = m;