Show a patch.

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

{
    "id": 74605,
    "url": "https://patches.dpdk.org/api/patches/74605/",
    "web_url": "https://patches.dpdk.org/patch/74605/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1595404727-164521-1-git-send-email-suanmingm@mellanox.com>",
    "date": "2020-07-22T07:58:45",
    "name": "[v2,1/3] net/mlx5: separate aging counter pool range",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ae7b0e2f04da78474c1917886e6da11bee57dd4d",
    "submitter": {
        "id": 1358,
        "url": "https://patches.dpdk.org/api/people/1358/",
        "name": "Suanming Mou",
        "email": "suanmingm@mellanox.com"
    },
    "delegate": {
        "id": 3268,
        "url": "https://patches.dpdk.org/api/users/3268/",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@mellanox.com"
    },
    "mbox": "https://patches.dpdk.org/patch/74605/mbox/",
    "series": [
        {
            "id": 11229,
            "url": "https://patches.dpdk.org/api/series/11229/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11229",
            "date": "2020-07-22T07:58:45",
            "name": "[v2,1/3] net/mlx5: separate aging counter pool range",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/11229/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74605/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74605/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "References": "<1594903224-20442-1-git-send-email-suanmingm@mellanox.com>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v2 1/3] net/mlx5: separate aging counter pool\n\trange",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "From": "Suanming Mou <suanmingm@mellanox.com>",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 3EA1AA0526;\n\tWed, 22 Jul 2020 09:58:55 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1B1991BFBA;\n\tWed, 22 Jul 2020 09:58:55 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 7CBF41BE90\n for <dev@dpdk.org>; Wed, 22 Jul 2020 09:58:53 +0200 (CEST)"
        ],
        "To": "viacheslavo@mellanox.com,\n\tmatan@mellanox.com",
        "X-Mailer": "git-send-email 1.8.3.1",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Wed, 22 Jul 2020 15:58:45 +0800",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "In-Reply-To": "<1594903224-20442-1-git-send-email-suanmingm@mellanox.com>",
        "Cc": "rasland@mellanox.com,\n\tdev@dpdk.org",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<1595404727-164521-1-git-send-email-suanmingm@mellanox.com>",
        "Return-Path": "<dev-bounces@dpdk.org>"
    },
    "content": "Currently, when allocate the counter or counter based age from group 0,\ncounter and age may share the same counter dcs ID range. Both age and\npure counter need to sync up with each other's container to check if\nthe ID range exists and update the min_dcs.\n\nIt comes two disadvantages:\n1. If the ID range is shared, this counter range will be queried twice\nboth from age and pure counter container in 1s.\n2. The same range counter check between the two container makes the\ncounter allocate sync min_dcs time to time with extra min_dcs updating.\n\nThis patch avoid the same ID range to be shared when allocate the new\npool. If the same ID range exists in other container, just add the\ncounter to the other container until get new range which saves the\nmin_dcs sync up time to time.\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\nAcked-by: Matan Azrad <matan@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow_dv.c | 69 +++++++++++++++++------------------------\n 1 file changed, 28 insertions(+), 41 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex f0cc7ad..2fc4457 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -4408,39 +4408,6 @@ struct field_modify_info modify_tcp[] = {\n }\n \n /**\n- * Update the minimum dcs-id for aged or no-aged counter pool.\n- *\n- * @param[in] dev\n- *   Pointer to the Ethernet device structure.\n- * @param[in] pool\n- *   Current counter pool.\n- * @param[in] batch\n- *   Whether the pool is for counter that was allocated by batch command.\n- * @param[in] age\n- *   Whether the counter is for aging.\n- */\n-static void\n-flow_dv_counter_update_min_dcs(struct rte_eth_dev *dev,\n-\t\t\tstruct mlx5_flow_counter_pool *pool,\n-\t\t\tuint32_t batch, uint32_t age)\n-{\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_flow_counter_pool *other;\n-\tstruct mlx5_pools_container *cont;\n-\n-\tcont = MLX5_CNT_CONTAINER(priv->sh, batch, (age ^ 0x1));\n-\tother = flow_dv_find_pool_by_id(cont, pool->min_dcs->id);\n-\tif (!other)\n-\t\treturn;\n-\tif (pool->min_dcs->id < other->min_dcs->id) {\n-\t\trte_atomic64_set(&other->a64_dcs,\n-\t\t\trte_atomic64_read(&pool->a64_dcs));\n-\t} else {\n-\t\trte_atomic64_set(&pool->a64_dcs,\n-\t\t\trte_atomic64_read(&other->a64_dcs));\n-\t}\n-}\n-/**\n  * Prepare a new counter and/or a new counter pool.\n  *\n  * @param[in] dev\n@@ -4467,31 +4434,50 @@ struct field_modify_info modify_tcp[] = {\n \tstruct mlx5_counters tmp_tq;\n \tstruct mlx5_devx_obj *dcs = NULL;\n \tstruct mlx5_flow_counter *cnt;\n+\tuint32_t add2other;\n \tuint32_t i;\n \n \tcont = MLX5_CNT_CONTAINER(priv->sh, batch, age);\n \tif (!batch) {\n+retry:\n+\t\tadd2other = 0;\n \t\t/* bulk_bitmap must be 0 for single counter allocation. */\n \t\tdcs = mlx5_devx_cmd_flow_counter_alloc(priv->sh->ctx, 0);\n \t\tif (!dcs)\n \t\t\treturn NULL;\n \t\tpool = flow_dv_find_pool_by_id(cont, dcs->id);\n+\t\t/* Check if counter belongs to exist pool ID range. */\n \t\tif (!pool) {\n-\t\t\tpool = flow_dv_pool_create(dev, dcs, batch, age);\n-\t\t\tif (!pool) {\n-\t\t\t\tmlx5_devx_cmd_destroy(dcs);\n-\t\t\t\treturn NULL;\n+\t\t\tpool = flow_dv_find_pool_by_id\n+\t\t\t       (MLX5_CNT_CONTAINER\n+\t\t\t       (priv->sh, batch, (age ^ 0x1)), dcs->id);\n+\t\t\t/*\n+\t\t\t * Pool eixsts, counter will be added to the other\n+\t\t\t * container, need to reallocate it later.\n+\t\t\t */\n+\t\t\tif (pool) {\n+\t\t\t\tadd2other = 1;\n+\t\t\t} else {\n+\t\t\t\tpool = flow_dv_pool_create(dev, dcs, batch,\n+\t\t\t\t\t\t\t   age);\n+\t\t\t\tif (!pool) {\n+\t\t\t\t\tmlx5_devx_cmd_destroy(dcs);\n+\t\t\t\t\treturn NULL;\n+\t\t\t\t}\n \t\t\t}\n-\t\t} else if (dcs->id < pool->min_dcs->id) {\n+\t\t}\n+\t\tif (dcs->id < pool->min_dcs->id)\n \t\t\trte_atomic64_set(&pool->a64_dcs,\n \t\t\t\t\t (int64_t)(uintptr_t)dcs);\n-\t\t}\n-\t\tflow_dv_counter_update_min_dcs(dev,\n-\t\t\t\t\t\tpool, batch, age);\n \t\ti = dcs->id % MLX5_COUNTERS_PER_POOL;\n \t\tcnt = MLX5_POOL_GET_CNT(pool, i);\n \t\tcnt->pool = pool;\n \t\tMLX5_GET_POOL_CNT_EXT(pool, i)->dcs = dcs;\n+\t\tif (add2other) {\n+\t\t\tTAILQ_INSERT_TAIL(&pool->counters[pool->query_gen],\n+\t\t\t\t\t  cnt, next);\n+\t\t\tgoto retry;\n+\t\t}\n \t\t*cnt_free = cnt;\n \t\treturn pool;\n \t}\n@@ -9985,3 +9971,4 @@ struct field_modify_info modify_tcp[] = {\n };\n \n #endif /* HAVE_IBV_FLOW_DV_SUPPORT */\n+\n",
    "prefixes": [
        "v2",
        "1/3"
    ]
}