From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 01888A046B for ; Mon, 24 Jun 2019 15:46:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 927631BF06; Mon, 24 Jun 2019 15:46:17 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 2AFBF1BF05; Mon, 24 Jun 2019 15:46:16 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 82AC380005A; Mon, 24 Jun 2019 13:46:13 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 24 Jun 2019 06:46:10 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Mon, 24 Jun 2019 06:46:10 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x5ODk8Cc027232; Mon, 24 Jun 2019 14:46:08 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id B3020161621; Mon, 24 Jun 2019 14:46:08 +0100 (BST) From: Andrew Rybchenko To: Olivier Matz CC: , Dilshod Urazov , , Date: Mon, 24 Jun 2019 14:46:02 +0100 Message-ID: <1561383962-27064-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1560679802-20112-1-git-send-email-arybchenko@solarflare.com> References: <1560679802-20112-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24708.005 X-TM-AS-Result: No-2.738400-4.000000-10 X-TMASE-MatchedRID: 8HNE+0KrXAVNxPCWgt1qAThiciQR/+DQFjhMXzZ2iMm5ZjHyzYrpGoae EkIf7bS3uJcOsGPcBgiUrJrp/D8uH1gjQ++zrIrOuwdUMMznEA/Fi3oiVvGfqeD3XFrJfgvzkWb sCrJXIAWt2gtuWr1Lmtr+D80ZNbcycGCkjn3GWnYWGaCgD30OgkqAhuLHn5fEDpCUEeEFm7CyRG fgmgP7aeLzNWBegCW2wgn7iDBesS0nRE+fI6etkkERa3/DE2owYmYSCUPiFRTafHV+GdIX4Or4d GE0f4YOIuUYrFwx/pk0uyCkAcGjc8W7mRlL398Qn3NwyN/DlZDxZd+ScYeauL1NuKS30BZnQIFI ZLtsgG0DUH+nVLNyiCsqIP9TxvtJMb6p570ilnc= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.738400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24708.005 X-MDID: 1561383974-V4Ohuk9SKQ3S Subject: [dpdk-dev] [PATCH v2] net: adjust layer 2 length on soft VLAN insertion X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Dilshod Urazov Layer 2 length must be updated after the prepend to mbuf to keep the length right to be used by other Tx offloads. If the packet has tunnel encapsulation, outer_l2_len should be updated. Otherwise l2_len should be updated. Fixes: c974021a5949 ("ether: add soft vlan encap/decap") Cc: stephen@networkplumber.org Cc: stable@dpdk.org Signed-off-by: Dilshod Urazov Signed-off-by: Andrew Rybchenko --- The fix is required for net/virtio which supports both VLAN insertion (using the function) and Tx checksum offloads. lib/librte_net/rte_ether.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 7be9b4890..961ed9361 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -417,6 +417,11 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) (*m)->ol_flags &= ~(PKT_RX_VLAN_STRIPPED | PKT_TX_VLAN); + if ((*m)->ol_flags & PKT_TX_TUNNEL_MASK) + (*m)->outer_l2_len += sizeof(struct rte_vlan_hdr); + else + (*m)->l2_len += sizeof(struct rte_vlan_hdr); + return 0; } -- 2.17.1