get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/122778/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 122778,
    "url": "http://patchwork.dpdk.org/api/patches/122778/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230201072815.1329101-3-valex@nvidia.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20230201072815.1329101-3-valex@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230201072815.1329101-3-valex@nvidia.com",
    "date": "2023-02-01T07:28:01",
    "name": "[v2,02/16] net/mlx5/hws: matcher remove AT and MT limitation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "52981a1b2fe659c26b30bdaf7eb92c4f7abd4f73",
    "submitter": {
        "id": 2858,
        "url": "http://patchwork.dpdk.org/api/people/2858/?format=api",
        "name": "Alex Vesker",
        "email": "valex@nvidia.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patchwork.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230201072815.1329101-3-valex@nvidia.com/mbox/",
    "series": [
        {
            "id": 26726,
            "url": "http://patchwork.dpdk.org/api/series/26726/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=26726",
            "date": "2023-02-01T07:28:01",
            "name": "net/mlx5/hws: support range and partial hash matching",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/26726/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/122778/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/122778/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D47F041B9B;\n\tWed,  1 Feb 2023 08:28:54 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6D44240A7A;\n\tWed,  1 Feb 2023 08:28:54 +0100 (CET)",
            "from NAM04-BN8-obe.outbound.protection.outlook.com\n (mail-bn8nam04on2061.outbound.protection.outlook.com [40.107.100.61])\n by mails.dpdk.org (Postfix) with ESMTP id 279F34021F\n for <dev@dpdk.org>; Wed,  1 Feb 2023 08:28:53 +0100 (CET)",
            "from BN1PR14CA0026.namprd14.prod.outlook.com (2603:10b6:408:e3::31)\n by DM6PR12MB4896.namprd12.prod.outlook.com (2603:10b6:5:1b6::18) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Wed, 1 Feb\n 2023 07:28:51 +0000",
            "from BN8NAM11FT006.eop-nam11.prod.protection.outlook.com\n (2603:10b6:408:e3:cafe::37) by BN1PR14CA0026.outlook.office365.com\n (2603:10b6:408:e3::31) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38 via Frontend\n Transport; Wed, 1 Feb 2023 07:28:50 +0000",
            "from mail.nvidia.com (216.228.117.160) by\n BN8NAM11FT006.mail.protection.outlook.com (10.13.177.21) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.6064.22 via Frontend Transport; Wed, 1 Feb 2023 07:28:50 +0000",
            "from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com\n (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 31 Jan\n 2023 23:28:42 -0800",
            "from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com\n (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 31 Jan\n 2023 23:28:39 -0800"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=IkXpYYdhSVzJzMCwtdM1OIUCu5kpfTqjabDH2Z9ASBYDY4zXfqrysMXl49fmd6hJynu2JzqDHLNq3+hIirgSLfBQoGCfQLFjljTRmLDmH6ygLsMJYhLohMg8seUILYtfQlzVa1w2yYptt8P4qrSBBl3gpYhy78Ua9XKfifY4UODRE/lvcTWvG9tQZWYwv12Deu6BgN0uIAzBeg3v+icqfBAvlq2os/JBN6Qu4fq/pTo+Zq+nw60aC+Vv/+UKmcKtJr+fjEiRg37ZZikOP0xtawr9KX/wXaRhWvWdNmTlRRMZt/2iXHOXITS6LsKB28R5YbUlkCCg8r6O4pghdka81Q==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n 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;\n bh=iU1+7ngSiW7pco8HxulNG8vgueNU0j9Z/8l3ZtZJl44=;\n b=CrZAEgaxY+5jSd/p6Q6Kf5WZP0SCgbb513RQv0yhT/8/eUO33qHXS39iNle2geC2IG7OsmT4IFN7e82kNBun9Zovb7/4IMw/yZotWb7rCzrJI8fJYovotIm9LKxmvGRcDxG4/9kh7Ni2k99St4k1fhIE+iojLv1CdSox89DLbXtZnfnnoQSuiv75uU13PqBGmMvS0tc4j6XuQTrosQxq8iPOH3Gc6HxrZfPqYuTv/k4eBBx8uzvXdrccKpeu80dxH15jGwQ4Xtp3+GHnvuQuVHcsMXCfJaxtV/Bwpa9e5/QLn1E3LmteInnzR8mSStODw4y2rR+tYS6UoAFi9t5sRA==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.117.160) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com;\n dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;\n dkim=none (message not signed); arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=iU1+7ngSiW7pco8HxulNG8vgueNU0j9Z/8l3ZtZJl44=;\n b=ObPrRVNLEvHGTW/Mv354YUP3X60AvYByZTIEIlhlbbTWbAZlKOSkG68gYEqbxYzWNzUzu3pDkKFX37ePC3vpAPUOxmA8x4ATd7m3K5Ap5GZnYUVjBnARdAiPpPmgwpnV1ROnshAPTWHUugxy4j0al4XpawXRADB6bA+9pGRwaQ8zm/7TXwOTfiyigrzgWSxPbobMOY3BWApMc9H9OiwO5BSETnKRjxqYLLgJLjDaqwBzpepmTKXhG8NAuoxYnofhKvnVHgaaSKzkXmhqRC5gyiWHNflj1gUdYVR5uLQG7iVeUKd6+bRFNnh6TUiczMZd/mMVbOcC5/J7nYK/VP90Kw==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.117.160)\n smtp.mailfrom=nvidia.com;\n dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=nvidia.com;",
        "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 216.228.117.160 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C",
        "From": "Alex Vesker <valex@nvidia.com>",
        "To": "<valex@nvidia.com>, <viacheslavo@nvidia.com>, <thomas@monjalon.net>,\n \"Matan Azrad\" <matan@nvidia.com>",
        "CC": "<dev@dpdk.org>, <orika@nvidia.com>",
        "Subject": "[v2 02/16] net/mlx5/hws: matcher remove AT and MT limitation",
        "Date": "Wed, 1 Feb 2023 09:28:01 +0200",
        "Message-ID": "<20230201072815.1329101-3-valex@nvidia.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20230201072815.1329101-1-valex@nvidia.com>",
        "References": "<20230131093346.1261066-1-valex@nvidia.com>\n <20230201072815.1329101-1-valex@nvidia.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.126.230.37]",
        "X-ClientProxiedBy": "rnnvmail201.nvidia.com (10.129.68.8) To\n rnnvmail201.nvidia.com (10.129.68.8)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "BN8NAM11FT006:EE_|DM6PR12MB4896:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "87411a26-d5c6-4c9f-2dd3-08db0425f70f",
        "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": "\n QSQ4CRfMb+CciRn//D2fb1U/j85nMpI5moakDJpGs1ABIe2KBDukMKtP9ITtNNDyrNMcEaqVaHy1eCna3GdqLloKeRW67a7uhLWmR8Z424tIBsB4teDp4Yjwv15babx0O6P8Tg/WmT3UYy1QsvkE9c/ffF9E1FGuqaWbFUakivJOUoACbT04RfgFTZ5Wdz2HfcAd8WRjpuJ/ARVV226a6VHzmzYRXOoLweb1oWyQ3TTFmSD4btTr3TxQdu03dGtU+oDsWn0DHQqeVquY7F/5k4IaifDLFotyXLblcBrouFmc1vUuhfCadkrcAaT0sNcI7tTZe0+T1a1bX0sLmDWhDJaCVjbUKRA4HtY/SMjKR+DiJh9gjkCeSxq1G0TYLZH3dTAbD6jHh1XolySkR+OlcUCyrFtA7HsvfMIBR1b/jEWj62LVdrelDW2xngIEEDdWWqatBdaFLSPCtkzD+F3QIOZfqm/tgeQbRSqEJLpfiuD3057lmBX15tBtHvJ39NjKk7/qcirzslu96b5A9nhRjeYh1gLNUzqDQCsWTT6kezmFK7zHZYgCn9tclNGzEdlD91S01dGIUvCPUPkVR9L0jFX/3+NqO5T+18zDrDbm/1S017v8n7qQyCF+HOZe0jITPxy71z59SbLyKItrZapc4BYduNqnXxke9biHAGtb30fT6W65yD+83x9NJbKOtJZUHsHC6QyGaFtwl8BZHn+V/Q==",
        "X-Forefront-Antispam-Report": "CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1;\n SRV:;\n IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE;\n SFS:(13230025)(4636009)(136003)(376002)(346002)(396003)(39860400002)(451199018)(40470700004)(46966006)(36840700001)(30864003)(36756003)(83380400001)(7636003)(2906002)(426003)(2616005)(336012)(82310400005)(86362001)(82740400003)(356005)(7696005)(40460700003)(36860700001)(186003)(6286002)(1076003)(47076005)(16526019)(26005)(478600001)(8936002)(55016003)(8676002)(41300700001)(4326008)(70586007)(70206006)(40480700001)(107886003)(6636002)(110136005)(6666004)(5660300002)(54906003)(316002);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "01 Feb 2023 07:28:50.6294 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 87411a26-d5c6-4c9f-2dd3-08db0425f70f",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n BN8NAM11FT006.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "DM6PR12MB4896",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "The action and match templates were stored on the matcher in\na fixed size array to reduce cache misses and reuse template\ncalculations. This approuch introduced two issues:\n-limitation of fixed array\n-definer is bindind to match template and cannot be used with\n union definer since the layout is fixed\n\nSigned-off-by: Alex Vesker <valex@nvidia.com>\n---\n drivers/net/mlx5/hws/mlx5dr_debug.c   |   4 +-\n drivers/net/mlx5/hws/mlx5dr_matcher.c | 109 ++++++++++++++++----------\n drivers/net/mlx5/hws/mlx5dr_matcher.h |   8 +-\n drivers/net/mlx5/hws/mlx5dr_rule.c    |  15 ++--\n 4 files changed, 78 insertions(+), 58 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c\nindex 0815327b18..9199ec16e0 100644\n--- a/drivers/net/mlx5/hws/mlx5dr_debug.c\n+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c\n@@ -92,7 +92,7 @@ mlx5dr_debug_dump_matcher_match_template(FILE *f, struct mlx5dr_matcher *matcher\n \tint i, ret;\n \n \tfor (i = 0; i < matcher->num_of_mt; i++) {\n-\t\tstruct mlx5dr_match_template *mt = matcher->mt[i];\n+\t\tstruct mlx5dr_match_template *mt = &matcher->mt[i];\n \n \t\tret = fprintf(f, \"%d,0x%\" PRIx64 \",0x%\" PRIx64 \",%d,%d\\n\",\n \t\t\t      MLX5DR_DEBUG_RES_TYPE_MATCHER_MATCH_TEMPLATE,\n@@ -123,7 +123,7 @@ mlx5dr_debug_dump_matcher_action_template(FILE *f, struct mlx5dr_matcher *matche\n \tint i, j, ret;\n \n \tfor (i = 0; i < matcher->num_of_at; i++) {\n-\t\tstruct mlx5dr_action_template *at = matcher->at[i];\n+\t\tstruct mlx5dr_action_template *at = &matcher->at[i];\n \n \t\tret = fprintf(f, \"%d,0x%\" PRIx64 \",0x%\" PRIx64 \",%d,%d,%d\",\n \t\t\t      MLX5DR_DEBUG_RES_TYPE_MATCHER_ACTION_TEMPLATE,\ndiff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c\nindex d509a2f0e1..913bb9d447 100644\n--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c\n+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c\n@@ -430,8 +430,8 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,\n \t\t\t/* The usual Hash Table */\n \t\t\trtc_attr.update_index_mode = MLX5_IFC_RTC_STE_UPDATE_MODE_BY_HASH;\n \t\t\t/* The first match template is used since all share the same definer */\n-\t\t\trtc_attr.definer_id = mlx5dr_definer_get_id(matcher->mt[0]->definer);\n-\t\t\trtc_attr.is_jumbo = mlx5dr_definer_is_jumbo(matcher->mt[0]->definer);\n+\t\t\trtc_attr.definer_id = mlx5dr_definer_get_id(matcher->mt->definer);\n+\t\t\trtc_attr.is_jumbo = mlx5dr_definer_is_jumbo(matcher->mt->definer);\n \t\t} else if (attr->insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX) {\n \t\t\trtc_attr.update_index_mode = MLX5_IFC_RTC_STE_UPDATE_MODE_BY_OFFSET;\n \t\t\trtc_attr.num_hash_definer = 1;\n@@ -439,10 +439,8 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,\n \t\t\tif (attr->distribute_mode == MLX5DR_MATCHER_DISTRIBUTE_BY_HASH) {\n \t\t\t\t/* Hash Split Table */\n \t\t\t\trtc_attr.access_index_mode = MLX5_IFC_RTC_STE_ACCESS_MODE_BY_HASH;\n-\t\t\t\trtc_attr.definer_id =\n-\t\t\t\t\tmlx5dr_definer_get_id(matcher->mt[0]->definer);\n-\t\t\t\trtc_attr.is_jumbo =\n-\t\t\t\t\tmlx5dr_definer_is_jumbo(matcher->mt[0]->definer);\n+\t\t\t\trtc_attr.definer_id = mlx5dr_definer_get_id(matcher->mt->definer);\n+\t\t\t\trtc_attr.is_jumbo = mlx5dr_definer_is_jumbo(matcher->mt->definer);\n \t\t\t} else if (attr->distribute_mode == MLX5DR_MATCHER_DISTRIBUTE_BY_LINEAR) {\n \t\t\t\t/* Linear Lookup Table */\n \t\t\t\trtc_attr.access_index_mode = MLX5_IFC_RTC_STE_ACCESS_MODE_LINEAR;\n@@ -579,7 +577,7 @@ static void mlx5dr_matcher_set_pool_attr(struct mlx5dr_pool_attr *attr,\n \n static int mlx5dr_matcher_bind_at(struct mlx5dr_matcher *matcher)\n {\n-\tbool is_jumbo = mlx5dr_definer_is_jumbo(matcher->mt[0]->definer);\n+\tbool is_jumbo = mlx5dr_definer_is_jumbo(matcher->mt->definer);\n \tstruct mlx5dr_cmd_stc_modify_attr stc_attr = {0};\n \tstruct mlx5dr_table *tbl = matcher->tbl;\n \tstruct mlx5dr_pool_attr pool_attr = {0};\n@@ -589,7 +587,7 @@ static int mlx5dr_matcher_bind_at(struct mlx5dr_matcher *matcher)\n \tbool valid;\n \n \tfor (i = 0; i < matcher->num_of_at; i++) {\n-\t\tstruct mlx5dr_action_template *at = matcher->at[i];\n+\t\tstruct mlx5dr_action_template *at = &matcher->at[i];\n \n \t\t/* Check if action combinabtion is valid */\n \t\tvalid = mlx5dr_action_check_combo(at->action_type_arr, matcher->tbl->type);\n@@ -679,7 +677,7 @@ static int mlx5dr_matcher_bind_mt(struct mlx5dr_matcher *matcher)\n \n \tfor (i = 0; i < matcher->num_of_mt; i++) {\n \t\t/* Get a definer for each match template */\n-\t\tret = mlx5dr_definer_get(ctx, matcher->mt[i]);\n+\t\tret = mlx5dr_definer_get(ctx, &matcher->mt[i]);\n \t\tif (ret)\n \t\t\tgoto definer_put;\n \n@@ -689,8 +687,8 @@ static int mlx5dr_matcher_bind_mt(struct mlx5dr_matcher *matcher)\n \t\tif (i == 0)\n \t\t\tcontinue;\n \n-\t\tret = mlx5dr_definer_compare(matcher->mt[i]->definer,\n-\t\t\t\t\t     matcher->mt[i - 1]->definer);\n+\t\tret = mlx5dr_definer_compare(matcher->mt[i].definer,\n+\t\t\t\t\t     matcher->mt[i - 1].definer);\n \t\tif (ret) {\n \t\t\tDR_LOG(ERR, \"Match templates cannot be used on the same matcher\");\n \t\t\trte_errno = ENOTSUP;\n@@ -716,7 +714,7 @@ static int mlx5dr_matcher_bind_mt(struct mlx5dr_matcher *matcher)\n \n definer_put:\n \twhile (created--)\n-\t\tmlx5dr_definer_put(matcher->mt[created]);\n+\t\tmlx5dr_definer_put(&matcher->mt[created]);\n \n \treturn ret;\n }\n@@ -726,7 +724,7 @@ static void mlx5dr_matcher_unbind_mt(struct mlx5dr_matcher *matcher)\n \tint i;\n \n \tfor (i = 0; i < matcher->num_of_mt; i++)\n-\t\tmlx5dr_definer_put(matcher->mt[i]);\n+\t\tmlx5dr_definer_put(&matcher->mt[i]);\n \n \tmlx5dr_pool_destroy(matcher->match_ste.pool);\n }\n@@ -939,11 +937,10 @@ mlx5dr_matcher_create_col_matcher(struct mlx5dr_matcher *matcher)\n \t}\n \n \tcol_matcher->tbl = matcher->tbl;\n-\tcol_matcher->num_of_mt = matcher->num_of_mt;\n-\tmemcpy(col_matcher->mt, matcher->mt, matcher->num_of_mt * sizeof(*matcher->mt));\n+\tcol_matcher->mt = matcher->mt;\n+\tcol_matcher->at = matcher->at;\n \tcol_matcher->num_of_at = matcher->num_of_at;\n-\tmemcpy(col_matcher->at, matcher->at, matcher->num_of_at * sizeof(*matcher->at));\n-\n+\tcol_matcher->num_of_mt = matcher->num_of_mt;\n \tcol_matcher->attr.priority = matcher->attr.priority;\n \tcol_matcher->attr.mode = MLX5DR_MATCHER_RESOURCE_MODE_HTABLE;\n \tcol_matcher->attr.optimize_flow_src = matcher->attr.optimize_flow_src;\n@@ -1069,7 +1066,7 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher)\n \tflow_attr.tbl_type = type;\n \n \t/* On root table matcher, only a single match template is supported */\n-\tret = flow_dv_translate_items_hws(matcher->mt[0]->items,\n+\tret = flow_dv_translate_items_hws(matcher->mt[0].items,\n \t\t\t\t\t  &flow_attr, mask->match_buf,\n \t\t\t\t\t  MLX5_SET_MATCHER_HS_M, NULL,\n \t\t\t\t\t  &match_criteria,\n@@ -1126,36 +1123,64 @@ static int mlx5dr_matcher_uninit_root(struct mlx5dr_matcher *matcher)\n }\n \n static int\n-mlx5dr_matcher_check_template(uint8_t num_of_mt, uint8_t num_of_at, bool is_root)\n+mlx5dr_matcher_set_templates(struct mlx5dr_matcher *matcher,\n+\t\t\t     struct mlx5dr_match_template *mt[],\n+\t\t\t     uint8_t num_of_mt,\n+\t\t\t     struct mlx5dr_action_template *at[],\n+\t\t\t     uint8_t num_of_at)\n {\n-\tuint8_t max_num_of_mt;\n-\n-\tmax_num_of_mt = is_root ?\n-\t\tMLX5DR_MATCHER_MAX_MT_ROOT :\n-\t\tMLX5DR_MATCHER_MAX_MT;\n+\tbool is_root = mlx5dr_table_is_root(matcher->tbl);\n+\tint i;\n \n \tif (!num_of_mt || !num_of_at) {\n \t\tDR_LOG(ERR, \"Number of action/match template cannot be zero\");\n-\t\tgoto out_not_sup;\n+\t\trte_errno = ENOTSUP;\n+\t\treturn rte_errno;\n+\t}\n+\n+\tif (is_root && num_of_mt > MLX5DR_MATCHER_MAX_MT_ROOT) {\n+\t\tDR_LOG(ERR, \"Number of match templates exceeds limit\");\n+\t\trte_errno = ENOTSUP;\n+\t\treturn rte_errno;\n \t}\n \n-\tif (num_of_at > MLX5DR_MATCHER_MAX_AT) {\n-\t\tDR_LOG(ERR, \"Number of action templates exceeds limit\");\n-\t\tgoto out_not_sup;\n+\tmatcher->mt = simple_calloc(num_of_mt, sizeof(*matcher->mt));\n+\tif (!matcher->mt) {\n+\t\tDR_LOG(ERR, \"Failed to allocate match template array\");\n+\t\trte_errno = ENOMEM;\n+\t\treturn rte_errno;\n \t}\n \n-\tif (num_of_mt > max_num_of_mt) {\n-\t\tDR_LOG(ERR, \"Number of match templates exceeds limit\");\n-\t\tgoto out_not_sup;\n+\tmatcher->at = simple_calloc(num_of_at, sizeof(*matcher->at));\n+\tif (!matcher->at) {\n+\t\tDR_LOG(ERR, \"Failed to allocate action template array\");\n+\t\trte_errno = ENOMEM;\n+\t\tgoto free_mt;\n \t}\n \n+\tfor (i = 0; i < num_of_mt; i++)\n+\t\tmatcher->mt[i] = *mt[i];\n+\n+\tfor (i = 0; i < num_of_at; i++)\n+\t\tmatcher->at[i] = *at[i];\n+\n+\tmatcher->num_of_mt = num_of_mt;\n+\tmatcher->num_of_at = num_of_at;\n+\n \treturn 0;\n \n-out_not_sup:\n-\trte_errno = ENOTSUP;\n+free_mt:\n+\tsimple_free(matcher->mt);\n \treturn rte_errno;\n }\n \n+static void\n+mlx5dr_matcher_unset_templates(struct mlx5dr_matcher *matcher)\n+{\n+\tsimple_free(matcher->at);\n+\tsimple_free(matcher->mt);\n+}\n+\n struct mlx5dr_matcher *\n mlx5dr_matcher_create(struct mlx5dr_table *tbl,\n \t\t      struct mlx5dr_match_template *mt[],\n@@ -1168,10 +1193,6 @@ mlx5dr_matcher_create(struct mlx5dr_table *tbl,\n \tstruct mlx5dr_matcher *matcher;\n \tint ret;\n \n-\tret = mlx5dr_matcher_check_template(num_of_mt, num_of_at, is_root);\n-\tif (ret)\n-\t\treturn NULL;\n-\n \tmatcher = simple_calloc(1, sizeof(*matcher));\n \tif (!matcher) {\n \t\trte_errno = ENOMEM;\n@@ -1180,15 +1201,15 @@ mlx5dr_matcher_create(struct mlx5dr_table *tbl,\n \n \tmatcher->tbl = tbl;\n \tmatcher->attr = *attr;\n-\tmatcher->num_of_mt = num_of_mt;\n-\tmemcpy(matcher->mt, mt, num_of_mt * sizeof(*mt));\n-\tmatcher->num_of_at = num_of_at;\n-\tmemcpy(matcher->at, at, num_of_at * sizeof(*at));\n \n \tret = mlx5dr_matcher_process_attr(tbl->ctx->caps, matcher, is_root);\n \tif (ret)\n \t\tgoto free_matcher;\n \n+\tret = mlx5dr_matcher_set_templates(matcher, mt, num_of_mt, at, num_of_at);\n+\tif (ret)\n+\t\tgoto free_matcher;\n+\n \tif (is_root)\n \t\tret = mlx5dr_matcher_init_root(matcher);\n \telse\n@@ -1196,11 +1217,13 @@ mlx5dr_matcher_create(struct mlx5dr_table *tbl,\n \n \tif (ret) {\n \t\tDR_LOG(ERR, \"Failed to initialise matcher: %d\", ret);\n-\t\tgoto free_matcher;\n+\t\tgoto unset_templates;\n \t}\n \n \treturn matcher;\n \n+unset_templates:\n+\tmlx5dr_matcher_unset_templates(matcher);\n free_matcher:\n \tsimple_free(matcher);\n \treturn NULL;\n@@ -1213,6 +1236,7 @@ int mlx5dr_matcher_destroy(struct mlx5dr_matcher *matcher)\n \telse\n \t\tmlx5dr_matcher_uninit(matcher);\n \n+\tmlx5dr_matcher_unset_templates(matcher);\n \tsimple_free(matcher);\n \treturn 0;\n }\n@@ -1272,7 +1296,6 @@ mlx5dr_match_template_create(const struct rte_flow_item items[],\n \n int mlx5dr_match_template_destroy(struct mlx5dr_match_template *mt)\n {\n-\tassert(!mt->refcount);\n \tsimple_free(mt->items);\n \tsimple_free(mt);\n \treturn 0;\ndiff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.h b/drivers/net/mlx5/hws/mlx5dr_matcher.h\nindex 2bebc4bcce..b957f5ea4b 100644\n--- a/drivers/net/mlx5/hws/mlx5dr_matcher.h\n+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.h\n@@ -6,12 +6,8 @@\n #define MLX5DR_MATCHER_H_\n \n /* Max supported match template */\n-#define MLX5DR_MATCHER_MAX_MT 2\n #define MLX5DR_MATCHER_MAX_MT_ROOT 1\n \n-/* Max supported action template */\n-#define MLX5DR_MATCHER_MAX_AT 4\n-\n /* We calculated that concatenating a collision table to the main table with\n  * 3% of the main table rows will be enough resources for high insertion\n  * success probability.\n@@ -59,9 +55,9 @@ struct mlx5dr_matcher {\n \tstruct mlx5dr_table *tbl;\n \tstruct mlx5dr_matcher_attr attr;\n \tstruct mlx5dv_flow_matcher *dv_matcher;\n-\tstruct mlx5dr_match_template *mt[MLX5DR_MATCHER_MAX_MT];\n+\tstruct mlx5dr_match_template *mt;\n \tuint8_t num_of_mt;\n-\tstruct mlx5dr_action_template *at[MLX5DR_MATCHER_MAX_AT];\n+\tstruct mlx5dr_action_template *at;\n \tuint8_t num_of_at;\n \tstruct mlx5dr_devx_obj *end_ft;\n \tstruct mlx5dr_matcher *col_matcher;\ndiff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c\nindex 60a82c022f..f5a0c46315 100644\n--- a/drivers/net/mlx5/hws/mlx5dr_rule.c\n+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c\n@@ -5,10 +5,10 @@\n #include \"mlx5dr_internal.h\"\n \n static void mlx5dr_rule_skip(struct mlx5dr_matcher *matcher,\n+\t\t\t     struct mlx5dr_match_template *mt,\n \t\t\t     const struct rte_flow_item *items,\n \t\t\t     bool *skip_rx, bool *skip_tx)\n {\n-\tstruct mlx5dr_match_template *mt = matcher->mt[0];\n \tconst struct flow_hw_port_info *vport;\n \tconst struct rte_flow_item_ethdev *v;\n \n@@ -43,6 +43,7 @@ static void mlx5dr_rule_skip(struct mlx5dr_matcher *matcher,\n static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe,\n \t\t\t\t     struct mlx5dr_rule *rule,\n \t\t\t\t     const struct rte_flow_item *items,\n+\t\t\t\t     struct mlx5dr_match_template *mt,\n \t\t\t\t     void *user_data)\n {\n \tstruct mlx5dr_matcher *matcher = rule->matcher;\n@@ -63,7 +64,7 @@ static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe,\n \t\tbreak;\n \n \tcase MLX5DR_TABLE_TYPE_FDB:\n-\t\tmlx5dr_rule_skip(matcher, items, &skip_rx, &skip_tx);\n+\t\tmlx5dr_rule_skip(matcher, mt, items, &skip_rx, &skip_tx);\n \n \t\tif (!skip_rx) {\n \t\t\tdep_wqe->rtc_0 = matcher->match_ste.rtc_0->id;\n@@ -186,8 +187,8 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,\n \t\t\t\t  uint8_t at_idx,\n \t\t\t\t  struct mlx5dr_rule_action rule_actions[])\n {\n-\tstruct mlx5dr_action_template *at = rule->matcher->at[at_idx];\n-\tstruct mlx5dr_match_template *mt = rule->matcher->mt[mt_idx];\n+\tstruct mlx5dr_action_template *at = &rule->matcher->at[at_idx];\n+\tstruct mlx5dr_match_template *mt = &rule->matcher->mt[mt_idx];\n \tbool is_jumbo = mlx5dr_definer_is_jumbo(mt->definer);\n \tstruct mlx5dr_matcher *matcher = rule->matcher;\n \tstruct mlx5dr_context *ctx = matcher->tbl->ctx;\n@@ -212,7 +213,7 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,\n \t * dep_wqe buffers (ctrl, data) are also reused for all STE writes.\n \t */\n \tdep_wqe = mlx5dr_send_add_new_dep_wqe(queue);\n-\tmlx5dr_rule_init_dep_wqe(dep_wqe, rule, items, attr->user_data);\n+\tmlx5dr_rule_init_dep_wqe(dep_wqe, rule, items, mt, attr->user_data);\n \n \tste_attr.wqe_ctrl = &dep_wqe->wqe_ctrl;\n \tste_attr.wqe_data = &dep_wqe->wqe_data;\n@@ -371,7 +372,7 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,\n \tste_attr.used_id_rtc_1 = &rule->rtc_1;\n \tste_attr.wqe_ctrl = &wqe_ctrl;\n \tste_attr.wqe_tag = &rule->tag;\n-\tste_attr.wqe_tag_is_jumbo = mlx5dr_definer_is_jumbo(matcher->mt[0]->definer);\n+\tste_attr.wqe_tag_is_jumbo = mlx5dr_definer_is_jumbo(matcher->mt->definer);\n \tste_attr.gta_opcode = MLX5DR_WQE_GTA_OP_DEACTIVATE;\n \tif (unlikely(mlx5dr_matcher_is_insert_by_idx(matcher)))\n \t\tste_attr.direct_index = attr->rule_idx;\n@@ -388,7 +389,7 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule,\n \t\t\t\t   struct mlx5dr_rule_action rule_actions[])\n {\n \tstruct mlx5dv_flow_matcher *dv_matcher = rule->matcher->dv_matcher;\n-\tuint8_t num_actions = rule->matcher->at[at_idx]->num_actions;\n+\tuint8_t num_actions = rule->matcher->at[at_idx].num_actions;\n \tstruct mlx5dr_context *ctx = rule->matcher->tbl->ctx;\n \tstruct mlx5dv_flow_match_parameters *value;\n \tstruct mlx5_flow_attr flow_attr = {0};\n",
    "prefixes": [
        "v2",
        "02/16"
    ]
}