Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/98624/?format=api
http://patchwork.dpdk.org/api/patches/98624/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210910123003.85448-17-cristian.dumitrescu@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20210910123003.85448-17-cristian.dumitrescu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210910123003.85448-17-cristian.dumitrescu@intel.com", "date": "2021-09-10T12:29:56", "name": "[17/24] pipeline: introduce action functions", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "e8abf36e196411959f2a4c8483ac2fab7d54054f", "submitter": { "id": 19, "url": "http://patchwork.dpdk.org/api/people/19/?format=api", "name": "Cristian Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "delegate": null, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210910123003.85448-17-cristian.dumitrescu@intel.com/mbox/", "series": [ { "id": 18838, "url": "http://patchwork.dpdk.org/api/series/18838/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18838", "date": "2021-09-10T12:29:44", "name": "[01/24] pipeline: move data structures to internal header file", "version": 1, "mbox": "http://patchwork.dpdk.org/series/18838/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/98624/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/98624/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 32736A0547;\n\tFri, 10 Sep 2021 14:32:45 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 01E20411AB;\n\tFri, 10 Sep 2021 14:30:48 +0200 (CEST)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 59D8C41149\n for <dev@dpdk.org>; Fri, 10 Sep 2021 14:30:26 +0200 (CEST)", "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Sep 2021 05:30:20 -0700", "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com) ([10.237.223.107])\n by orsmga001.jf.intel.com with ESMTP; 10 Sep 2021 05:30:19 -0700" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10102\"; a=\"243386311\"", "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"243386311\"", "E=Sophos;i=\"5.85,282,1624345200\"; d=\"scan'208\";a=\"514279809\"" ], "X-ExtLoop1": "1", "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>", "To": "dev@dpdk.org", "Date": "Fri, 10 Sep 2021 13:29:56 +0100", "Message-Id": "<20210910123003.85448-17-cristian.dumitrescu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20210910123003.85448-1-cristian.dumitrescu@intel.com>", "References": "<20210910123003.85448-1-cristian.dumitrescu@intel.com>", "Subject": "[dpdk-dev] [PATCH 17/24] pipeline: introduce action functions", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "For better performance, the option to run a single function per action\nis now provided, which requires a single function call per action that\ncan be better optimized by the C compiler, as opposed to one function\ncall per instruction. Special table lookup instructions are added to\nto support this feature.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c | 127 +++++++++++++++++++++++\n lib/pipeline/rte_swx_pipeline_internal.h | 6 ++\n 2 files changed, 133 insertions(+)", "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 4099e364f5..0d02548137 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -2097,6 +2097,62 @@ instr_table_exec(struct rte_swx_pipeline *p)\n \tthread_ip_action_call(p, t, action_id);\n }\n \n+static inline void\n+instr_table_af_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 table_id = ip->table.table_id;\n+\tstruct rte_swx_table_state *ts = &t->table_state[table_id];\n+\tstruct table_runtime *table = &t->tables[table_id];\n+\tstruct table_statistics *stats = &p->table_stats[table_id];\n+\tuint64_t action_id, n_pkts_hit, n_pkts_action;\n+\tuint8_t *action_data;\n+\taction_func_t action_func;\n+\tint done, hit;\n+\n+\t/* Table. */\n+\tdone = table->func(ts->obj,\n+\t\t\t table->mailbox,\n+\t\t\t table->key,\n+\t\t\t &action_id,\n+\t\t\t &action_data,\n+\t\t\t &hit);\n+\tif (!done) {\n+\t\t/* Thread. */\n+\t\tTRACE(\"[Thread %2u] table %u (not finalized)\\n\",\n+\t\t p->thread_id,\n+\t\t table_id);\n+\n+\t\tthread_yield(p);\n+\t\treturn;\n+\t}\n+\n+\taction_id = hit ? action_id : ts->default_action_id;\n+\taction_data = hit ? action_data : ts->default_action_data;\n+\taction_func = p->action_funcs[action_id];\n+\tn_pkts_hit = stats->n_pkts_hit[hit];\n+\tn_pkts_action = stats->n_pkts_action[action_id];\n+\n+\tTRACE(\"[Thread %2u] table %u (%s, action %u)\\n\",\n+\t p->thread_id,\n+\t table_id,\n+\t hit ? \"hit\" : \"miss\",\n+\t (uint32_t)action_id);\n+\n+\tt->action_id = action_id;\n+\tt->structs[0] = action_data;\n+\tt->hit = hit;\n+\tstats->n_pkts_hit[hit] = n_pkts_hit + 1;\n+\tstats->n_pkts_action[action_id] = n_pkts_action + 1;\n+\n+\t/* Thread. */\n+\tthread_ip_inc(p);\n+\n+\t/* Action. */\n+\taction_func(p);\n+}\n+\n static inline void\n instr_selector_exec(struct rte_swx_pipeline *p)\n {\n@@ -2193,6 +2249,68 @@ instr_learner_exec(struct rte_swx_pipeline *p)\n \tthread_ip_action_call(p, t, action_id);\n }\n \n+static inline void\n+instr_learner_af_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 learner_id = ip->table.table_id;\n+\tstruct rte_swx_table_state *ts = &t->table_state[p->n_tables +\n+\t\tp->n_selectors + learner_id];\n+\tstruct learner_runtime *l = &t->learners[learner_id];\n+\tstruct learner_statistics *stats = &p->learner_stats[learner_id];\n+\tuint64_t action_id, n_pkts_hit, n_pkts_action, time;\n+\tuint8_t *action_data;\n+\taction_func_t action_func;\n+\tint done, hit;\n+\n+\t/* Table. */\n+\ttime = rte_get_tsc_cycles();\n+\n+\tdone = rte_swx_table_learner_lookup(ts->obj,\n+\t\t\t\t\t l->mailbox,\n+\t\t\t\t\t time,\n+\t\t\t\t\t l->key,\n+\t\t\t\t\t &action_id,\n+\t\t\t\t\t &action_data,\n+\t\t\t\t\t &hit);\n+\tif (!done) {\n+\t\t/* Thread. */\n+\t\tTRACE(\"[Thread %2u] learner %u (not finalized)\\n\",\n+\t\t p->thread_id,\n+\t\t learner_id);\n+\n+\t\tthread_yield(p);\n+\t\treturn;\n+\t}\n+\n+\taction_id = hit ? action_id : ts->default_action_id;\n+\taction_data = hit ? action_data : ts->default_action_data;\n+\taction_func = p->action_funcs[action_id];\n+\tn_pkts_hit = stats->n_pkts_hit[hit];\n+\tn_pkts_action = stats->n_pkts_action[action_id];\n+\n+\tTRACE(\"[Thread %2u] learner %u (%s, action %u)\\n\",\n+\t p->thread_id,\n+\t learner_id,\n+\t hit ? \"hit\" : \"miss\",\n+\t (uint32_t)action_id);\n+\n+\tt->action_id = action_id;\n+\tt->structs[0] = action_data;\n+\tt->hit = hit;\n+\tt->learner_id = learner_id;\n+\tt->time = time;\n+\tstats->n_pkts_hit[hit] = n_pkts_hit + 1;\n+\tstats->n_pkts_action[action_id] = n_pkts_action + 1;\n+\n+\t/* Thread. */\n+\tthread_ip_action_call(p, t, action_id);\n+\n+\t/* Action */\n+\taction_func(p);\n+}\n+\n /*\n * learn.\n */\n@@ -6618,8 +6736,10 @@ static instr_exec_t instruction_table[] = {\n \t[INSTR_METER_IMI] = instr_meter_imi_exec,\n \n \t[INSTR_TABLE] = instr_table_exec,\n+\t[INSTR_TABLE_AF] = instr_table_af_exec,\n \t[INSTR_SELECTOR] = instr_selector_exec,\n \t[INSTR_LEARNER] = instr_learner_exec,\n+\t[INSTR_LEARNER_AF] = instr_learner_af_exec,\n \t[INSTR_LEARNER_LEARN] = instr_learn_exec,\n \t[INSTR_LEARNER_FORGET] = instr_forget_exec,\n \t[INSTR_EXTERN_OBJ] = instr_extern_obj_exec,\n@@ -6819,12 +6939,19 @@ action_build(struct rte_swx_pipeline *p)\n \tTAILQ_FOREACH(action, &p->actions, node)\n \t\tp->action_instructions[action->id] = action->instructions;\n \n+\t/* p->action_funcs. */\n+\tp->action_funcs = calloc(p->n_actions, sizeof(action_func_t));\n+\tCHECK(p->action_funcs, ENOMEM);\n+\n \treturn 0;\n }\n \n static void\n action_build_free(struct rte_swx_pipeline *p)\n {\n+\tfree(p->action_funcs);\n+\tp->action_funcs = NULL;\n+\n \tfree(p->action_instructions);\n \tp->action_instructions = NULL;\n }\ndiff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h\nindex 7a02d6cb5f..3578a10501 100644\n--- a/lib/pipeline/rte_swx_pipeline_internal.h\n+++ b/lib/pipeline/rte_swx_pipeline_internal.h\n@@ -443,8 +443,10 @@ enum instruction_type {\n \n \t/* table TABLE */\n \tINSTR_TABLE,\n+\tINSTR_TABLE_AF,\n \tINSTR_SELECTOR,\n \tINSTR_LEARNER,\n+\tINSTR_LEARNER_AF,\n \n \t/* learn LEARNER ACTION_NAME */\n \tINSTR_LEARNER_LEARN,\n@@ -687,6 +689,9 @@ struct instruction_data {\n /*\n * Action.\n */\n+typedef void\n+(*action_func_t)(struct rte_swx_pipeline *p);\n+\n struct action {\n \tTAILQ_ENTRY(action) node;\n \tchar name[RTE_SWX_NAME_SIZE];\n@@ -1382,6 +1387,7 @@ struct rte_swx_pipeline {\n \tstruct port_in_runtime *in;\n \tstruct port_out_runtime *out;\n \tstruct instruction **action_instructions;\n+\taction_func_t *action_funcs;\n \tstruct rte_swx_table_state *table_state;\n \tstruct table_statistics *table_stats;\n \tstruct selector_statistics *selector_stats;\n", "prefixes": [ "17/24" ] }{ "id": 98624, "url": "