Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/107/?format=api
http://patches.dpdk.org/api/patches/107/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1406535955-31070-7-git-send-email-helin.zhang@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": "<1406535955-31070-7-git-send-email-helin.zhang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1406535955-31070-7-git-send-email-helin.zhang@intel.com", "date": "2014-07-28T08:25:55", "name": "[dpdk-dev,v2,6/6] app/testpmd: add commands for configuring hash functions", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "f463fa730aee4463dbf72f8e3f992749f18569a9", "submitter": { "id": 14, "url": "http://patches.dpdk.org/api/people/14/?format=api", "name": "Zhang, Helin", "email": "helin.zhang@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1406535955-31070-7-git-send-email-helin.zhang@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/107/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/107/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<hzhan75@shecgisg004.sh.intel.com>", "Received": [ "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 986A4B364\n\tfor <dev@dpdk.org>; Mon, 28 Jul 2014 10:24:40 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga102.fm.intel.com with ESMTP; 28 Jul 2014 01:26:25 -0700", "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 28 Jul 2014 01:26:18 -0700", "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id s6S8QGje023821;\n\tMon, 28 Jul 2014 16:26:16 +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 s6S8QCGN031225; Mon, 28 Jul 2014 16:26:14 +0800", "(from hzhan75@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s6S8QB2L031221; \n\tMon, 28 Jul 2014 16:26:11 +0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.01,747,1400050800\"; d=\"scan'208\";a=\"568219990\"", "From": "Helin Zhang <helin.zhang@intel.com>", "To": "dev@dpdk.org", "Date": "Mon, 28 Jul 2014 16:25:55 +0800", "Message-Id": "<1406535955-31070-7-git-send-email-helin.zhang@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": "<1406535955-31070-1-git-send-email-helin.zhang@intel.com>", "References": "<1406535955-31070-1-git-send-email-helin.zhang@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 6/6] app/testpmd: add commands for configuring\n\thash functions", "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>", "X-List-Received-Date": "Mon, 28 Jul 2014 08:24:41 -0000" }, "content": "Eight commands are added to configure hash functions.\nThey are,\n - i40e_get_sym_hash_ena_per_port\n Get symmetric hash enable per port.\n - i40e_set_sym_hash_ena_per_port\n Set symmetric hash enable per port.\n - i40e_get_sym_hash_ena_per_pctype\n Get symmetric hash enable per PCTYPE\n (Packet Classification Type).\n - i40e_set_sym_hash_ena_per_pctype\n Set symmetric hash enable per PCTYPE\n (Packet Classification Type).\n - i40e_get_filter_swap\n Get filter swap configurations.\n - i40e_set_filter_swap\n Set filter swap configurations.\n - i40e_get_hash_function\n Get hash function.\n - i40e_set_hash_function\n Set hash function to 'Toeplitz' or 'Simple XOR'\n\nSigned-off-by: Helin Zhang <helin.zhang@intel.com>\n---\n app/test-pmd/cmdline.c | 579 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 579 insertions(+)", "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 345be11..9890400 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -74,6 +74,10 @@\n #include <rte_ethdev.h>\n #include <rte_string_fns.h>\n #include <rte_devargs.h>\n+#include <rte_eth_features.h>\n+#ifdef RTE_LIBRTE_I40E_PMD\n+#include <rte_i40e.h>\n+#endif\n \n #include <cmdline_rdline.h>\n #include <cmdline_parse.h>\n@@ -655,6 +659,43 @@ static void cmd_help_long_parsed(void *parsed_result,\n \n \t\t\t\"get_flex_filter (port_id) index (idx)\\n\"\n \t\t\t\" get info of a flex filter.\\n\\n\"\n+\n+#ifdef RTE_LIBRTE_I40E_PMD\n+\t\t\t\"i40e_get_sym_hash_ena_per_port (port_id)\\n\"\n+\t\t\t\" get symmetric hash enable configuration per port,\"\n+\t\t\t\" on i40e only\\n\\n\"\n+\n+\t\t\t\"i40e_set_sym_hash_ena_per_port (port_id)\"\n+\t\t\t\" (enable|disable)\\n\"\n+\t\t\t\" set symmetric hash enable configuration per port\"\n+\t\t\t\" to enable or disable, on i40e only\\n\\n\"\n+\n+\t\t\t\"i40e_get_sym_hash_ena_per_pctype (port_id) (pctype)\\n\"\n+\t\t\t\" get symmetric hash enable configuration per port,\"\n+\t\t\t\" on i40e only\\n\\n\"\n+\n+\t\t\t\"i40e_set_sym_hash_ena_per_pctype (port_id) (pctype)\"\n+\t\t\t\" (enable|disable)\\n\"\n+\t\t\t\" set symmetric hash enable configuration per\"\n+\t\t\t\" pctype to enable or disable, on i40e only\\n\\n\"\n+\n+\t\t\t\"i40e_get_filter_swap (port_id) (pctype)\\n\"\n+\t\t\t\" get filter swap configurations on i40e,\"\n+\t\t\t\" on i40e only\\n\\n\"\n+\n+\t\t\t\"i40e_set_filter_swap (port_id) (pctype) (off0_src0)\"\n+\t\t\t\" (off0_src1) (len0) (off1_src0) (off1_src1) (len1)\\n\"\n+\t\t\t\" set filter swap configurations, on i40e only\\n\\n\"\n+\n+\t\t\t\"i40e_get_hash_function (port_id)\\n\"\n+\t\t\t\" get hash function of Toeplitz or Simple XOR,\"\n+\t\t\t\" on i40e only\\n\\n\"\n+\n+\t\t\t\"i40e_set_hash_function (port_id)\"\n+\t\t\t\" (toeplitz|simple_xor)\\n\"\n+\t\t\t\" set the hash function to Toeplitz or Simple XOR,\"\n+\t\t\t\" on i40e only\\n\\n\"\n+#endif /* RTE_LIBRTE_I40E_PMD */\n \t\t);\n \t}\n }\n@@ -7304,6 +7345,534 @@ cmdline_parse_inst_t cmd_get_flex_filter = {\n \t},\n };\n \n+/* *** Classification Filters Control *** */\n+#ifdef RTE_LIBRTE_I40E_PMD\n+/* *** Get symmetric hash enable per port *** */\n+struct cmd_i40e_get_sym_hash_ena_per_port_result {\n+\tcmdline_fixed_string_t i40e_get_sym_hash_ena_per_port;\n+\tuint8_t port_id;\n+};\n+\n+static void\n+cmd_i40e_get_sym_hash_per_port_parsed(void *parsed_result,\n+\t\t\t\t __rte_unused struct cmdline *cl,\n+\t\t\t\t __rte_unused void *data)\n+{\n+\tstruct cmd_i40e_get_sym_hash_ena_per_port_result *res = parsed_result;\n+\tuint8_t enable = 0;\n+\tint ret;\n+\n+\tif (rte_eth_dev_is_command_supported(res->port_id,\n+\t\tRTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT) <= 0) {\n+\t\tprintf(\"Command of RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT \"\n+\t\t\t\"not supported on port: %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tret = rte_eth_dev_rx_classification_filter_ctl(res->port_id,\n+\t\tRTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT, &enable);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot get symmetric hash enable per port \"\n+\t\t\t\t\"on i40e port %u\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tprintf(\"Symmetric hash is %s on i40e port %u\\n\",\n+\t\tenable ? \"enabled\" : \"disabled\", res->port_id);\n+}\n+\n+cmdline_parse_token_string_t cmd_i40e_get_sym_hash_ena_per_port_all =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_i40e_get_sym_hash_ena_per_port_result,\n+\t\t\ti40e_get_sym_hash_ena_per_port,\n+\t\t\t\"i40e_get_sym_hash_ena_per_port\");\n+cmdline_parse_token_num_t cmd_i40e_get_sym_hash_ena_per_port_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_get_sym_hash_ena_per_port_result,\n+\t\tport_id, UINT8);\n+\n+cmdline_parse_inst_t cmd_i40e_get_sym_hash_ena_per_port = {\n+\t.f = cmd_i40e_get_sym_hash_per_port_parsed,\n+\t.data = NULL,\n+\t.help_str = \"i40e_get_sym_hash_ena_per_port port_id\",\n+\t.tokens = {\n+\t\t(void *)&cmd_i40e_get_sym_hash_ena_per_port_all,\n+\t\t(void *)&cmd_i40e_get_sym_hash_ena_per_port_port_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Set symmetric hash enable per port *** */\n+struct cmd_i40e_set_sym_hash_ena_per_port_result {\n+\tcmdline_fixed_string_t i40e_set_sym_hash_ena_per_port;\n+\tcmdline_fixed_string_t enable;\n+\tuint8_t port_id;\n+};\n+\n+static void\n+cmd_i40e_set_sym_hash_per_port_parsed(void *parsed_result,\n+\t\t\t\t __rte_unused struct cmdline *cl,\n+\t\t\t\t __rte_unused void *data)\n+{\n+\tstruct cmd_i40e_set_sym_hash_ena_per_port_result *res = parsed_result;\n+\tuint8_t enable = 0;\n+\tint ret;\n+\n+\tif (rte_eth_dev_is_command_supported(res->port_id,\n+\t\tRTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT) <= 0) {\n+\t\tprintf(\"Command of RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT \"\n+\t\t\t\"not supported on port: %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tif (!strcmp(res->enable, \"enable\"))\n+\t\tenable = 1;\n+\tret = rte_eth_dev_rx_classification_filter_ctl(res->port_id,\n+\t\tRTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT, &enable);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot set symmetric hash enable per port \"\n+\t\t\t\t\"on i40e port %u\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tprintf(\"Symmetric hash has been set to %s on i40e port %u\\n\",\n+\t\t\t\t\tres->enable, res->port_id);\n+}\n+\n+cmdline_parse_token_string_t cmd_i40e_set_sym_hash_ena_per_port_all =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_i40e_set_sym_hash_ena_per_port_result,\n+\t\t\t\ti40e_set_sym_hash_ena_per_port,\n+\t\t\t\t\"i40e_set_sym_hash_ena_per_port\");\n+cmdline_parse_token_num_t cmd_i40e_set_sym_hash_ena_per_port_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_sym_hash_ena_per_port_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_string_t cmd_i40e_set_sym_hash_ena_per_port_enable =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_i40e_set_sym_hash_ena_per_port_result,\n+\t\t\t\t\tenable, \"enable#disable\");\n+\n+cmdline_parse_inst_t cmd_i40e_set_sym_hash_ena_per_port = {\n+\t.f = cmd_i40e_set_sym_hash_per_port_parsed,\n+\t.data = NULL,\n+\t.help_str = \"i40e_set_sym_hash_ena_per_port port_id enable|disable\",\n+\t.tokens = {\n+\t\t(void *)&cmd_i40e_set_sym_hash_ena_per_port_all,\n+\t\t(void *)&cmd_i40e_set_sym_hash_ena_per_port_port_id,\n+\t\t(void *)&cmd_i40e_set_sym_hash_ena_per_port_enable,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Get symmetric hash enable per pctype *** */\n+struct cmd_i40e_get_sym_hash_ena_per_pctype_result {\n+\tcmdline_fixed_string_t i40e_get_sym_hash_ena_per_pctype;\n+\tuint8_t port_id;\n+\tuint8_t pctype;\n+};\n+\n+static void\n+cmd_i40e_get_sym_hash_per_pctype_parsed(void *parsed_result,\n+\t\t\t\t\t__rte_unused struct cmdline *cl,\n+\t\t\t\t\t__rte_unused void *data)\n+{\n+\tstruct cmd_i40e_get_sym_hash_ena_per_pctype_result *res =\n+\t\t\t\t\t\tparsed_result;\n+\tstruct rte_i40e_sym_hash_enable_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_is_command_supported(res->port_id,\n+\t\tRTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE) <= 0) {\n+\t\tprintf(\"Command of RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE \"\n+\t\t\t\"not supported on port: %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.pctype = res->pctype;\n+\tret = rte_eth_dev_rx_classification_filter_ctl(res->port_id,\n+\t\tRTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot get symmetric hash enable per pctype on i40e \"\n+\t\t\t\"port %u, pctype %u\\n\", res->port_id, res->pctype);\n+\t\treturn;\n+\t}\n+\tprintf(\"Symmetric hash is %s on i40e port %u, pctype %u\\n\",\n+\t\t\t\tinfo.enable ? \"enabled\" : \"disabled\",\n+\t\t\t\t\tres->port_id, res->pctype);\n+}\n+\n+cmdline_parse_token_string_t cmd_i40e_get_sym_hash_ena_per_pctype_all =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_i40e_get_sym_hash_ena_per_pctype_result,\n+\t\t\t\ti40e_get_sym_hash_ena_per_pctype,\n+\t\t\t\t\"i40e_get_sym_hash_ena_per_pctype\");\n+cmdline_parse_token_num_t cmd_i40e_get_sym_hash_ena_per_pctype_port_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_i40e_get_sym_hash_ena_per_pctype_result,\n+\t\t\t\t\t\tport_id, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_get_sym_hash_ena_per_pctype_pctype =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_i40e_get_sym_hash_ena_per_pctype_result,\n+\t\t\t\t\t\tpctype, UINT8);\n+\n+cmdline_parse_inst_t cmd_i40e_get_sym_hash_ena_per_pctype = {\n+\t.f = cmd_i40e_get_sym_hash_per_pctype_parsed,\n+\t.data = NULL,\n+\t.help_str = \"i40e_get_sym_hash_ena_per_pctype port_id pctype\",\n+\t.tokens = {\n+\t\t(void *)&cmd_i40e_get_sym_hash_ena_per_pctype_all,\n+\t\t(void *)&cmd_i40e_get_sym_hash_ena_per_pctype_port_id,\n+\t\t(void *)&cmd_i40e_get_sym_hash_ena_per_pctype_pctype,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Set symmetric hash enable per pctype *** */\n+struct cmd_i40e_set_sym_hash_ena_per_pctype_result {\n+\tcmdline_fixed_string_t i40e_set_sym_hash_ena_per_pctype;\n+\tcmdline_fixed_string_t enable;\n+\tuint8_t port_id;\n+\tuint8_t pctype;\n+};\n+\n+static void\n+cmd_i40e_set_sym_hash_per_pctype_parsed(void *parsed_result,\n+\t\t\t\t\t__rte_unused struct cmdline *cl,\n+\t\t\t\t\t__rte_unused void *data)\n+{\n+\tstruct cmd_i40e_set_sym_hash_ena_per_pctype_result *res =\n+\t\t\t\t\t\tparsed_result;\n+\tstruct rte_i40e_sym_hash_enable_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_is_command_supported(res->port_id,\n+\t\tRTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE) <= 0) {\n+\t\tprintf(\"Command of RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE \"\n+\t\t\t\"not supported on port: %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.pctype = res->pctype;\n+\tif (!strcmp(res->enable, \"enable\"))\n+\t\tinfo.enable = 1;\n+\tret = rte_eth_dev_rx_classification_filter_ctl(res->port_id,\n+\t\tRTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot set symmetric hash enable per pctype to %s \"\n+\t\t\t\"on i40e port %u, pctype %u\\n\", res->enable ?\n+\t\t\t\"enabled\" : \"disabled\", res->port_id, res->pctype);\n+\t\treturn;\n+\t}\n+\tprintf(\"Symmetic hash has been set to %s on i40e port %u, pctype %u\\n\",\n+\t\t\t\tres->enable, res->port_id, res->pctype);\n+}\n+\n+cmdline_parse_token_string_t cmd_i40e_set_sym_hash_ena_per_pctype_all =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_i40e_set_sym_hash_ena_per_pctype_result,\n+\t\t\t\ti40e_set_sym_hash_ena_per_pctype,\n+\t\t\t\t\"i40e_set_sym_hash_ena_per_pctype\");\n+cmdline_parse_token_num_t cmd_i40e_set_sym_hash_ena_per_pctype_port_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_i40e_set_sym_hash_ena_per_pctype_result,\n+\t\t\t\t\t\tport_id, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_set_sym_hash_ena_per_pctype_pctype =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_i40e_set_sym_hash_ena_per_pctype_result,\n+\t\tpctype, UINT8);\n+cmdline_parse_token_string_t cmd_i40e_set_sym_hash_ena_per_pctype_enable =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_i40e_set_sym_hash_ena_per_pctype_result,\n+\t\tenable, \"enable#disable\");\n+\n+cmdline_parse_inst_t cmd_i40e_set_sym_hash_ena_per_pctype = {\n+\t.f = cmd_i40e_set_sym_hash_per_pctype_parsed,\n+\t.data = NULL,\n+\t.help_str = \"i40e_set_sym_hash_ena_per_pctype pord_id \"\n+\t\t\t\t\t\"pctype enable|disable\",\n+\t.tokens = {\n+\t\t(void *)&cmd_i40e_set_sym_hash_ena_per_pctype_all,\n+\t\t(void *)&cmd_i40e_set_sym_hash_ena_per_pctype_port_id,\n+\t\t(void *)&cmd_i40e_set_sym_hash_ena_per_pctype_pctype,\n+\t\t(void *)&cmd_i40e_set_sym_hash_ena_per_pctype_enable,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Get filter swap *** */\n+struct cmd_i40e_get_filter_swap_result {\n+\tcmdline_fixed_string_t i40e_get_filter_swap;\n+\tuint8_t port_id;\n+\tuint8_t pctype;\n+};\n+\n+static void\n+cmd_i40e_get_filter_swap_parsed(void *parsed_result,\n+\t\t\t\t__rte_unused struct cmdline *cl,\n+\t\t\t\t__rte_unused void *data)\n+{\n+\tstruct cmd_i40e_get_filter_swap_result *res = parsed_result;\n+\tstruct rte_i40e_filter_swap_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_is_command_supported(res->port_id,\n+\t\t\tRTE_CMD_GET_FILTER_SWAP) <= 0) {\n+\t\tprintf(\"Command of RTE_CMD_GET_FILTER_SWAP not supported \"\n+\t\t\t\t\t\"on port: %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.pctype = res->pctype;\n+\tret = rte_eth_dev_rx_classification_filter_ctl(res->port_id,\n+\t\t\t\tRTE_CMD_GET_FILTER_SWAP, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot get filter swap on i40e port %u, pctype %u\\n\",\n+\t\t\t\t\t\tres->port_id, res->pctype);\n+\t\treturn;\n+\t}\n+\tprintf(\"Filter swap of i40e port %u, pctype %u is configured as:\\n\"\n+\t\t\t\"off0_src0: 0x%02x, off0_src1: 0x%02x, len0: 0x%02x\\n\"\n+\t\t\t\"off1_src0: 0x%02x, off1_src1: 0x%02x, len1: 0x%02x\\n\",\n+\t\tres->port_id, res->pctype, info.off0_src0, info.off0_src1,\n+\t\tinfo.len0, info.off1_src0, info.off1_src1, info.len1);\n+}\n+\n+cmdline_parse_token_string_t cmd_i40e_get_filter_swap_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_i40e_get_filter_swap_result,\n+\t\ti40e_get_filter_swap, \"i40e_get_filter_swap\");\n+cmdline_parse_token_num_t cmd_i40e_get_filter_swap_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_get_filter_swap_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_get_filter_swap_pctype =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_get_filter_swap_result,\n+\t\tpctype, UINT8);\n+\n+cmdline_parse_inst_t cmd_i40e_get_filter_swap = {\n+\t.f = cmd_i40e_get_filter_swap_parsed,\n+\t.data = NULL,\n+\t.help_str = \"i40e_get_filter_swap port_id pctype\",\n+\t.tokens = {\n+\t\t(void *)&cmd_i40e_get_filter_swap_all,\n+\t\t(void *)&cmd_i40e_get_filter_swap_port_id,\n+\t\t(void *)&cmd_i40e_get_filter_swap_pctype,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Set filter swap *** */\n+struct cmd_i40e_set_filter_swap_result {\n+\tcmdline_fixed_string_t i40e_set_filter_swap;\n+\tuint8_t port_id;\n+\tuint8_t pctype;\n+\tuint8_t off0_src0;\n+\tuint8_t off0_src1;\n+\tuint8_t len0;\n+\tuint8_t off1_src0;\n+\tuint8_t off1_src1;\n+\tuint8_t len1;\n+};\n+\n+static void\n+cmd_i40e_set_filter_swap_parsed(void *parsed_result,\n+\t\t\t\t__rte_unused struct cmdline *cl,\n+\t\t\t\t__rte_unused void *data)\n+{\n+\tstruct cmd_i40e_set_filter_swap_result *res = parsed_result;\n+\tstruct rte_i40e_filter_swap_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_is_command_supported(res->port_id,\n+\t\t\tRTE_CMD_SET_FILTER_SWAP) <= 0) {\n+\t\tprintf(\"Command of RTE_CMD_SET_FILTER_SWAP not supported \"\n+\t\t\t\t\t\"on port: %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.pctype = res->pctype;\n+\tinfo.off0_src0 = res->off0_src0;\n+\tinfo.off0_src1 = res->off0_src1;\n+\tinfo.len0 = res->len0;\n+\tinfo.off1_src0 = res->off1_src0;\n+\tinfo.off1_src1 = res->off1_src1;\n+\tinfo.len1 = res->len1;\n+\tret = rte_eth_dev_rx_classification_filter_ctl(res->port_id,\n+\t\t\t\tRTE_CMD_SET_FILTER_SWAP, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot set filter swap on i40e port %u, pctype %u\\n\",\n+\t\t\t\t\t\tres->port_id, res->pctype);\n+\t\treturn;\n+\t}\n+\tprintf(\"Filter swap of i40e port %u, pctype %u has been set as:\\n\"\n+\t\t\t\"off0_src0: 0x%02x, off0_src1: 0x%02x, len0: 0x%02x\\n\"\n+\t\t\t\"off1_src0: 0x%02x, off1_src1: 0x%02x, len1: 0x%02x\\n\",\n+\t\tres->port_id, res->pctype, info.off0_src0, info.off0_src1,\n+\t\tinfo.len0, info.off1_src0, info.off1_src1, info.len1);\n+}\n+\n+cmdline_parse_token_string_t cmd_i40e_set_filter_swap_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\ti40e_set_filter_swap, \"i40e_set_filter_swap\");\n+cmdline_parse_token_num_t cmd_i40e_set_filter_swap_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_set_filter_swap_pctype =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\tpctype, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_set_filter_swap_off0_src0 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\toff0_src0, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_set_filter_swap_off0_src1 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\toff0_src1, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_set_filter_swap_len0 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\tlen0, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_set_filter_swap_off1_src0 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\toff1_src0, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_set_filter_swap_off1_src1 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\toff1_src1, UINT8);\n+cmdline_parse_token_num_t cmd_i40e_set_filter_swap_len1 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_filter_swap_result,\n+\t\tlen1, UINT8);\n+\n+cmdline_parse_inst_t cmd_i40e_set_filter_swap = {\n+\t.f = cmd_i40e_set_filter_swap_parsed,\n+\t.data = NULL,\n+\t.help_str = \"i40e_set_filter_swap port_id pctype off0_src0 off0_src1 \"\n+\t\t\t\t\t\"len0 off1_src0 off1_src1 len1\",\n+\t.tokens = {\n+\t\t(void *)&cmd_i40e_set_filter_swap_all,\n+\t\t(void *)&cmd_i40e_set_filter_swap_port_id,\n+\t\t(void *)&cmd_i40e_set_filter_swap_pctype,\n+\t\t(void *)&cmd_i40e_set_filter_swap_off0_src0,\n+\t\t(void *)&cmd_i40e_set_filter_swap_off0_src1,\n+\t\t(void *)&cmd_i40e_set_filter_swap_len0,\n+\t\t(void *)&cmd_i40e_set_filter_swap_off1_src0,\n+\t\t(void *)&cmd_i40e_set_filter_swap_off1_src1,\n+\t\t(void *)&cmd_i40e_set_filter_swap_len1,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* Get hash function */\n+struct cmd_i40e_get_hash_function_result {\n+\tcmdline_fixed_string_t i40e_get_hash_function;\n+\tuint8_t port_id;\n+};\n+\n+static void\n+cmd_i40e_get_hash_function_parsed(void *parsed_result,\n+\t\t\t\t __rte_unused struct cmdline *cl,\n+\t\t\t\t __rte_unused void *data)\n+{\n+\tstruct cmd_i40e_get_hash_function_result *res = parsed_result;\n+\tenum rte_i40e_hash_function hf;\n+\tint ret;\n+\n+\tif (rte_eth_dev_is_command_supported(res->port_id,\n+\t\t\tRTE_CMD_GET_HASH_FUNCTION) <= 0) {\n+\t\tprintf(\"Command of RTE_CMD_GET_HASH_FUNCTION not \"\n+\t\t\t\"supported on port %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\tret = rte_eth_dev_rx_classification_filter_ctl(res->port_id,\n+\t\t\t\t\tRTE_CMD_GET_HASH_FUNCTION, &hf);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot get hash function on port %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\tprintf(\"Hash function is %s\\n\", hf == rte_i40e_hash_function_toeplitz ?\n+\t\t\t\t\t\t\"Toeplitz\" : \"Simple XOR\");\n+}\n+\n+cmdline_parse_token_string_t cmd_i40e_get_hash_function_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_i40e_get_hash_function_result,\n+\t\ti40e_get_hash_function, \"i40e_get_hash_function\");\n+cmdline_parse_token_num_t cmd_i40e_get_hash_function_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_get_hash_function_result,\n+\t\tport_id, UINT8);\n+\n+cmdline_parse_inst_t cmd_i40e_get_hash_function = {\n+\t.f = cmd_i40e_get_hash_function_parsed,\n+\t.data = NULL,\n+\t.help_str = \"i40e_get_hash_function port_id\",\n+\t.tokens = {\n+\t\t(void *)&cmd_i40e_get_hash_function_all,\n+\t\t(void *)&cmd_i40e_get_hash_function_port_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* Set hash function of Hoeplitz or Simple XOR */\n+struct cmd_i40e_set_hash_function_result {\n+\tcmdline_fixed_string_t i40e_set_hash_function;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t hash_function;\n+};\n+\n+static void\n+cmd_i40e_set_hash_function_parsed(void *parsed_result,\n+\t\t\t\t __rte_unused struct cmdline *cl,\n+\t\t\t\t __rte_unused void *data)\n+{\n+\tstruct cmd_i40e_set_hash_function_result *res = parsed_result;\n+\tenum rte_i40e_hash_function hf;\n+\tint ret;\n+\n+\tif (!strcmp(res->hash_function, \"toeplitz\"))\n+\t\thf = rte_i40e_hash_function_toeplitz;\n+\telse if (!strcmp(res->hash_function, \"simple_xor\"))\n+\t\thf = rte_i40e_hash_function_simple_xor;\n+\telse {\n+\t\tprintf(\"Unsupported hash function %s\\n\", res->hash_function);\n+\t\treturn;\n+\t}\n+\tif (rte_eth_dev_is_command_supported(res->port_id,\n+\t\t\tRTE_CMD_SET_HASH_FUNCTION) <= 0) {\n+\t\tprintf(\"Command of RTE_CMD_SET_HASH_FUNCTION not \"\n+\t\t\t\"supported on port %d\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\tret = rte_eth_dev_rx_classification_filter_ctl(res->port_id,\n+\t\t\t\tRTE_CMD_SET_HASH_FUNCTION, &hf);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot set hash function to %s on port %d\\n\",\n+\t\t\t\tres->hash_function, res->port_id);\n+\t\treturn;\n+\t}\n+\tprintf(\"Hash function has been successfully set to %s on port %d\\n\",\n+\t\t\t\t\tres->hash_function, res->port_id);\n+}\n+\n+cmdline_parse_token_string_t cmd_i40e_set_hash_function_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_i40e_set_hash_function_result,\n+\t\ti40e_set_hash_function, \"i40e_set_hash_function\");\n+cmdline_parse_token_num_t cmd_i40e_set_hash_function_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_i40e_set_hash_function_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_string_t cmd_i40e_set_hash_function_hash_function =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_i40e_set_hash_function_result,\n+\t\thash_function, \"toeplitz#simple_xor\");\n+\n+cmdline_parse_inst_t cmd_i40e_set_hash_function = {\n+\t.f = cmd_i40e_set_hash_function_parsed,\n+\t.data = NULL,\n+\t.help_str = \"i40e_set_hash_function port_id toeplitz|simple_xor\",\n+\t.tokens = {\n+\t\t(void *)&cmd_i40e_set_hash_function_all,\n+\t\t(void *)&cmd_i40e_set_hash_function_port_id,\n+\t\t(void *)&cmd_i40e_set_hash_function_hash_function,\n+\t\tNULL,\n+\t},\n+};\n+\n+#endif /* RTE_LIBRTE_I40E_PMD */\n+\n /* ******************************************************************************** */\n \n /* list of instructions */\n@@ -7429,6 +7998,16 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_add_flex_filter,\n \t(cmdline_parse_inst_t *)&cmd_remove_flex_filter,\n \t(cmdline_parse_inst_t *)&cmd_get_flex_filter,\n+#ifdef RTE_LIBRTE_I40E_PMD\n+\t(cmdline_parse_inst_t *)&cmd_i40e_get_sym_hash_ena_per_port,\n+\t(cmdline_parse_inst_t *)&cmd_i40e_set_sym_hash_ena_per_port,\n+\t(cmdline_parse_inst_t *)&cmd_i40e_get_sym_hash_ena_per_pctype,\n+\t(cmdline_parse_inst_t *)&cmd_i40e_set_sym_hash_ena_per_pctype,\n+\t(cmdline_parse_inst_t *)&cmd_i40e_get_filter_swap,\n+\t(cmdline_parse_inst_t *)&cmd_i40e_set_filter_swap,\n+\t(cmdline_parse_inst_t *)&cmd_i40e_set_hash_function,\n+\t(cmdline_parse_inst_t *)&cmd_i40e_get_hash_function,\n+#endif /* RTE_LIBRTE_I40E_PMD */\n \tNULL,\n };\n \n", "prefixes": [ "dpdk-dev", "v2", "6/6" ] }{ "id": 107, "url": "