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 92063A0C3F for ; Sat, 12 Jun 2021 01:17:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 876514003F; Sat, 12 Jun 2021 01:17:26 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2054.outbound.protection.outlook.com [40.107.220.54]) by mails.dpdk.org (Postfix) with ESMTP id DAEF54003F for ; Sat, 12 Jun 2021 01:17:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oa91MaD57/uFMrevr07Lrjba5Ix/sGqls5Ne30IY9me9162nGW25spm4d8lUD8aQX57w8ia0PjrcI/JRYAlfKcdfMeUHg3XGGz3pAFeZrzz17SbpO0uQjTytX9TXe1j2PlXrGwppK2sIawkrtkzYOFZ1szZ5YtAORRZ+wIAQV/V/lNdLA/WBYXebqxTohm2pD5lHbFS29KfGJB11ZtuAv3ePjUQ4RS1HfQqinZmOzQLnf3x7bL7LunCO2mFe4X3OGJzeEiZPVZr0ohv2WgfShW2zLGntsMLKxW2+FwlrdzLNYeIBq7zZNKNDf3j7AuXBCuUeAt+UqFnFmQ/k6iM3Yw== 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-SenderADCheck; bh=nTzVbSchGJ15pWiDIytc6SV4fZsTMPGc+NfVt+SNwqI=; b=A+4a2eVjdY36mrMa1fCC1SDv+eE4lRNlJX67y+fcDcDpeuNOuZC2UT3gkpvLVSm3uXF+zV+AJzaw8+6+PKqm7+SWiJJqDjepl/phHx2ksNMAoCDx0IKlGJUEvSZVReDj0iF6mFhNnOB+HFltZm4fyoajhrGWGQuoBc06+E1AhzYpZT086VVy1ME+JdCSQcgq2ZgvYlrCBSeXv6hjJE85EmmUi06ffsfw3Gorg+vZ9WpOWqiPooaa3Q62pLgqWS8mloW2sphJzd9/NnEAK5+2SSqRQwhuIvQzG5n8JclTw1Hhxqv1a+UkyAotTelhLohWQJldJohDh2NPlTx7OZ0k/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=cisco.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none 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=nTzVbSchGJ15pWiDIytc6SV4fZsTMPGc+NfVt+SNwqI=; b=pTuJ8CH99n9ZFMcPk+jlNb7Vr0aW6f9EHnYAAjEtuZQ82I74ggGMSOYZ9J+rpmhmbjTN+CFeTLhXf1CJTi1kfKuJ7FlWAieh8mc7GGIkQBIbUCB+KlO0tq4nMSjwD9wOLASs644YXDEyUZWV6DiyjkiSdxDW5OshlKy0xsYRxpLC74gp0Ld0lX18x0c5Ml9NjgRsAyZEZyyvWCkIqgP7SDh9AGET/qPskTA7/jASjEJAO1y9kNOJXTvOgzllU7lBoEoZaKCKTo2UlnkGSTDuU0enxaX0bDvx91egTc+4oMMhXOHs4hG20kV3FcYnROXKa355fv3dC7as/fcOGMqGOA== Received: from BN9PR03CA0489.namprd03.prod.outlook.com (2603:10b6:408:130::14) by BN8PR12MB3571.namprd12.prod.outlook.com (2603:10b6:408:62::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20; Fri, 11 Jun 2021 23:17:22 +0000 Received: from BN8NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:408:130:cafe::c5) by BN9PR03CA0489.outlook.office365.com (2603:10b6:408:130::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:17:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; cisco.com; dkim=none (message not signed) header.d=none;cisco.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT011.mail.protection.outlook.com (10.13.176.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:17:22 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Jun 2021 23:17:20 +0000 From: Xueming Li To: John Daley CC: Luca Boccassi , Hyong Youb Kim , dpdk stable Date: Sat, 12 Jun 2021 07:03:45 +0800 Message-ID: <20210611230433.8208-131-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611230433.8208-1-xuemingl@nvidia.com> References: <20210510160258.30982-229-xuemingl@nvidia.com> <20210611230433.8208-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf4cd5f2-ff63-4e77-2092-08d92d2f1166 X-MS-TrafficTypeDiagnostic: BN8PR12MB3571: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uxfIKoPqGzF0GUGmtMkDFanTvI7ij1fjt5kU424oiO85OULMCAHBO+TohPECD41+dXR2sKuQ+4/uzxTfe80d+KbyqCWqxfBXrcrnKrXPbBCxFvgOA9Etd+T/duxsNGKo0eaHt4mWzaOkLiE1Y3dJnLRI3gpkrFNgBFAHnrZ0zmJlheG3QfMj0n8fO1wqH+1Sf93/MbhKLgYUKgan1mW6B0PxgbxnYdF/byGou+W7Qrl7ObQ2YBPu5jMV6du/ywZZiCrCfN0n2mUUfVQ/Q8/28/CJ/0rYUps6ckPX0Ikmi8BzN3PzW+7Xc8NgQEfAYNVVMCwTja/FbnvfEB/BHFN7hsFw49WCNrYSOqARorDaO554layYF3hIz8dBpSwjl/0wZX8ZYZIpn3WDscrs5uUVpvH08rsE2XIO7fMX/fI88Ny6HqyNUG4US8dRlT81MsnM7dm8/vEooqBiDxUt1wwQZ/XuKyijYZlaiy33VXTDAqdCTlBQ8xtFMMdo0oN59dDgmF7j1uprcmHiIJm6JrOWRSmvIyVQB3AHUYtXPVAFh3EAry94cMfspf/Ci4RdhsOARjl6/XNiZbDbOa+DiA+a437kGXVfqDs0p5EAS6vVUP9zkNUpl7De/vH6Qw970TD2i+LJpUGTQemud+OwyazSIWyGennow9qsVWbqYfEEJ196rwJ8aNIWjZ179+FKhG7VdqeSzfFu12nyUsgmCVWFzIt5IwoXzQZuH2ijZj6W2WEIVmfqEG84CRMtDDu7Dar5EF+Fy2ad5Lj3XGQeF5Cnxt/PFpj/bjAMm1Z4075lpiElIEfMJ+2TdvwtTreUkftv X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(346002)(376002)(136003)(396003)(39860400002)(36840700001)(46966006)(47076005)(55016002)(70206006)(7636003)(186003)(70586007)(2616005)(426003)(336012)(8936002)(82740400003)(26005)(4326008)(2906002)(8676002)(6286002)(966005)(30864003)(6916009)(54906003)(1076003)(6666004)(36756003)(356005)(316002)(82310400003)(86362001)(5660300002)(53546011)(36906005)(7696005)(16526019)(36860700001)(478600001)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 23:17:22.6405 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf4cd5f2-ff63-4e77-2092-08d92d2f1166 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3571 Subject: [dpdk-stable] patch 'net/enic: enable GENEVE offload via VNIC configuration' has been queued to stable release 20.11.2 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.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 06/14/21. 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/6bdf3844471e199957a718af0faae4070f1d1e3d Thanks. Xueming Li --- >From 6bdf3844471e199957a718af0faae4070f1d1e3d Mon Sep 17 00:00:00 2001 From: John Daley Date: Tue, 11 May 2021 12:25:26 -0700 Subject: [PATCH] net/enic: enable GENEVE offload via VNIC configuration Cc: Luca Boccassi [ upstream commit 61c7b522d9062242d648d09b61d5137740bc2ebb ] The admin-configured vNIC settings (i.e. via CIMC or UCSM) now include Geneve offload. Use that setting to decide whether to enable or disable Geneve offload and remove the devarg 'geneve-opt'. Also, the firmware now allows the driver to change the Geneve port number. So extend udp_tunnel_port_{add,del} to accept Geneve port, in addition to VXLAN. Fixes: 93fb21fdbe23 ("net/enic: enable overlay offload for VXLAN and GENEVE") Signed-off-by: John Daley Reviewed-by: Hyong Youb Kim --- doc/guides/nics/enic.rst | 32 +++-- doc/guides/rel_notes/release_20_05.rst | 7 ++ drivers/net/enic/base/vnic_dev.c | 2 +- drivers/net/enic/base/vnic_enet.h | 1 + drivers/net/enic/enic.h | 4 +- drivers/net/enic/enic_ethdev.c | 70 ++++++----- drivers/net/enic/enic_main.c | 161 +++++++++++++++---------- drivers/net/enic/enic_res.c | 7 +- 8 files changed, 161 insertions(+), 123 deletions(-) diff --git a/doc/guides/nics/enic.rst b/doc/guides/nics/enic.rst index 5d1cc9f7fa..102522492a 100644 --- a/doc/guides/nics/enic.rst +++ b/doc/guides/nics/enic.rst @@ -294,35 +294,31 @@ inner and outer packets can be IPv4 or IPv6. RSS hash calculation, therefore queue selection, is done on inner packets. -In order to enable overlay offload, the 'Enable VXLAN' box should be checked +In order to enable overlay offload, enable VXLAN and/or Geneve on vNIC via CIMC or UCSM followed by a reboot of the server. When PMD successfully -enables overlay offload, it prints the following message on the console. +enables overlay offload, it prints one of the following messages on the console. .. code-block:: console - Overlay offload is enabled + Overlay offload is enabled (VxLAN) + Overlay offload is enabled (Geneve) + Overlay offload is enabled (VxLAN, Geneve) By default, PMD enables overlay offload if hardware supports it. To disable it, set ``devargs`` parameter ``disable-overlay=1``. For example:: -a 12:00.0,disable-overlay=1 -By default, the NIC uses 4789 as the VXLAN port. The user may change -it through ``rte_eth_dev_udp_tunnel_port_{add,delete}``. However, as -the current NIC has a single VXLAN port number, the user cannot -configure multiple port numbers. - -Geneve headers with non-zero options are not supported by default. To -use Geneve with options, update the VIC firmware to the latest version -and then set ``devargs`` parameter ``geneve-opt=1``. When Geneve with -options is enabled, flow API cannot be used as the features are -currently mutually exclusive. When this feature is successfully -enabled, PMD prints the following message. - -.. code-block:: console - - Geneve with options is enabled +By default, the NIC uses 4789 and 6081 as the VXLAN and Geneve ports, +respectively. The user may change them through +``rte_eth_dev_udp_tunnel_port_{add,delete}``. However, as the current +NIC has a single VXLAN port number and a single Geneve port number, +the user cannot configure multiple port numbers for each tunnel type. +Geneve offload support has evolved over VIC models. On older models, +Geneve offload and advanced filters are mutually exclusive. This is +enforced by UCSM and CIMC, which only allow one of the two features +to be selected at one time. Newer VIC models do not have this restriction. Ingress VLAN Rewrite -------------------- diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 985c845de4..b59576a575 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -121,6 +121,13 @@ New Features * Added flow counters to extended stats. * Added PCI function stats to extended stats. +* **Updated Cisco enic driver.** + + Updated Cisco enic driver GENEVE tunneling support: + + * Added support to control GENEVE tunneling via UCSM/CIMC and removed devarg. + * Added GENEVE port number configuration. + * **Updated Hisilicon hns3 driver.** Updated Hisilicon hns3 driver with new features and improvements, including: diff --git a/drivers/net/enic/base/vnic_dev.c b/drivers/net/enic/base/vnic_dev.c index aaca07ca67..6f48ea51de 100644 --- a/drivers/net/enic/base/vnic_dev.c +++ b/drivers/net/enic/base/vnic_dev.c @@ -1318,5 +1318,5 @@ int vnic_dev_capable_geneve(struct vnic_dev *vdev) int ret; ret = vnic_dev_cmd(vdev, CMD_GET_SUPP_FEATURE_VER, &a0, &a1, wait); - return ret == 0 && (a1 & FEATURE_GENEVE_OPTIONS); + return ret == 0 && !!(a1 & FEATURE_GENEVE_OPTIONS); } diff --git a/drivers/net/enic/base/vnic_enet.h b/drivers/net/enic/base/vnic_enet.h index 7687951c90..2a97a33044 100644 --- a/drivers/net/enic/base/vnic_enet.h +++ b/drivers/net/enic/base/vnic_enet.h @@ -55,6 +55,7 @@ struct vnic_enet_config { #define VENETF_NICSWITCH 0x80000 /* NICSWITCH enabled */ #define VENETF_RSSHASH_UDPIPV4 0x100000 /* Hash on UDP + IPv4 fields */ #define VENETF_RSSHASH_UDPIPV6 0x200000 /* Hash on UDP + IPv6 fields */ +#define VENETF_GENEVE 0x400000 /* GENEVE offload */ #define VENET_INTR_TYPE_MIN 0 /* Timer specs min interrupt spacing */ #define VENET_INTR_TYPE_IDLE 1 /* Timer specs idle time before irq */ diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 079f194275..67d872e4b1 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -137,15 +137,15 @@ struct enic { uint8_t adv_filters; uint32_t flow_filter_mode; uint8_t filter_actions; /* HW supported actions */ + bool geneve; bool vxlan; bool disable_overlay; /* devargs disable_overlay=1 */ uint8_t enable_avx2_rx; /* devargs enable-avx2-rx=1 */ - uint8_t geneve_opt_avail; /* Geneve with options offload available */ - uint8_t geneve_opt_enabled; /* Geneve with options offload enabled */ uint8_t geneve_opt_request; /* devargs geneve-opt=1 */ bool nic_cfg_chk; /* NIC_CFG_CHK available */ bool udp_rss_weak; /* Bodega style UDP RSS */ uint8_t ig_vlan_rewrite_mode; /* devargs ig-vlan-rewrite */ + uint16_t geneve_port; /* current geneve port pushed to NIC */ uint16_t vxlan_port; /* current vxlan port pushed to NIC */ int use_simple_tx_handler; int use_noscatter_vec_rx_handler; diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 327b62307b..9e59847f36 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -66,7 +67,6 @@ static const struct vic_speed_capa { #define ENIC_DEVARG_DISABLE_OVERLAY "disable-overlay" #define ENIC_DEVARG_ENABLE_AVX2_RX "enable-avx2-rx" -#define ENIC_DEVARG_GENEVE_OPT "geneve-opt" #define ENIC_DEVARG_IG_VLAN_REWRITE "ig-vlan-rewrite" #define ENIC_DEVARG_REPRESENTOR "representor" @@ -83,12 +83,6 @@ enicpmd_dev_filter_ctrl(struct rte_eth_dev *dev, ENICPMD_FUNC_TRACE(); - /* - * Currently, when Geneve with options offload is enabled, host - * cannot insert match-action rules. - */ - if (enic->geneve_opt_enabled) - return -ENOTSUP; switch (filter_type) { case RTE_ETH_FILTER_GENERIC: if (filter_op != RTE_ETH_FILTER_GET) @@ -983,26 +977,32 @@ static int enicpmd_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev, static int udp_tunnel_common_check(struct enic *enic, struct rte_eth_udp_tunnel *tnl) { - if (tnl->prot_type != RTE_TUNNEL_TYPE_VXLAN) + if (tnl->prot_type != RTE_TUNNEL_TYPE_VXLAN && + tnl->prot_type != RTE_TUNNEL_TYPE_GENEVE) return -ENOTSUP; if (!enic->overlay_offload) { - ENICPMD_LOG(DEBUG, " vxlan (overlay offload) is not " - "supported\n"); + ENICPMD_LOG(DEBUG, " overlay offload is not supported\n"); return -ENOTSUP; } return 0; } -static int update_vxlan_port(struct enic *enic, uint16_t port) +static int update_tunnel_port(struct enic *enic, uint16_t port, bool vxlan) { - if (vnic_dev_overlay_offload_cfg(enic->vdev, - OVERLAY_CFG_VXLAN_PORT_UPDATE, - port)) { - ENICPMD_LOG(DEBUG, " failed to update vxlan port\n"); + uint8_t cfg; + + cfg = vxlan ? OVERLAY_CFG_VXLAN_PORT_UPDATE : + OVERLAY_CFG_GENEVE_PORT_UPDATE; + if (vnic_dev_overlay_offload_cfg(enic->vdev, cfg, port)) { + ENICPMD_LOG(DEBUG, " failed to update tunnel port\n"); return -EINVAL; } - ENICPMD_LOG(DEBUG, " updated vxlan port to %u\n", port); - enic->vxlan_port = port; + ENICPMD_LOG(DEBUG, " updated %s port to %u\n", + vxlan ? "vxlan" : "geneve", port); + if (vxlan) + enic->vxlan_port = port; + else + enic->geneve_port = port; return 0; } @@ -1010,34 +1010,48 @@ static int enicpmd_dev_udp_tunnel_port_add(struct rte_eth_dev *eth_dev, struct rte_eth_udp_tunnel *tnl) { struct enic *enic = pmd_priv(eth_dev); + uint16_t port; + bool vxlan; int ret; ENICPMD_FUNC_TRACE(); ret = udp_tunnel_common_check(enic, tnl); if (ret) return ret; + vxlan = (tnl->prot_type == RTE_TUNNEL_TYPE_VXLAN); + if (vxlan) + port = enic->vxlan_port; + else + port = enic->geneve_port; /* - * The NIC has 1 configurable VXLAN port number. "Adding" a new port - * number replaces it. + * The NIC has 1 configurable port number per tunnel type. + * "Adding" a new port number replaces it. */ - if (tnl->udp_port == enic->vxlan_port || tnl->udp_port == 0) { + if (tnl->udp_port == port || tnl->udp_port == 0) { ENICPMD_LOG(DEBUG, " %u is already configured or invalid\n", tnl->udp_port); return -EINVAL; } - return update_vxlan_port(enic, tnl->udp_port); + return update_tunnel_port(enic, tnl->udp_port, vxlan); } static int enicpmd_dev_udp_tunnel_port_del(struct rte_eth_dev *eth_dev, struct rte_eth_udp_tunnel *tnl) { struct enic *enic = pmd_priv(eth_dev); + uint16_t port; + bool vxlan; int ret; ENICPMD_FUNC_TRACE(); ret = udp_tunnel_common_check(enic, tnl); if (ret) return ret; + vxlan = (tnl->prot_type == RTE_TUNNEL_TYPE_VXLAN); + if (vxlan) + port = enic->vxlan_port; + else + port = enic->geneve_port; /* * Clear the previously set port number and restore the * hardware default port number. Some drivers disable VXLAN @@ -1045,12 +1059,13 @@ static int enicpmd_dev_udp_tunnel_port_del(struct rte_eth_dev *eth_dev, * enic does not do that as VXLAN is part of overlay offload, * which is tied to inner RSS and TSO. */ - if (tnl->udp_port != enic->vxlan_port) { - ENICPMD_LOG(DEBUG, " %u is not a configured vxlan port\n", + if (tnl->udp_port != port) { + ENICPMD_LOG(DEBUG, " %u is not a configured tunnel port\n", tnl->udp_port); return -EINVAL; } - return update_vxlan_port(enic, RTE_VXLAN_DEFAULT_PORT); + port = vxlan ? RTE_VXLAN_DEFAULT_PORT : RTE_GENEVE_DEFAULT_PORT; + return update_tunnel_port(enic, port, vxlan); } static int enicpmd_dev_fw_version_get(struct rte_eth_dev *eth_dev, @@ -1154,8 +1169,6 @@ static int enic_parse_zero_one(const char *key, enic->disable_overlay = b; if (strcmp(key, ENIC_DEVARG_ENABLE_AVX2_RX) == 0) enic->enable_avx2_rx = b; - if (strcmp(key, ENIC_DEVARG_GENEVE_OPT) == 0) - enic->geneve_opt_request = b; return 0; } @@ -1197,7 +1210,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) static const char *const valid_keys[] = { ENIC_DEVARG_DISABLE_OVERLAY, ENIC_DEVARG_ENABLE_AVX2_RX, - ENIC_DEVARG_GENEVE_OPT, ENIC_DEVARG_IG_VLAN_REWRITE, ENIC_DEVARG_REPRESENTOR, NULL}; @@ -1208,7 +1220,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) enic->disable_overlay = false; enic->enable_avx2_rx = false; - enic->geneve_opt_request = false; enic->ig_vlan_rewrite_mode = IG_VLAN_REWRITE_MODE_PASS_THRU; if (!dev->device->devargs) return 0; @@ -1219,8 +1230,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) enic_parse_zero_one, enic) < 0 || rte_kvargs_process(kvlist, ENIC_DEVARG_ENABLE_AVX2_RX, enic_parse_zero_one, enic) < 0 || - rte_kvargs_process(kvlist, ENIC_DEVARG_GENEVE_OPT, - enic_parse_zero_one, enic) < 0 || rte_kvargs_process(kvlist, ENIC_DEVARG_IG_VLAN_REWRITE, enic_parse_ig_vlan_rewrite, enic) < 0) { rte_kvargs_free(kvlist); @@ -1389,5 +1398,4 @@ RTE_PMD_REGISTER_KMOD_DEP(net_enic, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_PMD_REGISTER_PARAM_STRING(net_enic, ENIC_DEVARG_DISABLE_OVERLAY "=0|1 " ENIC_DEVARG_ENABLE_AVX2_RX "=0|1 " - ENIC_DEVARG_GENEVE_OPT "=0|1 " ENIC_DEVARG_IG_VLAN_REWRITE "=trunk|untag|priority|pass"); diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index d0d41035fd..e0c71350ad 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "enic_compat.h" #include "enic.h" @@ -1704,6 +1705,85 @@ set_mtu_done: return rc; } +static void +enic_disable_overlay_offload(struct enic *enic) +{ + /* + * Disabling fails if the feature is provisioned but + * not enabled. So ignore result and do not log error. + */ + if (enic->vxlan) { + vnic_dev_overlay_offload_ctrl(enic->vdev, + OVERLAY_FEATURE_VXLAN, OVERLAY_OFFLOAD_DISABLE); + } + if (enic->geneve) { + vnic_dev_overlay_offload_ctrl(enic->vdev, + OVERLAY_FEATURE_GENEVE, OVERLAY_OFFLOAD_DISABLE); + } +} + +static int +enic_enable_overlay_offload(struct enic *enic) +{ + if (enic->vxlan && vnic_dev_overlay_offload_ctrl(enic->vdev, + OVERLAY_FEATURE_VXLAN, OVERLAY_OFFLOAD_ENABLE) != 0) { + dev_err(NULL, "failed to enable VXLAN offload\n"); + return -EINVAL; + } + if (enic->geneve && vnic_dev_overlay_offload_ctrl(enic->vdev, + OVERLAY_FEATURE_GENEVE, OVERLAY_OFFLOAD_ENABLE) != 0) { + dev_err(NULL, "failed to enable Geneve offload\n"); + return -EINVAL; + } + enic->tx_offload_capa |= + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | + (enic->geneve ? DEV_TX_OFFLOAD_GENEVE_TNL_TSO : 0) | + (enic->vxlan ? DEV_TX_OFFLOAD_VXLAN_TNL_TSO : 0); + enic->tx_offload_mask |= + PKT_TX_OUTER_IPV6 | + PKT_TX_OUTER_IPV4 | + PKT_TX_OUTER_IP_CKSUM | + PKT_TX_TUNNEL_MASK; + enic->overlay_offload = true; + + if (enic->vxlan && enic->geneve) + dev_info(NULL, "Overlay offload is enabled (VxLAN, Geneve)\n"); + else if (enic->vxlan) + dev_info(NULL, "Overlay offload is enabled (VxLAN)\n"); + else + dev_info(NULL, "Overlay offload is enabled (Geneve)\n"); + + return 0; +} + +static int +enic_reset_overlay_port(struct enic *enic) +{ + if (enic->vxlan) { + enic->vxlan_port = RTE_VXLAN_DEFAULT_PORT; + /* + * Reset the vxlan port to the default, as the NIC firmware + * does not reset it automatically and keeps the old setting. + */ + if (vnic_dev_overlay_offload_cfg(enic->vdev, + OVERLAY_CFG_VXLAN_PORT_UPDATE, + RTE_VXLAN_DEFAULT_PORT)) { + dev_err(enic, "failed to update vxlan port\n"); + return -EINVAL; + } + } + if (enic->geneve) { + enic->geneve_port = RTE_GENEVE_DEFAULT_PORT; + if (vnic_dev_overlay_offload_cfg(enic->vdev, + OVERLAY_CFG_GENEVE_PORT_UPDATE, + RTE_GENEVE_DEFAULT_PORT)) { + dev_err(enic, "failed to update vxlan port\n"); + return -EINVAL; + } + } + return 0; +} + static int enic_dev_init(struct enic *enic) { int err; @@ -1773,85 +1853,32 @@ static int enic_dev_init(struct enic *enic) /* set up link status checking */ vnic_dev_notify_set(enic->vdev, -1); /* No Intr for notify */ + enic->overlay_offload = false; /* - * When Geneve with options offload is available, always disable it - * first as it can interfere with user flow rules. + * First, explicitly disable overlay offload as the setting is + * sticky, and resetting vNIC may not disable it. */ - if (enic->geneve_opt_avail) { - /* - * Disabling fails if the feature is provisioned but - * not enabled. So ignore result and do not log error. - */ - vnic_dev_overlay_offload_ctrl(enic->vdev, - OVERLAY_FEATURE_GENEVE, - OVERLAY_OFFLOAD_DISABLE); - } - enic->overlay_offload = false; - if (enic->disable_overlay && enic->vxlan) { - /* - * Explicitly disable overlay offload as the setting is - * sticky, and resetting vNIC does not disable it. - */ - if (vnic_dev_overlay_offload_ctrl(enic->vdev, - OVERLAY_FEATURE_VXLAN, - OVERLAY_OFFLOAD_DISABLE)) { - dev_err(enic, "failed to disable overlay offload\n"); - } else { - dev_info(enic, "Overlay offload is disabled\n"); - } - } - if (!enic->disable_overlay && enic->vxlan && - /* 'VXLAN feature' enables VXLAN, NVGRE, and GENEVE. */ - vnic_dev_overlay_offload_ctrl(enic->vdev, - OVERLAY_FEATURE_VXLAN, - OVERLAY_OFFLOAD_ENABLE) == 0) { - enic->tx_offload_capa |= - DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | - DEV_TX_OFFLOAD_GENEVE_TNL_TSO | - DEV_TX_OFFLOAD_VXLAN_TNL_TSO; - enic->tx_offload_mask |= - PKT_TX_OUTER_IPV6 | - PKT_TX_OUTER_IPV4 | - PKT_TX_OUTER_IP_CKSUM | - PKT_TX_TUNNEL_MASK; - enic->overlay_offload = true; - dev_info(enic, "Overlay offload is enabled\n"); - } - /* Geneve with options offload requires overlay offload */ - if (enic->overlay_offload && enic->geneve_opt_avail && - enic->geneve_opt_request) { - if (vnic_dev_overlay_offload_ctrl(enic->vdev, - OVERLAY_FEATURE_GENEVE, - OVERLAY_OFFLOAD_ENABLE)) { - dev_err(enic, "failed to enable geneve+option\n"); - } else { - enic->geneve_opt_enabled = 1; - dev_info(enic, "Geneve with options is enabled\n"); + enic_disable_overlay_offload(enic); + /* Then, enable overlay offload according to vNIC flags */ + if (!enic->disable_overlay && (enic->vxlan || enic->geneve)) { + err = enic_enable_overlay_offload(enic); + if (err) { + dev_info(NULL, "failed to enable overlay offload\n"); + return err; } } /* - * Reset the vxlan port if HW vxlan parsing is available. It + * Reset the vxlan/geneve port if HW parsing is available. It * is always enabled regardless of overlay offload * enable/disable. */ - if (enic->vxlan) { - enic->vxlan_port = RTE_VXLAN_DEFAULT_PORT; - /* - * Reset the vxlan port to the default, as the NIC firmware - * does not reset it automatically and keeps the old setting. - */ - if (vnic_dev_overlay_offload_cfg(enic->vdev, - OVERLAY_CFG_VXLAN_PORT_UPDATE, - RTE_VXLAN_DEFAULT_PORT)) { - dev_err(enic, "failed to update vxlan port\n"); - return -EINVAL; - } - } + err = enic_reset_overlay_port(enic); + if (err) + return err; if (enic_fm_init(enic)) dev_warning(enic, "Init of flowman failed.\n"); return 0; - } static void lock_devcmd(void *priv) diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c index 20888eb257..d079e2f0e7 100644 --- a/drivers/net/enic/enic_res.c +++ b/drivers/net/enic/enic_res.c @@ -178,10 +178,9 @@ int enic_get_vnic_config(struct enic *enic) enic->vxlan = ENIC_SETTING(enic, VXLAN) && vnic_dev_capable_vxlan(enic->vdev); - if (vnic_dev_capable_geneve(enic->vdev)) { - dev_info(NULL, "Geneve with options offload available\n"); - enic->geneve_opt_avail = 1; - } + enic->geneve = ENIC_SETTING(enic, GENEVE) && + vnic_dev_capable_geneve(enic->vdev); + /* * Default hardware capabilities. enic_dev_init() may add additional * flags if it enables overlay offloads. -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-06-12 06:53:59.930607800 +0800 +++ 0131-net-enic-enable-GENEVE-offload-via-VNIC-configuratio.patch 2021-06-12 06:53:56.550000000 +0800 @@ -1 +1 @@ -From 61c7b522d9062242d648d09b61d5137740bc2ebb Mon Sep 17 00:00:00 2001 +From 6bdf3844471e199957a718af0faae4070f1d1e3d Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 61c7b522d9062242d648d09b61d5137740bc2ebb ] @@ -15 +17,0 @@ -Cc: stable@dpdk.org @@ -25 +27 @@ - drivers/net/enic/enic_ethdev.c | 71 ++++++----- + drivers/net/enic/enic_ethdev.c | 70 ++++++----- @@ -28 +30 @@ - 8 files changed, 161 insertions(+), 124 deletions(-) + 8 files changed, 161 insertions(+), 123 deletions(-) @@ -31 +33 @@ -index 4e7629c5cd..91bdcd065a 100644 +index 5d1cc9f7fa..102522492a 100644 @@ -103 +105 @@ -index 526273cef5..55c08eb3dc 100644 +index aaca07ca67..6f48ea51de 100644 @@ -106 +108 @@ -@@ -1318,7 +1318,7 @@ int vnic_dev_capable_geneve(struct vnic_dev *vdev) +@@ -1318,5 +1318,5 @@ int vnic_dev_capable_geneve(struct vnic_dev *vdev) @@ -113,2 +114,0 @@ - - uint64_t vnic_dev_capable_cq_entry_size(struct vnic_dev *vdev) @@ -128 +128 @@ -index cd66348f2f..47bfdac2cf 100644 +index 079f194275..67d872e4b1 100644 @@ -131 +131,2 @@ -@@ -118,17 +118,17 @@ struct enic { +@@ -137,15 +137,15 @@ struct enic { + uint8_t adv_filters; @@ -134 +134,0 @@ - uint64_t cq_entry_sizes; /* supported CQ entry sizes */ @@ -137,2 +136,0 @@ - bool cq64; /* actually using 64B CQ entry */ - bool cq64_request; /* devargs cq64=1 */ @@ -152 +150 @@ -index ab64480f39..8d5797523b 100644 +index 327b62307b..9e59847f36 100644 @@ -157,2 +155,2 @@ - #include - #include + #include + #include @@ -163,2 +161,2 @@ -@@ -67,7 +68,6 @@ static const struct vic_speed_capa { - #define ENIC_DEVARG_CQ64 "cq64" +@@ -66,7 +67,6 @@ static const struct vic_speed_capa { + @@ -171 +169 @@ -@@ -81,13 +81,6 @@ enicpmd_dev_flow_ops_get(struct rte_eth_dev *dev, +@@ -83,12 +83,6 @@ enicpmd_dev_filter_ctrl(struct rte_eth_dev *dev, @@ -181,5 +179,4 @@ -- - if (enic->flow_filter_mode == FILTER_FLOWMAN) - *ops = &enic_fm_flow_ops; - else -@@ -972,26 +965,32 @@ static int enicpmd_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev, + switch (filter_type) { + case RTE_ETH_FILTER_GENERIC: + if (filter_op != RTE_ETH_FILTER_GET) +@@ -983,26 +977,32 @@ static int enicpmd_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev, @@ -228 +225 @@ -@@ -999,34 +998,48 @@ static int enicpmd_dev_udp_tunnel_port_add(struct rte_eth_dev *eth_dev, +@@ -1010,34 +1010,48 @@ static int enicpmd_dev_udp_tunnel_port_add(struct rte_eth_dev *eth_dev, @@ -281 +278 @@ -@@ -1034,12 +1047,13 @@ static int enicpmd_dev_udp_tunnel_port_del(struct rte_eth_dev *eth_dev, +@@ -1045,12 +1059,13 @@ static int enicpmd_dev_udp_tunnel_port_del(struct rte_eth_dev *eth_dev, @@ -298 +295 @@ -@@ -1145,8 +1159,6 @@ static int enic_parse_zero_one(const char *key, +@@ -1154,8 +1169,6 @@ static int enic_parse_zero_one(const char *key, @@ -307,2 +304,2 @@ -@@ -1189,7 +1201,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) - ENIC_DEVARG_CQ64, +@@ -1197,7 +1210,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) + static const char *const valid_keys[] = { @@ -315,2 +312,2 @@ -@@ -1201,7 +1212,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) - enic->cq64_request = true; /* Use 64B entry if available */ +@@ -1208,7 +1220,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) + @@ -323 +320 @@ -@@ -1214,8 +1224,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) +@@ -1219,8 +1230,6 @@ static int enic_check_devargs(struct rte_eth_dev *dev) @@ -332,2 +329,2 @@ -@@ -1391,5 +1399,4 @@ RTE_PMD_REGISTER_PARAM_STRING(net_enic, - ENIC_DEVARG_CQ64 "=0|1" +@@ -1389,5 +1398,4 @@ RTE_PMD_REGISTER_KMOD_DEP(net_enic, "* igb_uio | uio_pci_generic | vfio-pci"); + RTE_PMD_REGISTER_PARAM_STRING(net_enic, @@ -339 +336 @@ -index 2a06d46872..2affd380c6 100644 +index d0d41035fd..e0c71350ad 100644 @@ -345 +342 @@ - #include + #include @@ -350 +347 @@ -@@ -1719,6 +1720,85 @@ set_mtu_done: +@@ -1704,6 +1705,85 @@ set_mtu_done: @@ -436 +433 @@ -@@ -1785,85 +1865,32 @@ static int enic_dev_init(struct enic *enic) +@@ -1773,85 +1853,32 @@ static int enic_dev_init(struct enic *enic) @@ -537 +534 @@ -index 689bf748ae..a8f5332a40 100644 +index 20888eb257..d079e2f0e7 100644 @@ -540 +537 @@ -@@ -179,10 +179,9 @@ int enic_get_vnic_config(struct enic *enic) +@@ -178,10 +178,9 @@ int enic_get_vnic_config(struct enic *enic) @@ -551,3 +548,3 @@ - /* Supported CQ entry sizes */ - enic->cq_entry_sizes = vnic_dev_capable_cq_entry_size(enic->vdev); - sizes = enic->cq_entry_sizes; + /* + * Default hardware capabilities. enic_dev_init() may add additional + * flags if it enables overlay offloads.