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 CB15BA0C4E for ; Mon, 2 Aug 2021 14:21:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDFEF41157; Mon, 2 Aug 2021 14:21:09 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by mails.dpdk.org (Postfix) with ESMTP id 422CB4003D; Mon, 2 Aug 2021 14:21:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BF81LnTD+7xC4YXb2GpjTMfWvsvk3ctCi4NSWYZYqH/JGNfkAoD0xCiXihoaPb/YrHOnsKvD9olCQRYBBMG5qZKTDICLqSYb+LlWPSEcoOTuwyIS85DA+XXevyavw9qeEA6SMUqlhLDQAvnda77rbt3yKGp09ZC3II77mP5hL8fVHDt2C8PojQ6kYe4UXvsb7pLh9+9o8VZDBrt9AUo1WfzTT3aQcrJ2DZj4Yz/GahnFYVRnlQfamFj7ocNfAfF7ZB+ouo/Z5uIoalFR4AqBAM+VCriyQby84MmWdrQWmAfcVf/+VExzAQ6OV3rGuxe7xTCtFsZg2LHbtxj5j4X/Tw== 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=IjJNeBYh438awy+4+XO+zku1K1M5CXoRi6340q83CSw=; b=CETdjX+wg8EPsAZTKykUvanp1crf/ij1Z6slWzOFY/YJ0PEIdqJOX9wFF9wqpd+1aGgrNeq/Oy/xRzuRWdcjniTHObFqrJd22NKC5z0JOfTD2keuukM34jiETx5/KG0/s6HNEO9Kx60/J+m6vhDv/g4TI4bIwUfhkNm0A81UhiX7AHI6vt4k6Uq6EEQAi7/prLxTY+aJZeBZmAeKyViMBt07KRzV8UIvTfliwRShiivLH//R2zQi+M9bNIhs7mucqQgnIHd3hXM5xfDiZ3nhH4WKp/XY9oy/p2BHSqKm1psMbSKN1RnqmbKb7NAulX2ihBQVmiDquqWm1NJKRCsKGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine 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=IjJNeBYh438awy+4+XO+zku1K1M5CXoRi6340q83CSw=; b=VfeJKsw6GmUjq2OpONGUQK51XI26sLkGvuJ+MnK9K2X04dhRvUVXCIZeQvX31is+Fr1SjUvPdtyD5qiPHPp0juBfoEIJrynKV4vTPkkl6ShoBZiQImQ13s+njCmg+Zi8w9+uqV9ufrjrgYm6iU7wKeJsimf6JuoZFtvjGqkB4rNJdfkHmzDmmq6Sg/bxRQZmM2Mbu4Ih07PxQrqqhcy/pfDTwYXd8iWCI5F+cJSiL/gE5oc9TMYB7OdwRp5y79Z3Pz8aHZ5xk3DhHqpqk+0Fts4nI4Nr60T6KdE/BAiPxhntAQl5OEP/3cr/NnQOlYDdsGqlWqNsAqPYQiKCtrPemw== Received: from MW4PR03CA0199.namprd03.prod.outlook.com (2603:10b6:303:b8::24) by DM6PR12MB3500.namprd12.prod.outlook.com (2603:10b6:5:11d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.25; Mon, 2 Aug 2021 12:21:04 +0000 Received: from CO1NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b8:cafe::8b) by MW4PR03CA0199.outlook.office365.com (2603:10b6:303:b8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Mon, 2 Aug 2021 12:21:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 CO1NAM11FT054.mail.protection.outlook.com (10.13.174.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4373.18 via Frontend Transport; Mon, 2 Aug 2021 12:21:03 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 2 Aug 2021 12:21:01 +0000 From: Rongwei Liu To: , , , , Shahaf Shuler , Raslan Darawsheh CC: , Date: Mon, 2 Aug 2021 15:20:48 +0300 Message-ID: <20210802122048.555306-1-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <2220126.5qsbnr2OsU@thomas> References: <2220126.5qsbnr2OsU@thomas> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f00bca3-2141-43da-f945-08d955afff1c X-MS-TrafficTypeDiagnostic: DM6PR12MB3500: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zyxlri2hTJUDjTu01YvsD/9mr/JPqXUe59c5+BrLe34WUSC3AzWct66eIgLWeoeQvyQqmM259jfmaKk9EkFZ6a9s/ZPGJHUeMzVe8Bb4QHws8dQ+kEIoz3Ifgv7I7RPFqdsh1lN4jkuWw7zbKrRD8c2b7/MRzFIcU9FK+CwZ56p5coaV81yFf37WRfFiCNgpZoozrOm9Yw6CTrVhOAQ1QaYFCmI1m5ZIoCiQ7O+GaQ43T6fblGHkUk3ZGzgLqqsbwAW2+t5M7FqVgGg393Wi2o0zSS31uvFhhMuZNzkxKX04fUZXDo5D8wqEMZ4zPWRRybLB+V9+Smo3jqSCJEySWxOqlUnt4qZwcuJgxeAdazJ0+droS0jdwpYKFFNtFknWE7prR3SicTdcS/Qmemc05eChyheJdQKwQ7Wq6mL44QXyJE3MKKxwX6HoKCYXWepST3NKOVEmCRWkqdegce/eKcb9jY1jVWgaNhF2tNJ/YpLPgD4wHUP42ReB0M59V36nYG47p3ihzKkaTFHD7XrLYqNR5N0YTppXHt75JWGVOK7XPywYK/1zDTBf7YMiiXIy6PtuXKRCy2tTXGygkRSvAbq+Jv8oOCan3qKX1UbYri9F0K7yv3uxb/Y2Xlkg63RJmvxQrIyXev0Ps7kK570ONBA/HmS10xLLfAlrg153borpCX2ZRnm/axV6bkBVOFWiJ7aJ5LnSHxkmLnB5oqjMAA== 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)(46966006)(36840700001)(356005)(8936002)(6666004)(4326008)(2906002)(6636002)(1076003)(82310400003)(7696005)(47076005)(26005)(426003)(7636003)(5660300002)(36906005)(16526019)(8676002)(86362001)(55016002)(83380400001)(186003)(70586007)(508600001)(36756003)(70206006)(110136005)(336012)(316002)(36860700001)(2616005)(6286002)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2021 12:21:03.6632 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f00bca3-2141-43da-f945-08d955afff1c 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: CO1NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3500 Subject: [dpdk-stable] [PATCH v2] net/mlx5: fix vni matching with non-std port at ConnectX-5 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" In the recent update, the misc5 matcher was introduced to match VxLAN header extra fields. However, ConnectX-5 doesn't support misc5 for the UDP ports different from VXLAN's standard one (4789). Need to fall back to the previous approach and use legacy misc matcher if non-standard UDP port is recognized in VxLAN flow. Fixes: 630a587bfb37 ("net/mlx5: support matching on VXLAN reserved field") Cc: stable@dpdk.org Signed-off-by: Rongwei Liu --- doc/guides/nics/mlx5.rst | 1 + drivers/net/mlx5/mlx5_flow.c | 21 +++++++++++++++------ drivers/net/mlx5/mlx5_flow.h | 1 + drivers/net/mlx5/mlx5_flow_dv.c | 21 +++++++++++++++++---- drivers/net/mlx5/mlx5_flow_verbs.c | 16 +++++++++++++--- 5 files changed, 47 insertions(+), 13 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 3e9c736cae..a4d0f054d9 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -202,6 +202,7 @@ Limitations Last reserved 8-bits matching is only supported When using DV flow engine (``dv_flow_en`` = 1). + For ConnectX-5, the UDP destination port must be the standard one (4789). Group zero's behavior may differ which depends on FW. Matching value equals 0 (value & mask) is not supported. diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 0689e6d45d..e63a297e2a 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2432,6 +2432,8 @@ mlx5_flow_validate_item_tcp(const struct rte_flow_item *item, * * @param[in] dev * Pointer to the Ethernet device structure. + * @param[in] udp_dport + * UDP destination port * @param[in] item * Item specification. * @param[in] item_flags @@ -2446,6 +2448,7 @@ mlx5_flow_validate_item_tcp(const struct rte_flow_item *item, */ int mlx5_flow_validate_item_vxlan(struct rte_eth_dev *dev, + uint16_t udp_dport, const struct rte_flow_item *item, uint64_t item_flags, const struct rte_flow_attr *attr, @@ -2481,12 +2484,18 @@ mlx5_flow_validate_item_vxlan(struct rte_eth_dev *dev, "no outer UDP layer found"); if (!mask) mask = &rte_flow_item_vxlan_mask; - /* FDB domain & NIC domain non-zero group */ - if ((attr->transfer || attr->group) && priv->sh->misc5_cap) - valid_mask = &nic_mask; - /* Group zero in NIC domain */ - if (!attr->group && !attr->transfer && priv->sh->tunnel_header_0_1) - valid_mask = &nic_mask; + + if (priv->sh->steering_format_version != + MLX5_STEERING_LOGIC_FORMAT_CONNECTX_5 || + !udp_dport || udp_dport == MLX5_UDP_PORT_VXLAN) { + /* FDB domain & NIC domain non-zero group */ + if ((attr->transfer || attr->group) && priv->sh->misc5_cap) + valid_mask = &nic_mask; + /* Group zero in NIC domain */ + if (!attr->group && !attr->transfer && + priv->sh->tunnel_header_0_1) + valid_mask = &nic_mask; + } ret = mlx5_flow_item_acceptable (item, (const uint8_t *)mask, (const uint8_t *)valid_mask, diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 3724293d26..22fa007b42 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1522,6 +1522,7 @@ int mlx5_flow_validate_item_vlan(const struct rte_flow_item *item, struct rte_eth_dev *dev, struct rte_flow_error *error); int mlx5_flow_validate_item_vxlan(struct rte_eth_dev *dev, + uint16_t udp_dport, const struct rte_flow_item *item, uint64_t item_flags, const struct rte_flow_attr *attr, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 059bd25efc..ae0975e8b3 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -6926,6 +6926,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const struct rte_flow_item *rule_items = items; const struct rte_flow_item *port_id_item = NULL; bool def_policy = false; + uint16_t udp_dport = 0; if (items == NULL) return -1; @@ -7100,6 +7101,14 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, ret = mlx5_flow_validate_item_udp(items, item_flags, next_protocol, error); + const struct rte_flow_item_udp *spec = items->spec; + const struct rte_flow_item_udp *mask = items->mask; + if (!mask) + mask = &rte_flow_item_udp_mask; + if (spec != NULL) + udp_dport = rte_be_to_cpu_16 + (spec->hdr.dst_port & + mask->hdr.dst_port); if (ret < 0) return ret; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L4_UDP : @@ -7129,9 +7138,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, last_item = MLX5_FLOW_LAYER_GRE_KEY; break; case RTE_FLOW_ITEM_TYPE_VXLAN: - ret = mlx5_flow_validate_item_vxlan(dev, items, - item_flags, attr, - error); + ret = mlx5_flow_validate_item_vxlan(dev, udp_dport, + items, item_flags, + attr, error); if (ret < 0) return ret; last_item = MLX5_FLOW_LAYER_VXLAN; @@ -8927,6 +8936,7 @@ flow_dv_translate_item_vxlan(struct rte_eth_dev *dev, MLX5_SET(fte_match_set_lyr_2_4, headers_m, udp_dport, 0xFFFF); MLX5_SET(fte_match_set_lyr_2_4, headers_v, udp_dport, dport); } + dport = MLX5_GET16(fte_match_set_lyr_2_4, headers_v, udp_dport); if (!vxlan_v) return; if (!vxlan_m) { @@ -8936,7 +8946,10 @@ flow_dv_translate_item_vxlan(struct rte_eth_dev *dev, else vxlan_m = &nic_mask; } - if ((!attr->group && !attr->transfer && !priv->sh->tunnel_header_0_1) || + if ((priv->sh->steering_format_version == + MLX5_STEERING_LOGIC_FORMAT_CONNECTX_5 && + dport != MLX5_UDP_PORT_VXLAN) || + (!attr->group && !attr->transfer && !priv->sh->tunnel_header_0_1) || ((attr->group || attr->transfer) && !priv->sh->misc5_cap)) { void *misc_m; void *misc_v; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index a36b8adf6b..b93fd4d2c9 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1257,6 +1257,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, uint8_t next_protocol = 0xff; uint16_t ether_type = 0; bool is_empty_vlan = false; + uint16_t udp_dport = 0; if (items == NULL) return -1; @@ -1364,6 +1365,15 @@ flow_verbs_validate(struct rte_eth_dev *dev, ret = mlx5_flow_validate_item_udp(items, item_flags, next_protocol, error); + const struct rte_flow_item_udp *spec = items->spec; + const struct rte_flow_item_udp *mask = items->mask; + if (!mask) + mask = &rte_flow_item_udp_mask; + if (spec != NULL) + udp_dport = rte_be_to_cpu_16 + (spec->hdr.dst_port & + mask->hdr.dst_port); + if (ret < 0) return ret; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L4_UDP : @@ -1381,9 +1391,9 @@ flow_verbs_validate(struct rte_eth_dev *dev, MLX5_FLOW_LAYER_OUTER_L4_TCP; break; case RTE_FLOW_ITEM_TYPE_VXLAN: - ret = mlx5_flow_validate_item_vxlan(dev, items, - item_flags, attr, - error); + ret = mlx5_flow_validate_item_vxlan(dev, udp_dport, + items, item_flags, + attr, error); if (ret < 0) return ret; last_item = MLX5_FLOW_LAYER_VXLAN; -- 2.27.0