get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 128100,
    "url": "http://patches.dpdk.org/api/patches/128100/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230605085200.492223-1-ophirmu@nvidia.com/",
    "project": {
        "id": 1,
        "url": "http://patches.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": "<20230605085200.492223-1-ophirmu@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230605085200.492223-1-ophirmu@nvidia.com",
    "date": "2023-06-05T08:52:00",
    "name": "[V7] lib: set/get max memzone segments",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9f02277c99ebd0977cc8be0c90bf89cf2e18d0c9",
    "submitter": {
        "id": 1908,
        "url": "http://patches.dpdk.org/api/people/1908/?format=api",
        "name": "Ophir Munk",
        "email": "ophirmu@nvidia.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230605085200.492223-1-ophirmu@nvidia.com/mbox/",
    "series": [
        {
            "id": 28349,
            "url": "http://patches.dpdk.org/api/series/28349/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28349",
            "date": "2023-06-05T08:52:00",
            "name": "[V7] lib: set/get max memzone segments",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/28349/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/128100/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/128100/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 B1D5B42BBB;\n\tMon,  5 Jun 2023 10:53:10 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8DE2240A7F;\n\tMon,  5 Jun 2023 10:53:10 +0200 (CEST)",
            "from NAM11-BN8-obe.outbound.protection.outlook.com\n (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40])\n by mails.dpdk.org (Postfix) with ESMTP id E0F3A4003C\n for <dev@dpdk.org>; Mon,  5 Jun 2023 10:53:08 +0200 (CEST)",
            "from MW4PR02CA0012.namprd02.prod.outlook.com (2603:10b6:303:16d::35)\n by MW3PR12MB4555.namprd12.prod.outlook.com (2603:10b6:303:59::20)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Mon, 5 Jun\n 2023 08:53:05 +0000",
            "from CO1NAM11FT089.eop-nam11.prod.protection.outlook.com\n (2603:10b6:303:16d:cafe::b2) by MW4PR02CA0012.outlook.office365.com\n (2603:10b6:303:16d::35) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32 via Frontend\n Transport; Mon, 5 Jun 2023 08:53:05 +0000",
            "from mail.nvidia.com (216.228.117.161) by\n CO1NAM11FT089.mail.protection.outlook.com (10.13.175.179) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.6455.33 via Frontend Transport; Mon, 5 Jun 2023 08:53:05 +0000",
            "from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com\n (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 5 Jun 2023\n 01:52:49 -0700",
            "from nvidia.com (10.126.231.35) 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.37; Mon, 5 Jun 2023\n 01:52:45 -0700"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=RUvhS93Hm5UPOrbV9jkhJH2OEN6G8gRX+j5qZExGIl3zXTxkztV8pAEcLo+or2VSUUdlVjeo/j7aaOb2I60GWgd6GCXNUQFPXYw0CNqkpWK5JLstnGOMog8mmz+EgT9xbbk58PSFDF8jpALvMa7DfmRZfv3LXTyn49jSFK0hOUGlrFJzn10Q3jyOtJydnu9PDiwY8RZJQ9Z1OH6B+HK6KcgKzN+thwuBSzFh5BCzrzePNlqminRTIKINhplCaWACTIsLI5f630mkfY1ZJERiuX/zCeqhW+0sHPg7XOdWNJi6qsibcUxeGZ2AsDXgIBxcbb56qRgYCY3Omp1rexBKXQ==",
        "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=XT3Q+TpG2pguWqM0dWLOfHAN9QOMBGKafCdl19K6zag=;\n b=YRjwCGY6oLhJzsN0nd6sjx1hqJTxLYRB3XSQdTtNgVBK8/qCQeAo06TvvqLFWsha+fmk9xl3OWwP2QiakCAVSW3W8SXWG8sXY/xaUB3wTsrU3Dpz85520obfs1rViIaqjrfrucd4ugPi2sgKPBfoCrXVbIE+PgwzyDMKF4whRBGlJnkWIMDHYpPBmMPwk9s8IHl7vtLCjYUDHFc9q1TVOL0qSVbCo+prrhGCr+phXpiOtvKxzvTux+IpmPkmUK2rgxwl3i+1U/vETJxeuGLstrzjOXvPIEeQx4/eUoO8D//9Cffz0AVHT4QSPKlKfvYSiI0TTxXnksRoqMq1uHWRUg==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.117.161) smtp.rcpttodomain=dpdk.org 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=XT3Q+TpG2pguWqM0dWLOfHAN9QOMBGKafCdl19K6zag=;\n b=jEl0E+Pq87oV2w6BDzoky0AxrLuXtDHJ6PMOjTtTuyoc7yGPI68TrswyZe9QMusxIhJCj9z3TKsSAt+mEbdfRPELyYXDTmT30V2sr2MGAsfvJ/jTNOrzmYXJQhCsxtrYp0HbIXanISQrjOSGMmpsvPlLD2SUdppxr65brLLT5yqqNetmTzScUu+3rG1kLBHAsaVio5YxinyZnhh6y8NNN/hPBylEoSlxFc8HMlPrWV6HDtDhAG+KVYL/VKaDSjPBfcMRxexYsmcKDYOIPXW03Ajf4D3bLW4AdVWKIP0Y21lVTba9Bql2Sz92k7BPtFO6aL2fyx9tYzr9vSZUpns1Ng==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.117.161)\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.161 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C",
        "From": "Ophir Munk <ophirmu@nvidia.com>",
        "To": "<dev@dpdk.org>, Bruce Richardson <bruce.richardson@intel.com>, \"Devendra\n Singh Rawat\" <dsinghrawat@marvell.com>, Alok Prasad <palok@marvell.com>,\n Maayan Kashani <mkashani@nvidia.com>",
        "CC": "Ophir Munk <ophirmu@mellanox.com>, Matan Azrad <matan@nvidia.com>, \"Thomas\n Monjalon\" <thomas@monjalon.net>, Lior Margalit <lmargalit@nvidia.com>,\n \"David Marchand\" <david.marchand@redhat.com>, Anatoly Burakov\n <anatoly.burakov@intel.com>",
        "Subject": "[PATCH V7] lib: set/get max memzone segments",
        "Date": "Mon, 5 Jun 2023 11:52:00 +0300",
        "Message-ID": "<20230605085200.492223-1-ophirmu@nvidia.com>",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<20230531084131.3853333-1-ophirmu@nvidia.com>",
        "References": "<20230531084131.3853333-1-ophirmu@nvidia.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"UTF-8\"",
        "Content-Transfer-Encoding": "8bit",
        "X-Originating-IP": "[10.126.231.35]",
        "X-ClientProxiedBy": "rnnvmail203.nvidia.com (10.129.68.9) To\n rnnvmail201.nvidia.com (10.129.68.8)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "CO1NAM11FT089:EE_|MW3PR12MB4555:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "308e4997-2a07-4539-690f-08db65a24749",
        "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 xr9QLyCeY53hJuY5t6bey0cMjFyHWOxfvnZ4Zmj88UOh3y8ICm5oYyuFk/Xk2ZQCXCrBjTt/Hduz6INEBNQJbPAvA4kUw1rWkRnn6QQTO9vfJNlJxEvdTM5ZOb21WQsJAZurC2ob4iGntRcxhYXkCg+MIETpQQufdUfc00IxE0P9G7+CdfiPY+pjVe9DaFD8uc4OITNoDCgKukQqGpSa0vIv6fNX5PeVAS6C5lvEa/sPCAX14k5Vfwp4inB09STi7HkZP3UYk1OB6J9/7iB6EMfb7FBdoqTesAwNOXZSi40b4oecA/vsvB9NxP+FjbQKUBGOK4LxIUmEup6cTrn8BvbRGf9EDsM+C2+9nB2mEaiHiAZ2JyDP0YXjwwsAQq96Qzc0OI/5RGxpYtgR/5zE7z5tTIXJn2udig7Gy8T/eH+l4FN/KC7sGCandGjfFnby5XepS8WlmZXvT72emu2s00cX2RIxI7s39NCaFLXWIEizkbGJF4122z8tWr39de+EA3+0AR+sD/BFZdlRAwoWFJ2hs8N5UqEauqQJkJs5pGWFD1/y3gr8K1txN41V2B+A/b7tcgnlecqlsZ81CNs2Qvecpt1fuX8KFnxYIpgZTj2AcFhzDBswMGHY0XTycAnweL+H3iT3EFQ46FnnZhLquyaLkXKsv3dpaxlQMzWFtJBw0JNKBkoBRTfcqIc7ZuiU53FhcUuQp4CaD+yJjSSqmIfwrw1eHQHRB3+z6Mb5oV9GeERIqvimRX48ixylheHI",
        "X-Forefront-Antispam-Report": "CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1;\n SRV:;\n IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE;\n SFS:(13230028)(4636009)(136003)(376002)(346002)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(356005)(7636003)(82740400003)(82310400005)(30864003)(40460700003)(110136005)(86362001)(55016003)(54906003)(478600001)(7696005)(70586007)(70206006)(6636002)(40480700001)(36756003)(4326008)(6666004)(6286002)(186003)(2906002)(26005)(1076003)(16526019)(316002)(8676002)(336012)(8936002)(5660300002)(66574015)(2616005)(36860700001)(83380400001)(41300700001)(47076005)(426003);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "05 Jun 2023 08:53:05.6751 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 308e4997-2a07-4539-690f-08db65a24749",
        "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.161];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n CO1NAM11FT089.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "MW3PR12MB4555",
        "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": "Currently, the max memzones count constat (RTE_MAX_MEMZONE) is used to\ndecide how many memzones a DPDK application can have. This value could\ntechnically be changed by manually editing `rte_config.h` before\ncompilation, but if DPDK is already compiled, that option is not useful.\nThere are certain use cases that would benefit from making this value\nconfigurable.\n\nThis commit addresses the issue by adding a new API to set the max\nnumber of memzones before EAL initialization (while using the old\nconstant as default value), as well as an API to get current maximum\nnumber of memzones.\n\nSigned-off-by: Ophir Munk <ophirmu@nvidia.com>\nReviewed-by: Thomas Monjalon <thomas@monjalon.net>\nReviewed-by: David Marchand <david.marchand@redhat.com>\nReviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\nAcked-by: Alok Prasad <palok@marvell.com>\n---\n app/test/test_func_reentrancy.c     |  2 +-\n app/test/test_malloc_perf.c         |  2 +-\n app/test/test_memzone.c             | 42 ++++++++++++++++++++++-------------\n config/rte_config.h                 |  1 -\n drivers/net/qede/base/bcm_osal.c    | 38 ++++++++++++++++++++++++++------\n drivers/net/qede/base/bcm_osal.h    |  3 +++\n drivers/net/qede/qede_main.c        |  7 ++++++\n lib/eal/common/eal_common_memzone.c | 44 ++++++++++++++++++++++++++++++++++---\n lib/eal/common/eal_memcfg.h         |  2 ++\n lib/eal/include/rte_memzone.h       | 30 +++++++++++++++++++++++++\n lib/eal/version.map                 |  4 ++++\n 11 files changed, 147 insertions(+), 28 deletions(-)",
    "diff": "diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c\nindex d1ed5d4..ae9de6f 100644\n\nV7: Rebased on latest main branch\n\n--- a/app/test/test_func_reentrancy.c\n+++ b/app/test/test_func_reentrancy.c\n@@ -51,7 +51,7 @@ typedef void (*case_clean_t)(unsigned lcore_id);\n #define MEMPOOL_ELT_SIZE                    (sizeof(uint32_t))\n #define MEMPOOL_SIZE                        (4)\n \n-#define MAX_LCORES\t(RTE_MAX_MEMZONE / (MAX_ITER_MULTI * 4U))\n+#define MAX_LCORES\t(rte_memzone_max_get() / (MAX_ITER_MULTI * 4U))\n \n static uint32_t obj_count;\n static uint32_t synchro;\ndiff --git a/app/test/test_malloc_perf.c b/app/test/test_malloc_perf.c\nindex ccec43a..9bd1662 100644\n--- a/app/test/test_malloc_perf.c\n+++ b/app/test/test_malloc_perf.c\n@@ -165,7 +165,7 @@ test_malloc_perf(void)\n \t\treturn -1;\n \n \tif (test_alloc_perf(\"rte_memzone_reserve\", memzone_alloc, memzone_free,\n-\t\t\tNULL, memset_us_gb, RTE_MAX_MEMZONE - 1) < 0)\n+\t\t\tNULL, memset_us_gb, rte_memzone_max_get() - 1) < 0)\n \t\treturn -1;\n \n \treturn 0;\ndiff --git a/app/test/test_memzone.c b/app/test/test_memzone.c\nindex c9255e5..f10f4fd 100644\n--- a/app/test/test_memzone.c\n+++ b/app/test/test_memzone.c\n@@ -871,9 +871,17 @@ test_memzone_bounded(void)\n static int\n test_memzone_free(void)\n {\n-\tconst struct rte_memzone *mz[RTE_MAX_MEMZONE + 1];\n+\tconst struct rte_memzone **mz;\n \tint i;\n \tchar name[20];\n+\tint rc = -1;\n+\n+\tmz = rte_calloc(\"memzone_test\", rte_memzone_max_get() + 1,\n+\t\t\tsizeof(struct rte_memzone *), 0);\n+\tif (!mz) {\n+\t\tprintf(\"Fail allocating memzone test array\\n\");\n+\t\treturn rc;\n+\t}\n \n \tmz[0] = rte_memzone_reserve(TEST_MEMZONE_NAME(\"tempzone0\"), 2000,\n \t\t\tSOCKET_ID_ANY, 0);\n@@ -881,42 +889,42 @@ test_memzone_free(void)\n \t\t\tSOCKET_ID_ANY, 0);\n \n \tif (mz[0] > mz[1])\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \tif (!rte_memzone_lookup(TEST_MEMZONE_NAME(\"tempzone0\")))\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \tif (!rte_memzone_lookup(TEST_MEMZONE_NAME(\"tempzone1\")))\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \n \tif (rte_memzone_free(mz[0])) {\n \t\tprintf(\"Fail memzone free - tempzone0\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \tif (rte_memzone_lookup(TEST_MEMZONE_NAME(\"tempzone0\"))) {\n \t\tprintf(\"Found previously free memzone - tempzone0\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \tmz[2] = rte_memzone_reserve(TEST_MEMZONE_NAME(\"tempzone2\"), 2000,\n \t\t\tSOCKET_ID_ANY, 0);\n \n \tif (mz[2] > mz[1]) {\n \t\tprintf(\"tempzone2 should have gotten the free entry from tempzone0\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \tif (rte_memzone_free(mz[2])) {\n \t\tprintf(\"Fail memzone free - tempzone2\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \tif (rte_memzone_lookup(TEST_MEMZONE_NAME(\"tempzone2\"))) {\n \t\tprintf(\"Found previously free memzone - tempzone2\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \tif (rte_memzone_free(mz[1])) {\n \t\tprintf(\"Fail memzone free - tempzone1\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \tif (rte_memzone_lookup(TEST_MEMZONE_NAME(\"tempzone1\"))) {\n \t\tprintf(\"Found previously free memzone - tempzone1\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \n \ti = 0;\n@@ -928,7 +936,7 @@ test_memzone_free(void)\n \n \tif (rte_memzone_free(mz[0])) {\n \t\tprintf(\"Fail memzone free - tempzone0\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \tmz[0] = rte_memzone_reserve(TEST_MEMZONE_NAME(\"tempzone0new\"), 0,\n \t\t\tSOCKET_ID_ANY, 0);\n@@ -936,17 +944,21 @@ test_memzone_free(void)\n \tif (mz[0] == NULL) {\n \t\tprintf(\"Fail to create memzone - tempzone0new - when MAX memzones were \"\n \t\t\t\t\"created and one was free\\n\");\n-\t\treturn -1;\n+\t\tgoto exit_test;\n \t}\n \n \tfor (i = i - 2; i >= 0; i--) {\n \t\tif (rte_memzone_free(mz[i])) {\n \t\t\tprintf(\"Fail memzone free - tempzone%d\\n\", i);\n-\t\t\treturn -1;\n+\t\t\tgoto exit_test;\n \t\t}\n \t}\n \n-\treturn 0;\n+\trc = 0;\n+\n+exit_test:\n+\trte_free(mz);\n+\treturn rc;\n }\n \n static int test_memzones_left;\ndiff --git a/config/rte_config.h b/config/rte_config.h\nindex 7b8c85e..400e44e 100644\n--- a/config/rte_config.h\n+++ b/config/rte_config.h\n@@ -34,7 +34,6 @@\n #define RTE_MAX_MEM_MB_PER_LIST 32768\n #define RTE_MAX_MEMSEG_PER_TYPE 32768\n #define RTE_MAX_MEM_MB_PER_TYPE 65536\n-#define RTE_MAX_MEMZONE 2560\n #define RTE_MAX_TAILQ 32\n #define RTE_LOG_DP_LEVEL RTE_LOG_INFO\n #define RTE_MAX_VFIO_CONTAINERS 64\ndiff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c\nindex 2c59397..638d006 100644\n--- a/drivers/net/qede/base/bcm_osal.c\n+++ b/drivers/net/qede/base/bcm_osal.c\n@@ -47,10 +47,34 @@ void osal_poll_mode_dpc(osal_int_ptr_t hwfn_cookie)\n }\n \n /* Array of memzone pointers */\n-static const struct rte_memzone *ecore_mz_mapping[RTE_MAX_MEMZONE];\n+static const struct rte_memzone **ecore_mz_mapping;\n /* Counter to track current memzone allocated */\n static uint16_t ecore_mz_count;\n \n+static uint32_t ref_cnt;\n+\n+int ecore_mz_mapping_alloc(void)\n+{\n+\tif (__atomic_fetch_add(&ref_cnt, 1, __ATOMIC_RELAXED) == 0) {\n+\t\tecore_mz_mapping = rte_calloc(\"ecore_mz_map\",\n+\t\t\t\trte_memzone_max_get(), sizeof(struct rte_memzone *), 0);\n+\t}\n+\n+\tif (!ecore_mz_mapping)\n+\t\treturn -ENOMEM;\n+\n+\treturn 0;\n+}\n+\n+void ecore_mz_mapping_free(void)\n+{\n+\tif (__atomic_fetch_sub(&ref_cnt, 1, __ATOMIC_RELAXED) - 1 == 0) {\n+\t\tif (ecore_mz_mapping)\n+\t\t\trte_free(ecore_mz_mapping);\n+\t\tecore_mz_mapping = NULL;\n+\t}\n+}\n+\n unsigned long qede_log2_align(unsigned long n)\n {\n \tunsigned long ret = n ? 1 : 0;\n@@ -132,9 +156,9 @@ void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,\n \tuint32_t core_id = rte_lcore_id();\n \tunsigned int socket_id;\n \n-\tif (ecore_mz_count >= RTE_MAX_MEMZONE) {\n-\t\tDP_ERR(p_dev, \"Memzone allocation count exceeds %u\\n\",\n-\t\t       RTE_MAX_MEMZONE);\n+\tif (ecore_mz_count >= rte_memzone_max_get()) {\n+\t\tDP_ERR(p_dev, \"Memzone allocation count exceeds %zu\\n\",\n+\t\t       rte_memzone_max_get());\n \t\t*phys = 0;\n \t\treturn OSAL_NULL;\n \t}\n@@ -171,9 +195,9 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *p_dev,\n \tuint32_t core_id = rte_lcore_id();\n \tunsigned int socket_id;\n \n-\tif (ecore_mz_count >= RTE_MAX_MEMZONE) {\n-\t\tDP_ERR(p_dev, \"Memzone allocation count exceeds %u\\n\",\n-\t\t       RTE_MAX_MEMZONE);\n+\tif (ecore_mz_count >= rte_memzone_max_get()) {\n+\t\tDP_ERR(p_dev, \"Memzone allocation count exceeds %zu\\n\",\n+\t\t       rte_memzone_max_get());\n \t\t*phys = 0;\n \t\treturn OSAL_NULL;\n \t}\ndiff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h\nindex 67e7f75..97e261d 100644\n--- a/drivers/net/qede/base/bcm_osal.h\n+++ b/drivers/net/qede/base/bcm_osal.h\n@@ -477,4 +477,7 @@ enum dbg_status\tqed_dbg_alloc_user_data(struct ecore_hwfn *p_hwfn,\n \tqed_dbg_alloc_user_data(p_hwfn, user_data_ptr)\n #define OSAL_DB_REC_OCCURRED(p_hwfn) nothing\n \n+int ecore_mz_mapping_alloc(void);\n+void ecore_mz_mapping_free(void);\n+\n #endif /* __BCM_OSAL_H */\ndiff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c\nindex 0303903..fd63262 100644\n--- a/drivers/net/qede/qede_main.c\n+++ b/drivers/net/qede/qede_main.c\n@@ -72,6 +72,12 @@ qed_probe(struct ecore_dev *edev, struct rte_pci_device *pci_dev,\n \thw_prepare_params.allow_mdump = false;\n \thw_prepare_params.b_en_pacing = false;\n \thw_prepare_params.epoch = OSAL_GET_EPOCH(ECORE_LEADING_HWFN(edev));\n+\trc = ecore_mz_mapping_alloc();\n+\tif (rc) {\n+\t\tDP_ERR(edev, \"mem zones array allocation failed\\n\");\n+\t\treturn rc;\n+\t}\n+\n \trc = ecore_hw_prepare(edev, &hw_prepare_params);\n \tif (rc) {\n \t\tDP_ERR(edev, \"hw prepare failed\\n\");\n@@ -722,6 +728,7 @@ static void qed_remove(struct ecore_dev *edev)\n \t\treturn;\n \n \tecore_hw_remove(edev);\n+\tecore_mz_mapping_free();\n }\n \n static int qed_send_drv_state(struct ecore_dev *edev, bool active)\ndiff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c\nindex a9cd91f..d024410 100644\n--- a/lib/eal/common/eal_common_memzone.c\n+++ b/lib/eal/common/eal_common_memzone.c\n@@ -22,6 +22,9 @@\n #include \"eal_private.h\"\n #include \"eal_memcfg.h\"\n \n+/* Default count used until rte_memzone_max_set() is called */\n+#define DEFAULT_MAX_MEMZONE_COUNT 2560\n+\n static inline const struct rte_memzone *\n memzone_lookup_thread_unsafe(const char *name)\n {\n@@ -81,8 +84,9 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,\n \t/* no more room in config */\n \tif (arr->count >= arr->len) {\n \t\tRTE_LOG(ERR, EAL,\n-\t\t\"%s(): Number of requested memzone segments exceeds RTE_MAX_MEMZONE\\n\",\n-\t\t\t__func__);\n+\t\t\"%s(): Number of requested memzone segments exceeds maximum \"\n+\t\t\"%u\\n\", __func__, arr->len);\n+\n \t\trte_errno = ENOSPC;\n \t\treturn NULL;\n \t}\n@@ -396,7 +400,7 @@ rte_eal_memzone_init(void)\n \n \tif (rte_eal_process_type() == RTE_PROC_PRIMARY &&\n \t\t\trte_fbarray_init(&mcfg->memzones, \"memzone\",\n-\t\t\tRTE_MAX_MEMZONE, sizeof(struct rte_memzone))) {\n+\t\t\trte_memzone_max_get(), sizeof(struct rte_memzone))) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot allocate memzone list\\n\");\n \t\tret = -1;\n \t} else if (rte_eal_process_type() == RTE_PROC_SECONDARY &&\n@@ -430,3 +434,37 @@ void rte_memzone_walk(void (*func)(const struct rte_memzone *, void *),\n \t}\n \trte_rwlock_read_unlock(&mcfg->mlock);\n }\n+\n+int\n+rte_memzone_max_set(size_t max)\n+{\n+\tstruct rte_mem_config *mcfg;\n+\n+\tif (eal_get_internal_configuration()->init_complete > 0) {\n+\t\tRTE_LOG(ERR, EAL, \"Max memzone cannot be set after calling \"\n+\t\t\t\t  \"eal init\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tmcfg = rte_eal_get_configuration()->mem_config;\n+\tif (mcfg == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Failed to set max memzone\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tmcfg->max_memzone = max;\n+\n+\treturn 0;\n+}\n+\n+size_t\n+rte_memzone_max_get(void)\n+{\n+\tstruct rte_mem_config *mcfg;\n+\n+\tmcfg = rte_eal_get_configuration()->mem_config;\n+\tif (mcfg == NULL || mcfg->max_memzone == 0)\n+\t\treturn DEFAULT_MAX_MEMZONE_COUNT;\n+\n+\treturn mcfg->max_memzone;\n+}\ndiff --git a/lib/eal/common/eal_memcfg.h b/lib/eal/common/eal_memcfg.h\nindex ea013a9..8889ba0 100644\n--- a/lib/eal/common/eal_memcfg.h\n+++ b/lib/eal/common/eal_memcfg.h\n@@ -75,6 +75,8 @@ struct rte_mem_config {\n \t/**< TSC rate */\n \n \tuint8_t dma_maskbits; /**< Keeps the more restricted dma mask. */\n+\n+\tsize_t max_memzone; /**< Maximum number of allocated memzones. */\n };\n \n /* update internal config from shared mem config */\ndiff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h\nindex 5302caa..44dcd22 100644\n--- a/lib/eal/include/rte_memzone.h\n+++ b/lib/eal/include/rte_memzone.h\n@@ -305,6 +305,36 @@ void rte_memzone_dump(FILE *f);\n void rte_memzone_walk(void (*func)(const struct rte_memzone *, void *arg),\n \t\t      void *arg);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Set max memzone count.\n+ *\n+ * This function can only be called prior to rte_eal_init().\n+ *\n+ * @param max\n+ *   Maximum number of memzones\n+ * @return\n+ *  0 on success, -1 otherwise\n+ */\n+__rte_experimental\n+int rte_memzone_max_set(size_t max);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Get the maximum number of memzones.\n+ *\n+ * @note: The maximum value will not change after calling rte_eal_init().\n+ *\n+ * @return\n+ *   Maximum number of memzones\n+ */\n+__rte_experimental\n+size_t rte_memzone_max_get(void);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/eal/version.map b/lib/eal/version.map\nindex 51a820d..b52a83c 100644\n--- a/lib/eal/version.map\n+++ b/lib/eal/version.map\n@@ -430,6 +430,10 @@ EXPERIMENTAL {\n \trte_thread_create_control;\n \trte_thread_set_name;\n \t__rte_eal_trace_generic_blob;\n+\n+\t# added in 23.07\n+\trte_memzone_max_set;\n+\trte_memzone_max_get;\n };\n \n INTERNAL {\n",
    "prefixes": [
        "V7"
    ]
}