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 F06FD43AFD; Sun, 18 Feb 2024 06:12:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E6B8940FDE; Sun, 18 Feb 2024 06:12:08 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2064.outbound.protection.outlook.com [40.107.101.64]) by mails.dpdk.org (Postfix) with ESMTP id 652E540EA5 for ; Sun, 18 Feb 2024 06:12:07 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jMPCqUvEGQwZ7EaJ5KlRzQF8e1eV6DNrj1a/eMz5upMusnZJ67Kjy1zW9ojt3YBrGF5KGy5ed95JHHCeMdolTHJsaRloVO2HoCG0IggwCkw1xGM9He2TitMcBieuIfCm6e9J2yrxJ0NuNL9IG4ndV9/kPdtI2O+BnK6fX5/wlCCOhECJSOZcmcYeeiMoxTC0buekxNbRmD1S2c1ENViIdV/4PD/rQQb8X0vL+XSLF1Cq00dsiQiEdQgIoDZ4rqnv/G1YiNoOpaS8qf9oSakFQ3MnIOfs6BXrrTTwHBp6EBPeR28Zo1esMnb27nisUAjCdyvDtkWlyLFLWNOwWxrhog== 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=b6mHJRJ3KwaKwR3pqLuEhv05yHFWnKZWbuxUwiys8jQ=; b=SyCTlLPwpegW0XAfHlifS80/Xo05l2ksftRYg3DwUPax5RJxUu8+B0Sl5H1VZe7XQIwnNgGSdEIYJ7TNzLt/9AJnnaBDXlgcJ59sFhWLb5btd790ZFGgERbfrOMIgHNH1Yw8WCV85bbp++vzt4BSy2mHccJORuxvF/SXV1lCuHi7omxemvRjoebGZBBvNu4Wyon7bT+Hv8ujzBHTzJcW1VhiJwNdVe8YOoCvXzvVi88yJzySRR2pGm05CxrWCr8+ojO080q4yGPb+ndwscJGXcQixfh0nYnYeV5CJKSn3w/g7jV+RA4zkPkJn65HJHWnaKrEwqgZ35zOI0lJTcahEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=b6mHJRJ3KwaKwR3pqLuEhv05yHFWnKZWbuxUwiys8jQ=; b=dXlpdJ8AFQRgQiJk0YH/tPZEzIMHndGb0Goy8tv9Mwd+3CGso23P1xdFCr7dJRwtKcw2Kn44RhrHAfl0eGI8KMlhyb++6c3WXD9VNCgvScwJ1AxifgSiY50hQXH3rxED9etpRGeTVv5/o54EmUEjE5ZkRXy/We8eaYpasrGp1aNYQ1Hfi5wx7xFDibZHj/ImCKKjc/HYKX2BnWp9ZFwjcMzTxtl0eVL9QqQarLEK92cdDn+lgPmnpY89u5jzLgu9EEofQ5a0i1bGxBQnzLe2otFoxqlgDqA299g/qj48gblJEJEAvHcdeWZ/6tmAWhr9yNIzUV7jIGNGqldYhH33XQ== Received: from CH2PR14CA0006.namprd14.prod.outlook.com (2603:10b6:610:60::16) by MW6PR12MB7088.namprd12.prod.outlook.com (2603:10b6:303:238::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.15; Sun, 18 Feb 2024 05:12:03 +0000 Received: from DS2PEPF00003447.namprd04.prod.outlook.com (2603:10b6:610:60:cafe::f9) by CH2PR14CA0006.outlook.office365.com (2603:10b6:610:60::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.35 via Frontend Transport; Sun, 18 Feb 2024 05:12:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS2PEPF00003447.mail.protection.outlook.com (10.167.17.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Sun, 18 Feb 2024 05:12:03 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sat, 17 Feb 2024 21:12:02 -0800 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Sat, 17 Feb 2024 21:12:01 -0800 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Sat, 17 Feb 2024 21:11:59 -0800 From: Itamar Gozlan To: , , , , , , , Dariusz Sosnowski , Ori Kam , Matan Azrad CC: Subject: [v2 07/10] net/mlx5/hws: extend action template creation API Date: Sun, 18 Feb 2024 07:11:21 +0200 Message-ID: <20240218051125.717011-7-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240218051125.717011-1-igozlan@nvidia.com> References: <20240213095038.451299-9-igozlan@nvidia.com> <20240218051125.717011-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: DS2PEPF00003447:EE_|MW6PR12MB7088:EE_ X-MS-Office365-Filtering-Correlation-Id: efb8bfa3-5246-417c-ff06-08dc304024af 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: 603lnv5+azlig7jA09LMlwwxupcKZBdgvsuMFzJN2sgF6OJeNKTg/cJdxE8aXV/eG07hlxAAZeLaDf5+zIPozb+lduhqpCHRUAfS3q0XfsjH/R3XLNrSRC4GU+/bcXCzF+BCn0sCWoC4cO92Sqh4kH0xl32cNnbj8z0sNimS86wkhnxR+r7BeEN/ehpP0gyNA9aXwRwOYEZgcDuw52c5PVGMopMg3/ukLVL+cP0yAMTlFTZJR0q47HgbrMw8/SnA2q5qZc9PtPrB05sYmeBlz1oyj5IEtRQBdpUjDKlydmtfIpgrqxqJ381eafzbYJ3/eYhTrBE2UAxOY0THCxSKFYr9rkBnpLAacIpAuJuNoAbvB7nDVgzBLwCBIc6okUZqdvt/Bsfd9SRRobQb/woBStwhczNYbp6tJUZEW1/PyIKGmsqsgD2kVKWNwRyN52sC8v++WURImnorKeYZ6zIkWqjJfaQjsTHbth9UEvmkpb2Lji6IvTK7Debygpj3jLk89YIUN1A+2TlwrsDPtxtTCuKV33hZstACphTzv5lsxQemf3A0uJMwzTM6KP87P9iv0+yH4LdYGdzltxA81rAjpEysCvKwbBCJt25xtpv1cNNlKFbVgXTGoGAFiD7SoHljhJW9CyZ9aao6iuXJRMU7E/OtMpryS7harFfdKx5Mb74= X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(136003)(396003)(39860400002)(346002)(376002)(230922051799003)(64100799003)(186009)(82310400011)(36860700004)(451199024)(1800799012)(46966006)(40470700004)(70206006)(70586007)(5660300002)(2906002)(8676002)(8936002)(4326008)(55016003)(86362001)(7636003)(36756003)(356005)(82740400003)(921011)(41300700001)(83380400001)(6286002)(26005)(1076003)(426003)(2616005)(336012)(7696005)(6636002)(478600001)(110136005)(316002)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2024 05:12:03.0071 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efb8bfa3-5246-417c-ff06-08dc304024af X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF00003447.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7088 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 49f72118ba..3647e25cf2 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, @@ -383,10 +388,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 3bb3a9a178..9d3dad65d4 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -6202,7 +6202,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