Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/35901/?format=api
https://patches.dpdk.org/api/patches/35901/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180309182426.135278-24-jasvinder.singh@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": "<20180309182426.135278-24-jasvinder.singh@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180309182426.135278-24-jasvinder.singh@intel.com", "date": "2018-03-09T18:24:12", "name": "[dpdk-dev,23/37] ip_pipeline: add cli to enable and disable pipeline port", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "3c2b26eaae8b3af832df304de83ca0ee7efd16fd", "submitter": { "id": 285, "url": "https://patches.dpdk.org/api/people/285/?format=api", "name": "Jasvinder Singh", "email": "jasvinder.singh@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180309182426.135278-24-jasvinder.singh@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/35901/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/35901/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1BABA1B01A;\n\tFri, 9 Mar 2018 19:25:00 +0100 (CET)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 68BD6AAED\n\tfor <dev@dpdk.org>; Fri, 9 Mar 2018 19:24:54 +0100 (CET)", "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t09 Mar 2018 10:24:54 -0800", "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.222.149])\n\tby orsmga004.jf.intel.com with ESMTP; 09 Mar 2018 10:24:53 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.47,446,1515484800\"; d=\"scan'208\";a=\"181382353\"", "From": "Jasvinder Singh <jasvinder.singh@intel.com>", "To": "dev@dpdk.org", "Cc": "cristian.dumitrescu@intel.com,\n\tFan Zhang <roy.fan.zhang@intel.com>", "Date": "Fri, 9 Mar 2018 18:24:12 +0000", "Message-Id": "<20180309182426.135278-24-jasvinder.singh@intel.com>", "X-Mailer": "git-send-email 2.9.3", "In-Reply-To": "<20180309182426.135278-1-jasvinder.singh@intel.com>", "References": "<20180309182426.135278-1-jasvinder.singh@intel.com>", "Subject": "[dpdk-dev] [PATCH 23/37] ip_pipeline: add cli to enable and disable\n\tpipeline port", "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add commands to enable and disable the pipeline ports.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\nSigned-off-by: Fan Zhang <roy.fan.zhang@intel.com>\n---\n examples/ip_pipeline/cli.c | 112 +++++++++++++++++++++++++++\n examples/ip_pipeline/pipeline.h | 8 ++\n examples/ip_pipeline/thread.c | 163 +++++++++++++++++++++++++++++++++++++++-\n 3 files changed, 282 insertions(+), 1 deletion(-)", "diff": "diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c\nindex 4d8d808..ac6d6bd 100644\n--- a/examples/ip_pipeline/cli.c\n+++ b/examples/ip_pipeline/cli.c\n@@ -1742,6 +1742,100 @@ cmd_pipeline_port_in_table(char **tokens,\n }\n \n /**\n+ * pipeline <pipeline_name> port in <port_id> enable\n+ */\n+static void\n+cmd_pipeline_port_in_enable(char **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tchar *pipeline_name;\n+\tuint32_t port_id;\n+\tint status;\n+\n+\tif (n_tokens != 6) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tpipeline_name = tokens[1];\n+\n+\tif (strcmp(tokens[2], \"port\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"port\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[3], \"in\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"in\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&port_id, tokens[4]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"port_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"enable\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"enable\");\n+\t\treturn;\n+\t}\n+\n+\tstatus = pipeline_port_in_enable(pipeline_name, port_id);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+}\n+\n+/**\n+ * pipeline <pipeline_name> port in <port_id> disable\n+ */\n+static void\n+cmd_pipeline_port_in_disable(char **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tchar *pipeline_name;\n+\tuint32_t port_id;\n+\tint status;\n+\n+\tif (n_tokens != 6) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tpipeline_name = tokens[1];\n+\n+\tif (strcmp(tokens[2], \"port\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"port\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[3], \"in\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"in\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&port_id, tokens[4]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"port_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"disable\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"disable\");\n+\t\treturn;\n+\t}\n+\n+\tstatus = pipeline_port_in_disable(pipeline_name, port_id);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+}\n+\n+/**\n * thread <thread_id> pipeline <pipeline_name> enable\n */\n static void\n@@ -1947,6 +2041,24 @@ cli_process(char *in, char *out, size_t out_size)\n \t\t\t\tout, out_size);\n \t\t\treturn;\n \t\t}\n+\n+\t\tif ((n_tokens >= 6) &&\n+\t\t\t(strcmp(tokens[2], \"port\") == 0) &&\n+\t\t\t(strcmp(tokens[3], \"in\") == 0) &&\n+\t\t\t(strcmp(tokens[5], \"enable\") == 0)) {\n+\t\t\tcmd_pipeline_port_in_enable(tokens, n_tokens,\n+\t\t\t\tout, out_size);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif ((n_tokens >= 6) &&\n+\t\t\t(strcmp(tokens[2], \"port\") == 0) &&\n+\t\t\t(strcmp(tokens[3], \"in\") == 0) &&\n+\t\t\t(strcmp(tokens[5], \"disable\") == 0)) {\n+\t\t\tcmd_pipeline_port_in_disable(tokens, n_tokens,\n+\t\t\t\tout, out_size);\n+\t\t\treturn;\n+\t\t}\n \t}\n \n \tif (strcmp(tokens[0], \"thread\") == 0) {\ndiff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h\nindex dbc6f77..9b79b67 100644\n--- a/examples/ip_pipeline/pipeline.h\n+++ b/examples/ip_pipeline/pipeline.h\n@@ -262,4 +262,12 @@ struct table_rule_action {\n \tstruct rte_table_action_time_params time;\n };\n \n+int\n+pipeline_port_in_enable(const char *pipeline_name,\n+\tuint32_t port_id);\n+\n+int\n+pipeline_port_in_disable(const char *pipeline_name,\n+\tuint32_t port_id);\n+\n #endif /* _INCLUDE_PIPELINE_H_ */\ndiff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c\nindex d707ad7..a47b645 100644\n--- a/examples/ip_pipeline/thread.c\n+++ b/examples/ip_pipeline/thread.c\n@@ -482,13 +482,17 @@ thread_msg_handle(struct thread_data *t)\n /**\n * Master thread & data plane threads: message passing\n */\n-\n enum pipeline_req_type {\n+\t/* Port IN */\n+\tPIPELINE_REQ_PORT_IN_ENABLE,\n+\tPIPELINE_REQ_PORT_IN_DISABLE,\n+\n \tPIPELINE_REQ_MAX\n };\n \n struct pipeline_msg_req {\n \tenum pipeline_req_type type;\n+\tuint32_t id; /* Port IN, port OUT or table ID */\n };\n \n struct pipeline_msg_rsp {\n@@ -496,6 +500,129 @@ struct pipeline_msg_rsp {\n };\n \n /**\n+ * Master thread\n+ */\n+static struct pipeline_msg_req *\n+pipeline_msg_alloc(void)\n+{\n+\tsize_t size = RTE_MAX(sizeof(struct pipeline_msg_req),\n+\t\tsizeof(struct pipeline_msg_rsp));\n+\n+\treturn calloc(1, size);\n+}\n+\n+static void\n+pipeline_msg_free(struct pipeline_msg_rsp *rsp)\n+{\n+\tfree(rsp);\n+}\n+\n+static struct pipeline_msg_rsp *\n+pipeline_msg_send_recv(struct pipeline *p,\n+\tstruct pipeline_msg_req *req)\n+{\n+\tstruct rte_ring *msgq_req = p->msgq_req;\n+\tstruct rte_ring *msgq_rsp = p->msgq_rsp;\n+\tstruct pipeline_msg_rsp *rsp;\n+\tint status;\n+\n+\t/* send */\n+\tdo {\n+\t\tstatus = rte_ring_sp_enqueue(msgq_req, req);\n+\t} while (status == -ENOBUFS);\n+\n+\t/* recv */\n+\tdo {\n+\t\tstatus = rte_ring_sc_dequeue(msgq_rsp, (void **) &rsp);\n+\t} while (status != 0);\n+\n+\treturn rsp;\n+}\n+\n+int\n+pipeline_port_in_enable(const char *pipeline_name,\n+\tuint32_t port_id)\n+{\n+\tstruct pipeline *p;\n+\tstruct pipeline_msg_req *req;\n+\tstruct pipeline_msg_rsp *rsp;\n+\tint status;\n+\n+\t/* Check input params */\n+\tif (pipeline_name == NULL)\n+\t\treturn -1;\n+\n+\tp = pipeline_find(pipeline_name);\n+\tif ((p == NULL) ||\n+\t\t(port_id >= p->n_ports_in))\n+\t\treturn -1;\n+\n+\t/* Allocate request */\n+\treq = pipeline_msg_alloc();\n+\tif (req == NULL)\n+\t\treturn -1;\n+\n+\t/* Write request */\n+\treq->type = PIPELINE_REQ_PORT_IN_ENABLE;\n+\treq->id = port_id;\n+\n+\t/* Send request and wait for response */\n+\trsp = pipeline_msg_send_recv(p, req);\n+\tif (rsp == NULL)\n+\t\treturn -1;\n+\n+\t/* Read response */\n+\tstatus = rsp->status;\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n+int\n+pipeline_port_in_disable(const char *pipeline_name,\n+\tuint32_t port_id)\n+{\n+\tstruct pipeline *p;\n+\tstruct pipeline_msg_req *req;\n+\tstruct pipeline_msg_rsp *rsp;\n+\tint status;\n+\n+\t/* Check input params */\n+\tif (pipeline_name == NULL)\n+\t\treturn -1;\n+\n+\tp = pipeline_find(pipeline_name);\n+\tif ((p == NULL) ||\n+\t\t(port_id >= p->n_ports_in))\n+\t\treturn -1;\n+\n+\t/* Allocate request */\n+\treq = pipeline_msg_alloc();\n+\tif (req == NULL)\n+\t\treturn -1;\n+\n+\t/* Write request */\n+\treq->type = PIPELINE_REQ_PORT_IN_DISABLE;\n+\treq->id = port_id;\n+\n+\t/* Send request and wait for response */\n+\trsp = pipeline_msg_send_recv(p, req);\n+\tif (rsp == NULL)\n+\t\treturn -1;\n+\n+\t/* Read response */\n+\tstatus = rsp->status;\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n+\n+/**\n * Data plane threads: message handling\n */\n static inline struct pipeline_msg_req *\n@@ -522,6 +649,32 @@ pipeline_msg_send(struct rte_ring *msgq_rsp,\n \t} while (status == -ENOBUFS);\n }\n \n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_port_in_enable(struct pipeline_data *p,\n+\tstruct pipeline_msg_req *req)\n+{\n+\tstruct pipeline_msg_rsp *rsp = (struct pipeline_msg_rsp *) req;\n+\tuint32_t port_id = req->id;\n+\n+\trsp->status = rte_pipeline_port_in_enable(p->p,\n+\t\tport_id);\n+\n+\treturn rsp;\n+}\n+\n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_port_in_disable(struct pipeline_data *p,\n+\tstruct pipeline_msg_req *req)\n+{\n+\tstruct pipeline_msg_rsp *rsp = (struct pipeline_msg_rsp *) req;\n+\tuint32_t port_id = req->id;\n+\n+\trsp->status = rte_pipeline_port_in_disable(p->p,\n+\t\tport_id);\n+\n+\treturn rsp;\n+}\n+\n static void\n pipeline_msg_handle(struct pipeline_data *p)\n {\n@@ -534,6 +687,14 @@ pipeline_msg_handle(struct pipeline_data *p)\n \t\t\tbreak;\n \n \t\tswitch (req->type) {\n+\t\tcase PIPELINE_REQ_PORT_IN_ENABLE:\n+\t\t\trsp = pipeline_msg_handle_port_in_enable(p, req);\n+\t\t\tbreak;\n+\n+\t\tcase PIPELINE_REQ_PORT_IN_DISABLE:\n+\t\t\trsp = pipeline_msg_handle_port_in_disable(p, req);\n+\t\t\tbreak;\n+\n \t\tdefault:\n \t\t\trsp = (struct pipeline_msg_rsp *) req;\n \t\t\trsp->status = -1;\n", "prefixes": [ "dpdk-dev", "23/37" ] }{ "id": 35901, "url": "