From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4EC3041D8D for ; Mon, 27 Feb 2023 08:11:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4631440A84; Mon, 27 Feb 2023 08:11:22 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2050.outbound.protection.outlook.com [40.107.94.50]) by mails.dpdk.org (Postfix) with ESMTP id 7F98A40A7D for ; Mon, 27 Feb 2023 08:11:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kAPCGtAagphgYY4bZ4toHpMAJBU+hlOsbJW7F8Hd+/vdh1vI4TR8yLuhmGqdEPIaL9LnYs+pSpWM0E0B4YlQxr12l5XTommrhzKCh+bygfc3RXP455xQAURmNZwdUMW2OtMfJ2MYKLZ17ZNwtnqqbb61TPApateMb+iFmTSqewpZ/zdS/r0j0uhC2bBdq5zP5sFSqQ3xkExCme2iHvVyDzlu6n9Y0mYk4MnuytYKBU2nDazd+bk5Azl6IarBnmI/zjPXxOUzwJZyF1I+vlwatHGeRUAn+NGEaXBHzrBXqjYBxz8vOs4KVMpLyl+LjPRXVBYKlap64eK3AagaQK868Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dEJtxEsFYyiZQfbZITyTFa2V91YL+N/wsCm/c/j3HFg=; b=f7N7ahkLY9hZq6VlAixCgHI62Y5maOuEjFtsYwkA8it+XRZawOiohBd19MlsSey8z3qWnzVEACf4ubt2MHobhXGNjgSm8VvL0ef2TuUj4mJd7ygvQSesKSP0GdNy2DRoh1UTjH7QEtutc61wYtdo49Szxtke4CPfyGwToI0AQh15mm/LyQGfaYZkhz0WBBjHfoKjw86CUHmrhlg0ios1el4enAqWKmUihwpsTjbZiWk7KQjs5RHBDI6AKF5i//b7jF2tUc1jtNU55zq2YqAleHwxYQ74lS05I1qH2Jp6Ni2iLRn3tL1+W4x3iSzwGByvuHNdCGdxw/Zlbo/Y95qmMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=trustnetic.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dEJtxEsFYyiZQfbZITyTFa2V91YL+N/wsCm/c/j3HFg=; b=cq3GOLKafWGXTgG0SaoZSCW7lo1cx/IQxKw52xa8TFX+H0yZhPyJX9+pxaj2zDPnBl6Y06WeShwAcodtJRky2iqgB6OG+89ST446TljX5zfgcNBEFSiT4GVySW4gzLCkfZJFgzzp8/98SCirvmc+xS4xEeYfU1Q8BdXIBtcyR62Q3toY3iGoWuRnI3zsebzXO3qWcs9QPeSn0RVtC51paEsm3F2oQMAMSo2A5uioKzmao+5Wi3KjqpvTwL9znM8kE4xQ9ZDNuvWZIKlqFhsW5/3mCe3PqcbFmdiULgsPw9/V78vpSP1Va6DSEc99Y8xo+ZwmD6ZhFEiLD098L9mbfQ== Received: from DM6PR06CA0022.namprd06.prod.outlook.com (2603:10b6:5:120::35) by CH0PR12MB5370.namprd12.prod.outlook.com (2603:10b6:610:d5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29; Mon, 27 Feb 2023 07:11:18 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::60) by DM6PR06CA0022.outlook.office365.com (2603:10b6:5:120::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.28 via Frontend Transport; Mon, 27 Feb 2023 07:11:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.14 via Frontend Transport; Mon, 27 Feb 2023 07:11:17 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 26 Feb 2023 23:11:09 -0800 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sun, 26 Feb 2023 23:11:06 -0800 From: Xueming Li To: Jiawen Wu CC: dpdk stable Subject: patch 'net/ngbe: fix packet type to parse from offload flags' has been queued to stable release 22.11.2 Date: Mon, 27 Feb 2023 15:00:01 +0800 Message-ID: <20230227070107.15664-93-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227070107.15664-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230227070107.15664-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT006:EE_|CH0PR12MB5370:EE_ X-MS-Office365-Filtering-Correlation-Id: 663e90a2-952f-49d7-d4c1-08db1891d229 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n2YAPeENqSueQw3e8+VLX/rYtQ8lLFrsOMYgo1waB8X398VddiOcfDXF10UWyyQJ8UuIDPib583XbW4wfL1ZvPI327a2e2RLEVedaRJue5cdFRpb0v1/prNbJhjuG+IRAj74oYBMrM2cj4g0Yf/RTqeKKB9J6dRHEU/YmigGvD0Mv5nzOr6HHqHmLq8+pVsLDso2entIQ1LmZnPhFlWkbvbVDEjGe1hno3393vQuKS48fBNl2YQD2s+/f2aEy4AhQzlfXZHTfRUqxrS4SYBa3GjJx1z1/yp9oEpKWN/KA6Xo+qi9W65jecLod4/JlLLzeb8/F+obExw3ZREV4l53h6p5J2+97Oi2HvjFieTocqx+OH421+Fk8m4917jFM0kV8Y6N1LjhJinNbCoX76+PMivRwqTeGv6IidjSQCkWG1qHnehqEFHF6FsjexUeVvUt1L7ywO7OB96jNTTfWdLkhRp31Fe5AYQYYKeJVQlOPUeJqXgScXQLPZWOS8mh25LwpLR3HNegEVUpz2n0dSum3eHHfMNMYdCtQJJ4ckWTmxWfAH5N4VGT/iS71k8nz2KtNFcRbgaxcwC/4o41dC3gi6XnR2Qnjk7rfQT9pVdcfPXDVaOEdUM2kx2uaaRDVjsh2kbGe89+E0DJ5VSmshbz+tbtPXrBHRCUt0tpBfmnAMTj1VbZSSzdVAPO2GGh7b8p/5JoSrr2EmL/gxnVG5215xiBIMoLVCxKKkhaAqQFSFh+sxNjWmMz0EXToxCSDkL6UAX2hP9JcDvmxk1LlBfAIchmsDZdVvYxry+ch3Bds/BUdqXQJc3TVPzh7Yenqgji X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(136003)(376002)(396003)(39860400002)(346002)(451199018)(40470700004)(36840700001)(46966006)(478600001)(7696005)(966005)(47076005)(40460700003)(2616005)(336012)(426003)(1076003)(53546011)(16526019)(186003)(26005)(316002)(6286002)(6666004)(70206006)(70586007)(83380400001)(4326008)(8676002)(5660300002)(41300700001)(356005)(34020700004)(8936002)(55016003)(36860700001)(6916009)(36756003)(82740400003)(7636003)(86362001)(82310400005)(40480700001)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 07:11:17.6776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 663e90a2-952f-49d7-d4c1-08db1891d229 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5370 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 22.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/01/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=767d609db761c5f511da65e68aa335058c0781b5 Thanks. Xueming Li --- >From 767d609db761c5f511da65e68aa335058c0781b5 Mon Sep 17 00:00:00 2001 From: Jiawen Wu Date: Thu, 2 Feb 2023 17:21:27 +0800 Subject: [PATCH] net/ngbe: fix packet type to parse from offload flags Cc: Xueming Li [ upstream commit fa402b1e02b71a20aabef27733cbb75431363620 ] Context descriptors which contains the length of each packet layer and the packet type are needed when Tx checksum offload or TSO is on. If the packet type and length do not strictly match, it will cause Tx ring hang. In some external applications, developers may fill in wrong packet_type in rte_mbuf for Tx path. For example, they encap/decap the packets but did not refill the packet_type. To prevent this, change it to parse from ol_flags. And remove redundant tunnel type since the NIC does not support it. Fixes: 9f3206140274 ("net/ngbe: support TSO") Signed-off-by: Jiawen Wu --- drivers/net/ngbe/ngbe_rxtx.c | 92 +++++++++--------------------------- 1 file changed, 23 insertions(+), 69 deletions(-) diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c index 9fd24fa444..0c678e1557 100644 --- a/drivers/net/ngbe/ngbe_rxtx.c +++ b/drivers/net/ngbe/ngbe_rxtx.c @@ -24,15 +24,11 @@ /* Bit Mask to indicate what bits required for building Tx context */ static const u64 NGBE_TX_OFFLOAD_MASK = (RTE_MBUF_F_TX_IP_CKSUM | - RTE_MBUF_F_TX_OUTER_IPV6 | - RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_IPV6 | RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_VLAN | RTE_MBUF_F_TX_L4_MASK | RTE_MBUF_F_TX_TCP_SEG | - RTE_MBUF_F_TX_TUNNEL_MASK | - RTE_MBUF_F_TX_OUTER_IP_CKSUM | NGBE_TX_IEEE1588_TMST); #define NGBE_TX_OFFLOAD_NOTSUP_MASK \ @@ -333,34 +329,15 @@ ngbe_set_xmit_ctx(struct ngbe_tx_queue *txq, } vlan_macip_lens = NGBE_TXD_IPLEN(tx_offload.l3_len >> 1); - - if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) { - tx_offload_mask.outer_tun_len |= ~0; - tx_offload_mask.outer_l2_len |= ~0; - tx_offload_mask.outer_l3_len |= ~0; - tx_offload_mask.l2_len |= ~0; - tunnel_seed = NGBE_TXD_ETUNLEN(tx_offload.outer_tun_len >> 1); - tunnel_seed |= NGBE_TXD_EIPLEN(tx_offload.outer_l3_len >> 2); - - switch (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) { - case RTE_MBUF_F_TX_TUNNEL_IPIP: - /* for non UDP / GRE tunneling, set to 0b */ - break; - default: - PMD_TX_LOG(ERR, "Tunnel type not supported"); - return; - } - vlan_macip_lens |= NGBE_TXD_MACLEN(tx_offload.outer_l2_len); - } else { - tunnel_seed = 0; - vlan_macip_lens |= NGBE_TXD_MACLEN(tx_offload.l2_len); - } + vlan_macip_lens |= NGBE_TXD_MACLEN(tx_offload.l2_len); if (ol_flags & RTE_MBUF_F_TX_VLAN) { tx_offload_mask.vlan_tci |= ~0; vlan_macip_lens |= NGBE_TXD_VLAN(tx_offload.vlan_tci); } + tunnel_seed = 0; + txq->ctx_cache[ctx_idx].flags = ol_flags; txq->ctx_cache[ctx_idx].tx_offload.data[0] = tx_offload_mask.data[0] & tx_offload.data[0]; @@ -449,16 +426,10 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) return cmdtype; } -static inline uint8_t -tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) +static inline uint32_t +tx_desc_ol_flags_to_ptype(uint64_t oflags) { - bool tun; - - if (ptype) - return ngbe_encode_ptype(ptype); - - /* Only support flags in NGBE_TX_OFFLOAD_MASK */ - tun = !!(oflags & RTE_MBUF_F_TX_TUNNEL_MASK); + uint32_t ptype; /* L2 level */ ptype = RTE_PTYPE_L2_ETHER; @@ -466,41 +437,36 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) ptype |= RTE_PTYPE_L2_ETHER_VLAN; /* L3 level */ - if (oflags & (RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IP_CKSUM)) - ptype |= RTE_PTYPE_L3_IPV4; - else if (oflags & (RTE_MBUF_F_TX_OUTER_IPV6)) - ptype |= RTE_PTYPE_L3_IPV6; - if (oflags & (RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IP_CKSUM)) - ptype |= (tun ? RTE_PTYPE_INNER_L3_IPV4 : RTE_PTYPE_L3_IPV4); + ptype |= RTE_PTYPE_L3_IPV4; else if (oflags & (RTE_MBUF_F_TX_IPV6)) - ptype |= (tun ? RTE_PTYPE_INNER_L3_IPV6 : RTE_PTYPE_L3_IPV6); + ptype |= RTE_PTYPE_L3_IPV6; /* L4 level */ switch (oflags & (RTE_MBUF_F_TX_L4_MASK)) { case RTE_MBUF_F_TX_TCP_CKSUM: - ptype |= (tun ? RTE_PTYPE_INNER_L4_TCP : RTE_PTYPE_L4_TCP); + ptype |= RTE_PTYPE_L4_TCP; break; case RTE_MBUF_F_TX_UDP_CKSUM: - ptype |= (tun ? RTE_PTYPE_INNER_L4_UDP : RTE_PTYPE_L4_UDP); + ptype |= RTE_PTYPE_L4_UDP; break; case RTE_MBUF_F_TX_SCTP_CKSUM: - ptype |= (tun ? RTE_PTYPE_INNER_L4_SCTP : RTE_PTYPE_L4_SCTP); + ptype |= RTE_PTYPE_L4_SCTP; break; } if (oflags & RTE_MBUF_F_TX_TCP_SEG) - ptype |= (tun ? RTE_PTYPE_INNER_L4_TCP : RTE_PTYPE_L4_TCP); - - /* Tunnel */ - switch (oflags & RTE_MBUF_F_TX_TUNNEL_MASK) { - case RTE_MBUF_F_TX_TUNNEL_IPIP: - case RTE_MBUF_F_TX_TUNNEL_IP: - ptype |= RTE_PTYPE_L2_ETHER | - RTE_PTYPE_L3_IPV4 | - RTE_PTYPE_TUNNEL_IP; - break; - } + ptype |= RTE_PTYPE_L4_TCP; + + return ptype; +} + +static inline uint8_t +tx_desc_ol_flags_to_ptid(uint64_t oflags) +{ + uint32_t ptype; + + ptype = tx_desc_ol_flags_to_ptype(oflags); return ngbe_encode_ptype(ptype); } @@ -622,16 +588,12 @@ ngbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, /* If hardware offload required */ tx_ol_req = ol_flags & NGBE_TX_OFFLOAD_MASK; if (tx_ol_req) { - tx_offload.ptid = tx_desc_ol_flags_to_ptid(tx_ol_req, - tx_pkt->packet_type); + tx_offload.ptid = tx_desc_ol_flags_to_ptid(tx_ol_req); tx_offload.l2_len = tx_pkt->l2_len; tx_offload.l3_len = tx_pkt->l3_len; tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; - tx_offload.outer_l2_len = tx_pkt->outer_l2_len; - tx_offload.outer_l3_len = tx_pkt->outer_l3_len; - tx_offload.outer_tun_len = 0; /* If new context need be built or reuse the exist ctx*/ ctx = what_ctx_update(txq, tx_ol_req, tx_offload); @@ -752,10 +714,6 @@ ngbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, */ pkt_len -= (tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len); - pkt_len -= - (tx_pkt->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) - ? tx_offload.outer_l2_len + - tx_offload.outer_l3_len : 0; } /* @@ -1939,12 +1897,8 @@ ngbe_get_tx_port_offloads(struct rte_eth_dev *dev) RTE_ETH_TX_OFFLOAD_UDP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_CKSUM | RTE_ETH_TX_OFFLOAD_SCTP_CKSUM | - RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_TSO | RTE_ETH_TX_OFFLOAD_UDP_TSO | - RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO | - RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | - RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | RTE_ETH_TX_OFFLOAD_MULTI_SEGS; if (hw->is_pf) -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-27 14:08:43.895428200 +0800 +++ 0094-net-ngbe-fix-packet-type-to-parse-from-offload-flags.patch 2023-02-27 14:08:40.829237000 +0800 @@ -1 +1 @@ -From fa402b1e02b71a20aabef27733cbb75431363620 Mon Sep 17 00:00:00 2001 +From 767d609db761c5f511da65e68aa335058c0781b5 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit fa402b1e02b71a20aabef27733cbb75431363620 ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org