Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/68477/?format=api
http://patchwork.dpdk.org/api/patches/68477/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1586932797-99533-8-git-send-email-suanmingm@mellanox.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": "<1586932797-99533-8-git-send-email-suanmingm@mellanox.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1586932797-99533-8-git-send-email-suanmingm@mellanox.com", "date": "2020-04-15T06:39:54", "name": "[07/10] net/mlx5: allocate meter from indexed pool", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "32f9fe8c4813e58b5b2ce2988d7c93c535dec2ef", "submitter": { "id": 1358, "url": "http://patchwork.dpdk.org/api/people/1358/?format=api", "name": "Suanming Mou", "email": "suanmingm@mellanox.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/1586932797-99533-8-git-send-email-suanmingm@mellanox.com/mbox/", "series": [ { "id": 9383, "url": "http://patchwork.dpdk.org/api/series/9383/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=9383", "date": "2020-04-15T06:39:47", "name": "net/mlx5: optimize flow structure", "version": 1, "mbox": "http://patchwork.dpdk.org/series/9383/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/68477/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/68477/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 009BCA0577;\n\tWed, 15 Apr 2020 08:41:15 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 3E9A01D41C;\n\tWed, 15 Apr 2020 08:40:19 +0200 (CEST)", "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 85C4E1D410\n for <dev@dpdk.org>; Wed, 15 Apr 2020 08:40:17 +0200 (CEST)" ], "From": "Suanming Mou <suanmingm@mellanox.com>", "To": "Matan Azrad <matan@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>,\n Viacheslav Ovsiienko <viacheslavo@mellanox.com>", "Cc": "wentaoc@mellanox.com,\n\trasland@mellanox.com,\n\tdev@dpdk.org", "Date": "Wed, 15 Apr 2020 14:39:54 +0800", "Message-Id": "<1586932797-99533-8-git-send-email-suanmingm@mellanox.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1586932797-99533-1-git-send-email-suanmingm@mellanox.com>", "References": "<1586932797-99533-1-git-send-email-suanmingm@mellanox.com>", "Subject": "[dpdk-dev] [PATCH 07/10] net/mlx5: allocate meter from indexed pool", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch allocate the meter object memory from indexed memory pool\nwhich will help to save the MALLOC_ELEM_OVERHEAD memory taken by\nrte_malloc().\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c | 11 +++++++++++\n drivers/net/mlx5/mlx5.h | 1 +\n drivers/net/mlx5/mlx5_flow.h | 1 +\n drivers/net/mlx5/mlx5_flow_meter.c | 11 ++++++-----\n 4 files changed, 19 insertions(+), 5 deletions(-)", "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 1493d25..81a2e94 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -256,6 +256,17 @@ struct mlx5_dev_spawn_data {\n \t},\n #endif\n \t{\n+\t\t.size = sizeof(struct mlx5_flow_meter),\n+\t\t.trunk_size = 64,\n+\t\t.grow_trunk = 3,\n+\t\t.grow_shift = 2,\n+\t\t.need_lock = 0,\n+\t\t.release_mem_en = 1,\n+\t\t.malloc = rte_malloc_socket,\n+\t\t.free = rte_free,\n+\t\t.type = \"mlx5_meter_ipool\",\n+\t},\n+\t{\n \t\t.size = (sizeof(struct mlx5_hrxq) + MLX5_RSS_HASH_KEY_LEN),\n \t\t.trunk_size = 64,\n \t\t.grow_trunk = 3,\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 378a13f..cf785f5 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -59,6 +59,7 @@ enum mlx5_ipool_index {\n \tMLX5_IPOOL_PORT_ID, /* Pool for port id resource. */\n \tMLX5_IPOOL_JUMP, /* Pool for jump resource. */\n #endif\n+\tMLX5_IPOOL_MTR, /* Pool for meter resource. */\n \tMLX5_IPOOL_HRXQ, /* Pool for hrxq resource. */\n \tMLX5_IPOOL_MLX5_FLOW, /* Pool for mlx5 flow handle. */\n \tMLX5_IPOOL_RTE_FLOW, /* Pool for rte_flow. */\ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 983ccc1..c8b2d20 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -705,6 +705,7 @@ struct mlx5_meter_domains_infos {\n struct mlx5_flow_meter {\n \tTAILQ_ENTRY(mlx5_flow_meter) next;\n \t/**< Pointer to the next flow meter structure. */\n+\tuint32_t idx; /* Index to meter object. */\n \tuint32_t meter_id;\n \t/**< Meter id. */\n \tstruct rte_mtr_params params;\ndiff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c\nindex aa0fd7a..b5fbf5d 100644\n--- a/drivers/net/mlx5/mlx5_flow_meter.c\n+++ b/drivers/net/mlx5/mlx5_flow_meter.c\n@@ -631,6 +631,7 @@\n \t\t\t};\n \tint ret;\n \tunsigned int i;\n+\tuint32_t idx = 0;\n \n \tif (!priv->mtr_en)\n \t\treturn -rte_mtr_error_set(error, ENOTSUP,\n@@ -647,12 +648,12 @@\n \t\t\t\t\t RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,\n \t\t\t\t\t NULL, \"Meter profile id not valid.\");\n \t/* Allocate the flow meter memory. */\n-\tfm = rte_calloc(__func__, 1,\n-\t\t\tsizeof(struct mlx5_flow_meter), RTE_CACHE_LINE_SIZE);\n+\tfm = mlx5_ipool_zmalloc(priv->sh->ipool[MLX5_IPOOL_MTR], &idx);\n \tif (fm == NULL)\n \t\treturn -rte_mtr_error_set(error, ENOMEM,\n \t\t\t\t\t RTE_MTR_ERROR_TYPE_UNSPECIFIED, NULL,\n \t\t\t\t\t \"Memory alloc failed for meter.\");\n+\tfm->idx = idx;\n \t/* Fill the flow meter parameters. */\n \tfm->meter_id = meter_id;\n \tfm->profile = fmp;\n@@ -683,7 +684,7 @@\n \tfor (i = 0; i < RTE_DIM(fm->policer_stats.cnt); i++)\n \t\tif (fm->policer_stats.cnt[i])\n \t\t\tmlx5_counter_free(dev, fm->policer_stats.cnt[i]);\n-\trte_free(fm);\n+\tmlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_MTR], idx);\n \treturn -rte_mtr_error_set(error, -ret,\n \t\t\t\t RTE_MTR_ERROR_TYPE_UNSPECIFIED,\n \t\t\t\t NULL, \"Failed to create devx meter.\");\n@@ -746,7 +747,7 @@\n \t/* Free meter flow table */\n \tmlx5_flow_destroy_policer_rules(dev, fm, &attr);\n \tmlx5_flow_destroy_mtr_tbls(dev, fm->mfts);\n-\trte_free(fm);\n+\tmlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_MTR], fm->idx);\n \treturn 0;\n }\n \n@@ -1274,7 +1275,7 @@ struct mlx5_flow_meter *\n \t\t/* Free meter flow table. */\n \t\tmlx5_flow_destroy_policer_rules(dev, fm, &attr);\n \t\tmlx5_flow_destroy_mtr_tbls(dev, fm->mfts);\n-\t\trte_free(fm);\n+\t\tmlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_MTR], fm->idx);\n \t}\n \tTAILQ_FOREACH_SAFE(fmp, fmps, next, tmp) {\n \t\t/* Check unused. */\n", "prefixes": [ "07/10" ] }{ "id": 68477, "url": "