Show a patch.

GET /api/patches/74605/
Content-Type: application/json
Vary: Accept

    "id": 74605,
    "url": "",
    "web_url": "",
    "project": {
        "id": 1,
        "url": "",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "",
        "list_email": "",
        "web_url": "",
        "scm_url": "git://",
        "webscm_url": ""
    "msgid": "<>",
    "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": "",
        "name": "Suanming Mou",
        "email": ""
    "delegate": {
        "id": 3268,
        "url": "",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": ""
    "mbox": "",
    "series": [
            "id": 11229,
            "url": "",
            "web_url": "",
            "date": "2020-07-22T07:58:45",
            "name": "[v2,1/3] net/mlx5: separate aging counter pool range",
            "version": 2,
            "mbox": ""
    "comments": "",
    "check": "success",
    "checks": "",
    "tags": {},
    "headers": {
        "List-Subscribe": "<>,\n <>",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "X-Original-To": "",
        "List-Post": "<>",
        "References": "<>",
        "X-BeenThere": "",
        "List-Id": "DPDK patches and discussions <>",
        "Subject": "[dpdk-dev] [PATCH v2 1/3] net/mlx5: separate aging counter pool\n\trange",
        "Sender": "\"dev\" <>",
        "From": "Suanming Mou <>",
        "Received": [
            "from ( [])\n\tby (Postfix) with ESMTP id 3EA1AA0526;\n\tWed, 22 Jul 2020 09:58:55 +0200 (CEST)",
            "from [] (localhost [])\n\tby (Postfix) with ESMTP id 1B1991BFBA;\n\tWed, 22 Jul 2020 09:58:55 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [])\n by (Postfix) with ESMTP id 7CBF41BE90\n for <>; Wed, 22 Jul 2020 09:58:53 +0200 (CEST)"
        "To": ",\n\",
        "X-Mailer": "git-send-email",
        "List-Unsubscribe": "<>,\n <>",
        "Date": "Wed, 22 Jul 2020 15:58:45 +0800",
        "List-Archive": "<>",
        "Delivered-To": "",
        "In-Reply-To": "<>",
        "Cc": ",\n\",
        "List-Help": "<>",
        "Errors-To": "",
        "Message-Id": "<>",
        "Return-Path": "<>"
    "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 <>\nAcked-by: Matan Azrad <>\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": [