get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 112363,
    "url": "https://patches.dpdk.org/api/patches/112363/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220606112109.208873-22-lizh@nvidia.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20220606112109.208873-22-lizh@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220606112109.208873-22-lizh@nvidia.com",
    "date": "2022-06-06T11:20:58",
    "name": "[v1,11/17] vdpa/mlx5: add task ring for MT management",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "af012d0f857b48b6bf067fb996191a2a6cae0b90",
    "submitter": {
        "id": 1967,
        "url": "https://patches.dpdk.org/api/people/1967/?format=api",
        "name": "Li Zhang",
        "email": "lizh@nvidia.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220606112109.208873-22-lizh@nvidia.com/mbox/",
    "series": [
        {
            "id": 23349,
            "url": "https://patches.dpdk.org/api/series/23349/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=23349",
            "date": "2022-06-06T11:20:58",
            "name": null,
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/23349/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/112363/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/112363/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 02E56A0543;\n\tMon,  6 Jun 2022 13:24:25 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5452242BD4;\n\tMon,  6 Jun 2022 13:22:43 +0200 (CEST)",
            "from NAM02-BN1-obe.outbound.protection.outlook.com\n (mail-bn1nam07on2051.outbound.protection.outlook.com [40.107.212.51])\n by mails.dpdk.org (Postfix) with ESMTP id 99FAC42BCA\n for <dev@dpdk.org>; Mon,  6 Jun 2022 13:22:41 +0200 (CEST)",
            "from BN9PR03CA0641.namprd03.prod.outlook.com (2603:10b6:408:13b::16)\n by MN2PR12MB3661.namprd12.prod.outlook.com (2603:10b6:208:169::31)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Mon, 6 Jun\n 2022 11:22:39 +0000",
            "from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com\n (2603:10b6:408:13b:cafe::6f) by BN9PR03CA0641.outlook.office365.com\n (2603:10b6:408:13b::16) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12 via Frontend\n Transport; Mon, 6 Jun 2022 11:22:39 +0000",
            "from mail.nvidia.com (12.22.5.234) by\n BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id\n 15.20.5314.12 via Frontend Transport; Mon, 6 Jun 2022 11:22:38 +0000",
            "from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com\n (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32;\n Mon, 6 Jun 2022 11:22:38 +0000",
            "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.22; Mon, 6 Jun 2022\n 04:22:35 -0700"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=RiPO4GCjT4+7wxWebGpyM/Uk9Xb+/zqqu9Sxolnjs77KwxNpbeGSDytxM+3CsyxgwsMa4+uTKxPo+DsA3P5oebylPE6flJjalxMtRNeb80sPY/3QdWe5eIL/vNKiRTT7piSoashqSOujh2HNTILq1xRG1pLEQ28MlE8XdyfH412dX0SbIFj90NKMwLTjJc5w5D/9BREMOHOeFql0X0RMj1tSckC9DsVEgslCs0rsU8ihnP0TzVgaQuK1vngm0jcH8Apgc6GMMnC7x+fXYdcReiqcjdXXZFlcnPTS6ggRCSX6vE4tGGhsv5ZbWcGHpmuofykVgwcspoUuFQJexrvj2A==",
        "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=WPeiYEKr8Xl0aU3ahh2E84TguKGVfhqJFiY6ZoKAkqw=;\n b=hXXdwkPAAzMP1073Jpx0cjRA8o5gBO4HuHdDCgfxu62QDSxi+qDb0b8Ec8R4R+MavjqN3Jr3rnP1igVf3TUak197eO9mCShiAgsU/MILi7s6xpELKG7qmnGFDA6wm1/iVMaMQ6h5+HBn5KUTTLhcNP1XFywYc5xr3FQb0QDmJzsSwj/iye6vqmPHQXu4qb6t7ZQAQemrAZgWs/8vajKBv4hF+h66nDa6BhT7Z4nGrTvtyIqwmt73PLH9Y6qKUdH3Mg5c82aPkNBYHd3lEf0Dz9mIoOpvQ1I6K5YvEgg+y+dbxaCXMWu5hruxadDliAQm1shGaHFndZKoTJ6N7oEgdA==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 12.22.5.234) smtp.rcpttodomain=monjalon.net 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=WPeiYEKr8Xl0aU3ahh2E84TguKGVfhqJFiY6ZoKAkqw=;\n b=Q/9z9lg+z9E+T63b/Vwp4IA8slK04Cij66LqtP2Q5/peG6LuFP0W64FrWcm5jNmBw1l7cN8ZVEBqYiA/SGeIMwqws40ifm5oZITs13iMCmU/6dsh+0jetK6N4NUq5Y0a7980xNcUaS54X34ci8uqvuUYoVMlucffEppyR5hVR73Pu00zCQ5XmJL6wXNzN+yDFUzA0hCRiUhoAoPgP0Zr9wiwArLVOixhi/X9YLNCvfjUmAyeBTKl/yhkk4UpriMy+RHc3VQID0INggnPiZztwVa1pFFGopYHuFH1p9WfnRjkFEUi3EgWZeMIZm4K475F8YAiJPOkHu9zzhGf4AS/aA==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 12.22.5.234)\n smtp.mailfrom=nvidia.com; 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 12.22.5.234 as permitted sender) receiver=protection.outlook.com;\n client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C",
        "From": "Li Zhang <lizh@nvidia.com>",
        "To": "<orika@nvidia.com>, <viacheslavo@nvidia.com>, <matan@nvidia.com>,\n <shahafs@nvidia.com>",
        "CC": "<dev@dpdk.org>, <thomas@monjalon.net>, <rasland@nvidia.com>,\n <roniba@nvidia.com>",
        "Subject": "[PATCH v1 11/17] vdpa/mlx5: add task ring for MT management",
        "Date": "Mon, 6 Jun 2022 14:20:58 +0300",
        "Message-ID": "<20220606112109.208873-22-lizh@nvidia.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20220606112109.208873-1-lizh@nvidia.com>",
        "References": "<20220408075606.33056-1-lizh@nvidia.com>\n <20220606112109.208873-1-lizh@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": "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-Office365-Filtering-Correlation-Id": "ed2f32fd-4236-479d-4ebb-08da47aedd5f",
        "X-MS-TrafficTypeDiagnostic": "MN2PR12MB3661:EE_",
        "X-LD-Processed": "43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr",
        "X-Microsoft-Antispam-PRVS": "\n <MN2PR12MB3661D8BCCDF9A9B00FC28344BFA29@MN2PR12MB3661.namprd12.prod.outlook.com>",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n BYHGZq5kWDlgUoYtIdaBZrZicwv2mASeIVr3YorP+XOCjUs6y926CZrnXYUClBpQCgaxXzPa6XCDkIqYcanYyS8pSmBm+KdF3pjsOgL4gCec3Z9r3gf0cUySBJMV82JtSPeMgzx2xVbOch4FWAuGrUS0IZBJU6ujKozWSNY6RkQeGk82A9rhIBIkuFRIV8XGj2z15Y8Ozgkz/SatLjI94m39BwW2/9+ixFaIdaqezH9nXyk+5SRkGKeZOyWbsYygdEkg8n3birFT1yfd5RefLa0Di669KqJheiYn3NCxlgnMt33i9VY9cF5l2vTyCO8Uw7nfzkA3rIHIWKVCskz03f1jU19AjpUY8oMKLllwkjoV3D6fhf1uMtLPLjYgUyKNXzS9vtsjp2HhhImy9hKOXCDmr1ilr3E0LMdtbx3c3/uvxat2z00xREXSYHp8DEQ8QluyssAry/TSdHEh7sK1BNqgBUzjoBVzBRCI15LQDPXSfDZZj3I/SZ9/xJrZmZKhod2QhYhB5zdxipdVpwLJJePBuf1cFf59XPC3U3pWscV9mAyMUHdtgtkhY3PrhFaisoVZh2XgTM7U64zxHVbgiPOu4QdXYCxmc/UXpxDr7k4tWg3VGP4utdGDq7IRuujnnTSwtLTWmoBPoNZ6RzTy+sBE0+dJhqUy+ICiSsS7LPm3I5ASKXIc+Scz3NneMN0/limcFiYAVrjvXiOAiEDwFQ==",
        "X-Forefront-Antispam-Report": "CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:;\n IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE;\n SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(2616005)(316002)(1076003)(8936002)(6636002)(36860700001)(107886003)(336012)(47076005)(26005)(426003)(55016003)(6286002)(40460700003)(186003)(86362001)(110136005)(83380400001)(7696005)(16526019)(36756003)(8676002)(70206006)(81166007)(54906003)(4326008)(5660300002)(508600001)(356005)(2906002)(70586007)(82310400005)(6666004)(36900700001);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "06 Jun 2022 11:22:38.8520 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n ed2f32fd-4236-479d-4ebb-08da47aedd5f",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n BN8NAM11FT048.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "MN2PR12MB3661",
        "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": "The configuration threads tasks need a container to\nsupport multiple tasks assigned to a thread in parallel.\nUse rte_ring container per thread to manage\nthe thread tasks without locks.\nThe caller thread from the user context opens a task to\na thread and enqueue it to the thread ring.\nThe thread polls its ring and dequeue tasks.\nThat’s why the ring should be in multi-producer\nand single consumer mode.\nAnatomic counter manages the tasks completion notification.\nThe threads report errors to the caller by\na dedicated error counter per task.\n\nSigned-off-by: Li Zhang <lizh@nvidia.com>\n---\n drivers/vdpa/mlx5/mlx5_vdpa.h         |  17 ++++\n drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 115 +++++++++++++++++++++++++-\n 2 files changed, 130 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h\nindex 4e7c2557b7..2bbb868ec6 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa.h\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa.h\n@@ -74,10 +74,22 @@ enum {\n };\n \n #define MLX5_VDPA_MAX_C_THRD 256\n+#define MLX5_VDPA_MAX_TASKS_PER_THRD 4096\n+#define MLX5_VDPA_TASKS_PER_DEV 64\n+\n+/* Generic task information and size must be multiple of 4B. */\n+struct mlx5_vdpa_task {\n+\tstruct mlx5_vdpa_priv *priv;\n+\tuint32_t *remaining_cnt;\n+\tuint32_t *err_cnt;\n+\tuint32_t idx;\n+} __rte_packed __rte_aligned(4);\n \n /* Generic mlx5_vdpa_c_thread information. */\n struct mlx5_vdpa_c_thread {\n \tpthread_t tid;\n+\tstruct rte_ring *rng;\n+\tpthread_cond_t c_cond;\n };\n \n struct mlx5_vdpa_conf_thread_mng {\n@@ -532,4 +544,9 @@ mlx5_vdpa_mult_threads_create(int cpu_core);\n  */\n void\n mlx5_vdpa_mult_threads_destroy(bool need_unlock);\n+\n+bool\n+mlx5_vdpa_task_add(struct mlx5_vdpa_priv *priv,\n+\t\tuint32_t thrd_idx,\n+\t\tuint32_t num);\n #endif /* RTE_PMD_MLX5_VDPA_H_ */\ndiff --git a/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c b/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c\nindex ba7d8b63b3..1fdc92d3ad 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c\n@@ -11,17 +11,103 @@\n #include <rte_alarm.h>\n #include <rte_tailq.h>\n #include <rte_ring_elem.h>\n+#include <rte_ring_peek.h>\n \n #include <mlx5_common.h>\n \n #include \"mlx5_vdpa_utils.h\"\n #include \"mlx5_vdpa.h\"\n \n+static inline uint32_t\n+mlx5_vdpa_c_thrd_ring_dequeue_bulk(struct rte_ring *r,\n+\tvoid **obj, uint32_t n, uint32_t *avail)\n+{\n+\tuint32_t m;\n+\n+\tm = rte_ring_dequeue_bulk_elem_start(r, obj,\n+\t\tsizeof(struct mlx5_vdpa_task), n, avail);\n+\tn = (m == n) ? n : 0;\n+\trte_ring_dequeue_elem_finish(r, n);\n+\treturn n;\n+}\n+\n+static inline uint32_t\n+mlx5_vdpa_c_thrd_ring_enqueue_bulk(struct rte_ring *r,\n+\tvoid * const *obj, uint32_t n, uint32_t *free)\n+{\n+\tuint32_t m;\n+\n+\tm = rte_ring_enqueue_bulk_elem_start(r, n, free);\n+\tn = (m == n) ? n : 0;\n+\trte_ring_enqueue_elem_finish(r, obj,\n+\t\tsizeof(struct mlx5_vdpa_task), n);\n+\treturn n;\n+}\n+\n+bool\n+mlx5_vdpa_task_add(struct mlx5_vdpa_priv *priv,\n+\t\tuint32_t thrd_idx,\n+\t\tuint32_t num)\n+{\n+\tstruct rte_ring *rng = conf_thread_mng.cthrd[thrd_idx].rng;\n+\tstruct mlx5_vdpa_task task[MLX5_VDPA_TASKS_PER_DEV];\n+\tuint32_t i;\n+\n+\tMLX5_ASSERT(num <= MLX5_VDPA_TASKS_PER_DEV);\n+\tfor (i = 0 ; i < num; i++) {\n+\t\ttask[i].priv = priv;\n+\t\t/* To be added later. */\n+\t}\n+\tif (!mlx5_vdpa_c_thrd_ring_enqueue_bulk(rng, (void **)&task, num, NULL))\n+\t\treturn -1;\n+\tfor (i = 0 ; i < num; i++)\n+\t\tif (task[i].remaining_cnt)\n+\t\t\t__atomic_fetch_add(task[i].remaining_cnt, 1,\n+\t\t\t\t__ATOMIC_RELAXED);\n+\t/* wake up conf thread. */\n+\tpthread_mutex_lock(&conf_thread_mng.cthrd_lock);\n+\tpthread_cond_signal(&conf_thread_mng.cthrd[thrd_idx].c_cond);\n+\tpthread_mutex_unlock(&conf_thread_mng.cthrd_lock);\n+\treturn 0;\n+}\n+\n static void *\n mlx5_vdpa_c_thread_handle(void *arg)\n {\n-\t/* To be added later. */\n-\treturn arg;\n+\tstruct mlx5_vdpa_conf_thread_mng *multhrd = arg;\n+\tpthread_t thread_id = pthread_self();\n+\tstruct mlx5_vdpa_priv *priv;\n+\tstruct mlx5_vdpa_task task;\n+\tstruct rte_ring *rng;\n+\tuint32_t thrd_idx;\n+\tuint32_t task_num;\n+\n+\tfor (thrd_idx = 0; thrd_idx < multhrd->max_thrds;\n+\t\tthrd_idx++)\n+\t\tif (multhrd->cthrd[thrd_idx].tid == thread_id)\n+\t\t\tbreak;\n+\tif (thrd_idx >= multhrd->max_thrds)\n+\t\treturn NULL;\n+\trng = multhrd->cthrd[thrd_idx].rng;\n+\twhile (1) {\n+\t\ttask_num = mlx5_vdpa_c_thrd_ring_dequeue_bulk(rng,\n+\t\t\t(void **)&task, 1, NULL);\n+\t\tif (!task_num) {\n+\t\t\t/* No task and condition wait. */\n+\t\t\tpthread_mutex_lock(&multhrd->cthrd_lock);\n+\t\t\tpthread_cond_wait(\n+\t\t\t\t&multhrd->cthrd[thrd_idx].c_cond,\n+\t\t\t\t&multhrd->cthrd_lock);\n+\t\t\tpthread_mutex_unlock(&multhrd->cthrd_lock);\n+\t\t}\n+\t\tpriv = task.priv;\n+\t\tif (priv == NULL)\n+\t\t\tcontinue;\n+\t\t__atomic_fetch_sub(task.remaining_cnt,\n+\t\t\t1, __ATOMIC_RELAXED);\n+\t\t/* To be added later. */\n+\t}\n+\treturn NULL;\n }\n \n static void\n@@ -34,6 +120,10 @@ mlx5_vdpa_c_thread_destroy(uint32_t thrd_idx, bool need_unlock)\n \t\tif (need_unlock)\n \t\t\tpthread_mutex_init(&conf_thread_mng.cthrd_lock, NULL);\n \t}\n+\tif (conf_thread_mng.cthrd[thrd_idx].rng) {\n+\t\trte_ring_free(conf_thread_mng.cthrd[thrd_idx].rng);\n+\t\tconf_thread_mng.cthrd[thrd_idx].rng = NULL;\n+\t}\n }\n \n static int\n@@ -45,6 +135,7 @@ mlx5_vdpa_c_thread_create(int cpu_core)\n \trte_cpuset_t cpuset;\n \tpthread_attr_t attr;\n \tuint32_t thrd_idx;\n+\tuint32_t ring_num;\n \tchar name[32];\n \tint ret;\n \n@@ -60,8 +151,26 @@ mlx5_vdpa_c_thread_create(int cpu_core)\n \t\tDRV_LOG(ERR, \"Failed to set thread priority.\");\n \t\tgoto c_thread_err;\n \t}\n+\tring_num = MLX5_VDPA_MAX_TASKS_PER_THRD / conf_thread_mng.max_thrds;\n+\tif (!ring_num) {\n+\t\tDRV_LOG(ERR, \"Invalid ring number for thread.\");\n+\t\tgoto c_thread_err;\n+\t}\n \tfor (thrd_idx = 0; thrd_idx < conf_thread_mng.max_thrds;\n \t\tthrd_idx++) {\n+\t\tsnprintf(name, sizeof(name), \"vDPA-mthread-ring-%d\",\n+\t\t\tthrd_idx);\n+\t\tconf_thread_mng.cthrd[thrd_idx].rng = rte_ring_create_elem(name,\n+\t\t\tsizeof(struct mlx5_vdpa_task), ring_num,\n+\t\t\trte_socket_id(),\n+\t\t\tRING_F_MP_HTS_ENQ | RING_F_MC_HTS_DEQ |\n+\t\t\tRING_F_EXACT_SZ);\n+\t\tif (!conf_thread_mng.cthrd[thrd_idx].rng) {\n+\t\t\tDRV_LOG(ERR,\n+\t\t\t\"Failed to create vdpa multi-threads %d ring.\",\n+\t\t\tthrd_idx);\n+\t\t\tgoto c_thread_err;\n+\t\t}\n \t\tret = pthread_create(&conf_thread_mng.cthrd[thrd_idx].tid,\n \t\t\t\t&attr, mlx5_vdpa_c_thread_handle,\n \t\t\t\t(void *)&conf_thread_mng);\n@@ -91,6 +200,8 @@ mlx5_vdpa_c_thread_create(int cpu_core)\n \t\t\t\t\tname);\n \t\telse\n \t\t\tDRV_LOG(DEBUG, \"Thread name: %s.\", name);\n+\t\tpthread_cond_init(&conf_thread_mng.cthrd[thrd_idx].c_cond,\n+\t\t\tNULL);\n \t}\n \tpthread_mutex_unlock(&conf_thread_mng.cthrd_lock);\n \treturn 0;\n",
    "prefixes": [
        "v1",
        "11/17"
    ]
}