Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/44580/?format=api
http://patches.dpdk.org/api/patches/44580/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1536675645-10105-13-git-send-email-reshma.pattan@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": "<1536675645-10105-13-git-send-email-reshma.pattan@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1536675645-10105-13-git-send-email-reshma.pattan@intel.com", "date": "2018-09-11T14:20:42", "name": "[v2,12/15] net/softnic: add flow create API", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "db3d110c7b71664dca167d34f4bc81ff41ed3428", "submitter": { "id": 70, "url": "http://patches.dpdk.org/api/people/70/?format=api", "name": "Pattan, Reshma", "email": "reshma.pattan@intel.com" }, "delegate": { "id": 10018, "url": "http://patches.dpdk.org/api/users/10018/?format=api", "username": "cristian_dumitrescu", "first_name": "Cristian", "last_name": "Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1536675645-10105-13-git-send-email-reshma.pattan@intel.com/mbox/", "series": [ { "id": 1278, "url": "http://patches.dpdk.org/api/series/1278/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1278", "date": "2018-09-11T14:20:42", "name": null, "version": 2, "mbox": "http://patches.dpdk.org/series/1278/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/44580/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/44580/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 81A2B5F29;\n\tTue, 11 Sep 2018 16:21:13 +0200 (CEST)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 5EB2A5A6A\n\tfor <dev@dpdk.org>; Tue, 11 Sep 2018 16:21:02 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Sep 2018 07:21:02 -0700", "from sivswdev02.ir.intel.com (HELO localhost.localdomain)\n\t([10.237.217.46])\n\tby fmsmga007.fm.intel.com with ESMTP; 11 Sep 2018 07:21:01 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.53,360,1531810800\"; d=\"scan'208\";a=\"69156913\"", "From": "Reshma Pattan <reshma.pattan@intel.com>", "To": "dev@dpdk.org", "Cc": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>,\n\tReshma Pattan <reshma.pattan@intel.com>", "Date": "Tue, 11 Sep 2018 15:20:42 +0100", "Message-Id": "<1536675645-10105-13-git-send-email-reshma.pattan@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": "<1536251222-17275-1-git-send-email-reshma.pattan@intel.com>", "References": "<1536251222-17275-1-git-send-email-reshma.pattan@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 12/15] net/softnic: add flow create API", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "pmd_flow_create API is added to support\nrte flow create.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Reshma Pattan <reshma.pattan@intel.com>\n---\n drivers/net/softnic/rte_eth_softnic_flow.c | 174 +++++++++++++++++++++++++++++\n 1 file changed, 174 insertions(+)", "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c\nindex 16f1e4730..d3c94965b 100644\n--- a/drivers/net/softnic/rte_eth_softnic_flow.c\n+++ b/drivers/net/softnic/rte_eth_softnic_flow.c\n@@ -1,13 +1,39 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2018 Intel Corporation\n */\n+#include <stdint.h>\n+#include <stdlib.h>\n+#include <string.h>\n+\n+#include <rte_common.h>\n+#include <rte_byteorder.h>\n+#include <rte_malloc.h>\n+#include <rte_string_fns.h>\n+#include <rte_flow.h>\n+#include <rte_flow_driver.h>\n \n #include \"rte_eth_softnic_internals.h\"\n #include \"rte_eth_softnic.h\"\n \n+#define rte_htons rte_cpu_to_be_16\n+#define rte_htonl rte_cpu_to_be_32\n+\n #define rte_ntohs rte_be_to_cpu_16\n #define rte_ntohl rte_be_to_cpu_32\n \n+static struct rte_flow *\n+softnic_flow_find(struct softnic_table *table,\n+\tstruct softnic_table_rule_match *rule_match)\n+{\n+\tstruct rte_flow *flow;\n+\n+\tTAILQ_FOREACH(flow, &table->flows, node)\n+\t\tif (memcmp(&flow->match, rule_match, sizeof(*rule_match)) == 0)\n+\t\t\treturn flow;\n+\n+\treturn NULL;\n+}\n+\n int\n flow_attr_map_set(struct pmd_internals *softnic,\n \t\tuint32_t group_id,\n@@ -1443,6 +1469,154 @@ pmd_flow_validate(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n+static struct rte_flow *\n+pmd_flow_create(struct rte_eth_dev *dev,\n+\tconst struct rte_flow_attr *attr,\n+\tconst struct rte_flow_item item[],\n+\tconst struct rte_flow_action action[],\n+\tstruct rte_flow_error *error)\n+{\n+\tstruct softnic_table_rule_match rule_match;\n+\tstruct softnic_table_rule_action rule_action;\n+\tvoid *rule_data;\n+\n+\tstruct pmd_internals *softnic = dev->data->dev_private;\n+\tstruct pipeline *pipeline;\n+\tstruct softnic_table *table;\n+\tstruct rte_flow *flow;\n+\tconst char *pipeline_name = NULL;\n+\tuint32_t table_id = 0;\n+\tint new_flow, status;\n+\n+\t/* Check input parameters. */\n+\tif (attr == NULL) {\n+\t\trte_flow_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ATTR,\n+\t\t\tNULL,\n+\t\t\t\"Null attr\");\n+\t\treturn NULL;\n+\t}\n+\n+\tif (item == NULL) {\n+\t\trte_flow_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\tNULL,\n+\t\t\t\"Null item\");\n+\t\treturn NULL;\n+\t}\n+\n+\tif (action == NULL) {\n+\t\trte_flow_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\tNULL,\n+\t\t\t\"Null action\");\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Identify the pipeline table to add this flow to. */\n+\tstatus = flow_pipeline_table_get(softnic, attr, &pipeline_name,\n+\t\t\t\t\t&table_id, error);\n+\tif (status)\n+\t\treturn NULL;\n+\n+\tpipeline = softnic_pipeline_find(softnic, pipeline_name);\n+\tif (pipeline == NULL) {\n+\t\trte_flow_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\tNULL,\n+\t\t\t\"Invalid pipeline name\");\n+\t\treturn NULL;\n+\t}\n+\n+\tif (table_id >= pipeline->n_tables) {\n+\t\trte_flow_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\tNULL,\n+\t\t\t\"Invalid pipeline table ID\");\n+\t\treturn NULL;\n+\t}\n+\n+\ttable = &pipeline->table[table_id];\n+\n+\t/* Rule match. */\n+\tmemset(&rule_match, 0, sizeof(rule_match));\n+\tstatus = flow_rule_match_get(softnic,\n+\t\tpipeline,\n+\t\ttable,\n+\t\tattr,\n+\t\titem,\n+\t\t&rule_match,\n+\t\terror);\n+\tif (status)\n+\t\treturn NULL;\n+\n+\t/* Rule action. */\n+\tmemset(&rule_action, 0, sizeof(rule_action));\n+\tstatus = flow_rule_action_get(softnic,\n+\t\tpipeline,\n+\t\ttable,\n+\t\tattr,\n+\t\taction,\n+\t\t&rule_action,\n+\t\terror);\n+\tif (status)\n+\t\treturn NULL;\n+\n+\t/* Flow find/allocate. */\n+\tnew_flow = 0;\n+\tflow = softnic_flow_find(table, &rule_match);\n+\tif (flow == NULL) {\n+\t\tnew_flow = 1;\n+\t\tflow = calloc(1, sizeof(struct rte_flow));\n+\t\tif (flow == NULL) {\n+\t\t\trte_flow_error_set(error,\n+\t\t\t\tENOMEM,\n+\t\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\tNULL,\n+\t\t\t\t\"Not enough memory for new flow\");\n+\t\t\treturn NULL;\n+\t\t}\n+\t}\n+\n+\t/* Rule add. */\n+\tstatus = softnic_pipeline_table_rule_add(softnic,\n+\t\tpipeline_name,\n+\t\ttable_id,\n+\t\t&rule_match,\n+\t\t&rule_action,\n+\t\t&rule_data);\n+\tif (status) {\n+\t\tif (new_flow)\n+\t\t\tfree(flow);\n+\n+\t\trte_flow_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\tNULL,\n+\t\t\t\"Pipeline table rule add failed\");\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Flow fill in. */\n+\tmemcpy(&flow->match, &rule_match, sizeof(rule_match));\n+\tmemcpy(&flow->action, &rule_action, sizeof(rule_action));\n+\tflow->data = rule_data;\n+\tflow->pipeline = pipeline;\n+\tflow->table_id = table_id;\n+\n+\t/* Flow add to list. */\n+\tif (new_flow)\n+\t\tTAILQ_INSERT_TAIL(&table->flows, flow, node);\n+\n+\treturn flow;\n+}\n+\n const struct rte_flow_ops pmd_flow_ops = {\n \t.validate = pmd_flow_validate,\n+\t.create = pmd_flow_create,\n };\n", "prefixes": [ "v2", "12/15" ] }{ "id": 44580, "url": "