From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6812FA04FA; Sun, 2 Feb 2020 10:13:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3C4EC1BFFA; Sun, 2 Feb 2020 10:13:06 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) by dpdk.org (Postfix) with ESMTP id 758701BFF7; Sun, 2 Feb 2020 10:13:04 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHOYCXPK+c7PimTkfr4HiBvk9tbDSJHH0Nucj8cUWHorn+R42bgcZPN0rWTtrM5vSsiMSGeagsA+miQjKKG9nV9TslnZwn5upuodyY6Mojwx8rh31uTphYfnSF2KzkaXJhmq2qwCMwQYMgbwZBAhrBDllWy3l1Q8n63/BDPVba/zyNL7dym5tLWjPmoifvubem/3QRfCXf3kT3QJPkf3EWAGFaM6nl/TGKLVHEq1KJfpB81NKcLXtnX5+cy8RKpie+whkzZU5hMLL16iPXgqc7bM2DXCnNYke0Z43MxIiiCEDKjq/8JtxN56Wvnuzc/27fkJ9+ZoFX/yDy+VsVU20A== 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=gY7WbBMidKW+EndLBD0svHW8fvtfL5I1c5NjLPIiMjk=; b=Xk9TCHNe5axXvIBgpCiXH9pdQEmFY0Sa27CH2WlkFj3eSd4FwamFkvsBpr3MqHdNVlTJR4oIgVOMKN/+Sht4nWU4JxS4oO+NX2+zfPCaXvH+rn1s0HLtiP4i6muWXTqedakNBwwv8Y0gEUo6yYzv6C3D0oAJNebBDhrL557g0jLfODOLVosgQcWh70sizjVTNyuL5PKpQfmCQw1+k5QRd9eLWwDkEf1zAYqE1X72x0NChaATgAB73WIixq3vL0/V7OZcc1bI7xHs1CPZUBJRMUc1tNh9PAFRi+4FkgnG/TlFGt9enfpdRo5A8KXbtsfrxEPxCLzS+Y05VCMfUQ5mqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gY7WbBMidKW+EndLBD0svHW8fvtfL5I1c5NjLPIiMjk=; b=iDRqobW8HgIhsBEdSWc1gd6GPz/N+KXZpwxKfqp2xQYSxh+yLWH0uvYE4sRr7mdmRMftcHP+8b0td0vdY3eB55w40atfyesfM5KULLO80IrkMKAw8B/VWKBgZnADfLjxRZ1cpTAbx6hqEKCuSTbPSGozeHd1vYXDdUGz8DzHnYg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (10.186.174.145) by AM0PR05MB6436.eurprd05.prod.outlook.com (20.179.34.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.27; Sun, 2 Feb 2020 09:13:03 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::bdb0:493e:2231:1c8a]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::bdb0:493e:2231:1c8a%3]) with mapi id 15.20.2686.031; Sun, 2 Feb 2020 09:13:03 +0000 From: Raslan Darawsheh To: slava@monjalon.net, matan@mellanox.com Cc: dev@dpdk.org, orika@mellanox.com, stable@dpdk.org Date: Sun, 2 Feb 2020 11:12:55 +0200 Message-Id: <1580634775-645-1-git-send-email-rasland@mellanox.com> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: ZR0P278CA0045.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::14) To AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) MIME-Version: 1.0 Received: from mellanox.com (212.29.221.74) by ZR0P278CA0045.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2686.29 via Frontend Transport; Sun, 2 Feb 2020 09:13:02 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [212.29.221.74] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9c251354-6fc1-4fab-0c55-08d7a7c01b92 X-MS-TrafficTypeDiagnostic: AM0PR05MB6436:|AM0PR05MB6436: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-Forefront-PRVS: 0301360BF5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(366004)(346002)(39850400004)(136003)(189003)(199004)(956004)(6666004)(6636002)(36756003)(7696005)(52116002)(81166006)(81156014)(8676002)(316002)(2616005)(8936002)(8886007)(2906002)(86362001)(55016002)(66556008)(66476007)(4326008)(66946007)(5660300002)(26005)(16526019)(186003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB6436; H:AM0PR05MB6707.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pkMIOS11WJLzyoTmuhOzhk8l5ta99nv6PptHHvLh5lg1l9I4ZPcGNOGjAFG5xGWRemMJQfFGAhMmw3cmkbbyzVQhtDyyljgQ2PkYoaxWJSaVXva/ZPZhv9s9ErP6AM9iIO7WqVvnJW0PrstMEbF1iCHS4EFvjiT9lWgS/OA4csgs16h0tutSThev9KsZv9Znkbv1g83DjCVu2enTuc9mxD9P8m7aPG7Xz6vlUsNlQOP5GyOdJ+DqGrFl3MFQybg0gdoB9RMJW6c+Qzi7MSiLD3Lk6LJwimWqPnYFwY4NO0Cez8/Yg5fQLu0yYqiDB0rM3NaJemIJRIyxbXcB4MzpxLME/dqOlJjAqP8P6E7Fi0hUQheOFSTXomobRwegDdOgjs8VSCwq/AmE0A1cHcdrBR0LtfiH99P/wHFoSTX17wgO/BRZ1L91klq+gYfjooKn X-MS-Exchange-AntiSpam-MessageData: XbzionufYSBbH5WJNBJfo8MnCwOT+UwCfdfefCD2dh4PxrP5vNvLYmgHuFX+I9z8H6S2hpFVQYY0EyraoYD3Dqtb6/vWkoa592lRNvGOVFjLi9YOaVdDo+aK+UAbZF2OB9u/KmyI/7tKBwgi8/WI7g== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c251354-6fc1-4fab-0c55-08d7a7c01b92 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2020 09:13:03.6271 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: C8d9aZZtGc8Z1XIIr+xuAZY4kTB79kctQjgVSHr6kKlwKjwCa6+wol2tT1sVuxHZhJV79Cs/Jj68gGHOH7EwGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6436 Subject: [dpdk-dev] [PATCH] net/mlx5: fix vxlan-gpe item translation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Currently, when using vxlan-gpe or vxlan item in the flow both are being treated the same with flags 0x8 in vxlan header. which mean the matching of the item vxlan-gpe will match any vxlan packet. This fix the translation of vxlan gpe item into pmd flow item. which will by default set the flags to vxlan-gpe to be 0xc. Fixes: 3d694341 ("net/mlx5: add Direct Verbs validation function") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh Acked-by: Matan Azrad matan@mellanox.com --- drivers/net/mlx5/mlx5_flow_dv.c | 75 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index d51d17d..2878393 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5779,6 +5779,76 @@ flow_dv_translate_item_vxlan(void *matcher, void *key, } /** + * Add VXLAN-GPE item to matcher and to the value. + * + * @param[in, out] matcher + * Flow matcher. + * @param[in, out] key + * Flow matcher value. + * @param[in] item + * Flow pattern to translate. + * @param[in] inner + * Item is inner pattern. + */ + +static void +flow_dv_translate_item_vxlan_gpe(void *matcher, void *key, + const struct rte_flow_item *item, int inner) +{ + const struct rte_flow_item_vxlan_gpe *vxlan_m = item->mask; + const struct rte_flow_item_vxlan_gpe *vxlan_v = item->spec; + void *headers_m; + void *headers_v; + void *misc_m = + MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters_3); + void *misc_v = + MLX5_ADDR_OF(fte_match_param, key, misc_parameters_3); + char *vni_m; + char *vni_v; + uint16_t dport; + int size; + int i; + uint8_t flags_m = 0xff; + uint8_t flags_v = 0xc; + + if (inner) { + headers_m = MLX5_ADDR_OF(fte_match_param, matcher, + inner_headers); + headers_v = MLX5_ADDR_OF(fte_match_param, key, inner_headers); + } else { + headers_m = MLX5_ADDR_OF(fte_match_param, matcher, + outer_headers); + headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers); + } + dport = item->type == RTE_FLOW_ITEM_TYPE_VXLAN ? + MLX5_UDP_PORT_VXLAN : MLX5_UDP_PORT_VXLAN_GPE; + if (!MLX5_GET16(fte_match_set_lyr_2_4, headers_v, udp_dport)) { + 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); + } + if (!vxlan_v) + return; + if (!vxlan_m) + vxlan_m = &rte_flow_item_vxlan_gpe_mask; + size = sizeof(vxlan_m->vni); + vni_m = MLX5_ADDR_OF(fte_match_set_misc3, misc_m, outer_vxlan_gpe_vni); + vni_v = MLX5_ADDR_OF(fte_match_set_misc3, misc_v, outer_vxlan_gpe_vni); + memcpy(vni_m, vxlan_m->vni, size); + for (i = 0; i < size; ++i) + vni_v[i] = vni_m[i] & vxlan_v->vni[i]; + if (vxlan_m->flags) { + flags_m = vxlan_m->flags; + flags_v = vxlan_v->flags; + } + MLX5_SET(fte_match_set_misc3, misc_m, outer_vxlan_gpe_flags, flags_m); + MLX5_SET(fte_match_set_misc3, misc_v, outer_vxlan_gpe_flags, flags_v); + MLX5_SET(fte_match_set_misc3, misc_m, outer_vxlan_gpe_next_protocol, + vxlan_m->protocol); + MLX5_SET(fte_match_set_misc3, misc_v, outer_vxlan_gpe_next_protocol, + vxlan_v->protocol); +} + +/** * Add Geneve item to matcher and to the value. * * @param[in, out] matcher @@ -7559,8 +7629,9 @@ __flow_dv_translate(struct rte_eth_dev *dev, last_item = MLX5_FLOW_LAYER_VXLAN; break; case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: - flow_dv_translate_item_vxlan(match_mask, match_value, - items, tunnel); + flow_dv_translate_item_vxlan_gpe(match_mask, + match_value, items, + tunnel); last_item = MLX5_FLOW_LAYER_VXLAN_GPE; break; case RTE_FLOW_ITEM_TYPE_GENEVE: -- 2.7.4