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 E8C684389F; Fri, 12 Jan 2024 09:03:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A9B4040A77; Fri, 12 Jan 2024 09:03:15 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2042.outbound.protection.outlook.com [40.107.237.42]) by mails.dpdk.org (Postfix) with ESMTP id 4A28A40A6D for ; Fri, 12 Jan 2024 09:03:13 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U4nUlGU3kWd67O+mMqDNvoYMI5lR5XzTW/4EvyB9f1ZsoWWuYPuAtjsMPN3wadCoBXVG8y2e+5bryfOCWhEL7VG95wH3xqtw5+zSp46wlQoIDoTZmK8JuIPfNW9FIG2oj5aVNtrLHzgXWeTarndSayXOmpxBuQn4ctBEzwsHaOHPUT97G/lgXJttA21PaK301hqmRtRb89idDth4u97KZ3e2zwsiYhz/vIndGZmUkUwz3J2/JB5VbMVOdVYDd2WeC8w8njPRfBz6Rnph+u+ox5HHeg9c1IlWxgwVoHP5Ni85InxJMSzMy4v+wr4FHDO6zBOl1xbrajaiNYrZ7Y0JMA== 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=ke7q19HUSGiml1LDDyQ910KJ7KVsdhiEiCO1uJMhHmQ=; b=R2M1eO9gd5mpXdsEeGCMl5+fPysYwug2F3ATWReGoqf9XD6K65DmIaEgFM8DojJhDtBfqCgbVpgsR7o/RbpmiGc1w3jhTVHT5kSABlQn+Me5kIEL3sHIh9LCa0wh72pCdGFhlczS7hf9oJfyiJvjHX6OWXGN1oNkY/bRwHHqRHOjjEuiQv+oi3S1lcO8/CszDSz+eddhqtSR72Bly5rfEDJc4HEJBp0TTiHL0Gs7mAo1M6geCGX88QMWDOepJAV6D8/TYSA6B/nroDJP9QzeiCKlo0l0oADoGBjjWK4a2Shdj2HqisHXkFVLyIZ9q3n2SA80+hBIvde9M3xIKgQQTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org 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 (0) 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=ke7q19HUSGiml1LDDyQ910KJ7KVsdhiEiCO1uJMhHmQ=; b=Q3WnoICoBLdIDov8C4PHytDKkBqu8eIuh2ehUWWXBFuaI6ba2w51swLLGt3INvSQZbVdcULtKjeJXp/LWEqIvBS/zXgsSE6y4ZbUfXvdbsN5Z8EWgbw2UZpjTPpADmeHhvkGjl8xYlU9rPnDX+I1tzfq+aCfE8pfDP2lJ7zdwAvqPZMtScm7t7LvjgSKOLDd7j6f9jh69aSo45T9Ha+X1VnSpxOZH+mAChU5TOSbLyr+kv4vbmxv0s+Yi4B3W2JPvpEzzD3V65DrBHpodR/74y5v5KC6YTxjRirOxUGWUVI13JtQT9w66s1W/HgwMhJRUOcYMyM7sPuPWFmHFIZIGQ== Received: from SA1P222CA0135.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c2::13) by PH7PR12MB6907.namprd12.prod.outlook.com (2603:10b6:510:1b9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.18; Fri, 12 Jan 2024 08:03:11 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10b6:806:3c2:cafe::36) by SA1P222CA0135.outlook.office365.com (2603:10b6:806:3c2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21 via Frontend Transport; Fri, 12 Jan 2024 08:03:11 +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 SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.14 via Frontend Transport; Fri, 12 Jan 2024 08:03:10 +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.41; Fri, 12 Jan 2024 00:02:50 -0800 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.41; Fri, 12 Jan 2024 00:02:47 -0800 From: Gavin Li To: , , , , , , , , CC: , Subject: [V1 3/5] net/mlx5: support VXLAN-GPE reserved fields matching Date: Fri, 12 Jan 2024 10:02:08 +0200 Message-ID: <20240112080210.1288356-4-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240112080210.1288356-1-gavinl@nvidia.com> References: <20240112080210.1288356-1-gavinl@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-TrafficTypeDiagnostic: SN1PEPF000252A3:EE_|PH7PR12MB6907:EE_ X-MS-Office365-Filtering-Correlation-Id: ebdfea4a-045b-43d6-7887-08dc1344eb8b X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hPB17uk5pdSPF9QdDUbdLN1g9hbhFpM8cm5kU7BXqCyuE7/her9To8lfVGsWD4kXY+LfyqrWKMvnyei4chYiUyYa+KFM8ud0P1p9azbgxodNCDolc96Lds7Sle7f2fIfKukvS+2nVRthC+ezBOfoSKaHot2pPYwxK40gnrF6vARHpDZc2zT/vyuCCtrffDZGkyjoYGb+ictf5RP2D6oIVv9VNvUHPL0BWOI8qHtm+Xn34NQHSNfl4OAm7YA8NC33as0ZMizYROnrhNP4IAXNIrAhwGU+CX7KLkTLb6M3U99MxLtwKs8M7nhUHTzCfThOhV4jXeUChGx9/kUFeehBcPyTwR0JZ6PX/traZXStf/Pd6sing7ZFiFUxb3GYOxF4YNPClSB7soygzrput067oQAss7rP+EuvIXAccivPhHsTFXV11a8GIK2sTeYdmB21pE1wZU7yUpxx4+/8SC4lwHlbMEPDpX5a9eyg8fBQUpRkYj6+Wh9Y5/o/qqcdQzFlVKeTf3IbTq8hNiRbebws7JGtUmAGUdZ3/CtH1WvDnlVdycN6nqOvw9/PfJDYh2payDG+bYOt16VoKAdP5mFJFXnGzzVWsDGtGFJabm3sROmEF8x3jMFstYYpOuURLpaI7NzWvVi+QNXYRDAoglZM6gnTg62vNYz4+U+B/HC59+dvpImo0uxAFeWI7O+6bsvmeEY5IcINsmOEgXrJ6wJ+B5Ew6IiuPwEDOZxKB19sNX+6pFnPLLh+OehrEZOoe+Xs 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:(13230031)(4636009)(39860400002)(396003)(376002)(346002)(136003)(230922051799003)(1800799012)(82310400011)(186009)(64100799003)(451199024)(36840700001)(46966006)(40470700004)(70206006)(70586007)(40460700003)(7696005)(40480700001)(26005)(2616005)(110136005)(6286002)(316002)(6636002)(54906003)(8676002)(107886003)(1076003)(8936002)(4326008)(16526019)(83380400001)(55016003)(336012)(426003)(6666004)(2906002)(5660300002)(478600001)(47076005)(36860700001)(82740400003)(41300700001)(356005)(86362001)(7636003)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2024 08:03:10.9007 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebdfea4a-045b-43d6-7887-08dc1344eb8b 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: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6907 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This adds matching on the reserved fields of VXLAN-GPE header (the 16-bits before Next Protocol and the last 8-bits). To support all the header fields, tunnel_header_0_1 should be supported by FW and misc5_cap is set. If one of the reserved fields is matched on, misc5 is used for matching. Otherwise, keep using misc3 Signed-off-by: Gavin Li Acked-by: Dariusz Sosnowski --- doc/guides/nics/mlx5.rst | 5 +++++ drivers/net/mlx5/mlx5_flow.c | 5 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 32 ++++++++++++++++++++++++++------ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 7bfd6c6aeb..27384d5a86 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -311,6 +311,11 @@ Limitations Group zero's behavior may differ which depends on FW. Matching value equals 0 (value & mask) is not supported. +- Matching on VXLAN-GPE header fields: + + - ``rsvd0``/``rsvd1`` matching support depends on FW version when using DV flow + engine (``dv_flow_en`` = 1). + - L3 VXLAN and VXLAN-GPE tunnels cannot be supported together with MPLSoGRE and MPLSoUDP. - MPLSoGRE is not supported in HW steering (``dv_flow_en`` = 2). diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index ffa183dc1b..9b6f483d3f 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3316,6 +3316,11 @@ mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item, "no outer UDP layer found"); if (!mask) mask = &rte_flow_item_vxlan_gpe_mask; + if (priv->sh->misc5_cap && priv->sh->tunnel_header_0_1) { + nic_mask.rsvd0[0] = 0xff; + nic_mask.rsvd0[1] = 0xff; + nic_mask.rsvd1 = 0xff; + } ret = mlx5_flow_item_acceptable (item, (const uint8_t *)mask, (const uint8_t *)&nic_mask, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 97f55003c3..f3589da654 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9813,14 +9813,10 @@ flow_dv_translate_item_vxlan_gpe(void *key, const struct rte_flow_item *item, vxlan_v = vxlan_m; else if (key_type == MLX5_SET_MATCHER_HS_V) vxlan_m = vxlan_v; - for (i = 0; i < size; ++i) - vni_v[i] = vxlan_m->hdr.vni[i] & vxlan_v->hdr.vni[i]; if (vxlan_m->hdr.flags) { flags_m = vxlan_m->hdr.flags; flags_v = vxlan_v->hdr.flags; } - MLX5_SET(fte_match_set_misc3, misc_v, outer_vxlan_gpe_flags, - flags_m & flags_v); m_protocol = vxlan_m->hdr.protocol; v_protocol = vxlan_v->hdr.protocol; if (!m_protocol) { @@ -9839,8 +9835,32 @@ flow_dv_translate_item_vxlan_gpe(void *key, const struct rte_flow_item *item, if (key_type & MLX5_SET_MATCHER_M) v_protocol = m_protocol; } - MLX5_SET(fte_match_set_misc3, misc_v, - outer_vxlan_gpe_next_protocol, m_protocol & v_protocol); + /* + * If only match flags/protocol/vni field, keep using misc3 for matching. + * If need to match rsvd0 or rsvd1, using misc5 and do not need using misc3. + */ + if (!(vxlan_m->hdr.rsvd0[0] || vxlan_m->hdr.rsvd0[1] || vxlan_m->hdr.rsvd1)) { + for (i = 0; i < size; ++i) + vni_v[i] = vxlan_m->hdr.vni[i] & vxlan_v->hdr.vni[i]; + MLX5_SET(fte_match_set_misc3, misc_v, outer_vxlan_gpe_flags, + flags_m & flags_v); + MLX5_SET(fte_match_set_misc3, misc_v, + outer_vxlan_gpe_next_protocol, m_protocol & v_protocol); + } else { + uint32_t tunnel_v; + void *misc5_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters_5); + + tunnel_v = (flags_m & flags_v) << 24 | + (vxlan_v->hdr.rsvd0[0] & vxlan_m->hdr.rsvd0[0]) << 16 | + (vxlan_v->hdr.rsvd0[1] & vxlan_m->hdr.rsvd0[1]) << 8 | + (m_protocol & v_protocol); + MLX5_SET(fte_match_set_misc5, misc5_v, tunnel_header_0, tunnel_v); + tunnel_v = (vxlan_v->hdr.vni[0] & vxlan_m->hdr.vni[0]) << 24 | + (vxlan_v->hdr.vni[1] & vxlan_m->hdr.vni[1]) << 16 | + (vxlan_v->hdr.vni[2] & vxlan_m->hdr.vni[2]) << 8 | + (vxlan_v->hdr.rsvd1 & vxlan_m->hdr.rsvd1); + MLX5_SET(fte_match_set_misc5, misc5_v, tunnel_header_1, tunnel_v); + } } /** -- 2.39.1