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 B52E1A0350; Wed, 6 May 2020 08:58:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A93311D700; Wed, 6 May 2020 08:58:10 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80051.outbound.protection.outlook.com [40.107.8.51]) by dpdk.org (Postfix) with ESMTP id D54A51D6FD; Wed, 6 May 2020 08:58:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e7SFI+oW53RrSu2YRQbb9nYHnMhszBxuIZCBklOz7mIGiXh/mqidNJdPe2mpqoxZWblI5FrULIpUrv4mj9NVD1HyM+krZSUNtZVW8ArS8JRTamVaunuuUVUokHLNWJK/uEvtdtwa3rh6VazsC0xZK2qKrxfivICZyD0Lc1LmovkCAjD3y2oLSS391zJkz3c0Dhf69IZBWjQzBGS+tDOPb30G/uLGI5ezDYCViHNsuzuOGVDhz4+epGaOs5ugRNhDFwkVny9jXIKl6W8ka5poXNfFzKr8MWPYlBIQ3VY1Z43fmcgk9R/iz5T3vfrjU/ewWRoQxLZygRsz6BH7+wZ3+g== 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=j2VNgqnL/g98cZIeByVVso6kIvK+nKptc9K5vOZlh2Q=; b=FE8UpNKA5p6JPjtNpsdMsW9RI6PJCAhIuIdAjcG50gDdvPmFzWA/jz+UnDbA2P1reYxozKq9vzqJqdrZTI8zT3mYQaCVsrOGClZ93cxVfIDQcY2BmP7Xa3tci9bDUx1gtpiO48eCjLX7bpwHVec3rUk2QUi2aQ8qTz7Ae120p66DdAZCJsArPiXFTCc/T52qGCXUBocsLO/90yGdK/CnHzh2RsUiOdXlZtNsrM5d/gn2M50VreP9BJXvzvUP/VOCZoJ/n191WEql/CQvEWpWqdXhNN5zX1aPlEGZEQjvWKxQteQWOwU25CYygunmoRDGIGwHVKHh9r+QwINhN3AYwg== 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=j2VNgqnL/g98cZIeByVVso6kIvK+nKptc9K5vOZlh2Q=; b=F/opxLkuIwgEeHC8F/IpSQrKw+O62aHo6hmqSu9IkjEaCMnK7T87PEMOzh20KXB4uWTj7v3lA/NQO1fVRUQK7UEj0ol6mWdgjUivYZABj/s7OC29ZvBIG0C5tsQ0/IrfZ2jcF9AcedIqAB8UpYX82zK2wJSkdRVUIBHUTnRuMA0= Authentication-Results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) by AM0PR05MB6690.eurprd05.prod.outlook.com (2603:10a6:20b:146::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Wed, 6 May 2020 06:58:08 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e%5]) with mapi id 15.20.2958.030; Wed, 6 May 2020 06:58:08 +0000 From: Raslan Darawsheh To: viacheslavo@mellanox.com, matan@mellanox.com Cc: dev@dpdk.org, orika@mellanox.com, stable@dpdk.org Date: Wed, 6 May 2020 09:57:56 +0300 Message-Id: <20200506065756.1989-1-rasland@mellanox.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200505094543.30841-1-rasland@mellanox.com> References: <20200505094543.30841-1-rasland@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM0PR10CA0040.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::20) To AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (188.161.229.217) by AM0PR10CA0040.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2979.27 via Frontend Transport; Wed, 6 May 2020 06:58:07 +0000 X-Mailer: git-send-email 2.26.0 X-Originating-IP: [188.161.229.217] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e06547ca-128c-49ea-bdb9-08d7f18ad511 X-MS-TrafficTypeDiagnostic: AM0PR05MB6690:|AM0PR05MB6690: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-Forefront-PRVS: 03950F25EC X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Oc2nhKATa4iOh1Of4OPSTXtP5HFwNNB6pzlnYfcUWmz7j+hwx3K+IsexEIY9L4AHV+qZYAzP3juZ0JsjIq0d/2gUX6HPdVT3vJUENJfpfWpse63S0tMLwanWCLpkYfjvTzLe1MmD2jrIfuvHAKRRohy7Lp56wbt3gLajTnz+Z922CjjQRxPmMxYQ9IXUBqpmazeALDNk2z1caL2ikYVHUOxEdl2o9n8x/3DEZrRpJl7xTz9ATvLBnj7xaV03aTcdvtV2YOYo+PW1lwzQ3cYBKhqV7UjmvDrB0CUks7harlmt31yCAnADorJc+i9bviRJ9u4YR2iJClxz20m/D3ornWeEc/9m/5MCJi9pk8KVj+gOLATNl906yga9W0pSXOUoMslLU1FLaZpu1B1AtYSTjqbXF2eJRSBfuzJKxbXh1v0QgDzCTjn+4sscHA2P7YyRiPkuPsRjkja/WR1jGv4bgBxmI0sXSAHeGb7nKIVrMyimjNCi/mlJI+hbWSNgOcDxN870EuWbRLEX+C3bBQe8ZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6707.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(366004)(346002)(376002)(396003)(39860400002)(33430700001)(55016002)(36756003)(8676002)(86362001)(1076003)(26005)(186003)(7696005)(52116002)(6666004)(316002)(8936002)(33440700001)(2616005)(956004)(6636002)(16526019)(5660300002)(66476007)(66556008)(66946007)(478600001)(450100002)(4326008)(2906002)(8886007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: abk1Yrv4G7+Z7x1UqP7h72S9J3syhQlbVYa8u7zW9mhJGEngd0tb9W0u1y4a3ezriHQRWxkLDQsfH4/docn9Bijgw7TaSCZOHjoa1pM98RhzjZiv/xGXzZGpwjD/jn31V6Y+7dBzF08s1gHUojbFW0PsuuBLNBYxbCNhqaPptdr/PwZ0uISxXJZl60DP55MVau4LX9qzVf3xRlHC2+FzIJazFxJpbkH2uScoJqxXQ949z9ZCtiVgGBlmGlmOC6fIYoJEvVmh3fitTqWKl4c/6xPDe2kpVoQ27awxXqzGh4xlEsui/f4QfHn33v499mN2LhbfDRXQVT/NjiAjj1D9TXyBGMi1XALY2F+Ur2k9SsCEFD95CtMS8B4eG1kTHpREaUawMJ/bi8oH0r0tQ2ZW3B88MA4cyP76xjqFx0kOkAXemvn9G87hI12HIRLXfle1FxtGAw4jddqyCHM+DaLlgesot079p6iDzr/oLGBnFTNjzMUMLXeOIYpsqd8i7ZbwRFO6RiGr4ZKBfGkKrdQ8quIrEZVzOV/TtD4YjToo/DTPDdV+6rVs4q/Wd5EL1ls3orBmvS9vIQM7nPzNXK/KlKCdhX99gV7dCc7fUWypKbJXVGVtYKyn6sJVM47GLdiGoUlywEfuHcvj/e1vuCGN5EZKAIVhr13w1vA1panPKk3YP9CnWb9tyVlMNM5MWPEjiG6ICRczkdMWpl/CGntUv2ghrC83+G/kOJJq3BZOdV22hanH7Gf1CYwOAbA6u/cNRygYhpdRv9ggdGQQX+ikTf8ySRBzpkIw+55Sw3WeHv27D+JmbNB+gV3xEvYBLjc5 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e06547ca-128c-49ea-bdb9-08d7f18ad511 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2020 06:58:08.4230 (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: b+KocTn3ZkkgbTgkv0xMZQvpyIktDNkYiMjhf07oEsUGdHzSFy/ru43xNaXGTvxVgXt+2PP32vlatmWIxqfKkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6690 Subject: [dpdk-dev] [PATCH v4] net/mlx5: fix matching for UDP tunnels with verbs 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" When creating flow rule with zero specs it will cause matching all UDP packets like following: eth / ipv4 / udp / vxlan / end Such rule will match all udp packets. This change the behavior to match the dv flow engine which will automatically set the match on relative outer UDP port if the user didn't specify any. Fixes: 84c406e74524 ("net/mlx5: add flow translate function") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh Acked-by: Matan Azrad --- v2: fixed checkpatch issues v3: handled ITEM_VOID after udp item. v4: removed extra unnecessary check for NULL --- drivers/net/mlx5/mlx5_flow_verbs.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 7efd97f54..24d4a7203 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -680,6 +680,28 @@ flow_verbs_translate_item_udp(struct mlx5_flow *dev_flow, udp.val.src_port &= udp.mask.src_port; udp.val.dst_port &= udp.mask.dst_port; } + item++; + while (item->type == RTE_FLOW_ITEM_TYPE_VOID) + item++; + if (!(udp.val.dst_port & udp.mask.dst_port)) { + switch ((item)->type) { + case RTE_FLOW_ITEM_TYPE_VXLAN: + udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN); + udp.mask.dst_port = 0xffff; + break; + case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: + udp.val.dst_port = htons(MLX5_UDP_PORT_VXLAN_GPE); + udp.mask.dst_port = 0xffff; + break; + case RTE_FLOW_ITEM_TYPE_MPLS: + udp.val.dst_port = htons(MLX5_UDP_PORT_MPLS); + udp.mask.dst_port = 0xffff; + break; + default: + break; + } + } + flow_verbs_spec_add(&dev_flow->verbs, &udp, size); } -- 2.26.0