Show a patch.

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

{
    "id": 90,
    "url": "http://patches.dpdk.org/api/patches/90/",
    "web_url": "http://patches.dpdk.org/patch/90/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1406184149-11531-5-git-send-email-helin.zhang@intel.com>",
    "date": "2014-07-24T06:42:28",
    "name": "[dpdk-dev,4/5] i40e: support configuring symmetric hash function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "76f8d3c1b159f867b57e1799d500391fb928079f",
    "submitter": {
        "id": 14,
        "url": "http://patches.dpdk.org/api/people/14/",
        "name": "Helin Zhang",
        "email": "helin.zhang@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/90/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/90/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/90/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<hzhan75@shecgisg004.sh.intel.com>",
        "References": "<1406184149-11531-1-git-send-email-helin.zhang@intel.com>",
        "X-Mailman-Version": "2.1.15",
        "X-IronPort-AV": "E=Sophos;i=\"5.01,722,1400050800\"; d=\"scan'208\";a=\"548226825\"",
        "From": "Helin Zhang <helin.zhang@intel.com>",
        "X-List-Received-Date": "Thu, 24 Jul 2014 06:41:20 -0000",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1406184149-11531-5-git-send-email-helin.zhang@intel.com>",
        "Received": [
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 3CD44B360\n\tfor <dev@dpdk.org>; Thu, 24 Jul 2014 08:41:19 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP; 23 Jul 2014 23:42:45 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 23 Jul 2014 23:42:44 -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 s6O6gg8p017105;\n\tThu, 24 Jul 2014 14:42:42 +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 s6O6gdT3011668; Thu, 24 Jul 2014 14:42:41 +0800",
            "(from hzhan75@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s6O6gdCN011664; \n\tThu, 24 Jul 2014 14:42:39 +0800"
        ],
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "Precedence": "list",
        "Date": "Thu, 24 Jul 2014 14:42:28 +0800",
        "Subject": "[dpdk-dev] [PATCH 4/5] i40e: support configuring symmetric hash\n\tfunction",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "X-ExtLoop1": "1",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "In-Reply-To": "<1406184149-11531-1-git-send-email-helin.zhang@intel.com>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "To": "dev@dpdk.org"
    },
    "content": "Symmetric hash function can be configured:\n* Set symmetric hash enable per port.\n* Set symmetric hash enable per pctype (packet classification type).\n* Set the swap configurations.\nCommands are implemented for 'rx_classification_filter_ctl'\nto support above operations which can be called in applications.\nAlso 'check_command_supported' is also implemented to check if\na specific capability(command) is supported or not.\n\nSigned-off-by: Helin Zhang <helin.zhang@intel.com>\n---\n lib/librte_ether/Makefile           |   1 +\n lib/librte_ether/rte_eth_features.h |  65 ++++++\n lib/librte_pmd_i40e/Makefile        |   6 +\n lib/librte_pmd_i40e/i40e_ethdev.c   | 409 ++++++++++++++++++++++++++++++++++++\n lib/librte_pmd_i40e/rte_i40e.h      |  95 +++++++++\n 5 files changed, 576 insertions(+)\n create mode 100644 lib/librte_ether/rte_eth_features.h\n create mode 100644 lib/librte_pmd_i40e/rte_i40e.h",
    "diff": "diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile\nindex b310f8b..8089723 100644\n--- a/lib/librte_ether/Makefile\n+++ b/lib/librte_ether/Makefile\n@@ -46,6 +46,7 @@ SRCS-y += rte_ethdev.c\n #\n SYMLINK-y-include += rte_ether.h\n SYMLINK-y-include += rte_ethdev.h\n+SYMLINK-y-include += rte_eth_features.h\n \n # this lib depends upon:\n DEPDIRS-y += lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf\ndiff --git a/lib/librte_ether/rte_eth_features.h b/lib/librte_ether/rte_eth_features.h\nnew file mode 100644\nindex 0000000..d1790e2\n--- /dev/null\n+++ b/lib/librte_ether/rte_eth_features.h\n@@ -0,0 +1,65 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _RTE_ETH_FEATURES_H_\n+#define _RTE_ETH_FEATURES_H_\n+\n+/**\n+ * @file\n+ *\n+ * Ethernet device specific features\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#define RTE_CMD_UNKNOWN                        0\n+/**< Command unknown. */\n+#define RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE 1\n+/**< Command to set symmetric hash enable per pctype. */\n+#define RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE 2\n+/**< Command to get symmetric hash enable per port. */\n+#define RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT   3\n+/**< Command to set symmetric hash enable per port. */\n+#define RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT   4\n+/**< Command to get filter swap configurations. */\n+#define RTE_CMD_GET_FILTER_SWAP                5\n+/**< Command to set filter swap configurations. */\n+#define RTE_CMD_SET_FILTER_SWAP                6\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_ETH_FEATURES_H_ */\ndiff --git a/lib/librte_pmd_i40e/Makefile b/lib/librte_pmd_i40e/Makefile\nindex 4b31675..a777a76 100644\n--- a/lib/librte_pmd_i40e/Makefile\n+++ b/lib/librte_pmd_i40e/Makefile\n@@ -87,6 +87,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_ethdev.c\n SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_rxtx.c\n SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_ethdev_vf.c\n SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_pf.c\n+\n+#\n+# Export include file\n+#\n+SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include += rte_i40e.h\n+\n # this lib depends upon:\n DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether\n DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_mempool lib/librte_mbuf\ndiff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex cc04c70..b699638 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -48,7 +48,9 @@\n #include <rte_malloc.h>\n #include <rte_memcpy.h>\n #include <rte_dev.h>\n+#include <rte_eth_features.h>\n \n+#include \"rte_i40e.h\"\n #include \"i40e_logs.h\"\n #include \"i40e/i40e_register_x710_int.h\"\n #include \"i40e/i40e_prototype.h\"\n@@ -204,6 +206,13 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev,\n static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,\n \t\t\t\t      struct rte_eth_rss_conf *rss_conf);\n static void i40e_select_hash_function(struct i40e_hw *hw);\n+static void i40e_init_hash_function(struct i40e_hw *hw);\n+static int i40e_dev_check_command_supported(\n+\t\t\t\tstruct rte_eth_dev *dev __rte_unused,\n+\t\t\t\tuint32_t cmd);\n+static int i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev,\n+\t\t\t\t\t     uint32_t cmd,\n+\t\t\t\t\t     void *args);\n \n /* Default hash key buffer for RSS */\n static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1];\n@@ -249,6 +258,8 @@ static struct eth_dev_ops i40e_eth_dev_ops = {\n \t.reta_query                   = i40e_dev_rss_reta_query,\n \t.rss_hash_update              = i40e_dev_rss_hash_update,\n \t.rss_hash_conf_get            = i40e_dev_rss_hash_conf_get,\n+\t.check_command_supported      = i40e_dev_check_command_supported,\n+\t.rx_classification_filter_ctl = i40e_rx_classification_filter_ctl,\n };\n \n static struct eth_driver rte_i40e_pmd = {\n@@ -385,6 +396,8 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,\n \t\treturn ret;\n \t}\n \n+\t/* Init hash functions */\n+\ti40e_init_hash_function(hw);\n \t/* Select hash functions */\n \ti40e_select_hash_function(hw);\n \n@@ -3961,6 +3974,342 @@ i40e_pf_config_mq_rx(struct i40e_pf *pf)\n \treturn 0;\n }\n \n+static int\n+i40e_get_filter_swap(struct i40e_hw *hw, struct rte_i40e_filter_swap_info *info)\n+{\n+\tuint32_t reg;\n+\n+\tif (!hw || !info) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid pointer\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tswitch (info->pctype) {\n+\tcase ETH_PCTYPE_NONF_IPV4_UDP:\n+\tcase ETH_PCTYPE_NONF_IPV4_TCP:\n+\tcase ETH_PCTYPE_NONF_IPV4_SCTP:\n+\tcase ETH_PCTYPE_NONF_IPV4_OTHER:\n+\tcase ETH_PCTYPE_FRAG_IPV4:\n+\tcase ETH_PCTYPE_NONF_IPV6_UDP:\n+\tcase ETH_PCTYPE_NONF_IPV6_TCP:\n+\tcase ETH_PCTYPE_NONF_IPV6_SCTP:\n+\tcase ETH_PCTYPE_NONF_IPV6_OTHER:\n+\tcase ETH_PCTYPE_FRAG_IPV6:\n+\tcase ETH_PCTYPE_L2_PAYLOAD:\n+\t\treg = I40E_READ_REG(hw, I40E_GLQF_SWAP(0, info->pctype));\n+\t\tPMD_DRV_LOG(DEBUG, \"Value read from I40E_GLQF_SWAP[0,%d]: \"\n+\t\t\t\t\t\"0x%x\\n\", info->pctype, reg);\n+\n+\t\t/**\n+\t\t * The offset and length read from register in word unit,\n+\t\t * which need to be converted in byte unit before being saved.\n+\t\t */\n+\t\tinfo->off0_src0 =\n+\t\t\t(uint8_t)((reg & I40E_GLQF_SWAP_OFF0_SRC0_MASK) >>\n+\t\t\t\tI40E_GLQF_SWAP_OFF0_SRC0_SHIFT) << 1;\n+\t\tinfo->off0_src1 =\n+\t\t\t(uint8_t)((reg & I40E_GLQF_SWAP_OFF0_SRC1_MASK) >>\n+\t\t\t\tI40E_GLQF_SWAP_OFF0_SRC1_SHIFT) << 1;\n+\t\tinfo->len0 = (uint8_t)((reg & I40E_GLQF_SWAP_FLEN0_MASK) >>\n+\t\t\t\t\tI40E_GLQF_SWAP_FLEN0_SHIFT) << 1;\n+\t\tinfo->off1_src0 =\n+\t\t\t(uint8_t)((reg & I40E_GLQF_SWAP_OFF1_SRC0_MASK) >>\n+\t\t\t\tI40E_GLQF_SWAP_OFF1_SRC0_SHIFT) << 1;\n+\t\tinfo->off1_src1 =\n+\t\t\t(uint8_t)((reg & I40E_GLQF_SWAP_OFF1_SRC1_MASK) >>\n+\t\t\t\tI40E_GLQF_SWAP_OFF1_SRC1_SHIFT) << 1;\n+\t\tinfo->len1 = (uint8_t)((reg & I40E_GLQF_SWAP_FLEN1_MASK) >>\n+\t\t\t\t\tI40E_GLQF_SWAP_FLEN1_SHIFT) << 1;\n+\t\tbreak;\n+\tcase ETH_PCTYPE_FCOE_OX:\n+\tcase ETH_PCTYPE_FCOE_RX:\n+\tcase ETH_PCTYPE_FCOE_OTHER:\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"PCTYPE[%u] is out of supported range\\n\",\n+\t\t\t\t\t\t\tinfo->pctype);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_set_filter_swap(struct i40e_hw *hw, struct rte_i40e_filter_swap_info *info)\n+{\n+#define I40E_FIELD_LEN_MAX 0x1f\n+#define I40E_FIELD_OFFSET_MAX 0x7f\n+\tuint32_t reg;\n+\n+\tif (!hw || !info) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid pointer\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tswitch (info->pctype) {\n+\tcase ETH_PCTYPE_NONF_IPV4_UDP:\n+\tcase ETH_PCTYPE_NONF_IPV4_TCP:\n+\tcase ETH_PCTYPE_NONF_IPV4_SCTP:\n+\tcase ETH_PCTYPE_NONF_IPV4_OTHER:\n+\tcase ETH_PCTYPE_FRAG_IPV4:\n+\tcase ETH_PCTYPE_NONF_IPV6_UDP:\n+\tcase ETH_PCTYPE_NONF_IPV6_TCP:\n+\tcase ETH_PCTYPE_NONF_IPV6_SCTP:\n+\tcase ETH_PCTYPE_NONF_IPV6_OTHER:\n+\tcase ETH_PCTYPE_FRAG_IPV6:\n+\tcase ETH_PCTYPE_L2_PAYLOAD:\n+\t\tif (info->off0_src0 > I40E_FIELD_OFFSET_MAX) {\n+\t\t\tPMD_DRV_LOG(ERR, \"off0_src0 (0x%x) exceeds the \"\n+\t\t\t\t\"maximum of 0x%x\\n\", info->off0_src0,\n+\t\t\t\t\t\tI40E_FIELD_OFFSET_MAX);\n+\t\t\treturn -1;\n+\t\t} else if (info->off0_src1 > I40E_FIELD_OFFSET_MAX) {\n+\t\t\tPMD_DRV_LOG(ERR, \"off0_src1 (0x%x) exceeds the \"\n+\t\t\t\t\"maximum of 0x%x\\n\", info->off0_src1,\n+\t\t\t\t\t\tI40E_FIELD_OFFSET_MAX);\n+\t\t\treturn -1;\n+\t\t} else if (info->len0 > I40E_FIELD_LEN_MAX) {\n+\t\t\tPMD_DRV_LOG(ERR, \"len0 (0x%x) exceeds the maximum \"\n+\t\t\t\t\"of 0x%x\\n\", info->len0, I40E_FIELD_LEN_MAX);\n+\t\t\treturn -1;\n+\t\t} else if (info->off1_src0 > I40E_FIELD_OFFSET_MAX) {\n+\t\t\tPMD_DRV_LOG(ERR, \"off1_src0 (0x%x) exceeds the \"\n+\t\t\t\t\"maximum of 0x%x\\n\", info->off1_src0,\n+\t\t\t\t\t\tI40E_FIELD_OFFSET_MAX);\n+\t\t\treturn -1;\n+\t\t} else if (info->off1_src1 > I40E_FIELD_OFFSET_MAX) {\n+\t\t\tPMD_DRV_LOG(ERR, \"off1_src1 (0x%x) exceeds the \"\n+\t\t\t\t\"maximum of 0x%x\\n\", info->off1_src1,\n+\t\t\t\t\t\tI40E_FIELD_OFFSET_MAX);\n+\t\t\treturn -1;\n+\t\t} else if (info->len1 > I40E_FIELD_LEN_MAX) {\n+\t\t\tPMD_DRV_LOG(ERR, \"len1 (0x%x) exceeds the maximum \"\n+\t\t\t\t\"of 0x%x\\n\", info->len1, I40E_FIELD_LEN_MAX);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\t/**\n+\t\t * The offset and length given in byte unit, which need to be\n+\t\t * converted in word unit before being written to the register,\n+\t\t * as hardware requires it in word unit.\n+\t\t */\n+\t\treg = (info->off0_src0 >> 1) << I40E_GLQF_SWAP_OFF0_SRC0_SHIFT;\n+\t\treg |= (info->off0_src1 >> 1) <<\n+\t\t\tI40E_GLQF_SWAP_OFF0_SRC1_SHIFT;\n+\t\treg |= (info->len0 >> 1) << I40E_GLQF_SWAP_FLEN0_SHIFT;\n+\t\treg |= (info->off1_src0 >> 1) <<\n+\t\t\tI40E_GLQF_SWAP_OFF1_SRC0_SHIFT;\n+\t\treg |= (info->off1_src1 >> 1) <<\n+\t\t\tI40E_GLQF_SWAP_OFF1_SRC1_SHIFT;\n+\t\treg |= (info->len1 >> 1) << I40E_GLQF_SWAP_FLEN1_SHIFT;\n+\t\tPMD_DRV_LOG(DEBUG, \"Value to be written to \"\n+\t\t\t\"I40E_GLQF_SWAP[0,%d]: 0x%x\\n\", info->pctype, reg);\n+\t\tI40E_WRITE_REG(hw, I40E_GLQF_SWAP(0, info->pctype), reg);\n+\t\tI40E_WRITE_FLUSH(hw);\n+\t\tbreak;\n+\tcase ETH_PCTYPE_FCOE_OX:\n+\tcase ETH_PCTYPE_FCOE_RX:\n+\tcase ETH_PCTYPE_FCOE_OTHER:\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"PCTYPE[%u] is out of supported range\\n\",\n+\t\t\t\t\t\t\tinfo->pctype);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_get_symmetric_hash_enable_per_port(struct i40e_hw *hw, uint8_t *enable)\n+{\n+\tuint32_t reg;\n+\n+\tif (!hw || !enable) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid pointer\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\treg = I40E_READ_REG(hw, I40E_PRTQF_CTL_0);\n+\t*enable = reg & I40E_PRTQF_CTL_0_HSYM_ENA_MASK ? 1 : 0;\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_set_symmetric_hash_enable_per_port(struct i40e_hw *hw, uint8_t *enable)\n+{\n+\tuint32_t reg;\n+\n+\tif (!hw || !enable) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid pointer\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\treg = I40E_READ_REG(hw, I40E_PRTQF_CTL_0);\n+\tif (*enable > 0) {\n+\t\tif (reg & I40E_PRTQF_CTL_0_HSYM_ENA_MASK) {\n+\t\t\tPMD_DRV_LOG(INFO, \"Symmetric hash has already \"\n+\t\t\t\t\t\t\"been enabled\\n\");\n+\t\t\treturn 0;\n+\t\t}\n+\t\treg |= I40E_PRTQF_CTL_0_HSYM_ENA_MASK;\n+\t} else {\n+\t\tif (!(reg & I40E_PRTQF_CTL_0_HSYM_ENA_MASK)) {\n+\t\t\tPMD_DRV_LOG(INFO, \"Symmetric hash has already \"\n+\t\t\t\t\t\t\"been disabled\\n\");\n+\t\t\treturn 0;\n+\t\t}\n+\t\treg &= ~I40E_PRTQF_CTL_0_HSYM_ENA_MASK;\n+\t}\n+\tI40E_WRITE_REG(hw, I40E_PRTQF_CTL_0, reg);\n+\tI40E_WRITE_FLUSH(hw);\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_get_symmetric_hash_enable_per_pctype(struct i40e_hw *hw,\n+\t\t\tstruct rte_i40e_sym_hash_enable_info *info)\n+{\n+\tuint32_t reg;\n+\n+\tif (!hw || !info) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid pointer\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tswitch (info->pctype) {\n+\tcase ETH_PCTYPE_NONF_IPV4_UDP:\n+\tcase ETH_PCTYPE_NONF_IPV4_TCP:\n+\tcase ETH_PCTYPE_NONF_IPV4_SCTP:\n+\tcase ETH_PCTYPE_NONF_IPV4_OTHER:\n+\tcase ETH_PCTYPE_FRAG_IPV4:\n+\tcase ETH_PCTYPE_NONF_IPV6_UDP:\n+\tcase ETH_PCTYPE_NONF_IPV6_TCP:\n+\tcase ETH_PCTYPE_NONF_IPV6_SCTP:\n+\tcase ETH_PCTYPE_NONF_IPV6_OTHER:\n+\tcase ETH_PCTYPE_FRAG_IPV6:\n+\tcase ETH_PCTYPE_L2_PAYLOAD:\n+\t\treg = I40E_READ_REG(hw, I40E_GLQF_HSYM(info->pctype));\n+\t\tbreak;\n+\tcase ETH_PCTYPE_FCOE_OX:\n+\tcase ETH_PCTYPE_FCOE_RX:\n+\tcase ETH_PCTYPE_FCOE_OTHER:\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"PCTYPE[%u] is out of supported range\\n\",\n+\t\t\t\t\t\t\tinfo->pctype);\n+\t\treturn -1;\n+\t}\n+\n+\tinfo->enable = reg & I40E_GLQF_HSYM_SYMH_ENA_MASK ? 1 : 0;\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_set_symmetric_hash_enable_per_pctype(struct i40e_hw *hw,\n+\t\t\tstruct rte_i40e_sym_hash_enable_info *info)\n+{\n+\tuint32_t reg;\n+\n+\tif (!hw || !info) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid pointer\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tswitch (info->pctype) {\n+\tcase ETH_PCTYPE_NONF_IPV4_UDP:\n+\tcase ETH_PCTYPE_NONF_IPV4_TCP:\n+\tcase ETH_PCTYPE_NONF_IPV4_SCTP:\n+\tcase ETH_PCTYPE_NONF_IPV4_OTHER:\n+\tcase ETH_PCTYPE_FRAG_IPV4:\n+\tcase ETH_PCTYPE_NONF_IPV6_UDP:\n+\tcase ETH_PCTYPE_NONF_IPV6_TCP:\n+\tcase ETH_PCTYPE_NONF_IPV6_SCTP:\n+\tcase ETH_PCTYPE_NONF_IPV6_OTHER:\n+\tcase ETH_PCTYPE_FRAG_IPV6:\n+\tcase ETH_PCTYPE_L2_PAYLOAD:\n+\t\treg = info->enable ? I40E_GLQF_HSYM_SYMH_ENA_MASK : 0;\n+\t\tI40E_WRITE_REG(hw, I40E_GLQF_HSYM(info->pctype), reg);\n+\t\tI40E_WRITE_FLUSH(hw);\n+\t\tbreak;\n+\tcase ETH_PCTYPE_FCOE_OX:\n+\tcase ETH_PCTYPE_FCOE_RX:\n+\tcase ETH_PCTYPE_FCOE_OTHER:\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"PCTYPE[%u] is out of supported range\\n\",\n+\t\t\t\t\t\t\tinfo->pctype);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_dev_check_command_supported(struct rte_eth_dev *dev __rte_unused,\n+\t\t\t\t uint32_t cmd)\n+{\n+\tuint32_t i;\n+\t/* Check the commands defined for i40e only in rte_eth_features.h */\n+\tstatic const uint32_t i40e_commands[] = {\n+\t\tRTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE,\n+\t\tRTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE,\n+\t\tRTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT,\n+\t\tRTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT,\n+\t\tRTE_CMD_GET_FILTER_SWAP,\n+\t\tRTE_CMD_SET_FILTER_SWAP,\n+\t};\n+\n+\tfor (i = 0; i < RTE_DIM(i40e_commands); i++) {\n+\t\tif (i40e_commands[i] == cmd)\n+\t\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev,\n+\t\t\t\t  uint32_t cmd,\n+\t\t\t\t  void *args)\n+{\n+\tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tint ret = 0;\n+\n+\tswitch (cmd) {\n+\tcase RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE:\n+\t\tret = i40e_get_symmetric_hash_enable_per_pctype(hw,\n+\t\t\t(struct rte_i40e_sym_hash_enable_info *)args);\n+\t\tbreak;\n+\tcase RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE:\n+\t\tret = i40e_set_symmetric_hash_enable_per_pctype(hw,\n+\t\t\t(struct rte_i40e_sym_hash_enable_info *)args);\n+\t\tbreak;\n+\tcase RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT:\n+\t\tret = i40e_get_symmetric_hash_enable_per_port(hw,\n+\t\t\t\t\t\t(uint8_t *)args);\n+\t\tbreak;\n+\tcase RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT:\n+\t\tret = i40e_set_symmetric_hash_enable_per_port(hw,\n+\t\t\t\t\t\t(uint8_t *)args);\n+\t\tbreak;\n+\tcase RTE_CMD_GET_FILTER_SWAP:\n+\t\tret = i40e_get_filter_swap(hw,\n+\t\t\t(struct rte_i40e_filter_swap_info *)args);\n+\t\tbreak;\n+\tcase RTE_CMD_SET_FILTER_SWAP:\n+\t\tret = i40e_set_filter_swap(hw,\n+\t\t\t(struct rte_i40e_filter_swap_info *)args);\n+\t\tbreak;\n+\tdefault:\n+\t\tret = -1;\n+\t\tPMD_DRV_LOG(ERR, \"Unknown command which is not \"\n+\t\t\t\t\t\"supported by i40e\\n\");\n+\t\tbreak;\n+\t}\n+\n+\treturn ret;\n+}\n+\n static void\n i40e_select_hash_function(struct i40e_hw *hw)\n {\n@@ -3986,3 +4335,63 @@ i40e_select_hash_function(struct i40e_hw *hw)\n \tI40E_WRITE_REG(hw, I40E_GLQF_CTL, reg);\n \tI40E_WRITE_FLUSH(hw);\n }\n+\n+/**\n+ * Initialize filter swap configurations and symmetric hash control\n+ * configurations, as only global reset can reload the firmware\n+ * configurations.\n+ */\n+static void\n+i40e_init_hash_function(struct i40e_hw *hw)\n+{\n+\tstatic struct rte_i40e_filter_swap_info swap_info[] = {\n+\t\t{ETH_PCTYPE_NONF_IPV4_UDP,\n+\t\t\t0x1e, 0x36, 0x04, 0x3a, 0x3c, 0x02},\n+\t\t{ETH_PCTYPE_NONF_IPV4_TCP,\n+\t\t\t0x1e, 0x36, 0x04, 0x3a, 0x3c, 0x02},\n+\t\t{ETH_PCTYPE_NONF_IPV4_SCTP,\n+\t\t\t0x1e, 0x36, 0x04, 0x00, 0x00, 0x00},\n+\t\t{ETH_PCTYPE_NONF_IPV4_OTHER,\n+\t\t\t0x1e, 0x36, 0x04, 0x00, 0x00, 0x00},\n+\t\t{ETH_PCTYPE_FRAG_IPV4,\n+\t\t\t0x1e, 0x36, 0x04, 0x00, 0x00, 0x00},\n+\t\t{ETH_PCTYPE_NONF_IPV6_UDP,\n+\t\t\t0x1a, 0x2a, 0x10, 0x3a, 0x3c, 0x02},\n+\t\t{ETH_PCTYPE_NONF_IPV6_TCP,\n+\t\t\t0x1a, 0x2a, 0x10, 0x3a, 0x3c, 0x02},\n+\t\t{ETH_PCTYPE_NONF_IPV6_SCTP,\n+\t\t\t0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00},\n+\t\t{ETH_PCTYPE_NONF_IPV6_OTHER,\n+\t\t\t0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00},\n+\t\t{ETH_PCTYPE_FRAG_IPV6,\n+\t\t\t0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00},\n+\t\t{ETH_PCTYPE_L2_PAYLOAD,\n+\t\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00},\n+\t};\n+\tstatic struct rte_i40e_sym_hash_enable_info sym_hash_ena_info[] = {\n+\t\t{ETH_PCTYPE_NONF_IPV4_UDP, 0},\n+\t\t{ETH_PCTYPE_NONF_IPV4_TCP, 0},\n+\t\t{ETH_PCTYPE_NONF_IPV4_SCTP, 0},\n+\t\t{ETH_PCTYPE_NONF_IPV4_OTHER, 0},\n+\t\t{ETH_PCTYPE_FRAG_IPV4, 0},\n+\t\t{ETH_PCTYPE_NONF_IPV6_UDP, 0},\n+\t\t{ETH_PCTYPE_NONF_IPV6_TCP, 0},\n+\t\t{ETH_PCTYPE_NONF_IPV6_SCTP, 0},\n+\t\t{ETH_PCTYPE_NONF_IPV6_OTHER, 0},\n+\t\t{ETH_PCTYPE_FRAG_IPV6, 0},\n+\t\t{ETH_PCTYPE_L2_PAYLOAD, 0},\n+\t};\n+\tuint32_t i;\n+\n+\t/* initialize filter swap */\n+\tfor (i = 0; i < RTE_DIM(swap_info); i++)\n+\t\ti40e_set_filter_swap(hw, &swap_info[i]);\n+\n+\t/* disable all symmetric hash per pctype */\n+\tfor (i = 0; i < RTE_DIM(sym_hash_ena_info); i++)\n+\t\ti40e_set_symmetric_hash_enable_per_pctype(hw,\n+\t\t\t\t\t&sym_hash_ena_info[i]);\n+\n+\t/* disable symmetric hash per port */\n+\ti40e_set_symmetric_hash_enable_per_port(hw, 0);\n+}\ndiff --git a/lib/librte_pmd_i40e/rte_i40e.h b/lib/librte_pmd_i40e/rte_i40e.h\nnew file mode 100644\nindex 0000000..211e566\n--- /dev/null\n+++ b/lib/librte_pmd_i40e/rte_i40e.h\n@@ -0,0 +1,95 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _RTE_I40E_H_\n+#define _RTE_I40E_H_\n+\n+/**\n+ * @file\n+ *\n+ * RTE I40E\n+ *\n+ * The I40E defines the commands and structures specifically for i40e hardware\n+ * features. As different types of NIC hardware may have different features,\n+ * they might not be common for all types of NIC hardwares. The commands and\n+ * structures can be used in applications directly together with generalized\n+ * APIs declared in rte_ethdev.h. The commands couldn't be supported by\n+ * non-i40e PMD.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/**\n+ * For commands:\n+ * 'RTE_CMD_GET_FILTER_SWAP'\n+ * 'RTE_CMD_SET_FILTER_SWAP'\n+ *\n+ * A structure used to get/set filter swap. All of the offsets and\n+ * length are defined in bytes.\n+ */\n+struct rte_i40e_filter_swap_info {\n+\t/**< Packet classification type, defined in rte_ethdev.h */\n+\tuint8_t pctype;\n+\t/**< Offset of the 1st field of the 1st couple to be swapped. */\n+\tuint8_t off0_src0;\n+\t/**< Offset of the 2nd field of the 1st couple to be swapped. */\n+\tuint8_t off0_src1;\n+\t/**< Field length of the first couple. */\n+\tuint8_t len0;\n+\t/**< Offset of the 1st field of the 2nd couple to be swapped. */\n+\tuint8_t off1_src0;\n+\t/**< Offset of the 2nd field of the 2nd couple to be swapped. */\n+\tuint8_t off1_src1;\n+\t/**< Field length of the second couple. */\n+\tuint8_t len1;\n+};\n+\n+/**\n+ * For commands:\n+ * 'RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE'\n+ * 'RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE'\n+ *\n+ * A structure used to set/get symmetric hash enable per pctype.\n+ */\n+struct rte_i40e_sym_hash_enable_info {\n+\tuint8_t pctype; /**< packet classification type */\n+\tuint8_t enable; /**< enable or disable flag */\n+};\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#endif /* _RTE_I40E_H_ */\n",
    "prefixes": [
        "dpdk-dev",
        "4/5"
    ]
}