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 0A09443B05; Tue, 13 Feb 2024 10:51:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91A28427DE; Tue, 13 Feb 2024 10:51:27 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) by mails.dpdk.org (Postfix) with ESMTP id 9BABC427DA for ; Tue, 13 Feb 2024 10:51:25 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YlqAzMFEw95ULwnB8+7nr3mMQm6jCu8nxHrO091WwFKpBNq3z9WHdUhkrAfa23SN4+yGtfKQVPWi5fRXEuxv00rXNyYa342HxXo5nNnjoFirPZxqzroJHtkxmbhPtQyibTUvenybn35dbYjYIfOWSimJgYjRf/PzAIS2F/Pble6qljogiSb1eZEevTCqz2YH26aka4NViJgSAs6871YfMW33AGgOfKWuoQTkm8GCEE9yQShgVLwJFplPq94k6TkWaT3pbCBML6NU7e8s6/CbDVd+fJ66l+82p8S3mq2eCz6HO7sdSiG4CYaFO9430jK40pvhO5OvNrT1Nb24WvwIpw== 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=9EXyhE9Tb+Rq/iSDqptoamWVLaoTxHYaWkIADlG8C0A=; b=dgyEUkFINbzQyox7EBkIcHgl4a9XYwl76Uto4pMvJt9GPzag1oBcoDqj4jTdgXWYRE6hI6hluFfmfbmbflQvlpXdv90zgepLMnTFHtRPw6f4EM01cgueYNp1McEzGZVgrbV2mK0PZNX2bM5MiooGCUKuqyFmjBVUUUbAfsbtgUbjLHvwIKY7VRD0rT5/gvQG9HeENCajtnvn9nvRRhdCuN6PAepLrcowefYmv0Fc9iRujrxoZzgyFfW4mWllQcJYUUJiZcLC+eGCqy4f2IcQ+4Ox7bs8uUmBDBz/y5ihX/ULxk82XLjNFLciZP0peQLnkrpJcqw2KKKvGIGUHzU3fw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=monjalon.net 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=9EXyhE9Tb+Rq/iSDqptoamWVLaoTxHYaWkIADlG8C0A=; b=LrmM/3X51jh87uwL2+6S6ZGBjC2yYKiPCCmeV8bNnqb2+V88kremigxBkl8Z9AUps3ecb7jD9os1T5JQfS8zfpt2PJULHQBsIpHB3Czi86YBIRvGx0vnvRfwskWPFCuEXhpW5TUvUczmPY80EqfVTtZe+N2XWMuZcw6VExhempZpBvBYUo6jfZc+4IyLh3YTqa+wdUFMbhomOZiB/ot3zCFn8+ST1Lv6i78vaO0+Mz2Dc0miE/kibHZGRzP0ZoxBNPYWAT289x+ER4OmerRUvRHtkkw8vic5OtjZpI+U/ktAZlgIRo/1/LNWZelse2KVUMR36YNsp9xBs5UDAj8ftg== Received: from BN9PR03CA0760.namprd03.prod.outlook.com (2603:10b6:408:13a::15) by BL1PR12MB5271.namprd12.prod.outlook.com (2603:10b6:208:315::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.26; Tue, 13 Feb 2024 09:51:23 +0000 Received: from BN2PEPF0000449E.namprd02.prod.outlook.com (2603:10b6:408:13a:cafe::94) by BN9PR03CA0760.outlook.office365.com (2603:10b6:408:13a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.40 via Frontend Transport; Tue, 13 Feb 2024 09:51:23 +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 BN2PEPF0000449E.mail.protection.outlook.com (10.167.243.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 09:51:23 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Tue, 13 Feb 2024 01:51:11 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 13 Feb 2024 01:51:10 -0800 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41 via Frontend Transport; Tue, 13 Feb 2024 01:51:08 -0800 From: Itamar Gozlan To: , , , , , , , Dariusz Sosnowski , Ori Kam , Matan Azrad CC: Subject: [PATCH 7/9] net/mlx5/hws: extend action template creation API Date: Tue, 13 Feb 2024 11:50:35 +0200 Message-ID: <20240213095038.451299-7-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240213095038.451299-1-igozlan@nvidia.com> References: <20240213095038.451299-1-igozlan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449E:EE_|BL1PR12MB5271:EE_ X-MS-Office365-Filtering-Correlation-Id: 76f50770-69f6-4666-412c-08dc2c795673 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: VHFZ39jAx5DrpZVw+RucEbMWa4g1Qctiucy4OCQJIKcBVPFb9NIqxE+gcpfUJpQxk/mrydbWnY0yIzsiRrmsevcq6zuMIN/scMRq5gzN7ny4sygMHTGOIPuX+Gds68gvgdwpK6WGd14uLww05zclFyyZPKmqV07d0SZqzsWZURGJBixM5hvwJONz64jTupmJsVpvYii/YWJ1XJTMgO5XyVkN/aHMVC5uXQnm+wDRZ2w6DlIClRz568vaXy/SVD1RSDCABPY7sonCbvNtokx0NZ44odPkrfIPcmUlp5LIv5uwof4B6eIAtS/Td7o/U9M6/3VXr3cXDeIrugg28DjEawNHbBTuis/1ssBQtUmJMWVD/44AP7mHghl5Kram4tgP3J1CTfaLg9KKX5jrcXLKCkK5aRKfajvjKbKZ1FjJZh+0VvcJSyqyCZgC91MfC7j5s4v95vVCeArQIBlol81tCyODm8blOekk0VvSO3elmLcMbnTS2vB+M+nb0l7MGsHqmTqreye12LeO/pEmymoSH2ZSePHvHmiKmZuTkTHdTHROUlUhkhP0Uw4g8kByQT9gEDc1lBtGQqVog6dfBTOyclhhSf+Hq56ij5GNd7HGQN3YOSs/SqnEejTzFLVOcqLxRtZ/9/4m3fF2fBMDShUSEg== 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)(396003)(346002)(376002)(39860400002)(136003)(230922051799003)(82310400011)(64100799003)(451199024)(1800799012)(186009)(46966006)(40470700004)(36840700001)(2906002)(55016003)(1076003)(41300700001)(2616005)(478600001)(921011)(83380400001)(5660300002)(7696005)(6636002)(8936002)(8676002)(4326008)(336012)(70586007)(70206006)(426003)(26005)(6286002)(36756003)(110136005)(6666004)(316002)(7636003)(356005)(82740400003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 09:51:23.0795 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76f50770-69f6-4666-412c-08dc2c795673 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: BN2PEPF0000449E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5271 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 From: Hamdan Igbaria Extend mlx5dr_action_template_create function params to include flags parameter. Signed-off-by: Hamdan Igbaria Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr.h | 10 +++++++++- drivers/net/mlx5/hws/mlx5dr_action.c | 11 ++++++++++- drivers/net/mlx5/hws/mlx5dr_action.h | 1 + drivers/net/mlx5/hws/mlx5dr_matcher.c | 16 ++++++++++------ drivers/net/mlx5/mlx5_flow_hw.c | 2 +- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index 9d8f8e13dc..c11ec08616 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -84,6 +84,11 @@ enum mlx5dr_match_template_flags { MLX5DR_MATCH_TEMPLATE_FLAG_RELAXED_MATCH = 1, }; +enum mlx5dr_action_template_flags { + /* Allow relaxed actions order. */ + MLX5DR_ACTION_TEMPLATE_FLAG_RELAXED_ORDER = 1 << 0, +}; + enum mlx5dr_send_queue_actions { /* Start executing all pending queued rules */ MLX5DR_SEND_QUEUE_ACTION_DRAIN_ASYNC = 1 << 0, @@ -362,10 +367,13 @@ int mlx5dr_match_template_destroy(struct mlx5dr_match_template *mt); * An array of actions based on the order of actions which will be provided * with rule_actions to mlx5dr_rule_create. The last action is marked * using MLX5DR_ACTION_TYP_LAST. + * @param[in] flags + * Template creation flags * @return pointer to mlx5dr_action_template on success NULL otherwise */ struct mlx5dr_action_template * -mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[]); +mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[], + uint32_t flags); /* Destroy action template. * diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 862ee3e332..370886907f 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -3385,12 +3385,19 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) } struct mlx5dr_action_template * -mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[]) +mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[], + uint32_t flags) { struct mlx5dr_action_template *at; uint8_t num_actions = 0; int i; + if (flags > MLX5DR_ACTION_TEMPLATE_FLAG_RELAXED_ORDER) { + DR_LOG(ERR, "Unsupported action template flag provided"); + rte_errno = EINVAL; + return NULL; + } + at = simple_calloc(1, sizeof(*at)); if (!at) { DR_LOG(ERR, "Failed to allocate action template"); @@ -3398,6 +3405,8 @@ mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[]) return NULL; } + at->flags = flags; + while (action_type[num_actions++] != MLX5DR_ACTION_TYP_LAST) ; diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h index fad35a845b..a8d9720c42 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.h +++ b/drivers/net/mlx5/hws/mlx5dr_action.h @@ -119,6 +119,7 @@ struct mlx5dr_action_template { uint8_t num_of_action_stes; uint8_t num_actions; uint8_t only_term; + uint32_t flags; }; struct mlx5dr_action { diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 0d5c462734..402242308d 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -686,12 +686,16 @@ static int mlx5dr_matcher_check_and_process_at(struct mlx5dr_matcher *matcher, bool valid; int ret; - /* Check if action combinabtion is valid */ - valid = mlx5dr_action_check_combo(at->action_type_arr, matcher->tbl->type); - if (!valid) { - DR_LOG(ERR, "Invalid combination in action template"); - rte_errno = EINVAL; - return rte_errno; + if (!(at->flags & MLX5DR_ACTION_TEMPLATE_FLAG_RELAXED_ORDER)) { + /* Check if actions combinabtion is valid, + * in the case of not relaxed actions order. + */ + valid = mlx5dr_action_check_combo(at->action_type_arr, matcher->tbl->type); + if (!valid) { + DR_LOG(ERR, "Invalid combination in action template"); + rte_errno = EINVAL; + return rte_errno; + } } /* Process action template to setters */ diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 3af5e1f160..5ad45ce2ae 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -6198,7 +6198,7 @@ flow_hw_dr_actions_template_create(struct rte_eth_dev *dev, at->recom_off = recom_off; action_types[recom_off] = recom_type; } - dr_template = mlx5dr_action_template_create(action_types); + dr_template = mlx5dr_action_template_create(action_types, 0); if (dr_template) { at->dr_actions_num = curr_off; } else { -- 2.39.3