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 6032FA0471 for ; Sun, 16 Jun 2019 12:10:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2C9B51BF1B; Sun, 16 Jun 2019 12:10:56 +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 2B3551BE9D; Sun, 16 Jun 2019 12:10:52 +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-us3.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 840D2600061; Sun, 16 Jun 2019 10:10:50 +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; Sun, 16 Jun 2019 03:10:47 -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; Sun, 16 Jun 2019 03:10:46 -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 x5GAAimr013056; Sun, 16 Jun 2019 11:10:44 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 81A43161621; Sun, 16 Jun 2019 11:10:44 +0100 (BST) From: Andrew Rybchenko To: Olivier Matz CC: , Dilshod Urazov , , Date: Sun, 16 Jun 2019 11:10:02 +0100 Message-ID: <1560679802-20112-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24682.005 X-TM-AS-Result: No-1.889100-4.000000-10 X-TMASE-MatchedRID: qSyFkk1Fqo1NxPCWgt1qAThiciQR/+DQFjhMXzZ2iMm5ZjHyzYrpGoae EkIf7bS3uJcOsGPcBgiUrJrp/D8uH1gjQ++zrIrOuwdUMMznEA/Fi3oiVvGfqeD3XFrJfgvzoKC +hsSBMDhfvis5Ium3Ylv7dwgZeko/emzGG4qDPal+J3gtIe0gA0tc8DbogbSE31GU/N5W5BDSJJ cbp1Y+W3Of6ROyOKT1De6RfWmEbcDjTE3Llr8edp4CIKY/Hg3AGdQnQSTrKGPEQdG7H66TyHEqm 8QYBtMOvxAKEs5gfg6uhytRju/XZpQuk063HCz1ob48XmQN4n9FptkLJO1Wk/rm2qU1Si4aqw0c gLnRqIJG0MT4ZCFDonZLRwSpjVHVk3UkV5Qp4wSI45Rd9ORJwFlJvEhEss3fzQahrdQz77w= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.889100-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24682.005 X-MDID: 1560679851-Dp1_XHIl1RCS Subject: [dpdk-stable] [PATCH] net: adjust layer 2 length on soft VLAN insertion X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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. Condition to decide which layer 2 length to update is chosen in accordance with [1], but could be ((*m)->ol_flags & PKT_TX_TUNNEL_MASK) != 0. [1] https://patches.dpdk.org/patch/52721/ 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..194570019 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)->outer_l2_len != 0) + (*m)->outer_l2_len += sizeof(struct rte_vlan_hdr); + else + (*m)->l2_len += sizeof(struct rte_vlan_hdr); + return 0; } -- 2.17.1