Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/18728/?format=api
http://patches.dpdk.org/api/patches/18728/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1483084390-53159-17-git-send-email-wei.zhao1@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": "<1483084390-53159-17-git-send-email-wei.zhao1@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1483084390-53159-17-git-send-email-wei.zhao1@intel.com", "date": "2016-12-30T07:53:08", "name": "[dpdk-dev,v2,16/18] net/ixgbe: create consistent filter", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "38503b80c95d254224d32bf9d237e4381ecde8a4", "submitter": { "id": 495, "url": "http://patches.dpdk.org/api/people/495/?format=api", "name": "Zhao1, Wei", "email": "wei.zhao1@intel.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1483084390-53159-17-git-send-email-wei.zhao1@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/18728/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/18728/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 35F25F94A;\n\tFri, 30 Dec 2016 08:59:23 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 504002C31\n\tfor <dev@dpdk.org>; Fri, 30 Dec 2016 08:58:12 +0100 (CET)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga102.jf.intel.com with ESMTP; 29 Dec 2016 23:58:11 -0800", "from dpdk1.bj.intel.com ([172.16.182.84])\n\tby FMSMGA003.fm.intel.com with ESMTP; 29 Dec 2016 23:58:10 -0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.33,428,1477983600\"; d=\"scan'208\";a=\"803524565\"", "From": "Wei Zhao <wei.zhao1@intel.com>", "To": "dev@dpdk.org", "Cc": "Wei Zhao <wei.zhao1@intel.com>,\n\tWenzhuo Lu <wenzhuo.lu@intel.com>", "Date": "Fri, 30 Dec 2016 15:53:08 +0800", "Message-Id": "<1483084390-53159-17-git-send-email-wei.zhao1@intel.com>", "X-Mailer": "git-send-email 2.5.5", "In-Reply-To": "<1483084390-53159-1-git-send-email-wei.zhao1@intel.com>", "References": "<1483084390-53159-1-git-send-email-wei.zhao1@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 16/18] net/ixgbe: create consistent filter", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://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": "<http://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": "This patch adds a function to create the flow directory filter.\n\nSigned-off-by: Wei Zhao <wei.zhao1@intel.com>\nSigned-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>\n\n---\n\nv2:\n--add new error set function\n---\n drivers/net/ixgbe/ixgbe_ethdev.c | 240 ++++++++++++++++++++++++++++++++++++++-\n drivers/net/ixgbe/ixgbe_ethdev.h | 5 +\n 2 files changed, 244 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c\nindex c98aa0d..1c857fc 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.c\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.c\n@@ -468,6 +468,11 @@ ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev,\n \t\tconst struct rte_flow_item pattern[],\n \t\tconst struct rte_flow_action actions[],\n \t\tstruct rte_flow_error *error);\n+static struct rte_flow *ixgbe_flow_create(struct rte_eth_dev *dev,\n+\t\tconst struct rte_flow_attr *attr,\n+\t\tconst struct rte_flow_item pattern[],\n+\t\tconst struct rte_flow_action actions[],\n+\t\tstruct rte_flow_error *error);\n static int ixgbe_flow_flush(struct rte_eth_dev *dev,\n \t\tstruct rte_flow_error *error);\n /*\n@@ -850,11 +855,55 @@ static const struct rte_ixgbe_xstats_name_off rte_ixgbevf_stats_strings[] = {\n \t\tsizeof(rte_ixgbevf_stats_strings[0]))\n static const struct rte_flow_ops ixgbe_flow_ops = {\n \tixgbe_flow_validate,\n-\tNULL,\n+\tixgbe_flow_create,\n \tNULL,\n \tixgbe_flow_flush,\n \tNULL,\n };\n+/* ntuple filter list structure */\n+struct ixgbe_ntuple_filter_ele {\n+\tTAILQ_ENTRY(ixgbe_ntuple_filter_ele) entries;\n+\tstruct rte_eth_ntuple_filter filter_info;\n+};\n+/* ethertype filter list structure */\n+struct ixgbe_ethertype_filter_ele {\n+\tTAILQ_ENTRY(ixgbe_ethertype_filter_ele) entries;\n+\tstruct rte_eth_ethertype_filter filter_info;\n+};\n+/* syn filter list structure */\n+struct ixgbe_eth_syn_filter_ele {\n+\tTAILQ_ENTRY(ixgbe_eth_syn_filter_ele) entries;\n+\tstruct rte_eth_syn_filter filter_info;\n+};\n+/* fdir filter list structure */\n+struct ixgbe_fdir_rule_ele {\n+\tTAILQ_ENTRY(ixgbe_fdir_rule_ele) entries;\n+\tstruct ixgbe_fdir_rule filter_info;\n+};\n+/* l2_tunnel filter list structure */\n+struct ixgbe_eth_l2_tunnel_conf_ele {\n+\tTAILQ_ENTRY(ixgbe_eth_l2_tunnel_conf_ele) entries;\n+\tstruct rte_eth_l2_tunnel_conf filter_info;\n+};\n+/* ixgbe_flow memory list structure */\n+struct ixgbe_flow_mem {\n+\tTAILQ_ENTRY(ixgbe_flow_mem) entries;\n+\tstruct ixgbe_flow *flow;\n+};\n+\n+TAILQ_HEAD(ixgbe_ntuple_filter_list, ixgbe_ntuple_filter_ele);\n+struct ixgbe_ntuple_filter_list filter_ntuple_list;\n+TAILQ_HEAD(ixgbe_ethertype_filter_list, ixgbe_ethertype_filter_ele);\n+struct ixgbe_ethertype_filter_list filter_ethertype_list;\n+TAILQ_HEAD(ixgbe_syn_filter_list, ixgbe_eth_syn_filter_ele);\n+struct ixgbe_syn_filter_list filter_syn_list;\n+TAILQ_HEAD(ixgbe_fdir_rule_filter_list, ixgbe_fdir_rule_ele);\n+struct ixgbe_fdir_rule_filter_list filter_fdir_list;\n+TAILQ_HEAD(ixgbe_l2_tunnel_filter_list, ixgbe_eth_l2_tunnel_conf_ele);\n+struct ixgbe_l2_tunnel_filter_list filter_l2_tunnel_list;\n+TAILQ_HEAD(ixgbe_flow_mem_list, ixgbe_flow_mem);\n+struct ixgbe_flow_mem_list ixgbe_flow_list;\n+\n /**\n * Atomically reads the link status information from global\n * structure rte_eth_dev.\n@@ -1380,6 +1429,14 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)\n \n \t/* initialize l2 tunnel filter list & hash */\n \tixgbe_l2_tn_filter_init(eth_dev);\n+\n+\tTAILQ_INIT(&filter_ntuple_list);\n+\tTAILQ_INIT(&filter_ethertype_list);\n+\tTAILQ_INIT(&filter_syn_list);\n+\tTAILQ_INIT(&filter_fdir_list);\n+\tTAILQ_INIT(&filter_l2_tunnel_list);\n+\tTAILQ_INIT(&ixgbe_flow_list);\n+\n \treturn 0;\n }\n \n@@ -10334,6 +10391,187 @@ ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev,\n \treturn ret;\n }\n \n+/**\n+ * Create or destroy a flow rule.\n+ * Theorically one rule can match more than one filters.\n+ * We will let it use the filter which it hitt first.\n+ * So, the sequence matters.\n+ */\n+static struct rte_flow *\n+ixgbe_flow_create(struct rte_eth_dev *dev,\n+\t\t const struct rte_flow_attr *attr,\n+\t\t const struct rte_flow_item pattern[],\n+\t\t const struct rte_flow_action actions[],\n+\t\t struct rte_flow_error *error)\n+{\n+\tint ret;\n+\tstruct rte_eth_ntuple_filter ntuple_filter;\n+\tstruct rte_eth_ethertype_filter ethertype_filter;\n+\tstruct rte_eth_syn_filter syn_filter;\n+\tstruct ixgbe_fdir_rule fdir_rule;\n+\tstruct rte_eth_l2_tunnel_conf l2_tn_filter;\n+\tstruct ixgbe_hw_fdir_info *fdir_info =\n+\t\tIXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);\n+\tstruct ixgbe_flow *flow = NULL;\n+\tstruct ixgbe_ntuple_filter_ele *ntuple_filter_ptr;\n+\tstruct ixgbe_ethertype_filter_ele *ethertype_filter_ptr;\n+\tstruct ixgbe_eth_syn_filter_ele *syn_filter_ptr;\n+\tstruct ixgbe_eth_l2_tunnel_conf_ele *l2_tn_filter_ptr;\n+\tstruct ixgbe_fdir_rule_ele *fdir_rule_ptr;\n+\tstruct ixgbe_flow_mem *ixgbe_flow_mem_ptr;\n+\n+\tflow = rte_zmalloc(\"ixgbe_flow\", sizeof(struct ixgbe_flow), 0);\n+\tif (!flow) {\n+\t\tPMD_DRV_LOG(ERR, \"failed to allocate memory\");\n+\t\treturn (struct rte_flow *)flow;\n+\t}\n+\tixgbe_flow_mem_ptr = rte_zmalloc(\"ixgbe_flow_mem\",\n+\t\t\tsizeof(struct ixgbe_flow_mem), 0);\n+\tif (!ixgbe_flow_mem_ptr) {\n+\t\tPMD_DRV_LOG(ERR, \"failed to allocate memory\");\n+\t\treturn NULL;\n+\t}\n+\tixgbe_flow_mem_ptr->flow = flow;\n+\tTAILQ_INSERT_TAIL(&ixgbe_flow_list,\n+\t\t\t\tixgbe_flow_mem_ptr, entries);\n+\n+\tmemset(&ntuple_filter, 0, sizeof(struct rte_eth_ntuple_filter));\n+\tret = ixgbe_parse_ntuple_filter(attr, pattern,\n+\t\t\tactions, &ntuple_filter, error);\n+\tif (!ret) {\n+\t\tret = ixgbe_add_del_ntuple_filter(dev, &ntuple_filter, TRUE);\n+\t\tif (!ret) {\n+\t\t\tntuple_filter_ptr = rte_zmalloc(\"ixgbe_ntuple_filter\",\n+\t\t\t\tsizeof(struct ixgbe_ntuple_filter_ele), 0);\n+\t\t\t(void)rte_memcpy(&ntuple_filter_ptr->filter_info,\n+\t\t\t\t&ntuple_filter,\n+\t\t\t\tsizeof(struct rte_eth_ntuple_filter));\n+\t\t\tTAILQ_INSERT_TAIL(&filter_ntuple_list,\n+\t\t\t\tntuple_filter_ptr, entries);\n+\t\t\tflow->rule = ntuple_filter_ptr;\n+\t\t\tflow->filter_type = RTE_ETH_FILTER_NTUPLE;\n+\t\t}\n+\t\treturn (struct rte_flow *)flow;\n+\t}\n+\n+\tmemset(ðertype_filter, 0, sizeof(struct rte_eth_ethertype_filter));\n+\tret = ixgbe_parse_ethertype_filter(attr, pattern,\n+\t\t\t\tactions, ðertype_filter, error);\n+\tif (!ret) {\n+\t\tret = ixgbe_add_del_ethertype_filter(dev,\n+\t\t\t\tðertype_filter, TRUE);\n+\t\tif (!ret) {\n+\t\t\tethertype_filter_ptr = rte_zmalloc(\n+\t\t\t\t\"ixgbe_ethertype_filter\",\n+\t\t\t\tsizeof(struct ixgbe_ethertype_filter_ele), 0);\n+\t\t\t(void)rte_memcpy(ðertype_filter_ptr->filter_info,\n+\t\t\t\tðertype_filter,\n+\t\t\t\tsizeof(struct rte_eth_ethertype_filter));\n+\t\t\tTAILQ_INSERT_TAIL(&filter_ethertype_list,\n+\t\t\t\tethertype_filter_ptr, entries);\n+\t\t\tflow->rule = ethertype_filter_ptr;\n+\t\t\tflow->filter_type = RTE_ETH_FILTER_ETHERTYPE;\n+\t\t}\n+\t\treturn (struct rte_flow *)flow;\n+\t}\n+\n+\tmemset(&syn_filter, 0, sizeof(struct rte_eth_syn_filter));\n+\tret = cons_parse_syn_filter(attr, pattern, actions, &syn_filter, error);\n+\tif (!ret) {\n+\t\tret = ixgbe_syn_filter_set(dev, &syn_filter, TRUE);\n+\t\tif (!ret) {\n+\t\t\tsyn_filter_ptr = rte_zmalloc(\"ixgbe_syn_filter\",\n+\t\t\t\tsizeof(struct ixgbe_eth_syn_filter_ele), 0);\n+\t\t\t(void)rte_memcpy(&syn_filter_ptr->filter_info,\n+\t\t\t\t&syn_filter,\n+\t\t\t\tsizeof(struct rte_eth_syn_filter));\n+\t\t\tTAILQ_INSERT_TAIL(&filter_syn_list,\n+\t\t\t\tsyn_filter_ptr,\n+\t\t\t\tentries);\n+\t\t\tflow->rule = syn_filter_ptr;\n+\t\t\tflow->filter_type = RTE_ETH_FILTER_SYN;\n+\t\t}\n+\t\treturn (struct rte_flow *)flow;\n+\t}\n+\n+\tmemset(&fdir_rule, 0, sizeof(struct ixgbe_fdir_rule));\n+\tret = ixgbe_parse_fdir_filter(attr, pattern,\n+\t\t\t\tactions, &fdir_rule, error);\n+\tif (!ret) {\n+\t\t/* A mask cannot be deleted. */\n+\t\tif (fdir_rule.b_mask) {\n+\t\t\tif (!fdir_info->mask_added) {\n+\t\t\t\t/* It's the first time the mask is set. */\n+\t\t\t\trte_memcpy(&fdir_info->mask,\n+\t\t\t\t\t&fdir_rule.mask,\n+\t\t\t\t\tsizeof(struct ixgbe_hw_fdir_mask));\n+\t\t\t\tret = ixgbe_fdir_set_input_mask(dev);\n+\t\t\t\tif (ret)\n+\t\t\t\t\treturn NULL;\n+\n+\t\t\t\tfdir_info->mask_added = TRUE;\n+\t\t\t} else {\n+\t\t\t\t/**\n+\t\t\t\t * Only support one global mask,\n+\t\t\t\t * all the masks should be the same.\n+\t\t\t\t */\n+\t\t\t\tret = memcmp(&fdir_info->mask,\n+\t\t\t\t\t&fdir_rule.mask,\n+\t\t\t\t\tsizeof(struct ixgbe_hw_fdir_mask));\n+\t\t\t\tif (ret)\n+\t\t\t\t\treturn NULL;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (fdir_rule.b_spec) {\n+\t\t\tret = ixgbe_fdir_filter_program(dev, &fdir_rule,\n+\t\t\t\t\tFALSE, FALSE);\n+\t\t\tif (!ret) {\n+\t\t\t\tfdir_rule_ptr = rte_zmalloc(\"ixgbe_fdir_filter\",\n+\t\t\t\t\tsizeof(struct ixgbe_fdir_rule_ele), 0);\n+\t\t\t\t(void)rte_memcpy(&fdir_rule_ptr->filter_info,\n+\t\t\t\t\t&fdir_rule,\n+\t\t\t\t\tsizeof(struct ixgbe_fdir_rule));\n+\t\t\t\tTAILQ_INSERT_TAIL(&filter_fdir_list,\n+\t\t\t\t\tfdir_rule_ptr, entries);\n+\t\t\t\tflow->rule = fdir_rule_ptr;\n+\t\t\t\tflow->filter_type = RTE_ETH_FILTER_FDIR;\n+\n+\t\t\t\treturn (struct rte_flow *)flow;\n+\t\t\t}\n+\n+\t\t\tif (ret)\n+\t\t\t\treturn NULL;\n+\t\t}\n+\n+\t\treturn NULL;\n+\t}\n+\n+\tmemset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\tret = cons_parse_l2_tn_filter(attr, pattern,\n+\t\t\t\t\tactions, &l2_tn_filter, error);\n+\tif (!ret) {\n+\t\tret = ixgbe_dev_l2_tunnel_filter_add(dev, &l2_tn_filter, FALSE);\n+\t\tif (!ret) {\n+\t\t\tl2_tn_filter_ptr = rte_zmalloc(\"ixgbe_l2_tn_filter\",\n+\t\t\t\tsizeof(struct ixgbe_eth_l2_tunnel_conf_ele), 0);\n+\t\t\t(void)rte_memcpy(&l2_tn_filter_ptr->filter_info,\n+\t\t\t\t&l2_tn_filter,\n+\t\t\t\tsizeof(struct rte_eth_l2_tunnel_conf));\n+\t\t\tTAILQ_INSERT_TAIL(&filter_l2_tunnel_list,\n+\t\t\t\tl2_tn_filter_ptr, entries);\n+\t\t\tflow->rule = l2_tn_filter_ptr;\n+\t\t\tflow->filter_type = RTE_ETH_FILTER_L2_TUNNEL;\n+\n+\t\t\treturn (struct rte_flow *)flow;\n+\t\t}\n+\t}\n+\n+\trte_free(ixgbe_flow_mem_ptr);\n+\trte_free(flow);\n+\treturn NULL;\n+}\n+\n RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd.pci_drv);\n RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe, pci_id_ixgbe_map);\n RTE_PMD_REGISTER_KMOD_DEP(net_ixgbe, \"* igb_uio | uio_pci_generic | vfio\");\ndiff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h\nindex 676d45f..0000138 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.h\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.h\n@@ -329,6 +329,11 @@ struct ixgbe_l2_tn_info {\n \tbool e_tag_ether_type; /* ether type for e-tag */\n };\n \n+struct ixgbe_flow {\n+\tenum rte_filter_type filter_type;\n+\tvoid *rule;\n+};\n+\n /*\n * Structure to store private data for each driver instance (for each port).\n */\n", "prefixes": [ "dpdk-dev", "v2", "16/18" ] }{ "id": 18728, "url": "