From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 3C6B4592E for ; Tue, 4 Nov 2014 07:56:57 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 03 Nov 2014 23:06:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,312,1413270000"; d="scan'208";a="616632607" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 03 Nov 2014 23:05:15 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id sA475E5r011050; Tue, 4 Nov 2014 15:05:14 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id sA475CuG008234; Tue, 4 Nov 2014 15:05:14 +0800 Received: (from couyang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sA475C51008230; Tue, 4 Nov 2014 15:05:12 +0800 From: Ouyang Changchun To: dev@dpdk.org Date: Tue, 4 Nov 2014 15:05:07 +0800 Message-Id: <1415084708-8192-2-git-send-email-changchun.ouyang@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1415084708-8192-1-git-send-email-changchun.ouyang@intel.com> References: <1414681176-13965-1-git-send-email-changchun.ouyang@intel.com> <1415084708-8192-1-git-send-email-changchun.ouyang@intel.com> Subject: [dpdk-dev] [PATCH v3 1/2] vhost: Fix packet length issue 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: Tue, 04 Nov 2014 06:56:57 -0000 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 --- examples/vhost/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 57ef464..5ca8dce 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -1078,7 +1078,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]; @@ -1102,8 +1108,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; -- 1.8.4.2