Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2232/?format=api
https://patches.dpdk.org/api/patches/2232/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421046973-23283-4-git-send-email-jingjing.wu@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": "<1421046973-23283-4-git-send-email-jingjing.wu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1421046973-23283-4-git-send-email-jingjing.wu@intel.com", "date": "2015-01-12T07:16:12", "name": "[dpdk-dev,v2,3/4] testpmd: new commands for ethertype filter", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "20e0c00adf5acdc749a8d8ab9b6e6e1d9d1c3127", "submitter": { "id": 47, "url": "https://patches.dpdk.org/api/people/47/?format=api", "name": "Jingjing Wu", "email": "jingjing.wu@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421046973-23283-4-git-send-email-jingjing.wu@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/2232/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/2232/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 1D26E5A8F;\n\tMon, 12 Jan 2015 08:16:47 +0100 (CET)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 59D795A98\n\tfor <dev@dpdk.org>; Mon, 12 Jan 2015 08:16:30 +0100 (CET)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP; 11 Jan 2015 23:16:29 -0800", "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga002.fm.intel.com with ESMTP; 11 Jan 2015 23:16:28 -0800", "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id t0C7GQt1007148;\n\tMon, 12 Jan 2015 15:16:26 +0800", "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid t0C7GNLV023339; Mon, 12 Jan 2015 15:16:25 +0800", "(from wujingji@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0C7GNYo023335; \n\tMon, 12 Jan 2015 15:16:23 +0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.07,742,1413270000\"; d=\"scan'208\";a=\"660354611\"", "From": "Jingjing Wu <jingjing.wu@intel.com>", "To": "dev@dpdk.org", "Date": "Mon, 12 Jan 2015 15:16:12 +0800", "Message-Id": "<1421046973-23283-4-git-send-email-jingjing.wu@intel.com>", "X-Mailer": "git-send-email 1.7.4.1", "In-Reply-To": "<1421046973-23283-1-git-send-email-jingjing.wu@intel.com>", "References": "<1419477270-14611-1-git-send-email-jingjing.wu@intel.com>\n\t<1421046973-23283-1-git-send-email-jingjing.wu@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 3/4] testpmd: new commands for ethertype filter", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <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": "Following commands of ethertype filter are removed:\n - add_ethertype_filter (port_id) ethertype (eth_value)\n - remove_ethertype_filter (port_id) index (idx)\n - get_ethertype_filter (port_id) index (idx)\nNew command is added for ethertype filter by using filter_ctrl API and new\nethertype filter structure:\n - ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr)\n (mac_address) ethertype (ether_type) (drop|fwd) queue (queue_id)\n\nSigned-off-by: Jingjing Wu <jingjing.wu@intel.com>\n---\n app/test-pmd/cmdline.c | 253 ++++++++++++++++++++++---------------------------\n app/test-pmd/config.c | 27 ------\n 2 files changed, 112 insertions(+), 168 deletions(-)", "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 882a5a2..f0c7d5f 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -654,15 +654,10 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"filters:\\n\"\n \t\t\t\"--------\\n\\n\"\n \n-\t\t\t\"add_ethertype_filter (port_id) ethertype (eth_value)\"\n-\t\t\t\" priority (enable|disable)(pri_value) queue (queue_id) index (idx)\\n\"\n-\t\t\t\" add an ethertype filter.\\n\\n\"\n-\n-\t\t\t\"remove_ethertype_filter (port_id) index (idx)\\n\"\n-\t\t\t\" remove an ethertype filter.\\n\\n\"\n-\n-\t\t\t\"get_ethertype_filter (port_id) index (idx)\\n\"\n-\t\t\t\" get info of a ethertype filter.\\n\\n\"\n+\t\t\t\"ethertype_filter (port_id) (add|del)\"\n+\t\t\t\" (mac_addr|mac_ignr) (mac_address) ethertype\"\n+\t\t\t\" (ether_type) (drop|fwd) queue (queue_id)\\n\"\n+\t\t\t\" Add/Del an ethertype filter.\\n\\n\"\n \n \t\t\t\"add_2tuple_filter (port_id) protocol (pro_value) (pro_mask)\"\n \t\t\t\" dst_port (port_value) (port_mask) flags (flg_value) priority (prio_value)\"\n@@ -7264,135 +7259,6 @@ cmdline_parse_inst_t cmd_dump_one = {\n \t},\n };\n \n-/* *** ADD/REMOVE an ethertype FILTER *** */\n-struct cmd_ethertype_filter_result {\n-\tcmdline_fixed_string_t filter;\n-\tuint8_t port_id;\n-\tcmdline_fixed_string_t ethertype;\n-\tuint16_t ethertype_value;\n-\tcmdline_fixed_string_t priority;\n-\tcmdline_fixed_string_t priority_en;\n-\tuint8_t priority_value;\n-\tcmdline_fixed_string_t queue;\n-\tuint16_t queue_id;\n-\tcmdline_fixed_string_t index;\n-\tuint16_t index_value;\n-};\n-\n-static void\n-cmd_ethertype_filter_parsed(void *parsed_result,\n-\t\t\t__attribute__((unused)) struct cmdline *cl,\n-\t\t\t__attribute__((unused)) void *data)\n-{\n-\tint ret = 0;\n-\tstruct cmd_ethertype_filter_result *res = parsed_result;\n-\tstruct rte_ethertype_filter filter;\n-\n-\tmemset(&filter, 0, sizeof(struct rte_ethertype_filter));\n-\tfilter.ethertype = rte_cpu_to_le_16(res->ethertype_value);\n-\tfilter.priority = res->priority_value;\n-\n-\tif (!strcmp(res->priority_en, \"enable\"))\n-\t\tfilter.priority_en = 1;\n-\tif (!strcmp(res->filter, \"add_ethertype_filter\"))\n-\t\tret = rte_eth_dev_add_ethertype_filter(res->port_id,\n-\t\t\t\tres->index_value,\n-\t\t\t\t&filter, res->queue_id);\n-\telse if (!strcmp(res->filter, \"remove_ethertype_filter\"))\n-\t\tret = rte_eth_dev_remove_ethertype_filter(res->port_id,\n-\t\t\t\tres->index_value);\n-\telse if (!strcmp(res->filter, \"get_ethertype_filter\"))\n-\t\tget_ethertype_filter(res->port_id, res->index_value);\n-\n-\tif (ret < 0)\n-\t\tprintf(\"ethertype filter setting error: (%s)\\n\",\n-\t\t\tstrerror(-ret));\n-}\n-\n-cmdline_parse_token_num_t cmd_ethertype_filter_port_id =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tport_id, UINT8);\n-cmdline_parse_token_string_t cmd_ethertype_filter_ethertype =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tethertype, \"ethertype\");\n-cmdline_parse_token_ipaddr_t cmd_ethertype_filter_ethertype_value =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tethertype_value, UINT16);\n-cmdline_parse_token_string_t cmd_ethertype_filter_priority =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tpriority, \"priority\");\n-cmdline_parse_token_string_t cmd_ethertype_filter_priority_en =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tpriority_en, \"enable#disable\");\n-cmdline_parse_token_num_t cmd_ethertype_filter_priority_value =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tpriority_value, UINT8);\n-cmdline_parse_token_string_t cmd_ethertype_filter_queue =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tqueue, \"queue\");\n-cmdline_parse_token_num_t cmd_ethertype_filter_queue_id =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tqueue_id, UINT16);\n-cmdline_parse_token_string_t cmd_ethertype_filter_index =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tindex, \"index\");\n-cmdline_parse_token_num_t cmd_ethertype_filter_index_value =\n-\tTOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tindex_value, UINT16);\n-cmdline_parse_token_string_t cmd_ethertype_filter_add_filter =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\tfilter, \"add_ethertype_filter\");\n-cmdline_parse_inst_t cmd_add_ethertype_filter = {\n-\t.f = cmd_ethertype_filter_parsed,\n-\t.data = NULL,\n-\t.help_str = \"add an ethertype filter\",\n-\t.tokens = {\n-\t\t(void *)&cmd_ethertype_filter_add_filter,\n-\t\t(void *)&cmd_ethertype_filter_port_id,\n-\t\t(void *)&cmd_ethertype_filter_ethertype,\n-\t\t(void *)&cmd_ethertype_filter_ethertype_value,\n-\t\t(void *)&cmd_ethertype_filter_priority,\n-\t\t(void *)&cmd_ethertype_filter_priority_en,\n-\t\t(void *)&cmd_ethertype_filter_priority_value,\n-\t\t(void *)&cmd_ethertype_filter_queue,\n-\t\t(void *)&cmd_ethertype_filter_queue_id,\n-\t\t(void *)&cmd_ethertype_filter_index,\n-\t\t(void *)&cmd_ethertype_filter_index_value,\n-\t\tNULL,\n-\t},\n-};\n-\n-cmdline_parse_token_string_t cmd_ethertype_filter_remove_filter =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\t filter, \"remove_ethertype_filter\");\n-cmdline_parse_inst_t cmd_remove_ethertype_filter = {\n-\t.f = cmd_ethertype_filter_parsed,\n-\t.data = NULL,\n-\t.help_str = \"remove an ethertype filter\",\n-\t.tokens = {\n-\t\t(void *)&cmd_ethertype_filter_remove_filter,\n-\t\t(void *)&cmd_ethertype_filter_port_id,\n-\t\t(void *)&cmd_ethertype_filter_index,\n-\t\t(void *)&cmd_ethertype_filter_index_value,\n-\t\tNULL,\n-\t},\n-};\n-cmdline_parse_token_string_t cmd_ethertype_filter_get_filter =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n-\t\t\t\t filter, \"get_ethertype_filter\");\n-cmdline_parse_inst_t cmd_get_ethertype_filter = {\n-\t.f = cmd_ethertype_filter_parsed,\n-\t.data = NULL,\n-\t.help_str = \"get an ethertype filter\",\n-\t.tokens = {\n-\t\t(void *)&cmd_ethertype_filter_get_filter,\n-\t\t(void *)&cmd_ethertype_filter_port_id,\n-\t\t(void *)&cmd_ethertype_filter_index,\n-\t\t(void *)&cmd_ethertype_filter_index_value,\n-\t\tNULL,\n-\t},\n-};\n-\n /* *** set SYN filter *** */\n struct cmd_set_syn_filter_result {\n \tcmdline_fixed_string_t filter;\n@@ -8096,6 +7962,113 @@ cmdline_parse_inst_t cmd_get_flex_filter = {\n \n /* *** Filters Control *** */\n \n+/* *** deal with ethertype filter *** */\n+struct cmd_ethertype_filter_result {\n+\tcmdline_fixed_string_t filter;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t ops;\n+\tcmdline_fixed_string_t mac;\n+\tstruct ether_addr mac_addr;\n+\tcmdline_fixed_string_t ethertype;\n+\tuint16_t ethertype_value;\n+\tcmdline_fixed_string_t drop;\n+\tcmdline_fixed_string_t queue;\n+\tuint16_t queue_id;\n+};\n+\n+cmdline_parse_token_string_t cmd_ethertype_filter_filter =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t\t filter, \"ethertype_filter\");\n+cmdline_parse_token_num_t cmd_ethertype_filter_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t port_id, UINT8);\n+cmdline_parse_token_string_t cmd_ethertype_filter_ops =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t\t ops, \"add#del\");\n+cmdline_parse_token_string_t cmd_ethertype_filter_mac =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t\t mac, \"mac_addr#mac_ignr\");\n+cmdline_parse_token_etheraddr_t cmd_ethertype_filter_mac_addr =\n+\tTOKEN_ETHERADDR_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t\t mac_addr);\n+cmdline_parse_token_string_t cmd_ethertype_filter_ethertype =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t\t ethertype, \"ethertype\");\n+cmdline_parse_token_num_t cmd_ethertype_filter_ethertype_value =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t ethertype_value, UINT16);\n+cmdline_parse_token_string_t cmd_ethertype_filter_drop =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t\t drop, \"drop#fwd\");\n+cmdline_parse_token_string_t cmd_ethertype_filter_queue =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t\t queue, \"queue\");\n+cmdline_parse_token_num_t cmd_ethertype_filter_queue_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_ethertype_filter_result,\n+\t\t\t queue_id, UINT16);\n+\n+static void\n+cmd_ethertype_filter_parsed(void *parsed_result,\n+\t\t\t __attribute__((unused)) struct cmdline *cl,\n+\t\t\t __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_ethertype_filter_result *res = parsed_result;\n+\tstruct rte_eth_ethertype_filter filter;\n+\tint ret = 0;\n+\n+\tret = rte_eth_dev_filter_supported(res->port_id,\n+\t\t\tRTE_ETH_FILTER_ETHERTYPE);\n+\tif (ret < 0) {\n+\t\tprintf(\"ethertype filter is not supported on port %u.\\n\",\n+\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&filter, 0, sizeof(filter));\n+\tif (!strcmp(res->mac, \"mac_addr\")) {\n+\t\tfilter.flags |= RTE_ETHTYPE_FLAGS_MAC;\n+\t\t(void)rte_memcpy(&filter.mac_addr, &res->mac_addr,\n+\t\t\tsizeof(struct ether_addr));\n+\t}\n+\tif (!strcmp(res->drop, \"drop\"))\n+\t\tfilter.flags |= RTE_ETHTYPE_FLAGS_DROP;\n+\tfilter.ether_type = res->ethertype_value;\n+\tfilter.queue = res->queue_id;\n+\n+\tif (!strcmp(res->ops, \"add\"))\n+\t\tret = rte_eth_dev_filter_ctrl(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_ETHERTYPE,\n+\t\t\t\tRTE_ETH_FILTER_ADD,\n+\t\t\t\t&filter);\n+\telse\n+\t\tret = rte_eth_dev_filter_ctrl(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_ETHERTYPE,\n+\t\t\t\tRTE_ETH_FILTER_DELETE,\n+\t\t\t\t&filter);\n+\tif (ret < 0)\n+\t\tprintf(\"ethertype filter programming error: (%s)\\n\",\n+\t\t\tstrerror(-ret));\n+}\n+\n+cmdline_parse_inst_t cmd_ethertype_filter = {\n+\t.f = cmd_ethertype_filter_parsed,\n+\t.data = NULL,\n+\t.help_str = \"add or delete an ethertype filter entry\",\n+\t.tokens = {\n+\t\t(void *)&cmd_ethertype_filter_filter,\n+\t\t(void *)&cmd_ethertype_filter_port_id,\n+\t\t(void *)&cmd_ethertype_filter_ops,\n+\t\t(void *)&cmd_ethertype_filter_mac,\n+\t\t(void *)&cmd_ethertype_filter_mac_addr,\n+\t\t(void *)&cmd_ethertype_filter_ethertype,\n+\t\t(void *)&cmd_ethertype_filter_ethertype_value,\n+\t\t(void *)&cmd_ethertype_filter_drop,\n+\t\t(void *)&cmd_ethertype_filter_queue,\n+\t\t(void *)&cmd_ethertype_filter_queue_id,\n+\t\tNULL,\n+\t},\n+};\n+\n /* *** deal with flow director filter *** */\n struct cmd_flow_director_result {\n \tcmdline_fixed_string_t flow_director_filter;\n@@ -8815,9 +8788,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_config_rss_hash_key,\n \t(cmdline_parse_inst_t *)&cmd_dump,\n \t(cmdline_parse_inst_t *)&cmd_dump_one,\n-\t(cmdline_parse_inst_t *)&cmd_add_ethertype_filter,\n-\t(cmdline_parse_inst_t *)&cmd_remove_ethertype_filter,\n-\t(cmdline_parse_inst_t *)&cmd_get_ethertype_filter,\n+\t(cmdline_parse_inst_t *)&cmd_ethertype_filter,\n \t(cmdline_parse_inst_t *)&cmd_add_syn_filter,\n \t(cmdline_parse_inst_t *)&cmd_remove_syn_filter,\n \t(cmdline_parse_inst_t *)&cmd_get_syn_filter,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 97b6525..c40f819 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2166,33 +2166,6 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)\n }\n \n void\n-get_ethertype_filter(uint8_t port_id, uint16_t index)\n-{\n-\tstruct rte_ethertype_filter filter;\n-\tint ret = 0;\n-\tuint16_t rx_queue;\n-\n-\tmemset(&filter, 0, sizeof(filter));\n-\tret = rte_eth_dev_get_ethertype_filter(port_id, index,\n-\t\t\t\t&filter, &rx_queue);\n-\tif (ret < 0) {\n-\t\tif (ret == (-ENOENT))\n-\t\t\tprintf(\"filter[%d] is not enabled\\n\", index);\n-\t\telse\n-\t\t\tprintf(\"get ethertype filter fails(%s)\\n\", strerror(-ret));\n-\t\treturn;\n-\t} else {\n-\t\tprintf(\"filter[%d]:\\n\", index);\n-\t\tprintf(\" ethertype: 0x%04x\\n\",\n-\t\t\trte_le_to_cpu_32(filter.ethertype));\n-\t\tprintf(\" priority: %s, %d\\n\",\n-\t\t\tfilter.priority_en ? \"enable\" : \"disable\",\n-\t\t\tfilter.priority);\n-\t\tprintf(\" queue: %d\\n\", rx_queue);\n-\t}\n-}\n-\n-void\n get_syn_filter(uint8_t port_id)\n {\n \tstruct rte_syn_filter filter;\n", "prefixes": [ "dpdk-dev", "v2", "3/4" ] }{ "id": 2232, "url": "