get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 136955,
    "url": "http://patches.dpdk.org/api/patches/136955/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240221102130.10124-2-dsosnowski@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": "<20240221102130.10124-2-dsosnowski@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240221102130.10124-2-dsosnowski@nvidia.com",
    "date": "2024-02-21T10:21:29",
    "name": "[v2,1/2] net/mlx5: move meter init functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3dcb282966011d92b46afd290a498747925a5001",
    "submitter": {
        "id": 2386,
        "url": "http://patches.dpdk.org/api/people/2386/?format=api",
        "name": "Dariusz Sosnowski",
        "email": "dsosnowski@nvidia.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240221102130.10124-2-dsosnowski@nvidia.com/mbox/",
    "series": [
        {
            "id": 31168,
            "url": "http://patches.dpdk.org/api/series/31168/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31168",
            "date": "2024-02-21T10:21:28",
            "name": "net/mlx5: add cross port meter mark action sharing",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/31168/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/136955/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/136955/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 23DFF43B61;\n\tWed, 21 Feb 2024 11:22:12 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1326740691;\n\tWed, 21 Feb 2024 11:22:12 +0100 (CET)",
            "from NAM11-DM6-obe.outbound.protection.outlook.com\n (mail-dm6nam11on2046.outbound.protection.outlook.com [40.107.223.46])\n by mails.dpdk.org (Postfix) with ESMTP id D763C402CE\n for <dev@dpdk.org>; Wed, 21 Feb 2024 11:22:10 +0100 (CET)",
            "from CY5PR19CA0116.namprd19.prod.outlook.com (2603:10b6:930:64::8)\n by BL3PR12MB6427.namprd12.prod.outlook.com (2603:10b6:208:3b6::11) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.21; Wed, 21 Feb\n 2024 10:22:08 +0000",
            "from CY4PEPF0000EE3D.namprd03.prod.outlook.com\n (2603:10b6:930:64:cafe::92) by CY5PR19CA0116.outlook.office365.com\n (2603:10b6:930:64::8) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.41 via Frontend\n Transport; Wed, 21 Feb 2024 10:22:08 +0000",
            "from mail.nvidia.com (216.228.117.161) by\n CY4PEPF0000EE3D.mail.protection.outlook.com (10.167.242.17) with Microsoft\n SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.7292.25 via Frontend Transport; Wed, 21 Feb 2024 10:22:08 +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.41; Wed, 21 Feb\n 2024 02:21:49 -0800",
            "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.1258.12; Wed, 21 Feb\n 2024 02:21:46 -0800"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=khBYRATPhTFtWu+Tx0lD8FbMYzRnyPjZKRRws332iSjhwIYafD6rPk8N6whfNaChyqHZpXTNYVq0E2OzQzSxCTjldbk9tutKgXhFw6fPex0/pUAeBCJMTrM3Jrw4jrYkpGmABjS50ePecf2cm/M0Kx2U1I4eobUUhW1rkta7FU3Wz/oPvsNDf3hICLP/jghlw9P/Fslk2Up0GvMOdPLvXquVLJwUU8FHB6HlOOJieN8F8oGrEbVPFqBZJkmJ7lij3j78+1NkcQb2ThYuVvL6B2Kxxv8ejSAM391aGFpk57emfM4xPI3oYLArdi1e6bjIxDLyRA66jdr1O3mnwU7B6g==",
        "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=e9zB10e4hUgDLDgkT7B7rde9/7LPWiQF0ItHvHr8bgc=;\n b=MmFqhHhRfcC4+8YWymmcVlnCCO+ufgLmpoBDF1lL99/9MkQcJ4IIi1RUZRM2EUgfHwFGYovgEL5zpQ8PBeQyBqQ+RcTLDal5M8oqJVdKLUkYEDyx7ggTDGprrjFup2nQ3oCcEiAT7yd6+NIJ2IsHRJ2/jQ4bYtHN/2UbHTsbmIc6rg1YFUtuu2rqr8ne/gM0Lom6KwyDOI5C6RxEdOeFHN67Wouqa7+0xLQaS4Zuw9NMi5OMdOlPcpaobO6hG8ifYTURc/yrlwjS5m8BW2AUA9FYIja+QvwHsNkuo31E+XUibgo7Rr3OtltmxlN1BKe63lvLSnkPnOGT1FLoro5lVA==",
        "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 (0)",
        "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=e9zB10e4hUgDLDgkT7B7rde9/7LPWiQF0ItHvHr8bgc=;\n b=Ru8TgnIrmU6Jq+ezFRO3FS2sRptdh5DHdIN57AfYHLdWPJV3GCYzXJoPeE5SNkNticcs46jW7L6cdhl29b/C4QlWQ/2dIrXGjQXz2itiYKXsH8uNHdrfNJKYI494d179yyvi/Ix3guFY8Wg6aDFQj01osCfMPYuc+nPuhSBb1hJcTfqA59b/0M13BR6a9SccaIUcLGOvbciI0nmbn5U4v4F+GD2YcwqmTHpQObDdbcCyU2xMDpLDk9Wrgn27Pme9czLUy11Pf8hs34jsNsMFxU6kPDmwMnlA6IfRLxCgxGXS6p8AkdT6F9souC8eU+T8twNZAGAM2XRCocOAwu04Qw==",
        "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": "Dariusz Sosnowski <dsosnowski@nvidia.com>",
        "To": "Viacheslav Ovsiienko <viacheslavo@nvidia.com>, Ori Kam <orika@nvidia.com>,\n Suanming Mou <suanmingm@nvidia.com>, Matan Azrad <matan@nvidia.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH v2 1/2] net/mlx5: move meter init functions",
        "Date": "Wed, 21 Feb 2024 12:21:29 +0200",
        "Message-ID": "<20240221102130.10124-2-dsosnowski@nvidia.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240221102130.10124-1-dsosnowski@nvidia.com>",
        "References": "<20240221101327.9820-1-dsosnowski@nvidia.com>\n <20240221102130.10124-1-dsosnowski@nvidia.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.126.231.35]",
        "X-ClientProxiedBy": "rnnvmail202.nvidia.com (10.129.68.7) To\n rnnvmail201.nvidia.com (10.129.68.8)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "CY4PEPF0000EE3D:EE_|BL3PR12MB6427:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "f2400827-908d-4dd8-650e-08dc32c6f575",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n CxFk/IZeOu/yYYOedbkZdSuYc0V/cLXDtx49hBXOyBpYdDRW6Cer5XKwwzUjQ20YO+q5XMw52ADrA9AR1pTBgWNVT+d5MYrqSKJW+zbWYErUma+FzZqG9eeKdnz/XoAQsqureeP08RPlat68mTkiq8Ehn09FB9VqjW+erEcirvIwX8aN9J9RnCtxoEd9BN5dK42Srvmbt5Ozp/BXHZPP7oJi64UbiU0qvSDHqGBrfeu15odWuofbxqPBrzAe85ocsCFwKii8vWiy2Leo3rQLh0vq7MzdfuGYTXUGz48CsuYyG9vB6ZMMtNqFO6rbI7u+P71jl59utsC3DLGY1hfQ9P5FzZPTYhepyfyucWHWe3U16Mn/hAYwU2/94Y3pFucWTWwyLp+Rt+mY1sDCeVsiLi7HxhliPFPXmLspW+SvYoiWz+VK7pmXoaSse6olfGzNXDVy4hm0M4ZROWeEwJfuffMXFhdd5n3aUfCjLZQ6A2Mt/xTi327Ye9m3weba7SqBeY6hHWsRQrLayqApK9AbpWYg73CB4qMldiKq5yrDI9oazYA/YTNY2N2bwJ+2Wqwd2ubW3Vt4j8lmZbKBugH8IiekHCGHkFuhD9NzBnG22rCGbD8DgwwszarauTtWa0Onmwx7Jxa0Ba2yIqxfhTzVVuCHIJW1vTepxTBcooj99I0=",
        "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:(13230031)(36860700004)(46966006)(40470700004); DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "21 Feb 2024 10:22:08.1230 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n f2400827-908d-4dd8-650e-08dc32c6f575",
        "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 CY4PEPF0000EE3D.namprd03.prod.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "BL3PR12MB6427",
        "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": "Move mlx5_flow_meter_init() and mlx5_flow_meter_uinit()\nto module for meter operations.\n\nSigned-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>\nAcked-by: Ori Kam <orika@nvidia.com>\n---\n drivers/net/mlx5/mlx5_flow_hw.c    | 203 ----------------------------\n drivers/net/mlx5/mlx5_flow_meter.c | 207 +++++++++++++++++++++++++++++\n 2 files changed, 207 insertions(+), 203 deletions(-)\n\n--\n2.34.1",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c\nindex 3bb3a9a178..4d6b22c4e3 100644\n--- a/drivers/net/mlx5/mlx5_flow_hw.c\n+++ b/drivers/net/mlx5/mlx5_flow_hw.c\n@@ -12859,209 +12859,6 @@ mlx5_flow_hw_ctrl_flows(struct rte_eth_dev *dev, uint32_t flags)\n \treturn 0;\n }\n\n-void\n-mlx5_flow_meter_uninit(struct rte_eth_dev *dev)\n-{\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\n-\tif (priv->mtr_policy_arr) {\n-\t\tmlx5_free(priv->mtr_policy_arr);\n-\t\tpriv->mtr_policy_arr = NULL;\n-\t}\n-\tif (priv->mtr_profile_arr) {\n-\t\tmlx5_free(priv->mtr_profile_arr);\n-\t\tpriv->mtr_profile_arr = NULL;\n-\t}\n-\tif (priv->hws_mpool) {\n-\t\tmlx5_aso_mtr_queue_uninit(priv->sh, priv->hws_mpool, NULL);\n-\t\tmlx5_ipool_destroy(priv->hws_mpool->idx_pool);\n-\t\tmlx5_free(priv->hws_mpool);\n-\t\tpriv->hws_mpool = NULL;\n-\t}\n-\tif (priv->mtr_bulk.aso) {\n-\t\tmlx5_free(priv->mtr_bulk.aso);\n-\t\tpriv->mtr_bulk.aso = NULL;\n-\t\tpriv->mtr_bulk.size = 0;\n-\t\tmlx5_aso_queue_uninit(priv->sh, ASO_OPC_MOD_POLICER);\n-\t}\n-\tif (priv->mtr_bulk.action) {\n-\t\tmlx5dr_action_destroy(priv->mtr_bulk.action);\n-\t\tpriv->mtr_bulk.action = NULL;\n-\t}\n-\tif (priv->mtr_bulk.devx_obj) {\n-\t\tclaim_zero(mlx5_devx_cmd_destroy(priv->mtr_bulk.devx_obj));\n-\t\tpriv->mtr_bulk.devx_obj = NULL;\n-\t}\n-}\n-\n-int\n-mlx5_flow_meter_init(struct rte_eth_dev *dev,\n-\t\t     uint32_t nb_meters,\n-\t\t     uint32_t nb_meter_profiles,\n-\t\t     uint32_t nb_meter_policies,\n-\t\t     uint32_t nb_queues)\n-{\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_devx_obj *dcs = NULL;\n-\tuint32_t log_obj_size;\n-\tint ret = 0;\n-\tint reg_id;\n-\tstruct mlx5_aso_mtr *aso;\n-\tuint32_t i;\n-\tstruct rte_flow_error error;\n-\tuint32_t flags;\n-\tuint32_t nb_mtrs = rte_align32pow2(nb_meters);\n-\tstruct mlx5_indexed_pool_config cfg = {\n-\t\t.size = sizeof(struct mlx5_aso_mtr),\n-\t\t.trunk_size = 1 << 12,\n-\t\t.per_core_cache = 1 << 13,\n-\t\t.need_lock = 1,\n-\t\t.release_mem_en = !!priv->sh->config.reclaim_mode,\n-\t\t.malloc = mlx5_malloc,\n-\t\t.max_idx = nb_meters,\n-\t\t.free = mlx5_free,\n-\t\t.type = \"mlx5_hw_mtr_mark_action\",\n-\t};\n-\n-\tif (!nb_meters) {\n-\t\tret = ENOTSUP;\n-\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t  NULL, \"Meter configuration is invalid.\");\n-\t\tgoto err;\n-\t}\n-\tif (!priv->mtr_en || !priv->sh->meter_aso_en) {\n-\t\tret = ENOTSUP;\n-\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t  NULL, \"Meter ASO is not supported.\");\n-\t\tgoto err;\n-\t}\n-\tpriv->mtr_config.nb_meters = nb_meters;\n-\tlog_obj_size = rte_log2_u32(nb_meters >> 1);\n-\tdcs = mlx5_devx_cmd_create_flow_meter_aso_obj\n-\t\t(priv->sh->cdev->ctx, priv->sh->cdev->pdn,\n-\t\t\tlog_obj_size);\n-\tif (!dcs) {\n-\t\tret = ENOMEM;\n-\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t  NULL, \"Meter ASO object allocation failed.\");\n-\t\tgoto err;\n-\t}\n-\tpriv->mtr_bulk.devx_obj = dcs;\n-\treg_id = mlx5_flow_get_reg_id(dev, MLX5_MTR_COLOR, 0, NULL);\n-\tif (reg_id < 0) {\n-\t\tret = ENOTSUP;\n-\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t  NULL, \"Meter register is not available.\");\n-\t\tgoto err;\n-\t}\n-\tflags = MLX5DR_ACTION_FLAG_HWS_RX | MLX5DR_ACTION_FLAG_HWS_TX;\n-\tif (priv->sh->config.dv_esw_en && priv->master)\n-\t\tflags |= MLX5DR_ACTION_FLAG_HWS_FDB;\n-\tpriv->mtr_bulk.action = mlx5dr_action_create_aso_meter\n-\t\t\t(priv->dr_ctx, (struct mlx5dr_devx_obj *)dcs,\n-\t\t\t\treg_id - REG_C_0, flags);\n-\tif (!priv->mtr_bulk.action) {\n-\t\tret = ENOMEM;\n-\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t  NULL, \"Meter action creation failed.\");\n-\t\tgoto err;\n-\t}\n-\tpriv->mtr_bulk.aso = mlx5_malloc(MLX5_MEM_ZERO,\n-\t\t\t\t\t sizeof(struct mlx5_aso_mtr) *\n-\t\t\t\t\t nb_meters,\n-\t\t\t\t\t RTE_CACHE_LINE_SIZE,\n-\t\t\t\t\t SOCKET_ID_ANY);\n-\tif (!priv->mtr_bulk.aso) {\n-\t\tret = ENOMEM;\n-\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t  NULL, \"Meter bulk ASO allocation failed.\");\n-\t\tgoto err;\n-\t}\n-\tpriv->mtr_bulk.size = nb_meters;\n-\taso = priv->mtr_bulk.aso;\n-\tfor (i = 0; i < priv->mtr_bulk.size; i++) {\n-\t\taso->type = ASO_METER_DIRECT;\n-\t\taso->state = ASO_METER_WAIT;\n-\t\taso->offset = i;\n-\t\taso++;\n-\t}\n-\tpriv->hws_mpool = mlx5_malloc(MLX5_MEM_ZERO,\n-\t\t\t\tsizeof(struct mlx5_aso_mtr_pool),\n-\t\t\t\tRTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);\n-\tif (!priv->hws_mpool) {\n-\t\tret = ENOMEM;\n-\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t  NULL, \"Meter ipool allocation failed.\");\n-\t\tgoto err;\n-\t}\n-\tpriv->hws_mpool->devx_obj = priv->mtr_bulk.devx_obj;\n-\tpriv->hws_mpool->action = priv->mtr_bulk.action;\n-\tpriv->hws_mpool->nb_sq = nb_queues;\n-\tif (mlx5_aso_mtr_queue_init(priv->sh, priv->hws_mpool,\n-\t\t\t\t    &priv->sh->mtrmng->pools_mng, nb_queues)) {\n-\t\tret = ENOMEM;\n-\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t  NULL, \"Meter ASO queue allocation failed.\");\n-\t\tgoto err;\n-\t}\n-\t/*\n-\t * No need for local cache if Meter number is a small number.\n-\t * Since flow insertion rate will be very limited in that case.\n-\t * Here let's set the number to less than default trunk size 4K.\n-\t */\n-\tif (nb_mtrs <= cfg.trunk_size) {\n-\t\tcfg.per_core_cache = 0;\n-\t\tcfg.trunk_size = nb_mtrs;\n-\t} else if (nb_mtrs <= MLX5_HW_IPOOL_SIZE_THRESHOLD) {\n-\t\tcfg.per_core_cache = MLX5_HW_IPOOL_CACHE_MIN;\n-\t}\n-\tpriv->hws_mpool->idx_pool = mlx5_ipool_create(&cfg);\n-\tif (nb_meter_profiles) {\n-\t\tpriv->mtr_config.nb_meter_profiles = nb_meter_profiles;\n-\t\tpriv->mtr_profile_arr =\n-\t\t\tmlx5_malloc(MLX5_MEM_ZERO,\n-\t\t\t\t    sizeof(struct mlx5_flow_meter_profile) *\n-\t\t\t\t    nb_meter_profiles,\n-\t\t\t\t    RTE_CACHE_LINE_SIZE,\n-\t\t\t\t    SOCKET_ID_ANY);\n-\t\tif (!priv->mtr_profile_arr) {\n-\t\t\tret = ENOMEM;\n-\t\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t\t   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t\t   NULL, \"Meter profile allocation failed.\");\n-\t\t\tgoto err;\n-\t\t}\n-\t}\n-\tif (nb_meter_policies) {\n-\t\tpriv->mtr_config.nb_meter_policies = nb_meter_policies;\n-\t\tpriv->mtr_policy_arr =\n-\t\t\tmlx5_malloc(MLX5_MEM_ZERO,\n-\t\t\t\t    sizeof(struct mlx5_flow_meter_policy) *\n-\t\t\t\t    nb_meter_policies,\n-\t\t\t\t    RTE_CACHE_LINE_SIZE,\n-\t\t\t\t    SOCKET_ID_ANY);\n-\t\tif (!priv->mtr_policy_arr) {\n-\t\t\tret = ENOMEM;\n-\t\t\trte_flow_error_set(&error, ENOMEM,\n-\t\t\t\t\t   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t\t   NULL, \"Meter policy allocation failed.\");\n-\t\t\tgoto err;\n-\t\t}\n-\t}\n-\treturn 0;\n-err:\n-\tmlx5_flow_meter_uninit(dev);\n-\treturn ret;\n-}\n-\n static __rte_always_inline uint32_t\n mlx5_reformat_domain_to_tbl_type(const struct rte_flow_indir_action_conf *domain)\n {\ndiff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c\nindex 7cbf772ea4..9cb4614436 100644\n--- a/drivers/net/mlx5/mlx5_flow_meter.c\n+++ b/drivers/net/mlx5/mlx5_flow_meter.c\n@@ -15,6 +15,213 @@\n #include \"mlx5.h\"\n #include \"mlx5_flow.h\"\n\n+#ifdef HAVE_MLX5_HWS_SUPPORT\n+\n+void\n+mlx5_flow_meter_uninit(struct rte_eth_dev *dev)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\n+\tif (priv->mtr_policy_arr) {\n+\t\tmlx5_free(priv->mtr_policy_arr);\n+\t\tpriv->mtr_policy_arr = NULL;\n+\t}\n+\tif (priv->mtr_profile_arr) {\n+\t\tmlx5_free(priv->mtr_profile_arr);\n+\t\tpriv->mtr_profile_arr = NULL;\n+\t}\n+\tif (priv->hws_mpool) {\n+\t\tmlx5_aso_mtr_queue_uninit(priv->sh, priv->hws_mpool, NULL);\n+\t\tmlx5_ipool_destroy(priv->hws_mpool->idx_pool);\n+\t\tmlx5_free(priv->hws_mpool);\n+\t\tpriv->hws_mpool = NULL;\n+\t}\n+\tif (priv->mtr_bulk.aso) {\n+\t\tmlx5_free(priv->mtr_bulk.aso);\n+\t\tpriv->mtr_bulk.aso = NULL;\n+\t\tpriv->mtr_bulk.size = 0;\n+\t\tmlx5_aso_queue_uninit(priv->sh, ASO_OPC_MOD_POLICER);\n+\t}\n+\tif (priv->mtr_bulk.action) {\n+\t\tmlx5dr_action_destroy(priv->mtr_bulk.action);\n+\t\tpriv->mtr_bulk.action = NULL;\n+\t}\n+\tif (priv->mtr_bulk.devx_obj) {\n+\t\tclaim_zero(mlx5_devx_cmd_destroy(priv->mtr_bulk.devx_obj));\n+\t\tpriv->mtr_bulk.devx_obj = NULL;\n+\t}\n+}\n+\n+int\n+mlx5_flow_meter_init(struct rte_eth_dev *dev,\n+\t\t     uint32_t nb_meters,\n+\t\t     uint32_t nb_meter_profiles,\n+\t\t     uint32_t nb_meter_policies,\n+\t\t     uint32_t nb_queues)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_devx_obj *dcs = NULL;\n+\tuint32_t log_obj_size;\n+\tint ret = 0;\n+\tint reg_id;\n+\tstruct mlx5_aso_mtr *aso;\n+\tuint32_t i;\n+\tstruct rte_flow_error error;\n+\tuint32_t flags;\n+\tuint32_t nb_mtrs = rte_align32pow2(nb_meters);\n+\tstruct mlx5_indexed_pool_config cfg = {\n+\t\t.size = sizeof(struct mlx5_aso_mtr),\n+\t\t.trunk_size = 1 << 12,\n+\t\t.per_core_cache = 1 << 13,\n+\t\t.need_lock = 1,\n+\t\t.release_mem_en = !!priv->sh->config.reclaim_mode,\n+\t\t.malloc = mlx5_malloc,\n+\t\t.max_idx = nb_meters,\n+\t\t.free = mlx5_free,\n+\t\t.type = \"mlx5_hw_mtr_mark_action\",\n+\t};\n+\n+\tif (!nb_meters) {\n+\t\tret = ENOTSUP;\n+\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t  NULL, \"Meter configuration is invalid.\");\n+\t\tgoto err;\n+\t}\n+\tif (!priv->mtr_en || !priv->sh->meter_aso_en) {\n+\t\tret = ENOTSUP;\n+\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t  NULL, \"Meter ASO is not supported.\");\n+\t\tgoto err;\n+\t}\n+\tpriv->mtr_config.nb_meters = nb_meters;\n+\tlog_obj_size = rte_log2_u32(nb_meters >> 1);\n+\tdcs = mlx5_devx_cmd_create_flow_meter_aso_obj\n+\t\t(priv->sh->cdev->ctx, priv->sh->cdev->pdn,\n+\t\t\tlog_obj_size);\n+\tif (!dcs) {\n+\t\tret = ENOMEM;\n+\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t  NULL, \"Meter ASO object allocation failed.\");\n+\t\tgoto err;\n+\t}\n+\tpriv->mtr_bulk.devx_obj = dcs;\n+\treg_id = mlx5_flow_get_reg_id(dev, MLX5_MTR_COLOR, 0, NULL);\n+\tif (reg_id < 0) {\n+\t\tret = ENOTSUP;\n+\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t  NULL, \"Meter register is not available.\");\n+\t\tgoto err;\n+\t}\n+\tflags = MLX5DR_ACTION_FLAG_HWS_RX | MLX5DR_ACTION_FLAG_HWS_TX;\n+\tif (priv->sh->config.dv_esw_en && priv->master)\n+\t\tflags |= MLX5DR_ACTION_FLAG_HWS_FDB;\n+\tpriv->mtr_bulk.action = mlx5dr_action_create_aso_meter\n+\t\t\t(priv->dr_ctx, (struct mlx5dr_devx_obj *)dcs,\n+\t\t\t\treg_id - REG_C_0, flags);\n+\tif (!priv->mtr_bulk.action) {\n+\t\tret = ENOMEM;\n+\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t  NULL, \"Meter action creation failed.\");\n+\t\tgoto err;\n+\t}\n+\tpriv->mtr_bulk.aso = mlx5_malloc(MLX5_MEM_ZERO,\n+\t\t\t\t\t sizeof(struct mlx5_aso_mtr) *\n+\t\t\t\t\t nb_meters,\n+\t\t\t\t\t RTE_CACHE_LINE_SIZE,\n+\t\t\t\t\t SOCKET_ID_ANY);\n+\tif (!priv->mtr_bulk.aso) {\n+\t\tret = ENOMEM;\n+\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t  NULL, \"Meter bulk ASO allocation failed.\");\n+\t\tgoto err;\n+\t}\n+\tpriv->mtr_bulk.size = nb_meters;\n+\taso = priv->mtr_bulk.aso;\n+\tfor (i = 0; i < priv->mtr_bulk.size; i++) {\n+\t\taso->type = ASO_METER_DIRECT;\n+\t\taso->state = ASO_METER_WAIT;\n+\t\taso->offset = i;\n+\t\taso++;\n+\t}\n+\tpriv->hws_mpool = mlx5_malloc(MLX5_MEM_ZERO,\n+\t\t\t\tsizeof(struct mlx5_aso_mtr_pool),\n+\t\t\t\tRTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);\n+\tif (!priv->hws_mpool) {\n+\t\tret = ENOMEM;\n+\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t  NULL, \"Meter ipool allocation failed.\");\n+\t\tgoto err;\n+\t}\n+\tpriv->hws_mpool->devx_obj = priv->mtr_bulk.devx_obj;\n+\tpriv->hws_mpool->action = priv->mtr_bulk.action;\n+\tpriv->hws_mpool->nb_sq = nb_queues;\n+\tif (mlx5_aso_mtr_queue_init(priv->sh, priv->hws_mpool,\n+\t\t\t\t    &priv->sh->mtrmng->pools_mng, nb_queues)) {\n+\t\tret = ENOMEM;\n+\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t  NULL, \"Meter ASO queue allocation failed.\");\n+\t\tgoto err;\n+\t}\n+\t/*\n+\t * No need for local cache if Meter number is a small number.\n+\t * Since flow insertion rate will be very limited in that case.\n+\t * Here let's set the number to less than default trunk size 4K.\n+\t */\n+\tif (nb_mtrs <= cfg.trunk_size) {\n+\t\tcfg.per_core_cache = 0;\n+\t\tcfg.trunk_size = nb_mtrs;\n+\t} else if (nb_mtrs <= MLX5_HW_IPOOL_SIZE_THRESHOLD) {\n+\t\tcfg.per_core_cache = MLX5_HW_IPOOL_CACHE_MIN;\n+\t}\n+\tpriv->hws_mpool->idx_pool = mlx5_ipool_create(&cfg);\n+\tif (nb_meter_profiles) {\n+\t\tpriv->mtr_config.nb_meter_profiles = nb_meter_profiles;\n+\t\tpriv->mtr_profile_arr =\n+\t\t\tmlx5_malloc(MLX5_MEM_ZERO,\n+\t\t\t\t    sizeof(struct mlx5_flow_meter_profile) *\n+\t\t\t\t    nb_meter_profiles,\n+\t\t\t\t    RTE_CACHE_LINE_SIZE,\n+\t\t\t\t    SOCKET_ID_ANY);\n+\t\tif (!priv->mtr_profile_arr) {\n+\t\t\tret = ENOMEM;\n+\t\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t\t   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\t   NULL, \"Meter profile allocation failed.\");\n+\t\t\tgoto err;\n+\t\t}\n+\t}\n+\tif (nb_meter_policies) {\n+\t\tpriv->mtr_config.nb_meter_policies = nb_meter_policies;\n+\t\tpriv->mtr_policy_arr =\n+\t\t\tmlx5_malloc(MLX5_MEM_ZERO,\n+\t\t\t\t    sizeof(struct mlx5_flow_meter_policy) *\n+\t\t\t\t    nb_meter_policies,\n+\t\t\t\t    RTE_CACHE_LINE_SIZE,\n+\t\t\t\t    SOCKET_ID_ANY);\n+\t\tif (!priv->mtr_policy_arr) {\n+\t\t\tret = ENOMEM;\n+\t\t\trte_flow_error_set(&error, ENOMEM,\n+\t\t\t\t\t   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\t   NULL, \"Meter policy allocation failed.\");\n+\t\t\tgoto err;\n+\t\t}\n+\t}\n+\treturn 0;\n+err:\n+\tmlx5_flow_meter_uninit(dev);\n+\treturn ret;\n+}\n+\n+#endif /* HAVE_MLX5_HWS_SUPPORT */\n+\n static int mlx5_flow_meter_disable(struct rte_eth_dev *dev,\n \t\tuint32_t meter_id, struct rte_mtr_error *error);\n\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}