Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/122546/?format=api
https://patches.dpdk.org/api/patches/122546/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230126133427.379941-10-cristian.dumitrescu@intel.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": "<20230126133427.379941-10-cristian.dumitrescu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230126133427.379941-10-cristian.dumitrescu@intel.com", "date": "2023-01-26T13:34:25", "name": "[V5,09/11] examples/pipeline: support blocks other than pipelines", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "9509e23a4096c378b091bfd9f2dd9c27f772426c", "submitter": { "id": 19, "url": "https://patches.dpdk.org/api/people/19/?format=api", "name": "Cristian Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230126133427.379941-10-cristian.dumitrescu@intel.com/mbox/", "series": [ { "id": 26657, "url": "https://patches.dpdk.org/api/series/26657/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26657", "date": "2023-01-26T13:34:16", "name": "pipeline: add IPsec support", "version": 5, "mbox": "https://patches.dpdk.org/series/26657/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/122546/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/122546/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 96EC942492;\n\tThu, 26 Jan 2023 14:36:01 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id AC68C42D97;\n\tThu, 26 Jan 2023 14:35:14 +0100 (CET)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id D4C7D42D8C\n for <dev@dpdk.org>; Thu, 26 Jan 2023 14:35:09 +0100 (CET)", "from orsmga003.jf.intel.com ([10.7.209.27])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Jan 2023 05:34:40 -0800", "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.222.53])\n by orsmga003.jf.intel.com with ESMTP; 26 Jan 2023 05:34:39 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1674740110; x=1706276110;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=mdmXL2cbD3l8yR8XHArRH55YWsys/+iSzAkvl6Qd8jQ=;\n b=cDKMWYJfcreFvp3mxuvDniC6qZi80LUX7VDJ9cQhRKnHvfG3TE67Gid6\n u00buplX8NjbPjkIZAjBRXVWuqAnzpKUqsqb/jBpSQF4xh6CzTPJIeeEB\n BBaK6yUKQhz7l1jZOtTg3eEWBqj7Y8YVTfuIQBXXreGmEuo3Npb3CEpo6\n A3YpEcIRcq6v8Sh1mw7GKC6ZV9NtlidJDgd3eQGUmTO/q/vSj4cvV31KT\n k6fSx20ctm4wAEFmwocO05fJRM0maWGOPapZzA0PTWcBC1m6+JvxVzCAV\n uRY+Ef9UmWC8ywCvTyYDb65ZPr9/42N58c0jTZtpJ/4ZdG02J2pmT8qgO A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6500,9779,10602\"; a=\"307155152\"", "E=Sophos;i=\"5.97,248,1669104000\"; d=\"scan'208\";a=\"307155152\"", "E=McAfee;i=\"6500,9779,10602\"; a=\"612789724\"", "E=Sophos;i=\"5.97,248,1669104000\"; d=\"scan'208\";a=\"612789724\"" ], "X-ExtLoop1": "1", "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>", "To": "dev@dpdk.org", "Cc": "Kamalakannan R <kamalakannan.r@intel.com>", "Subject": "[PATCH V5 09/11] examples/pipeline: support blocks other than\n pipelines", "Date": "Thu, 26 Jan 2023 13:34:25 +0000", "Message-Id": "<20230126133427.379941-10-cristian.dumitrescu@intel.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20230126133427.379941-1-cristian.dumitrescu@intel.com>", "References": "<20230111205608.87953-1-cristian.dumitrescu@intel.com>\n <20230126133427.379941-1-cristian.dumitrescu@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "Previously, the data plane threads only supported the execution of\npipelines assigned to them through configuration updates. Now, the\ndata plane threads also support running blocks such as IPsec.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Kamalakannan R <kamalakannan.r@intel.com>\n---\n examples/pipeline/thread.c | 143 +++++++++++++++++++++++++++++++++++++\n examples/pipeline/thread.h | 9 +++\n 2 files changed, 152 insertions(+)", "diff": "diff --git a/examples/pipeline/thread.c b/examples/pipeline/thread.c\nindex 3001bc0858..dc3ea73fbf 100644\n--- a/examples/pipeline/thread.c\n+++ b/examples/pipeline/thread.c\n@@ -16,6 +16,10 @@\n #define THREAD_PIPELINES_MAX 256\n #endif\n \n+#ifndef THREAD_BLOCKS_MAX\n+#define THREAD_BLOCKS_MAX 256\n+#endif\n+\n /* Pipeline instruction quanta: Needs to be big enough to do some meaningful\n * work, but not too big to avoid starving any other pipelines mapped to the\n * same thread. For a pipeline that executes 10 instructions per packet, a\n@@ -38,9 +42,16 @@\n * - Read-write by the CP thread;\n * - Read-only by the DP thread.\n */\n+struct block {\n+\tblock_run_f block_func;\n+\tvoid *block;\n+};\n+\n struct thread {\n \tstruct rte_swx_pipeline *pipelines[THREAD_PIPELINES_MAX];\n+\tstruct block *blocks[THREAD_BLOCKS_MAX];\n \tvolatile uint64_t n_pipelines;\n+\tvolatile uint64_t n_blocks;\n \tint enabled;\n } __rte_cache_aligned;\n \n@@ -53,14 +64,43 @@ int\n thread_init(void)\n {\n \tuint32_t thread_id;\n+\tint status = 0;\n \n \tRTE_LCORE_FOREACH_WORKER(thread_id) {\n \t\tstruct thread *t = &threads[thread_id];\n+\t\tuint32_t i;\n \n \t\tt->enabled = 1;\n+\n+\t\tfor (i = 0; i < THREAD_BLOCKS_MAX; i++) {\n+\t\t\tstruct block *b;\n+\n+\t\t\tb = calloc(1, sizeof(struct block));\n+\t\t\tif (!b) {\n+\t\t\t\tstatus = -ENOMEM;\n+\t\t\t\tgoto error;\n+\t\t\t}\n+\n+\t\t\tt->blocks[i] = b;\n+\t\t}\n \t}\n \n \treturn 0;\n+\n+error:\n+\tRTE_LCORE_FOREACH_WORKER(thread_id) {\n+\t\tstruct thread *t = &threads[thread_id];\n+\t\tuint32_t i;\n+\n+\t\tt->enabled = 0;\n+\n+\t\tfor (i = 0; i < THREAD_BLOCKS_MAX; i++) {\n+\t\t\tfree(t->blocks[i]);\n+\t\t\tt->blocks[i] = NULL;\n+\t\t}\n+\t}\n+\n+\treturn status;\n }\n \n static uint32_t\n@@ -83,6 +123,26 @@ pipeline_find(struct rte_swx_pipeline *p)\n \treturn thread_id;\n }\n \n+static uint32_t\n+block_find(void *b)\n+{\n+\tuint32_t thread_id;\n+\n+\tfor (thread_id = 0; thread_id < RTE_MAX_LCORE; thread_id++) {\n+\t\tstruct thread *t = &threads[thread_id];\n+\t\tuint32_t i;\n+\n+\t\tif (!t->enabled)\n+\t\t\tcontinue;\n+\n+\t\tfor (i = 0; i < t->n_blocks; i++)\n+\t\t\tif (t->blocks[i]->block == b)\n+\t\t\t\tbreak;\n+\t}\n+\n+\treturn thread_id;\n+}\n+\n /**\n * Enable a given pipeline to run on a specific DP thread.\n *\n@@ -201,9 +261,85 @@ pipeline_disable(struct rte_swx_pipeline *p)\n \treturn;\n }\n \n+int\n+block_enable(block_run_f block_func, void *block, uint32_t thread_id)\n+{\n+\tstruct thread *t;\n+\tuint64_t n_blocks;\n+\n+\t/* Check input params */\n+\tif (!block_func || !block || thread_id >= RTE_MAX_LCORE)\n+\t\treturn -EINVAL;\n+\n+\tif (block_find(block) < RTE_MAX_LCORE)\n+\t\treturn -EEXIST;\n+\n+\tt = &threads[thread_id];\n+\tif (!t->enabled)\n+\t\treturn -EINVAL;\n+\n+\tn_blocks = t->n_blocks;\n+\n+\t/* Check there is room for at least one more block. */\n+\tif (n_blocks >= THREAD_BLOCKS_MAX)\n+\t\treturn -ENOSPC;\n+\n+\t/* Install the new block. */\n+\tt->blocks[n_blocks]->block_func = block_func;\n+\tt->blocks[n_blocks]->block = block;\n+\n+\trte_wmb();\n+\tt->n_blocks = n_blocks + 1;\n+\n+\treturn 0;\n+}\n+\n+void\n+block_disable(void *block)\n+{\n+\tstruct thread *t;\n+\tuint64_t n_blocks;\n+\tuint32_t thread_id, i;\n+\n+\t/* Check input params */\n+\tif (!block)\n+\t\treturn;\n+\n+\t/* Find the thread that runs this block. */\n+\tthread_id = block_find(block);\n+\tif (thread_id == RTE_MAX_LCORE)\n+\t\treturn;\n+\n+\tt = &threads[thread_id];\n+\tn_blocks = t->n_blocks;\n+\n+\tfor (i = 0; i < n_blocks; i++) {\n+\t\tstruct block *b = t->blocks[i];\n+\n+\t\tif (block != b->block)\n+\t\t\tcontinue;\n+\n+\t\tif (i < n_blocks - 1) {\n+\t\t\tstruct block *block_last = t->blocks[n_blocks - 1];\n+\n+\t\t\tt->blocks[i] = block_last;\n+\t\t}\n+\n+\t\trte_wmb();\n+\t\tt->n_blocks = n_blocks - 1;\n+\n+\t\trte_wmb();\n+\t\tt->blocks[n_blocks - 1] = b;\n+\n+\t\treturn;\n+\t}\n+}\n+\n /**\n * Data plane (DP) threads.\n *\n+\n+\n * The t->n_pipelines variable is modified by the CP thread every time changes to the t->pipeline[]\n * array are operated, so it is therefore very important that the latest value of t->n_pipelines is\n * read by the DP thread at the beginning of every new dispatch loop iteration, otherwise a stale\n@@ -229,6 +365,13 @@ thread_main(void *arg __rte_unused)\n \t\t/* Pipelines. */\n \t\tfor (i = 0; i < t->n_pipelines; i++)\n \t\t\trte_swx_pipeline_run(t->pipelines[i], PIPELINE_INSTR_QUANTA);\n+\n+\t\t/* Blocks. */\n+\t\tfor (i = 0; i < t->n_blocks; i++) {\n+\t\t\tstruct block *b = t->blocks[i];\n+\n+\t\t\tb->block_func(b->block);\n+\t\t}\n \t}\n \n \treturn 0;\ndiff --git a/examples/pipeline/thread.h b/examples/pipeline/thread.h\nindex 338d480abb..f2e643def5 100644\n--- a/examples/pipeline/thread.h\n+++ b/examples/pipeline/thread.h\n@@ -21,6 +21,15 @@ pipeline_enable(struct rte_swx_pipeline *p, uint32_t thread_id);\n void\n pipeline_disable(struct rte_swx_pipeline *p);\n \n+typedef void\n+(*block_run_f)(void *block);\n+\n+int\n+block_enable(block_run_f block_func, void *block, uint32_t thread_id);\n+\n+void\n+block_disable(void *block);\n+\n /**\n * Data plane (DP) threads.\n */\n", "prefixes": [ "V5", "09/11" ] }{ "id": 122546, "url": "