get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1352/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1352,
    "url": "https://patches.dpdk.org/api/patches/1352/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1416409096-1340-4-git-send-email-helin.zhang@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": "<1416409096-1340-4-git-send-email-helin.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1416409096-1340-4-git-send-email-helin.zhang@intel.com",
    "date": "2014-11-19T14:58:16",
    "name": "[dpdk-dev,v6,3/3] app/testpmd: add commands to support hash functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9c92a53db4826aa669e0c784b4c51c0e6c1bf561",
    "submitter": {
        "id": 14,
        "url": "https://patches.dpdk.org/api/people/14/?format=api",
        "name": "Zhang, Helin",
        "email": "helin.zhang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1416409096-1340-4-git-send-email-helin.zhang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1352/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1352/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 418077FA5;\n\tWed, 19 Nov 2014 15:48:15 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 85AC37F99\n\tfor <dev@dpdk.org>; Wed, 19 Nov 2014 15:48:06 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP; 19 Nov 2014 06:58:31 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 19 Nov 2014 06:58:30 -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 sAJEwSUM032277;\n\tWed, 19 Nov 2014 22:58:28 +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 sAJEwQMH001396; Wed, 19 Nov 2014 22:58:28 +0800",
            "(from hzhan75@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sAJEwQlQ001392; \n\tWed, 19 Nov 2014 22:58:26 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.07,417,1413270000\"; d=\"scan'208\";a=\"610472218\"",
        "From": "Helin Zhang <helin.zhang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 19 Nov 2014 22:58:16 +0800",
        "Message-Id": "<1416409096-1340-4-git-send-email-helin.zhang@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1416409096-1340-1-git-send-email-helin.zhang@intel.com>",
        "References": "<1413861289-26662-1-git-send-email-helin.zhang@intel.com>\n\t<1416409096-1340-1-git-send-email-helin.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v6 3/3] app/testpmd: add commands to support hash\n\tfunctions",
        "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": "To demonstrate the hash filter control, commands are added.\nThey are,\n- get_sym_hash_ena_per_port\n- set_sym_hash_ena_per_port\n- get_sym_hash_ena_per_pctype\n- set_sym_hash_ena_per_pctype\n- get_filter_swap\n- set_filter_swap\n- get_hash_function\n- set_hash_function\n\nSigned-off-by: Helin Zhang <helin.zhang@intel.com>\n---\n app/test-pmd/cmdline.c | 628 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 628 insertions(+)\n\nv6 changes:\n* Flow type strings are used to replace Packet Classification\n  Types, to isolate hardware specific things.",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 4c3fc76..ce1547d 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -74,6 +74,7 @@\n #include <rte_ethdev.h>\n #include <rte_string_fns.h>\n #include <rte_devargs.h>\n+#include <rte_eth_ctrl.h>\n \n #include <cmdline_rdline.h>\n #include <cmdline_parse.h>\n@@ -683,6 +684,44 @@ 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+\t\t\t\"get_sym_hash_ena_per_port (port_id)\\n\"\n+\t\t\t\"    get symmetric hash enable configuration per port.\\n\\n\"\n+\n+\t\t\t\"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.\\n\\n\"\n+\n+\t\t\t\"get_sym_hash_ena_per_flow_type (port_id) (ipv4-udp|\"\n+\t\t\t\"ipv4-tcp|ipv4-sctp|ipv4-other|ipv4-frag|ipv6-udp|\"\n+\t\t\t\"ipv6-tcp|ipv6-sctp|ipv6-other|ipv6-frag|l2_payload)\\n\"\n+\t\t\t\"    get symmetric hash enable configuration per flow type.\\n\\n\"\n+\n+\t\t\t\"set_sym_hash_ena_per_flow_type (port_id) (ipv4-udp|\"\n+\t\t\t\"ipv4-tcp|ipv4-sctp|ipv4-other|ipv4-frag|ipv6-udp|\"\n+\t\t\t\"ipv6-tcp|ipv6-sctp|ipv6-other|ipv6-frag|l2_payload) \"\n+\t\t\t\"(enable|disable)\\n\"\n+\t\t\t\"    set symmetric hash enable configuration per\"\n+\t\t\t\" flow type to enable or disable.\\n\\n\"\n+\n+\t\t\t\"get_filter_swap (port_id) (ipv4-udp|ipv4-tcp|\"\n+\t\t\t\"ipv4-sctp|ipv4-other|ipv4-frag|ipv6-udp|ipv6-tcp|\"\n+\t\t\t\"ipv6-sctp|ipv6-other|ipv6-frag|l2_payload)\\n\"\n+\t\t\t\"    get filter swap configurations.\\n\\n\"\n+\n+\t\t\t\"set_filter_swap (port_id) (ipv4-udp|ipv4-tcp|\"\n+\t\t\t\"ipv4-sctp|ipv4-other|ipv4-frag|ipv6-udp|ipv6-tcp|\"\n+\t\t\t\"ipv6-sctp|ipv6-other|ipv6-frag|l2_payload) \"\n+\t\t\t\"(off0_src0) (off0_src1) (len0) (off1_src0) \"\n+\t\t\t\"(off1_src1) (len1)\\n\"\n+\t\t\t\"    set filter swap configurations.\\n\\n\"\n+\n+\t\t\t\"get_hash_function (port_id)\\n\"\n+\t\t\t\"    get hash function of Toeplitz or Simple XOR.\\n\\n\"\n+\n+\t\t\t\"set_hash_function (port_id) (toeplitz|simple_xor)\\n\"\n+\t\t\t\"    set the hash function to Toeplitz or Simple XOR.\\n\\n\"\n \t\t);\n \t}\n }\n@@ -7745,6 +7784,587 @@ cmdline_parse_inst_t cmd_get_flex_filter = {\n \t},\n };\n \n+/* *** Classification Filters Control *** */\n+static uint8_t\n+parse_flow_type(const char *str)\n+{\n+\tstruct flow_type_pair {\n+\t\tchar str[STR_TOKEN_SIZE];\n+\t\tuint8_t flow_type;\n+\t};\n+\tuint32_t i;\n+\tstatic const struct flow_type_pair ftype[] = {\n+\t\t{\"ipv4-udp\",   ETH_RSS_NONF_IPV4_UDP_SHIFT},\n+\t\t{\"ipv4-tcp\",   ETH_RSS_NONF_IPV4_TCP_SHIFT},\n+\t\t{\"ipv4-sctp\",  ETH_RSS_NONF_IPV4_SCTP_SHIFT},\n+\t\t{\"ipv4-other\", ETH_RSS_NONF_IPV4_OTHER_SHIFT},\n+\t\t{\"ipv4-frag\",  ETH_RSS_FRAG_IPV4_SHIFT},\n+\t\t{\"ipv6-udp\",   ETH_RSS_NONF_IPV6_UDP_SHIFT},\n+\t\t{\"ipv6-tcp\",   ETH_RSS_NONF_IPV6_TCP_SHIFT},\n+\t\t{\"ipv6-sctp\",  ETH_RSS_NONF_IPV6_SCTP_SHIFT},\n+\t\t{\"ipv6-other\", ETH_RSS_NONF_IPV6_OTHER_SHIFT},\n+\t\t{\"ipv6-frag\",  ETH_RSS_FRAG_IPV6_SHIFT},\n+\t\t{\"l2_payload\", ETH_RSS_L2_PAYLOAD_SHIFT},\n+\t};\n+\n+\tif (!str)\n+\t\treturn 0xFF;\n+\n+\tfor (i = 0; i < RTE_DIM(ftype); i++) {\n+\t\tif (!strcmp(ftype[i].str, str))\n+\t\t\treturn ftype[i].flow_type;\n+\t}\n+\n+\treturn 0xFF;\n+}\n+\n+/* *** Get symmetric hash enable per port *** */\n+struct cmd_get_sym_hash_ena_per_port_result {\n+\tcmdline_fixed_string_t get_sym_hash_ena_per_port;\n+\tuint8_t port_id;\n+};\n+\n+static void\n+cmd_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_get_sym_hash_ena_per_port_result *res = parsed_result;\n+\tstruct rte_eth_hash_filter_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_filter_supported(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_HASH) < 0) {\n+\t\tprintf(\"RTE_ETH_FILTER_HASH not supported on port: %d\\n\",\n+\t\t\t\t\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.info_type = RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT;\n+\tret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,\n+\t\t\t\t\t\tRTE_ETH_FILTER_GET, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot get symmetric hash enable per port \"\n+\t\t\t\t\t\"on port %u\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tprintf(\"Symmetric hash is %s on port %u\\n\", info.info.enable ?\n+\t\t\t\t\"enabled\" : \"disabled\", res->port_id);\n+}\n+\n+cmdline_parse_token_string_t cmd_get_sym_hash_ena_per_port_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_get_sym_hash_ena_per_port_result,\n+\t\tget_sym_hash_ena_per_port, \"get_sym_hash_ena_per_port\");\n+cmdline_parse_token_num_t cmd_get_sym_hash_ena_per_port_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_get_sym_hash_ena_per_port_result,\n+\t\tport_id, UINT8);\n+\n+cmdline_parse_inst_t cmd_get_sym_hash_ena_per_port = {\n+\t.f = cmd_get_sym_hash_per_port_parsed,\n+\t.data = NULL,\n+\t.help_str = \"get_sym_hash_ena_per_port port_id\",\n+\t.tokens = {\n+\t\t(void *)&cmd_get_sym_hash_ena_per_port_all,\n+\t\t(void *)&cmd_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_set_sym_hash_ena_per_port_result {\n+\tcmdline_fixed_string_t set_sym_hash_ena_per_port;\n+\tcmdline_fixed_string_t enable;\n+\tuint8_t port_id;\n+};\n+\n+static void\n+cmd_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_set_sym_hash_ena_per_port_result *res = parsed_result;\n+\tstruct rte_eth_hash_filter_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_filter_supported(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_HASH) < 0) {\n+\t\tprintf(\"RTE_ETH_FILTER_HASH not supported on port: %d\\n\",\n+\t\t\t\t\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.info_type = RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT;\n+\tif (!strcmp(res->enable, \"enable\"))\n+\t\tinfo.info.enable = 1;\n+\tret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,\n+\t\t\t\t\t\tRTE_ETH_FILTER_SET, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot set symmetric hash enable per port on \"\n+\t\t\t\t\t\"port %u\\n\", res->port_id);\n+\t\treturn;\n+\t}\n+\n+\tprintf(\"Symmetric hash has been set to %s on port %u\\n\",\n+\t\t\t\t\tres->enable, res->port_id);\n+}\n+\n+cmdline_parse_token_string_t cmd_set_sym_hash_ena_per_port_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_sym_hash_ena_per_port_result,\n+\t\tset_sym_hash_ena_per_port, \"set_sym_hash_ena_per_port\");\n+cmdline_parse_token_num_t cmd_set_sym_hash_ena_per_port_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_sym_hash_ena_per_port_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_string_t cmd_set_sym_hash_ena_per_port_enable =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_sym_hash_ena_per_port_result,\n+\t\tenable, \"enable#disable\");\n+\n+cmdline_parse_inst_t cmd_set_sym_hash_ena_per_port = {\n+\t.f = cmd_set_sym_hash_per_port_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set_sym_hash_ena_per_port port_id enable|disable\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_sym_hash_ena_per_port_all,\n+\t\t(void *)&cmd_set_sym_hash_ena_per_port_port_id,\n+\t\t(void *)&cmd_set_sym_hash_ena_per_port_enable,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Get symmetric hash enable per flow_type *** */\n+struct cmd_get_sym_hash_ena_per_flow_type_result {\n+\tcmdline_fixed_string_t get_sym_hash_ena_per_flow_type;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t flow_type;\n+};\n+\n+static void\n+cmd_get_sym_hash_per_flow_type_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_get_sym_hash_ena_per_flow_type_result *res = parsed_result;\n+\tstruct rte_eth_hash_filter_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_filter_supported(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_HASH) < 0) {\n+\t\tprintf(\"RTE_ETH_FILTER_HASH not supported on port: %d\\n\",\n+\t\t\t\t\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.info_type =\n+\t\tRTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_FLOW_TYPE;\n+\tinfo.info.sym_hash_ena.flow_type = parse_flow_type(res->flow_type);\n+\tret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,\n+\t\t\t\t\t\tRTE_ETH_FILTER_GET, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot get symmetric hash enable per flow_type on \"\n+\t\t\t\t\t\t\"port %u, flow_type %s\\n\",\n+\t\t\t\t\t\tres->port_id, res->flow_type);\n+\t\treturn;\n+\t}\n+\tprintf(\"Symmetric hash is %s on port %u, flow_type %s\\n\",\n+\t\t\tinfo.info.sym_hash_ena.enable ? \"enabled\" :\n+\t\t\t\"disabled\", res->port_id, res->flow_type);\n+}\n+\n+cmdline_parse_token_string_t cmd_get_sym_hash_ena_per_flow_type_all =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_sym_hash_ena_per_flow_type_result,\n+\t\t\tget_sym_hash_ena_per_flow_type,\n+\t\t\t\"get_sym_hash_ena_per_flow_type\");\n+cmdline_parse_token_num_t cmd_get_sym_hash_ena_per_flow_type_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_get_sym_hash_ena_per_flow_type_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_string_t cmd_get_sym_hash_ena_per_flow_type_flow_type =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_sym_hash_ena_per_flow_type_result, flow_type,\n+\t\t\"ipv4-udp#ipv4-tcp#ipv4-sctp#ipv4-other#ipv4-frag#ipv6-udp#\"\n+\t\t\"ipv6-tcp#ipv6-sctp#ipv6-other#ipv6-frag#l2_payload\");\n+\n+cmdline_parse_inst_t cmd_get_sym_hash_ena_per_flow_type = {\n+\t.f = cmd_get_sym_hash_per_flow_type_parsed,\n+\t.data = NULL,\n+\t.help_str = \"get_sym_hash_ena_per_flow_type port_id ipv4-udp|ipv4-tcp|\"\n+\t\t\"ipv4-sctp|ipv4-other|ipv4-frag|ipv6-udp|ipv6-tcp|ipv6-sctp|\"\n+\t\t\"ipv6-other|ipv6-frag|l2_payload\",\n+\t.tokens = {\n+\t\t(void *)&cmd_get_sym_hash_ena_per_flow_type_all,\n+\t\t(void *)&cmd_get_sym_hash_ena_per_flow_type_port_id,\n+\t\t(void *)&cmd_get_sym_hash_ena_per_flow_type_flow_type,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Set symmetric hash enable per flow_type *** */\n+struct cmd_set_sym_hash_ena_per_flow_type_result {\n+\tcmdline_fixed_string_t set_sym_hash_ena_per_flow_type;\n+\tcmdline_fixed_string_t enable;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t flow_type;\n+};\n+\n+static void\n+cmd_set_sym_hash_per_flow_type_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_set_sym_hash_ena_per_flow_type_result *res = parsed_result;\n+\tstruct rte_eth_hash_filter_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_filter_supported(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_HASH) < 0) {\n+\t\tprintf(\"RTE_ETH_FILTER_HASH not supported on port: %d\\n\",\n+\t\t\t\t\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.info_type =\n+\t\tRTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_FLOW_TYPE;\n+\tinfo.info.sym_hash_ena.flow_type = parse_flow_type(res->flow_type);\n+\tif (!strcmp(res->enable, \"enable\"))\n+\t\tinfo.info.sym_hash_ena.enable = 1;\n+\tret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,\n+\t\t\t\t\t\tRTE_ETH_FILTER_SET, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot set symmetric hash enable per flow_type to %s \"\n+\t\t\t\"on port %u, flow_type %s\\n\", res->enable ? \"enabled\" :\n+\t\t\t\t\"disabled\", res->port_id, res->flow_type);\n+\t\treturn;\n+\t}\n+\tprintf(\"Symmetic hash has been set to %s on port %u, flow_type %s\\n\",\n+\t\t\t\tres->enable, res->port_id, res->flow_type);\n+}\n+\n+cmdline_parse_token_string_t cmd_set_sym_hash_ena_per_flow_type_all =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_sym_hash_ena_per_flow_type_result,\n+\t\t\t\tset_sym_hash_ena_per_flow_type,\n+\t\t\t\t\"set_sym_hash_ena_per_flow_type\");\n+cmdline_parse_token_num_t cmd_set_sym_hash_ena_per_flow_type_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_sym_hash_ena_per_flow_type_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_string_t cmd_set_sym_hash_ena_per_flow_type_flow_type =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_sym_hash_ena_per_flow_type_result, flow_type,\n+\t\t\"ipv4-udp#ipv4-tcp#ipv4-sctp#ipv4-other#ipv4-frag#ipv6-udp#\"\n+\t\t\"ipv6-tcp#ipv6-sctp#ipv6-other#ipv6-frag#l2_payload\");\n+cmdline_parse_token_string_t cmd_set_sym_hash_ena_per_flow_type_enable =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_sym_hash_ena_per_flow_type_result,\n+\t\tenable, \"enable#disable\");\n+\n+cmdline_parse_inst_t cmd_set_sym_hash_ena_per_flow_type = {\n+\t.f = cmd_set_sym_hash_per_flow_type_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set_sym_hash_ena_per_flow_type pord_id ipv4-udp|ipv4-tcp|\"\n+\t\t\"ipv4-sctp|ipv4-other|ipv4-frag|ipv6-udp|ipv6-tcp|ipv6-sctp|\"\n+\t\t\"ipv6-other|ipv6-frag|l2_payload enable|disable\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_sym_hash_ena_per_flow_type_all,\n+\t\t(void *)&cmd_set_sym_hash_ena_per_flow_type_port_id,\n+\t\t(void *)&cmd_set_sym_hash_ena_per_flow_type_flow_type,\n+\t\t(void *)&cmd_set_sym_hash_ena_per_flow_type_enable,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Get filter swap *** */\n+struct cmd_get_filter_swap_result {\n+\tcmdline_fixed_string_t get_filter_swap;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t flow_type;\n+};\n+\n+static void\n+cmd_get_filter_swap_parsed(void *parsed_result,\n+\t\t\t   __rte_unused struct cmdline *cl,\n+\t\t\t   __rte_unused void *data)\n+{\n+\tstruct cmd_get_filter_swap_result *res = parsed_result;\n+\tstruct rte_eth_hash_filter_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_filter_supported(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_HASH) < 0) {\n+\t\tprintf(\"RTE_ETH_FILTER_HASH not supported on port: %d\\n\",\n+\t\t\t\t\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.info_type = RTE_ETH_HASH_FILTER_SWAP;\n+\tinfo.info.filter_swap.flow_type = parse_flow_type(res->flow_type);\n+\tret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,\n+\t\t\t\t\t\tRTE_ETH_FILTER_GET, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot get filter swap on port %u, flow_type %s\\n\",\n+\t\t\t\t\tres->port_id, res->flow_type);\n+\t\treturn;\n+\t}\n+\tprintf(\"Filter swap of port %u, flow_type %s is configured as:\\n\"\n+\t\t\"off0_src0: 0x%02x, off0_src1: 0x%02x, len0: 0x%02x\\n\"\n+\t\t\"off1_src0: 0x%02x, off1_src1: 0x%02x, len1: 0x%02x\\n\",\n+\t\tres->port_id, res->flow_type, info.info.filter_swap.off0_src0,\n+\t\tinfo.info.filter_swap.off0_src1, info.info.filter_swap.len0,\n+\t\tinfo.info.filter_swap.off1_src0,\n+\t\tinfo.info.filter_swap.off1_src1, info.info.filter_swap.len1);\n+}\n+\n+cmdline_parse_token_string_t cmd_get_filter_swap_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_get_filter_swap_result,\n+\t\tget_filter_swap, \"get_filter_swap\");\n+cmdline_parse_token_num_t cmd_get_filter_swap_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_get_filter_swap_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_string_t cmd_get_filter_swap_flow_type =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_get_filter_swap_result, flow_type,\n+\t\t\"ipv4-udp#ipv4-tcp#ipv4-sctp#ipv4-other#ipv4-frag#ipv6-udp#\"\n+\t\t\"ipv6-tcp#ipv6-sctp#ipv6-other#ipv6-frag#l2_payload\");\n+\n+cmdline_parse_inst_t cmd_get_filter_swap = {\n+\t.f = cmd_get_filter_swap_parsed,\n+\t.data = NULL,\n+\t.help_str = \"get_filter_swap port_id ipv4-udp|ipv4-tcp|ipv4-sctp|\"\n+\t\t\"ipv4-other|ipv4-frag|ipv6-udp|ipv6-tcp|ipv6-sctp|ipv6-other|\"\n+\t\t\"ipv6-frag|l2_payload\",\n+\t.tokens = {\n+\t\t(void *)&cmd_get_filter_swap_all,\n+\t\t(void *)&cmd_get_filter_swap_port_id,\n+\t\t(void *)&cmd_get_filter_swap_flow_type,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Set filter swap *** */\n+struct cmd_set_filter_swap_result {\n+\tcmdline_fixed_string_t set_filter_swap;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t flow_type;\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_set_filter_swap_parsed(void *parsed_result,\n+\t\t\t   __rte_unused struct cmdline *cl,\n+\t\t\t   __rte_unused void *data)\n+{\n+\tstruct cmd_set_filter_swap_result *res = parsed_result;\n+\tstruct rte_eth_hash_filter_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_filter_supported(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_HASH) < 0) {\n+\t\tprintf(\"RTE_ETH_FILTER_HASH not supported on port: %d\\n\",\n+\t\t\t\t\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.info_type = RTE_ETH_HASH_FILTER_SWAP;\n+\tinfo.info.filter_swap.flow_type = parse_flow_type(res->flow_type);\n+\tinfo.info.filter_swap.off0_src0 = res->off0_src0;\n+\tinfo.info.filter_swap.off0_src1 = res->off0_src1;\n+\tinfo.info.filter_swap.len0 = res->len0;\n+\tinfo.info.filter_swap.off1_src0 = res->off1_src0;\n+\tinfo.info.filter_swap.off1_src1 = res->off1_src1;\n+\tinfo.info.filter_swap.len1 = res->len1;\n+\tret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,\n+\t\t\t\t\t\tRTE_ETH_FILTER_SET, &info);\n+\tif (ret < 0) {\n+\t\tprintf(\"Cannot set filter swap on port %u, flow_type %s\\n\",\n+\t\t\t\t\tres->port_id, res->flow_type);\n+\t\treturn;\n+\t}\n+\tprintf(\"Filter swap of port %u, flow_type %s has been set as:\\n\"\n+\t\t\"off0_src0: 0x%02x, off0_src1: 0x%02x, len0: 0x%02x\\n\"\n+\t\t\"off1_src0: 0x%02x, off1_src1: 0x%02x, len1: 0x%02x\\n\",\n+\t\tres->port_id, res->flow_type, info.info.filter_swap.off0_src0,\n+\t\tinfo.info.filter_swap.off0_src1, info.info.filter_swap.len0,\n+\t\tinfo.info.filter_swap.off1_src0,\n+\t\tinfo.info.filter_swap.off1_src1, info.info.filter_swap.len1);\n+}\n+\n+cmdline_parse_token_string_t cmd_set_filter_swap_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_filter_swap_result,\n+\t\tset_filter_swap, \"set_filter_swap\");\n+cmdline_parse_token_num_t cmd_set_filter_swap_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_filter_swap_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_string_t cmd_set_filter_swap_flow_type =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_filter_swap_result, flow_type,\n+\t\t\"ipv4-udp#ipv4-tcp#ipv4-sctp#ipv4-other#ipv4-frag#ipv6-udp#\"\n+\t\t\"ipv6-tcp#ipv6-sctp#ipv6-other#ipv6-frag#l2_payload\");\n+cmdline_parse_token_num_t cmd_set_filter_swap_off0_src0 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_filter_swap_result,\n+\t\toff0_src0, UINT8);\n+cmdline_parse_token_num_t cmd_set_filter_swap_off0_src1 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_filter_swap_result,\n+\t\toff0_src1, UINT8);\n+cmdline_parse_token_num_t cmd_set_filter_swap_len0 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_filter_swap_result,\n+\t\tlen0, UINT8);\n+cmdline_parse_token_num_t cmd_set_filter_swap_off1_src0 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_filter_swap_result,\n+\t\toff1_src0, UINT8);\n+cmdline_parse_token_num_t cmd_set_filter_swap_off1_src1 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_filter_swap_result,\n+\t\toff1_src1, UINT8);\n+cmdline_parse_token_num_t cmd_set_filter_swap_len1 =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_filter_swap_result,\n+\t\tlen1, UINT8);\n+\n+cmdline_parse_inst_t cmd_set_filter_swap = {\n+\t.f = cmd_set_filter_swap_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set_filter_swap port_id ipv4-udp|ipv4-tcp|ipv4-sctp|\"\n+\t\t\"ipv4-other|ipv4-frag|ipv6-udp|ipv6-tcp|ipv6-sctp|ipv6-other|\"\n+\t\t\"ipv6-frag|l2_payload off0_src0 off0_src1 len0 off1_src0 \"\n+\t\t\"off1_src1 len1\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_filter_swap_all,\n+\t\t(void *)&cmd_set_filter_swap_port_id,\n+\t\t(void *)&cmd_set_filter_swap_flow_type,\n+\t\t(void *)&cmd_set_filter_swap_off0_src0,\n+\t\t(void *)&cmd_set_filter_swap_off0_src1,\n+\t\t(void *)&cmd_set_filter_swap_len0,\n+\t\t(void *)&cmd_set_filter_swap_off1_src0,\n+\t\t(void *)&cmd_set_filter_swap_off1_src1,\n+\t\t(void *)&cmd_set_filter_swap_len1,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* Get hash function */\n+struct cmd_get_hash_function_result {\n+\tcmdline_fixed_string_t get_hash_function;\n+\tuint8_t port_id;\n+};\n+\n+static void\n+cmd_get_hash_function_parsed(void *parsed_result,\n+\t\t\t     __rte_unused struct cmdline *cl,\n+\t\t\t     __rte_unused void *data)\n+{\n+\tstruct cmd_get_hash_function_result *res = parsed_result;\n+\tstruct rte_eth_hash_filter_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_filter_supported(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_HASH) < 0) {\n+\t\tprintf(\"RTE_ETH_FILTER_HASH not supported on port %d\\n\",\n+\t\t\t\t\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.info_type = RTE_ETH_HASH_FILTER_HASH_FUNCTION;\n+\tret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,\n+\t\t\t\t\t\tRTE_ETH_FILTER_GET, &info);\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\", info.info.hash_function ==\n+\t\tRTE_ETH_HASH_FUNCTION_TOEPLITZ ? \"Toeplitz\" : \"Simple XOR\");\n+}\n+\n+cmdline_parse_token_string_t cmd_get_hash_function_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_get_hash_function_result,\n+\t\tget_hash_function, \"get_hash_function\");\n+cmdline_parse_token_num_t cmd_get_hash_function_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_get_hash_function_result,\n+\t\tport_id, UINT8);\n+\n+cmdline_parse_inst_t cmd_get_hash_function = {\n+\t.f = cmd_get_hash_function_parsed,\n+\t.data = NULL,\n+\t.help_str = \"get_hash_function port_id\",\n+\t.tokens = {\n+\t\t(void *)&cmd_get_hash_function_all,\n+\t\t(void *)&cmd_get_hash_function_port_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* Set hash function of Hoeplitz or Simple XOR */\n+struct cmd_set_hash_function_result {\n+\tcmdline_fixed_string_t set_hash_function;\n+\tuint8_t port_id;\n+\tcmdline_fixed_string_t hash_function;\n+};\n+\n+static void\n+cmd_set_hash_function_parsed(void *parsed_result,\n+\t\t\t     __rte_unused struct cmdline *cl,\n+\t\t\t     __rte_unused void *data)\n+{\n+\tstruct cmd_set_hash_function_result *res = parsed_result;\n+\tstruct rte_eth_hash_filter_info info;\n+\tint ret;\n+\n+\tif (rte_eth_dev_filter_supported(res->port_id,\n+\t\t\t\tRTE_ETH_FILTER_HASH) < 0) {\n+\t\tprintf(\"RTE_ETH_FILTER_HASH not supported on port %d\\n\",\n+\t\t\t\t\t\t\tres->port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&info, 0, sizeof(info));\n+\tinfo.info_type = RTE_ETH_HASH_FILTER_HASH_FUNCTION;\n+\tif (!strcmp(res->hash_function, \"toeplitz\"))\n+\t\tinfo.info.hash_function = RTE_ETH_HASH_FUNCTION_TOEPLITZ;\n+\telse if (!strcmp(res->hash_function, \"simple_xor\"))\n+\t\tinfo.info.hash_function = RTE_ETH_HASH_FUNCTION_SIMPLE_XOR;\n+\telse {\n+\t\tprintf(\"Unsupported hash function %s\\n\", res->hash_function);\n+\t\treturn;\n+\t}\n+\tret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_HASH,\n+\t\t\t\t\t\tRTE_ETH_FILTER_SET, &info);\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_set_hash_function_all =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_hash_function_result,\n+\t\tset_hash_function, \"set_hash_function\");\n+cmdline_parse_token_num_t cmd_set_hash_function_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_hash_function_result,\n+\t\tport_id, UINT8);\n+cmdline_parse_token_string_t cmd_set_hash_function_hash_function =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_hash_function_result,\n+\t\thash_function, \"toeplitz#simple_xor\");\n+\n+cmdline_parse_inst_t cmd_set_hash_function = {\n+\t.f = cmd_set_hash_function_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set_hash_function port_id toeplitz|simple_xor\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_hash_function_all,\n+\t\t(void *)&cmd_set_hash_function_port_id,\n+\t\t(void *)&cmd_set_hash_function_hash_function,\n+\t\tNULL,\n+\t},\n+};\n+\n /* ******************************************************************************** */\n \n /* list of instructions */\n@@ -7874,6 +8494,14 @@ 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+\t(cmdline_parse_inst_t *)&cmd_get_sym_hash_ena_per_port,\n+\t(cmdline_parse_inst_t *)&cmd_set_sym_hash_ena_per_port,\n+\t(cmdline_parse_inst_t *)&cmd_get_sym_hash_ena_per_flow_type,\n+\t(cmdline_parse_inst_t *)&cmd_set_sym_hash_ena_per_flow_type,\n+\t(cmdline_parse_inst_t *)&cmd_get_filter_swap,\n+\t(cmdline_parse_inst_t *)&cmd_set_filter_swap,\n+\t(cmdline_parse_inst_t *)&cmd_set_hash_function,\n+\t(cmdline_parse_inst_t *)&cmd_get_hash_function,\n \tNULL,\n };\n \n",
    "prefixes": [
        "dpdk-dev",
        "v6",
        "3/3"
    ]
}