From patchwork Wed Mar 25 19:53:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asaf Penso X-Patchwork-Id: 67112 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 109F7A058B; Wed, 25 Mar 2020 20:53:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6F5BF2C15; Wed, 25 Mar 2020 20:53:30 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60041.outbound.protection.outlook.com [40.107.6.41]) by dpdk.org (Postfix) with ESMTP id 3B8832BAE; Wed, 25 Mar 2020 20:53:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YWPehUs1EtWNoX7Pd/qlgcqP/jkqZbx9fycwoOBbI6SXu+/H8U7nZ9snL2WyaNg/8D0ni5SXe61mk8MJl8YU1fgUD32vaof51gPW+Yv1e2qJps2PbSJZA90c8ZB5nLJ9+1vfRl1kvYOtZOTBmZO/bkk3xRIwvrsFXoXcDodYhTRhmvbL0YrRIvF+LWum3GuTaqCl+kKFy6FrMxC/6AfHYUiL2dqtHE3a0YaajWt22afVkANZl0YmH1U0/jcbmnktpLp/LHIZfHGUFWxIcA2N5TIqts5FouSiqjNO4gscR1wUupWhvDCJJ+XZhD7kP5nJjWaTgHvSA1u41Uum847HHA== 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=Ouw3MDBKecaqx7SlhMhhe7OlpYkqRVxdmmHFIcRwQFo=; b=Y4ghJ3/sx1tV0ET0AN3Z8TWQoRaPMHPEGxoT4Bu9/LSJY3cdHN6vIyf+hlarJkRhIosfqq9gZP6apipJcO0RPyoOXs7LTsXFAUNRMXEouasnBg5Y8skuuOrGMkSaShtNCN9iUhhbupudMrhrHjPVXU4TzutdUpuGp0fdocjboeN8nCKS+QFnzPgEkCLfkvZ+89a0WdaJbKOA/XxyCjpxSeGgi/CRc+puVNHL4oClz1sjCwvAoVwy8l3BEue4Zto3rsDWtAcJlxehSuvHZJjRPAZL4GJM5XK6AP1B8D/aLVEo0Q7aEviBepKflUkaS3sytPEBbTbUzkxFSv/jWv6AvA== 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=Ouw3MDBKecaqx7SlhMhhe7OlpYkqRVxdmmHFIcRwQFo=; b=DQrlJyCGv2j1eSgjrCZ0NJWChnbkSwNSQAXQkg+JT/2MtgXhJEBqg6XKTzwuYZh1b6GBaxRoUSmmuzSGXAm212+kTKi2cRHOaV52CY0MJCiRP4lVAR0QXQtpPR1TaCm2AgbwfN4pk42b7WpYfUycqNrP9YtcTU7aKhPoxTMOU14= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=asafp@mellanox.com; Received: from VI1PR05MB5693.eurprd05.prod.outlook.com (20.178.124.87) by VI1PR05MB5229.eurprd05.prod.outlook.com (20.178.10.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Wed, 25 Mar 2020 19:53:28 +0000 Received: from VI1PR05MB5693.eurprd05.prod.outlook.com ([fe80::f50f:1ae4:52bb:ce7b]) by VI1PR05MB5693.eurprd05.prod.outlook.com ([fe80::f50f:1ae4:52bb:ce7b%7]) with mapi id 15.20.2835.023; Wed, 25 Mar 2020 19:53:28 +0000 From: Asaf Penso To: dev@dpdk.org Cc: viacheslavo@mellanox.com, matan@mellanox.com, dekelp@mellanox.com, stable@dpdk.org Date: Wed, 25 Mar 2020 19:53:18 +0000 Message-Id: <1585165998-14221-1-git-send-email-asafp@mellanox.com> X-Mailer: git-send-email 1.8.3.1 X-ClientProxiedBy: PR0P264CA0030.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::18) To VI1PR05MB5693.eurprd05.prod.outlook.com (2603:10a6:803:d9::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR0P264CA0030.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19 via Frontend Transport; Wed, 25 Mar 2020 19:53:27 +0000 X-Mailer: git-send-email 1.8.3.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 05283759-1435-4a62-5c80-08d7d0f62fc6 X-MS-TrafficTypeDiagnostic: VI1PR05MB5229:|VI1PR05MB5229: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 0353563E2B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(39860400002)(366004)(376002)(346002)(396003)(450100002)(81166006)(81156014)(8676002)(6666004)(55016002)(66476007)(66946007)(66556008)(8886007)(4326008)(2906002)(5660300002)(16526019)(26005)(186003)(316002)(8936002)(956004)(6916009)(478600001)(86362001)(36756003)(7696005)(52116002)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB5229; H:VI1PR05MB5693.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; 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: OckoY4bDrWdQDkxQTzc5Bu9lCA+zHkK5C5oO7AeJrLMAQJQn0LnNnt9z52ATsHTunwqnEbfuk238+JbgQWrruzJUqpBbAw7klvhPKiXEG08tSWhVu1WDP3lrUTWmGX9oSt68ODUmtyDqABOxP+wnG6RweJRd41wu0TTuSMBaHIIc3oqN12hd6BC5R4XGqIgQSOOnTqaMyW7rWtlOprswk453KKWE45WfKQ10ziClC68kJQjnjmrM3l1EHjl7u42YM5roadVoPRcveuD0oVw1rEpwSOl4QpG9ISd1yyj0YchN85jK0DYgaDmkmAKdz6epqVzZkNrvPkGQrA6aRG9VzFtCjNOUN+LE1QQbVh8mmj+NEnlEEjmTz257yJXIKuvvL6YGmrn/gBMMtRrAywJkK25m1JI87nfq1STnIOIxQVRMACVrieYadIxbGSPLv23I X-MS-Exchange-AntiSpam-MessageData: cP7WxOUKTNWG6pMnNYUmQ3/gQ0NECTGRrssxFMdF8Syq5KdEo25POUFJoroafXnp25tynhBjGkSdPitELrGMfLTvUT5ivcL4qBkR5zgvnpe1Sx/+jiN7XDQQUFanBHD+16pVg4//P3+5WgBsEfEzoQ== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05283759-1435-4a62-5c80-08d7d0f62fc6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2020 19:53:28.1193 (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: R9es1B/dxk6Kw5fHCcXyPu+xwGU4e8T2wEFDbPdM6NQz9ZtFUXBwyrEeER/KTHj/WiCSa4aUqOnV9M1yRLXtNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5229 Subject: [dpdk-dev] [PATCH] net/mlx5: fix call to modify action without init item 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" The item is being set according to the attribute value, whether it is udp/tcp or ipv4/6. Also, there are two condition calls. If the attribute is neither udp/tcp or ipv4/6 the item is not initialized at all, but the call to the flow_dv_convert_modify_action is still being done. Also, even if the attribute is tcp/udp or ipv4/6, we still have two conditions. This patch changes the conditions, so the item will always be set. By doing this, there is also a save in the number of condition calls. Fixes: 4bb14c83 ("net/mlx5: support modify header using Direct Verbs") Cc: stable@dpdk.org Signed-off-by: Asaf Penso Reviewed-by: Dekel Peled Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 809833b..eabc745 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -702,8 +702,8 @@ struct field_modify_info modify_tcp[] = { item.spec = &udp; item.mask = &udp_mask; field = modify_udp; - } - if (attr->tcp) { + } else { + MLX5_ASSERT(attr->tcp); memset(&tcp, 0, sizeof(tcp)); memset(&tcp_mask, 0, sizeof(tcp_mask)); if (action->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC) { @@ -773,8 +773,8 @@ struct field_modify_info modify_tcp[] = { item.spec = &ipv4; item.mask = &ipv4_mask; field = modify_ipv4; - } - if (attr->ipv6) { + } else { + MLX5_ASSERT(attr->ipv6); memset(&ipv6, 0, sizeof(ipv6)); memset(&ipv6_mask, 0, sizeof(ipv6_mask)); ipv6.hdr.hop_limits = conf->ttl_value; @@ -834,8 +834,8 @@ struct field_modify_info modify_tcp[] = { item.spec = &ipv4; item.mask = &ipv4_mask; field = modify_ipv4; - } - if (attr->ipv6) { + } else { + MLX5_ASSERT(attr->ipv6); memset(&ipv6, 0, sizeof(ipv6)); memset(&ipv6_mask, 0, sizeof(ipv6_mask)); ipv6.hdr.hop_limits = 0xFF;