[dpdk-dev,v2] vhost: Fix packet length issue
Commit Message
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
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(-)
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(-)
> 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>
> > 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
@@ -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;