Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/76019/?format=api
http://patches.dpdk.org/api/patches/76019/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200826151445.51500-25-cristian.dumitrescu@intel.com/", "project": { "id": 1, "url": "http://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": "<20200826151445.51500-25-cristian.dumitrescu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200826151445.51500-25-cristian.dumitrescu@intel.com", "date": "2020-08-26T15:14:29", "name": "[24/40] pipeline: introduce extern instruction", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2d146a9e3e9573804dbf568c946e26434007aa13", "submitter": { "id": 19, "url": "http://patches.dpdk.org/api/people/19/?format=api", "name": "Cristian Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200826151445.51500-25-cristian.dumitrescu@intel.com/mbox/", "series": [ { "id": 11806, "url": "http://patches.dpdk.org/api/series/11806/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11806", "date": "2020-08-26T15:14:05", "name": "Pipeline alignment with the P4 language", "version": 1, "mbox": "http://patches.dpdk.org/series/11806/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/76019/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/76019/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 0F5ADA04B1;\n\tWed, 26 Aug 2020 17:20:35 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 7DCAA1C1E7;\n\tWed, 26 Aug 2020 17:15:40 +0200 (CEST)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by dpdk.org (Postfix) with ESMTP id 3D8DF1C0AE\n for <dev@dpdk.org>; Wed, 26 Aug 2020 17:15:12 +0200 (CEST)", "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Aug 2020 08:15:11 -0700", "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by orsmga004.jf.intel.com with ESMTP; 26 Aug 2020 08:15:11 -0700" ], "IronPort-SDR": [ "\n ni7HXysn8K/uH9S1rJiGEet+NEkXB0m+64AJmbchl7598hEQaaHb+nM/mO/w+D8wz8KxOrZccA\n 4rF3+Pv4MSvA==", "\n ARudv/UlZcaGYYY04kxtfsb1xBtPCIA5neJ+3u0XFq1AAtZj6Wm/DgpqrN6sprC1ljunIdvlkc\n fqytT1NEFNAg==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9725\"; a=\"153879577\"", "E=Sophos;i=\"5.76,356,1592895600\"; d=\"scan'208\";a=\"153879577\"", "E=Sophos;i=\"5.76,356,1592895600\"; d=\"scan'208\";a=\"444081406\"" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>", "To": "dev@dpdk.org", "Date": "Wed, 26 Aug 2020 16:14:29 +0100", "Message-Id": "<20200826151445.51500-25-cristian.dumitrescu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20200826151445.51500-1-cristian.dumitrescu@intel.com>", "References": "<20200826151445.51500-1-cristian.dumitrescu@intel.com>", "Subject": "[dpdk-dev] [PATCH 24/40] pipeline: introduce extern instruction", "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": "The extern instruction calls one of the member functions of a given\nextern object or it calls the given extern function. The function\narguments must be written in advance in the maibox. The results are\navailable in the same place after execution.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n lib/librte_pipeline/rte_swx_pipeline.c | 175 +++++++++++++++++++++++++\n 1 file changed, 175 insertions(+)", "diff": "diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c\nindex 51741dc99..1fb3a24af 100644\n--- a/lib/librte_pipeline/rte_swx_pipeline.c\n+++ b/lib/librte_pipeline/rte_swx_pipeline.c\n@@ -352,6 +352,12 @@ enum instruction_type {\n \n \t/* table TABLE */\n \tINSTR_TABLE,\n+\n+\t/* extern e.obj.func */\n+\tINSTR_EXTERN_OBJ,\n+\n+\t/* extern f.func */\n+\tINSTR_EXTERN_FUNC,\n };\n \n struct instr_operand {\n@@ -383,6 +389,15 @@ struct instr_table {\n \tuint8_t table_id;\n };\n \n+struct instr_extern_obj {\n+\tuint8_t ext_obj_id;\n+\tuint8_t func_id;\n+};\n+\n+struct instr_extern_func {\n+\tuint8_t ext_func_id;\n+};\n+\n struct instr_dst_src {\n \tstruct instr_operand dst;\n \tunion {\n@@ -413,6 +428,8 @@ struct instruction {\n \t\tstruct instr_dma dma;\n \t\tstruct instr_dst_src alu;\n \t\tstruct instr_table table;\n+\t\tstruct instr_extern_obj ext_obj;\n+\t\tstruct instr_extern_func ext_func;\n \t};\n };\n \n@@ -1271,6 +1288,50 @@ extern_obj_find(struct rte_swx_pipeline *p, const char *name)\n \treturn NULL;\n }\n \n+static struct extern_type_member_func *\n+extern_obj_member_func_parse(struct rte_swx_pipeline *p,\n+\t\t\t const char *name,\n+\t\t\t struct extern_obj **obj)\n+{\n+\tstruct extern_obj *object;\n+\tstruct extern_type_member_func *func;\n+\tchar *object_name, *func_name;\n+\n+\tif (name[0] != 'e' || name[1] != '.')\n+\t\treturn NULL;\n+\n+\tobject_name = strdup(&name[2]);\n+\tif (!object_name)\n+\t\treturn NULL;\n+\n+\tfunc_name = strchr(object_name, '.');\n+\tif (!func_name) {\n+\t\tfree(object_name);\n+\t\treturn NULL;\n+\t}\n+\n+\t*func_name = 0;\n+\tfunc_name++;\n+\n+\tobject = extern_obj_find(p, object_name);\n+\tif (!object) {\n+\t\tfree(object_name);\n+\t\treturn NULL;\n+\t}\n+\n+\tfunc = extern_type_member_func_find(object->type, func_name);\n+\tif (!func) {\n+\t\tfree(object_name);\n+\t\treturn NULL;\n+\t}\n+\n+\tif (obj)\n+\t\t*obj = object;\n+\n+\tfree(object_name);\n+\treturn func;\n+}\n+\n static struct field *\n extern_obj_mailbox_field_parse(struct rte_swx_pipeline *p,\n \t\t\t const char *name,\n@@ -1553,6 +1614,16 @@ extern_func_find(struct rte_swx_pipeline *p, const char *name)\n \treturn NULL;\n }\n \n+static struct extern_func *\n+extern_func_parse(struct rte_swx_pipeline *p,\n+\t\t const char *name)\n+{\n+\tif (name[0] != 'f' || name[1] != '.')\n+\t\treturn NULL;\n+\n+\treturn extern_func_find(p, &name[2]);\n+}\n+\n static struct field *\n extern_func_mailbox_field_parse(struct rte_swx_pipeline *p,\n \t\t\t\tconst char *name,\n@@ -2097,6 +2168,12 @@ thread_yield(struct rte_swx_pipeline *p)\n \tp->thread_id = (p->thread_id + 1) & (RTE_SWX_PIPELINE_THREADS_MAX - 1);\n }\n \n+static inline void\n+thread_yield_cond(struct rte_swx_pipeline *p, int cond)\n+{\n+\tp->thread_id = (p->thread_id + cond) & (RTE_SWX_PIPELINE_THREADS_MAX - 1);\n+}\n+\n /*\n * rx.\n */\n@@ -2760,6 +2837,94 @@ instr_table_exec(struct rte_swx_pipeline *p)\n \tthread_ip_action_call(p, t, action_id);\n }\n \n+/*\n+ * extern.\n+ */\n+static int\n+instr_extern_translate(struct rte_swx_pipeline *p,\n+\t\t struct action *action __rte_unused,\n+\t\t char **tokens,\n+\t\t int n_tokens,\n+\t\t struct instruction *instr,\n+\t\t struct instruction_data *data __rte_unused)\n+{\n+\tchar *token = tokens[1];\n+\n+\tCHECK(n_tokens == 2, EINVAL);\n+\n+\tif (token[0] == 'e') {\n+\t\tstruct extern_obj *obj;\n+\t\tstruct extern_type_member_func *func;\n+\n+\t\tfunc = extern_obj_member_func_parse(p, token, &obj);\n+\t\tCHECK(func, EINVAL);\n+\n+\t\tinstr->type = INSTR_EXTERN_OBJ;\n+\t\tinstr->ext_obj.ext_obj_id = obj->id;\n+\t\tinstr->ext_obj.func_id = func->id;\n+\n+\t\treturn 0;\n+\t}\n+\n+\tif (token[0] == 'f') {\n+\t\tstruct extern_func *func;\n+\n+\t\tfunc = extern_func_parse(p, token);\n+\t\tCHECK(func, EINVAL);\n+\n+\t\tinstr->type = INSTR_EXTERN_FUNC;\n+\t\tinstr->ext_func.ext_func_id = func->id;\n+\n+\t\treturn 0;\n+\t}\n+\n+\tCHECK(0, EINVAL);\n+}\n+\n+static inline void\n+instr_extern_obj_exec(struct rte_swx_pipeline *p)\n+{\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\tuint32_t obj_id = ip->ext_obj.ext_obj_id;\n+\tuint32_t func_id = ip->ext_obj.func_id;\n+\tstruct extern_obj_runtime *obj = &t->extern_objs[obj_id];\n+\trte_swx_extern_type_member_func_t func = obj->funcs[func_id];\n+\n+\tTRACE(\"[Thread %2u] extern obj %u member func %u\\n\",\n+\t p->thread_id,\n+\t obj_id,\n+\t func_id);\n+\n+\t/* Extern object member function execute. */\n+\tuint32_t done = func(obj->obj, obj->mailbox);\n+\n+\t/* Thread. */\n+\tthread_ip_inc_cond(t, done);\n+\tthread_yield_cond(p, done ^ 1);\n+}\n+\n+static inline void\n+instr_extern_func_exec(struct rte_swx_pipeline *p)\n+{\n+\tstruct thread *t = &p->threads[p->thread_id];\n+\tstruct instruction *ip = t->ip;\n+\tuint32_t ext_func_id = ip->ext_func.ext_func_id;\n+\tstruct extern_func_runtime *ext_func = &t->extern_funcs[ext_func_id];\n+\trte_swx_extern_func_t func = ext_func->func;\n+\n+\tTRACE(\"[Thread %2u] extern func %u\\n\",\n+\t p->thread_id,\n+\t ext_func_id);\n+\n+\t/* Extern function execute. */\n+\tuint32_t done = func(ext_func->mailbox);\n+\n+\t/* Thread. */\n+\tthread_ip_inc_cond(t, done);\n+\tthread_yield_cond(p, done ^ 1);\n+}\n+\n /*\n * mov.\n */\n@@ -4367,6 +4532,14 @@ instr_translate(struct rte_swx_pipeline *p,\n \t\t\t\t\t instr,\n \t\t\t\t\t data);\n \n+\tif (!strcmp(tokens[tpos], \"extern\"))\n+\t\treturn instr_extern_translate(p,\n+\t\t\t\t\t action,\n+\t\t\t\t\t &tokens[tpos],\n+\t\t\t\t\t n_tokens - tpos,\n+\t\t\t\t\t instr,\n+\t\t\t\t\t data);\n+\n \tCHECK(0, EINVAL);\n }\n \n@@ -4571,6 +4744,8 @@ static instr_exec_t instruction_table[] = {\n \t[INSTR_ALU_SHR_HI] = instr_alu_shr_hi_exec,\n \n \t[INSTR_TABLE] = instr_table_exec,\n+\t[INSTR_EXTERN_OBJ] = instr_extern_obj_exec,\n+\t[INSTR_EXTERN_FUNC] = instr_extern_func_exec,\n };\n \n static inline void\n", "prefixes": [ "24/40" ] }{ "id": 76019, "url": "