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 3559FA0543 for ; Tue, 21 Jun 2022 10:13:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 693804281B; Tue, 21 Jun 2022 10:13:05 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2086.outbound.protection.outlook.com [40.107.93.86]) by mails.dpdk.org (Postfix) with ESMTP id 1BCD94281B for ; Tue, 21 Jun 2022 10:13:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=euA4yflLy9wS6F/cC0SUif+JHVCfvmMrIKR4pZgk3u11QiQeicydJ9ayeI5PtQMGrm/tVv2ce/pju+g7gkW3Dwy2ONCpHfKu3FyON5RhpMAdAnWZBsaDHpZnRyFrD4uM0Pxo5EDUiK/gjcbQFpQBwd6EaBHejGQ94WrL3xXFyhe7CWQ/qscLq03X1Tf222jpAKoKZ3MPzCBJt06UYkqBA6sUmFW3rd/AUjUs0FRa2jGw9jPWD7JH/LGa6ONbiUZ9r0UNt4iGU5Za5penKZnQlbnfyTw1H55gxZVbp5ymo3T4gTKRWDKT8x/zBGgQLoYlXw6/PhQ81c0CFceQe+sJrg== 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=Sr5eQwVl3hzdmpZxdAuF07+3Jbm+2mfnRClt2ZH4P9c=; b=b29bsb/K/8fjGSQXABahDcSGl4/EFxwXiIOAhSS93NqSPXEDu4y7iDFJo5YINAMHtWR0xQp6fkh4UhAYNTLH1Y/4QbYIdmz9gIxy/8KNhzZbKSRGBQpCiyTNYhjcMIwaXQKLZigkzJIwU9il9290SFZ35tk5qoIPiS2sKFsz9HKhLm/Dytb0Uy1J+XqjxRCrlfnvTOu6SR48lVDbF5BaJnjwDBYswI+BeIKYTEtprFtJYrhO2nGFnQEitGnwDZM4zzDTa5iI9TgW9KRSLrKPG3i/JifbPbL1+eB3LReiT1J5V94A9dUOe8lXd/d+yzppdrq5subKa5ulDbQDPgmIjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=broadcom.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=Sr5eQwVl3hzdmpZxdAuF07+3Jbm+2mfnRClt2ZH4P9c=; b=Q5VL1O1KllD07bxVBuRxEwd6Zl3DTwChK+uiYNYtRF0R4ewjojRNj8BlfbwH7mPff/o/C5egS5qacPJpqXFFrVMtGcZXi6f7s1E6orHG++XaqZw2k9/PSp1O78YfsMfS064Eth1CYij6Uu0HnAdrEl+N2Gr9A8cLLh8pzkxPTGA3knIJbztft34AcMMpjjbsmE2+ShXxSW3IcJJwW8CP3EgDe6RDWjKYu50ZGJjXShRPLKwakFFQIQSKIJ2sTBI3ZTu1Nkuqgr1JwYeROZk4iNKYF6gj/m8ExvFuzdQ6mWmumtHDPP9+RveNJF7PgtTdu4XlZXC73JOe0KTKoo4kGg== Received: from BN8PR03CA0030.namprd03.prod.outlook.com (2603:10b6:408:94::43) by MN2PR12MB4127.namprd12.prod.outlook.com (2603:10b6:208:1d1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Tue, 21 Jun 2022 08:13:02 +0000 Received: from BN8NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::46) by BN8PR03CA0030.outlook.office365.com (2603:10b6:408:94::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.19 via Frontend Transport; Tue, 21 Jun 2022 08:13:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT053.mail.protection.outlook.com (10.13.177.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Tue, 21 Jun 2022 08:13:01 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 21 Jun 2022 08:13:00 +0000 Received: from nvidia.com (10.126.230.35) 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.22; Tue, 21 Jun 2022 01:12:58 -0700 From: Xueming Li To: Kalesh AP CC: Ajit Khaparde , Somnath Kotur , dpdk stable Subject: patch 'net/bnxt: fix tunnel stateless offloads' has been queued to stable release 20.11.6 Date: Tue, 21 Jun 2022 11:03:00 +0300 Message-ID: <20220621080301.2315720-115-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220621080301.2315720-1-xuemingl@nvidia.com> References: <20220621080301.2315720-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] 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-Office365-Filtering-Correlation-Id: e8eafe42-dbaf-4407-719d-08da535ddc25 X-MS-TrafficTypeDiagnostic: MN2PR12MB4127:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mgYeTMKSsHdbn/CmSoRaZ7JVQ4DsrUvPAHgib94NjfFvAUDfcLBaUmXjubJIzWrgSSM/3UmePo6a6OqlNeCK4yW2ztH+qzojMREdaCtmtcLhEANv6+P8T6M+YL10ol/cKxE5z0pkB2yekS+k8ggJCWwPQoUIR3WhDfD51RtM0WvvYVTrjZcF8KyN47oEQLQYaUEuQnmu+/5KZKDatUJdldpzXGqVijYnbdSs0v29d9vIqFgZMC/9GNnuiDOtHf18HSqbGtK5ZcfHIG7oIsgDuH3y/CN7G+Yv8BdDo56OkMAG9EiEoyx4cXCw2mCKBG6Gb8jgKWFTzdiWo6useZAX7bMjjrhewx3cXbTYkh/N4z2OXyVXcekZLMsf25n7CdhEWk74RjgjswsQSqqHuAuaOMTSJKMWH6mOX+KBpb98AmTu9d5DPNUx81ZwnM0zKU+qAVuiUC55iA/vKdZAVxvH7Acpfxr0gwBvqsclqH5r6lPZWtmshJeZSQKdZZxF0ygmD8JDYT5VvUkR6t08g0kSzc21G34uKK2MojvN15qGNsbbClx+KoOIFC++WI09l9ioDmb/+CkB5um+RvD2yPvu14yYd3r4n+pDBLaW4HZ2bDVDkBJHP8HaCsWzG5kZXT9ZWryIJbpvlC9rwkmeIUXVBRIQYBcPfZw33UGkcKZ6pYYn4ja+n14eJI3WkMQSDWaT8RIh1XI/84OAS1/9ccLcWze9iTaZldUAJtp4Quk3MSklAScyRUl45ImVL7MubptFW4BgHxPDdZRAXgAXGqasd6U5dOyfkQ/qY5NItmIOPaB1NlLayh/s1eTwegNeECGuR1TM71YebEbwZHdvqmigc5z3dPAVXA/aF89whWwsgQA= X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(346002)(136003)(376002)(39860400002)(396003)(36840700001)(40470700004)(46966006)(86362001)(5660300002)(40460700003)(82310400005)(81166007)(6286002)(36860700001)(30864003)(2906002)(82740400003)(8936002)(966005)(316002)(426003)(8676002)(336012)(70586007)(40480700001)(1076003)(70206006)(54906003)(356005)(36756003)(4326008)(55016003)(6666004)(47076005)(6916009)(83380400001)(53546011)(7696005)(478600001)(41300700001)(2616005)(186003)(26005)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 08:13:01.5133 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e8eafe42-dbaf-4407-719d-08da535ddc25 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4127 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 20.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/23/22. 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://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/145c5b453d83f9c898b67ce2fb637209851e910b Thanks. Xueming Li --- >From 145c5b453d83f9c898b67ce2fb637209851e910b Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Mon, 20 Jun 2022 13:58:43 +0530 Subject: [PATCH] net/bnxt: fix tunnel stateless offloads Cc: Xueming Li [ upstream commit c0278f6e52399f7612f9f1a9d52434071ac49921 ] [ upstream commit 41dfa14c9c6587dc934042c04ce7f86015acd608 ] The HW only supports tunnel header parsing globally for supported tunnel types. When a function uses one default VNIC to receive both the tunnel and non-tunnel packets, applying the same stateless offload operation to both tunnel and non-tunnel packets can cause problems in certain scenarios. To workaround these problems, the firmware advertises no tunnel header parsing capabilities to the driver using the HWRM_FUNC_QCAPS. The driver must check this flag setting and accordingly not advertise tunnel packet stateless offload capabilities to the stack. If the device supports VXLAN, GRE, IPIP and GENEVE tunnel parsing, then reports RX_OFFLOAD_OUTER_IPV4_CKSUM, RX_OFFLOAD_OUTER_UDP_CKSUM and TX_OFFLOAD_OUTER_IPV4_CKSUM in the Rx/Tx offload capabilities of the device. Also, advertise tunnel TSO capabilities based on FW support. Fixes: 0a6d2a720078 ("net/bnxt: get device infos") Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_hwrm.c | 4 ++ drivers/net/bnxt/bnxt_hwrm.h | 20 +++++++ drivers/net/bnxt/bnxt_rxq.c | 7 +-- drivers/net/bnxt/bnxt_txq.c | 19 ++++--- drivers/net/bnxt/hsi_struct_def_dpdk.h | 74 +++++++++++++++++++++++++- 6 files changed, 114 insertions(+), 11 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 0696b8a99d..4354c0f55e 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -835,6 +835,7 @@ struct bnxt { uint32_t max_mcast_addr; /* maximum number of mcast filters supported */ struct rte_eth_rss_conf rss_conf; /* RSS configuration. */ + uint16_t tunnel_disable_flag; /* tunnel stateless offloads status */ }; static diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index deebea428a..44070ca482 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -824,6 +824,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT; PMD_DRV_LOG(DEBUG, "VLAN acceleration for TX is enabled\n"); } + bp->tunnel_disable_flag = rte_le_to_cpu_16(resp->tunnel_disable_flag); + if (bp->tunnel_disable_flag) + PMD_DRV_LOG(DEBUG, "Tunnel parsing capability is disabled, flags : %#x\n", + bp->tunnel_disable_flag); unlock: HWRM_UNLOCK(); diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index d36defbc70..813ac333f7 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -120,6 +120,26 @@ struct bnxt_pf_resource_info { #define BNXT_CTX_VAL_INVAL 0xFFFF +#define BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp) \ + (!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_VXLAN)) +#define BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp) \ + (!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_NGE)) +#define BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp) \ + (!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_GRE)) +#define BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp) \ + (!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_IPINIP)) + +/* + * If the device supports VXLAN, GRE, IPIP and GENEVE tunnel parsing, then report + * RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM and + * RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM in the Rx/Tx offload capabilities of the device. + */ +#define BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp) \ + (BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp) && \ + BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp) && \ + BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp) && \ + BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp)) + int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic); int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic, diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 7959d48f47..f597f376e6 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -34,14 +34,15 @@ uint64_t bnxt_get_rx_port_offloads(struct bnxt *bp) DEV_RX_OFFLOAD_SCATTER | DEV_RX_OFFLOAD_RSS_HASH; - rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | - DEV_RX_OFFLOAD_OUTER_UDP_CKSUM; - if (bp->flags & BNXT_FLAG_PTP_SUPPORTED) rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP; if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP) rx_offload_capa |= DEV_RX_OFFLOAD_VLAN_STRIP; + if (BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp)) + rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | + DEV_RX_OFFLOAD_OUTER_UDP_CKSUM; + return rx_offload_capa; } diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index bc1797095d..d282d077ea 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -8,6 +8,7 @@ #include #include "bnxt.h" +#include "bnxt_hwrm.h" #include "bnxt_ring.h" #include "bnxt_txq.h" #include "bnxt_txr.h" @@ -27,15 +28,21 @@ uint64_t bnxt_get_tx_port_offloads(struct bnxt *bp) DEV_TX_OFFLOAD_QINQ_INSERT | DEV_TX_OFFLOAD_MULTI_SEGS; - tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | - DEV_TX_OFFLOAD_VXLAN_TNL_TSO | - DEV_TX_OFFLOAD_GRE_TNL_TSO | - DEV_TX_OFFLOAD_IPIP_TNL_TSO | - DEV_TX_OFFLOAD_GENEVE_TNL_TSO; - if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT) tx_offload_capa |= DEV_TX_OFFLOAD_VLAN_INSERT; + if (BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp)) + tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + + if (BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp)) + tx_offload_capa |= DEV_TX_OFFLOAD_VXLAN_TNL_TSO; + if (BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp)) + tx_offload_capa |= DEV_TX_OFFLOAD_GRE_TNL_TSO; + if (BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp)) + tx_offload_capa |= DEV_TX_OFFLOAD_GENEVE_TNL_TSO; + if (BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp)) + tx_offload_capa |= DEV_TX_OFFLOAD_IPIP_TNL_TSO; + return tx_offload_capa; } diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h index 81fc68d0c9..f905181d3b 100644 --- a/drivers/net/bnxt/hsi_struct_def_dpdk.h +++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h @@ -10718,7 +10718,7 @@ struct hwrm_func_qcaps_input { uint8_t unused_0[6]; } __rte_packed; -/* hwrm_func_qcaps_output (size:704b/88B) */ +/* hwrm_func_qcaps_output (size:768b/96B) */ struct hwrm_func_qcaps_output { /* The specific error status for the command. */ uint16_t error_code; @@ -11082,7 +11082,13 @@ struct hwrm_func_qcaps_output { * (max_tx_rings) to the function. */ uint16_t max_sp_tx_rings; - uint8_t unused_0[2]; + /* + * The maximum number of MSI-X vectors that may be allocated across + * all VFs for the function. This is valid only on the PF with SR-IOV + * enabled. Returns zero if this command is called on a PF with + * SR-IOV disabled or on a VF. + */ + uint16_t max_msix_vfs; uint32_t flags_ext; /* * If 1, the device can be configured to set the ECN bits in the @@ -11164,6 +11170,70 @@ struct hwrm_func_qcaps_output { * to the primate processor block. */ #define HWRM_FUNC_QCAPS_OUTPUT_MPC_CHNLS_CAP_PRIMATE UINT32_C(0x10) + /* + * Maximum number of Key Contexts supported per HWRM + * function call for allocating Key Contexts. + */ + uint16_t max_key_ctxs_alloc; + uint32_t flags_ext2; + /* + * When this bit is '1', it indicates that FW will support + * timestamping on all RX packets, not just PTP type packets. + */ + #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT2_RX_ALL_PKTS_TIMESTAMPS_SUPPORTED \ + UINT32_C(0x1) + /* When this bit is '1', it indicates that HW and FW support QUIC. */ + #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT2_QUIC_SUPPORTED \ + UINT32_C(0x2) + uint16_t tunnel_disable_flag; + /* + * When this bit is '1', it indicates that the VXLAN parsing + * is disabled in hardware + */ + #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_VXLAN \ + UINT32_C(0x1) + /* + * When this bit is '1', it indicates that the NGE parsing + * is disabled in hardware + */ + #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_NGE \ + UINT32_C(0x2) + /* + * When this bit is '1', it indicates that the NVGRE parsing + * is disabled in hardware + */ + #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_NVGRE \ + UINT32_C(0x4) + /* + * When this bit is '1', it indicates that the L2GRE parsing + * is disabled in hardware + */ + #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_L2GRE \ + UINT32_C(0x8) + /* + * When this bit is '1', it indicates that the GRE parsing + * is disabled in hardware + */ + #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_GRE \ + UINT32_C(0x10) + /* + * When this bit is '1', it indicates that the IPINIP parsing + * is disabled in hardware + */ + #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_IPINIP \ + UINT32_C(0x20) + /* + * When this bit is '1', it indicates that the MPLS parsing + * is disabled in hardware + */ + #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_MPLS \ + UINT32_C(0x40) + /* + * When this bit is '1', it indicates that the PPPOE parsing + * is disabled in hardware + */ + #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_PPPOE \ + UINT32_C(0x80) uint8_t unused_1; /* * This field is used in Output records to indicate that the output -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-21 15:37:54.304644100 +0800 +++ 0114-net-bnxt-fix-tunnel-stateless-offloads.patch 2022-06-21 15:37:49.277785436 +0800 @@ -0,0 +1,261 @@ +From 145c5b453d83f9c898b67ce2fb637209851e910b Mon Sep 17 00:00:00 2001 +From: Kalesh AP +Date: Mon, 20 Jun 2022 13:58:43 +0530 +Subject: [PATCH] net/bnxt: fix tunnel stateless offloads +Cc: Xueming Li + +[ upstream commit c0278f6e52399f7612f9f1a9d52434071ac49921 ] +[ upstream commit 41dfa14c9c6587dc934042c04ce7f86015acd608 ] + +The HW only supports tunnel header parsing globally for supported tunnel +types. When a function uses one default VNIC to receive both the tunnel +and non-tunnel packets, applying the same stateless offload operation to +both tunnel and non-tunnel packets can cause problems in certain scenarios. +To workaround these problems, the firmware advertises no tunnel header +parsing capabilities to the driver using the HWRM_FUNC_QCAPS. +The driver must check this flag setting and accordingly not advertise +tunnel packet stateless offload capabilities to the stack. + +If the device supports VXLAN, GRE, IPIP and GENEVE tunnel parsing, +then reports RX_OFFLOAD_OUTER_IPV4_CKSUM, RX_OFFLOAD_OUTER_UDP_CKSUM +and TX_OFFLOAD_OUTER_IPV4_CKSUM in the Rx/Tx offload capabilities of +the device. +Also, advertise tunnel TSO capabilities based on FW support. + +Fixes: 0a6d2a720078 ("net/bnxt: get device infos") + +Signed-off-by: Kalesh AP +Reviewed-by: Ajit Khaparde +Reviewed-by: Somnath Kotur +--- + drivers/net/bnxt/bnxt.h | 1 + + drivers/net/bnxt/bnxt_hwrm.c | 4 ++ + drivers/net/bnxt/bnxt_hwrm.h | 20 +++++++ + drivers/net/bnxt/bnxt_rxq.c | 7 +-- + drivers/net/bnxt/bnxt_txq.c | 19 ++++--- + drivers/net/bnxt/hsi_struct_def_dpdk.h | 74 +++++++++++++++++++++++++- + 6 files changed, 114 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h +index 0696b8a99d..4354c0f55e 100644 +--- a/drivers/net/bnxt/bnxt.h ++++ b/drivers/net/bnxt/bnxt.h +@@ -835,6 +835,7 @@ struct bnxt { + uint32_t max_mcast_addr; /* maximum number of mcast filters supported */ + + struct rte_eth_rss_conf rss_conf; /* RSS configuration. */ ++ uint16_t tunnel_disable_flag; /* tunnel stateless offloads status */ + }; + + static +diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c +index deebea428a..44070ca482 100644 +--- a/drivers/net/bnxt/bnxt_hwrm.c ++++ b/drivers/net/bnxt/bnxt_hwrm.c +@@ -824,6 +824,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) + bp->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT; + PMD_DRV_LOG(DEBUG, "VLAN acceleration for TX is enabled\n"); + } ++ bp->tunnel_disable_flag = rte_le_to_cpu_16(resp->tunnel_disable_flag); ++ if (bp->tunnel_disable_flag) ++ PMD_DRV_LOG(DEBUG, "Tunnel parsing capability is disabled, flags : %#x\n", ++ bp->tunnel_disable_flag); + unlock: + HWRM_UNLOCK(); + +diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h +index d36defbc70..813ac333f7 100644 +--- a/drivers/net/bnxt/bnxt_hwrm.h ++++ b/drivers/net/bnxt/bnxt_hwrm.h +@@ -120,6 +120,26 @@ struct bnxt_pf_resource_info { + + #define BNXT_CTX_VAL_INVAL 0xFFFF + ++#define BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp) \ ++ (!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_VXLAN)) ++#define BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp) \ ++ (!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_NGE)) ++#define BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp) \ ++ (!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_GRE)) ++#define BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp) \ ++ (!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_IPINIP)) ++ ++/* ++ * If the device supports VXLAN, GRE, IPIP and GENEVE tunnel parsing, then report ++ * RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM and ++ * RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM in the Rx/Tx offload capabilities of the device. ++ */ ++#define BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp) \ ++ (BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp) && \ ++ BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp) && \ ++ BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp) && \ ++ BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp)) ++ + int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp, + struct bnxt_vnic_info *vnic); + int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic, +diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c +index 7959d48f47..f597f376e6 100644 +--- a/drivers/net/bnxt/bnxt_rxq.c ++++ b/drivers/net/bnxt/bnxt_rxq.c +@@ -34,14 +34,15 @@ uint64_t bnxt_get_rx_port_offloads(struct bnxt *bp) + DEV_RX_OFFLOAD_SCATTER | + DEV_RX_OFFLOAD_RSS_HASH; + +- rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | +- DEV_RX_OFFLOAD_OUTER_UDP_CKSUM; +- + if (bp->flags & BNXT_FLAG_PTP_SUPPORTED) + rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP; + if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP) + rx_offload_capa |= DEV_RX_OFFLOAD_VLAN_STRIP; + ++ if (BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp)) ++ rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | ++ DEV_RX_OFFLOAD_OUTER_UDP_CKSUM; ++ + return rx_offload_capa; + } + +diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c +index bc1797095d..d282d077ea 100644 +--- a/drivers/net/bnxt/bnxt_txq.c ++++ b/drivers/net/bnxt/bnxt_txq.c +@@ -8,6 +8,7 @@ + #include + + #include "bnxt.h" ++#include "bnxt_hwrm.h" + #include "bnxt_ring.h" + #include "bnxt_txq.h" + #include "bnxt_txr.h" +@@ -27,15 +28,21 @@ uint64_t bnxt_get_tx_port_offloads(struct bnxt *bp) + DEV_TX_OFFLOAD_QINQ_INSERT | + DEV_TX_OFFLOAD_MULTI_SEGS; + +- tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | +- DEV_TX_OFFLOAD_VXLAN_TNL_TSO | +- DEV_TX_OFFLOAD_GRE_TNL_TSO | +- DEV_TX_OFFLOAD_IPIP_TNL_TSO | +- DEV_TX_OFFLOAD_GENEVE_TNL_TSO; +- + if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT) + tx_offload_capa |= DEV_TX_OFFLOAD_VLAN_INSERT; + ++ if (BNXT_TUNNELED_OFFLOADS_CAP_ALL_EN(bp)) ++ tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; ++ ++ if (BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp)) ++ tx_offload_capa |= DEV_TX_OFFLOAD_VXLAN_TNL_TSO; ++ if (BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp)) ++ tx_offload_capa |= DEV_TX_OFFLOAD_GRE_TNL_TSO; ++ if (BNXT_TUNNELED_OFFLOADS_CAP_NGE_EN(bp)) ++ tx_offload_capa |= DEV_TX_OFFLOAD_GENEVE_TNL_TSO; ++ if (BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp)) ++ tx_offload_capa |= DEV_TX_OFFLOAD_IPIP_TNL_TSO; ++ + return tx_offload_capa; + } + +diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h +index 81fc68d0c9..f905181d3b 100644 +--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h ++++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h +@@ -10718,7 +10718,7 @@ struct hwrm_func_qcaps_input { + uint8_t unused_0[6]; + } __rte_packed; + +-/* hwrm_func_qcaps_output (size:704b/88B) */ ++/* hwrm_func_qcaps_output (size:768b/96B) */ + struct hwrm_func_qcaps_output { + /* The specific error status for the command. */ + uint16_t error_code; +@@ -11082,7 +11082,13 @@ struct hwrm_func_qcaps_output { + * (max_tx_rings) to the function. + */ + uint16_t max_sp_tx_rings; +- uint8_t unused_0[2]; ++ /* ++ * The maximum number of MSI-X vectors that may be allocated across ++ * all VFs for the function. This is valid only on the PF with SR-IOV ++ * enabled. Returns zero if this command is called on a PF with ++ * SR-IOV disabled or on a VF. ++ */ ++ uint16_t max_msix_vfs; + uint32_t flags_ext; + /* + * If 1, the device can be configured to set the ECN bits in the +@@ -11164,6 +11170,70 @@ struct hwrm_func_qcaps_output { + * to the primate processor block. + */ + #define HWRM_FUNC_QCAPS_OUTPUT_MPC_CHNLS_CAP_PRIMATE UINT32_C(0x10) ++ /* ++ * Maximum number of Key Contexts supported per HWRM ++ * function call for allocating Key Contexts. ++ */ ++ uint16_t max_key_ctxs_alloc; ++ uint32_t flags_ext2; ++ /* ++ * When this bit is '1', it indicates that FW will support ++ * timestamping on all RX packets, not just PTP type packets. ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT2_RX_ALL_PKTS_TIMESTAMPS_SUPPORTED \ ++ UINT32_C(0x1) ++ /* When this bit is '1', it indicates that HW and FW support QUIC. */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT2_QUIC_SUPPORTED \ ++ UINT32_C(0x2) ++ uint16_t tunnel_disable_flag; ++ /* ++ * When this bit is '1', it indicates that the VXLAN parsing ++ * is disabled in hardware ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_VXLAN \ ++ UINT32_C(0x1) ++ /* ++ * When this bit is '1', it indicates that the NGE parsing ++ * is disabled in hardware ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_NGE \ ++ UINT32_C(0x2) ++ /* ++ * When this bit is '1', it indicates that the NVGRE parsing ++ * is disabled in hardware ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_NVGRE \ ++ UINT32_C(0x4) ++ /* ++ * When this bit is '1', it indicates that the L2GRE parsing ++ * is disabled in hardware ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_L2GRE \ ++ UINT32_C(0x8) ++ /* ++ * When this bit is '1', it indicates that the GRE parsing ++ * is disabled in hardware ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_GRE \ ++ UINT32_C(0x10) ++ /* ++ * When this bit is '1', it indicates that the IPINIP parsing ++ * is disabled in hardware ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_IPINIP \ ++ UINT32_C(0x20) ++ /* ++ * When this bit is '1', it indicates that the MPLS parsing ++ * is disabled in hardware ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_MPLS \ ++ UINT32_C(0x40) ++ /* ++ * When this bit is '1', it indicates that the PPPOE parsing ++ * is disabled in hardware ++ */ ++ #define HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_PPPOE \ ++ UINT32_C(0x80) + uint8_t unused_1; + /* + * This field is used in Output records to indicate that the output +-- +2.35.1 +