Show a patch.

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

{
    "id": 116,
    "url": "https://patches.dpdk.org/api/patches/116/",
    "web_url": "https://patches.dpdk.org/patch/116/",
    "project": {
        "id": 1,
        "url": "https://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": "<1406876916-24869-4-git-send-email-jingjing.wu@intel.com>",
    "date": "2014-08-01T07:08:33",
    "name": "[dpdk-dev,3/6] ethdev: define new ethdev API rx_classification_filter_ctl",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f3510d6b315f30a5422b8ddf32aa51e85d23fb4f",
    "submitter": {
        "id": 47,
        "url": "https://patches.dpdk.org/api/people/47/",
        "name": "Wu, Jingjing",
        "email": "jingjing.wu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/116/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/116/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/116/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Date": "Fri,  1 Aug 2014 15:08:33 +0800",
        "In-Reply-To": "<1406876916-24869-1-git-send-email-jingjing.wu@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<1406876916-24869-1-git-send-email-jingjing.wu@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "To": "dev@dpdk.org",
        "Received": [
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 2DF13B373\n\tfor <dev@dpdk.org>; Fri,  1 Aug 2014 09:06:55 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP; 01 Aug 2014 00:08:58 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 01 Aug 2014 00:08:56 -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 s7178sV1014892;\n\tFri, 1 Aug 2014 15:08:54 +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 s7178ord025049; Fri, 1 Aug 2014 15:08:52 +0800",
            "(from wujingji@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s7178oqw025045; \n\tFri, 1 Aug 2014 15:08:50 +0800"
        ],
        "From": "Jingjing Wu <jingjing.wu@intel.com>",
        "Precedence": "list",
        "X-ExtLoop1": "1",
        "Message-Id": "<1406876916-24869-4-git-send-email-jingjing.wu@intel.com>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH 3/6] ethdev: define new ethdev API\n\trx_classification_filter_ctl",
        "X-List-Received-Date": "Fri, 01 Aug 2014 07:06:56 -0000",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<wujingji@shecgisg004.sh.intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.01,778,1400050800\"; d=\"scan'208\";a=\"552236257\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "support a new ethdev API rx_classification_filter_ctl for all \nthe configuration or queries for receive classification filters.\nthis patch supports commands the API used below:\n  RTE_CMD_FDIR_RULE_ADD\n  RTE_CMD_FDIR_RULE_DEL\n  RTE_CMD_FDIR_FLUSH\n  RTE_CMD_FDIR_INFO_GET\n\nSigned-off-by: jingjing.wu <jingjing.wu@intel.com>\n---\n lib/librte_ether/Makefile           |   3 +-\n lib/librte_ether/rte_eth_features.h |  64 +++++++++++++++++++++\n lib/librte_ether/rte_ethdev.c       |  19 ++++++-\n lib/librte_ether/rte_ethdev.h       | 108 +++++++++++++++++++++++-------------\n 4 files changed, 154 insertions(+), 40 deletions(-)\n create mode 100644 lib/librte_ether/rte_eth_features.h",
    "diff": "diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile\nindex b310f8b..03dec8a 100644\n--- a/lib/librte_ether/Makefile\n+++ b/lib/librte_ether/Makefile\n@@ -46,8 +46,9 @@ 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\n+DEPDIRS-y += lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf lib/librte_net\n \n include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_ether/rte_eth_features.h b/lib/librte_ether/rte_eth_features.h\nnew file mode 100644\nindex 0000000..ba5eccb\n--- /dev/null\n+++ b/lib/librte_ether/rte_eth_features.h\n@@ -0,0 +1,64 @@\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+/* Commands defined for NIC specific features */\n+enum rte_eth_command {\n+\tRTE_CMD_UNKNOWN = 0,\n+\tRTE_CMD_FDIR_RULE_ADD,\n+\t/**< Command to add a new FDIR filter rule. */\n+\tRTE_CMD_FDIR_RULE_DEL,\n+\t/**< Command to delete a FDIR filter rule. */\n+\tRTE_CMD_FDIR_FLUSH,\n+\t/**< Command to clear all FDIR filter rules. */\n+\tRTE_CMD_FDIR_INFO_GET,\n+\t/**< Command to get FDIR information. */\n+};\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_ETH_FEATURES_H_ */\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex fd1010a..10a08de 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -41,7 +41,6 @@\n #include <errno.h>\n #include <stdint.h>\n #include <inttypes.h>\n-#include <netinet/in.h>\n \n #include <rte_byteorder.h>\n #include <rte_log.h>\n@@ -66,6 +65,7 @@\n #include <rte_errno.h>\n #include <rte_spinlock.h>\n #include <rte_string_fns.h>\n+#include <rte_ip.h>\n \n #include \"rte_ether.h\"\n #include \"rte_ethdev.h\"\n@@ -3002,3 +3002,20 @@ rte_eth_dev_get_flex_filter(uint8_t port_id, uint16_t index,\n \treturn (*dev->dev_ops->get_flex_filter)(dev, index, filter,\n \t\t\t\t\t\trx_queue);\n }\n+\n+int\n+rte_eth_dev_rx_classification_filter_ctl(uint8_t port_id,\n+\t\t\t\t\t enum rte_eth_command cmd,\n+\t\t\t\t\t void *args)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (port_id >= nb_ports) {\n+\t\tPMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n+\t\treturn -ENODEV;\n+\t}\n+\tdev = &rte_eth_devices[port_id];\n+\tFUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_classification_filter_ctl,\n+\t\t\t\t\t\t\t\t-ENOTSUP);\n+\treturn (*dev->dev_ops->rx_classification_filter_ctl)(dev, cmd, args);\n+}\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 50df654..a2d9596 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -177,6 +177,7 @@ extern \"C\" {\n #include <rte_pci.h>\n #include <rte_mbuf.h>\n #include \"rte_ether.h\"\n+#include \"rte_eth_features.h\"\n \n /**\n  * A structure used to retrieve statistics for an Ethernet port.\n@@ -345,47 +346,47 @@ struct rte_eth_rss_conf {\n #define ETH_RSS_IPV4_UDP_SHIFT                6\n #define ETH_RSS_IPV6_UDP_SHIFT                7\n #define ETH_RSS_IPV6_UDP_EX_SHIFT             8\n-/* for 40G only */\n-#define ETH_RSS_NONF_IPV4_UDP_SHIFT           31\n-#define ETH_RSS_NONF_IPV4_TCP_SHIFT           33\n-#define ETH_RSS_NONF_IPV4_SCTP_SHIFT          34\n-#define ETH_RSS_NONF_IPV4_OTHER_SHIFT         35\n-#define ETH_RSS_FRAG_IPV4_SHIFT               36\n-#define ETH_RSS_NONF_IPV6_UDP_SHIFT           41\n-#define ETH_RSS_NONF_IPV6_TCP_SHIFT           43\n-#define ETH_RSS_NONF_IPV6_SCTP_SHIFT          44\n-#define ETH_RSS_NONF_IPV6_OTHER_SHIFT         45\n-#define ETH_RSS_FRAG_IPV6_SHIFT               46\n-#define ETH_RSS_FCOE_OX_SHIFT                 48\n-#define ETH_RSS_FCOE_RX_SHIFT                 49\n-#define ETH_RSS_FCOE_OTHER_SHIFT              50\n-#define ETH_RSS_L2_PAYLOAD_SHIFT              63\n+/* Packet Classification Type for 40G only */\n+#define ETH_PCTYPE_NONF_IPV4_UDP              31\n+#define ETH_PCTYPE_NONF_IPV4_TCP              33\n+#define ETH_PCTYPE_NONF_IPV4_SCTP             34\n+#define ETH_PCTYPE_NONF_IPV4_OTHER            35\n+#define ETH_PCTYPE_FRAG_IPV4                  36\n+#define ETH_PCTYPE_NONF_IPV6_UDP              41\n+#define ETH_PCTYPE_NONF_IPV6_TCP              43\n+#define ETH_PCTYPE_NONF_IPV6_SCTP             44\n+#define ETH_PCTYPE_NONF_IPV6_OTHER            45\n+#define ETH_PCTYPE_FRAG_IPV6                  46\n+#define ETH_PCTYPE_FCOE_OX                    48 /* not used */\n+#define ETH_PCTYPE_FCOE_RX                    49 /* not used */\n+#define ETH_PCTYPE_FCOE_OTHER                 50 /* not used */\n+#define ETH_PCTYPE_L2_PAYLOAD                 63\n \n /* for 1G & 10G */\n-#define ETH_RSS_IPV4                    ((uint16_t)1 << ETH_RSS_IPV4_SHIFT)\n-#define ETH_RSS_IPV4_TCP                ((uint16_t)1 << ETH_RSS_IPV4_TCP_SHIFT)\n-#define ETH_RSS_IPV6                    ((uint16_t)1 << ETH_RSS_IPV6_SHIFT)\n-#define ETH_RSS_IPV6_EX                 ((uint16_t)1 << ETH_RSS_IPV6_EX_SHIFT)\n-#define ETH_RSS_IPV6_TCP                ((uint16_t)1 << ETH_RSS_IPV6_TCP_SHIFT)\n-#define ETH_RSS_IPV6_TCP_EX             ((uint16_t)1 << ETH_RSS_IPV6_TCP_EX_SHIFT)\n-#define ETH_RSS_IPV4_UDP                ((uint16_t)1 << ETH_RSS_IPV4_UDP_SHIFT)\n-#define ETH_RSS_IPV6_UDP                ((uint16_t)1 << ETH_RSS_IPV6_UDP_SHIFT)\n-#define ETH_RSS_IPV6_UDP_EX             ((uint16_t)1 << ETH_RSS_IPV6_UDP_EX_SHIFT)\n+#define ETH_RSS_IPV4                    (1 << ETH_RSS_IPV4_SHIFT)\n+#define ETH_RSS_IPV4_TCP                (1 << ETH_RSS_IPV4_TCP_SHIFT)\n+#define ETH_RSS_IPV6                    (1 << ETH_RSS_IPV6_SHIFT)\n+#define ETH_RSS_IPV6_EX                 (1 << ETH_RSS_IPV6_EX_SHIFT)\n+#define ETH_RSS_IPV6_TCP                (1 << ETH_RSS_IPV6_TCP_SHIFT)\n+#define ETH_RSS_IPV6_TCP_EX             (1 << ETH_RSS_IPV6_TCP_EX_SHIFT)\n+#define ETH_RSS_IPV4_UDP                (1 << ETH_RSS_IPV4_UDP_SHIFT)\n+#define ETH_RSS_IPV6_UDP                (1 << ETH_RSS_IPV6_UDP_SHIFT)\n+#define ETH_RSS_IPV6_UDP_EX             (1 << ETH_RSS_IPV6_UDP_EX_SHIFT)\n /* for 40G only */\n-#define ETH_RSS_NONF_IPV4_UDP           ((uint64_t)1 << ETH_RSS_NONF_IPV4_UDP_SHIFT)\n-#define ETH_RSS_NONF_IPV4_TCP           ((uint64_t)1 << ETH_RSS_NONF_IPV4_TCP_SHIFT)\n-#define ETH_RSS_NONF_IPV4_SCTP          ((uint64_t)1 << ETH_RSS_NONF_IPV4_SCTP_SHIFT)\n-#define ETH_RSS_NONF_IPV4_OTHER         ((uint64_t)1 << ETH_RSS_NONF_IPV4_OTHER_SHIFT)\n-#define ETH_RSS_FRAG_IPV4               ((uint64_t)1 << ETH_RSS_FRAG_IPV4_SHIFT)\n-#define ETH_RSS_NONF_IPV6_UDP           ((uint64_t)1 << ETH_RSS_NONF_IPV6_UDP_SHIFT)\n-#define ETH_RSS_NONF_IPV6_TCP           ((uint64_t)1 << ETH_RSS_NONF_IPV6_TCP_SHIFT)\n-#define ETH_RSS_NONF_IPV6_SCTP          ((uint64_t)1 << ETH_RSS_NONF_IPV6_SCTP_SHIFT)\n-#define ETH_RSS_NONF_IPV6_OTHER         ((uint64_t)1 << ETH_RSS_NONF_IPV6_OTHER_SHIFT)\n-#define ETH_RSS_FRAG_IPV6               ((uint64_t)1 << ETH_RSS_FRAG_IPV6_SHIFT)\n-#define ETH_RSS_FCOE_OX                 ((uint64_t)1 << ETH_RSS_FCOE_OX_SHIFT) /* not used */\n-#define ETH_RSS_FCOE_RX                 ((uint64_t)1 << ETH_RSS_FCOE_RX_SHIFT) /* not used */\n-#define ETH_RSS_FCOE_OTHER              ((uint64_t)1 << ETH_RSS_FCOE_OTHER_SHIFT) /* not used */\n-#define ETH_RSS_L2_PAYLOAD              ((uint64_t)1 << ETH_RSS_L2_PAYLOAD_SHIFT)\n+#define ETH_RSS_NONF_IPV4_UDP           (1ULL << ETH_PCTYPE_NONF_IPV4_UDP)\n+#define ETH_RSS_NONF_IPV4_TCP           (1ULL << ETH_PCTYPE_NONF_IPV4_TCP)\n+#define ETH_RSS_NONF_IPV4_SCTP          (1ULL << ETH_PCTYPE_NONF_IPV4_SCTP)\n+#define ETH_RSS_NONF_IPV4_OTHER         (1ULL << ETH_PCTYPE_NONF_IPV4_OTHER)\n+#define ETH_RSS_FRAG_IPV4               (1ULL << ETH_PCTYPE_FRAG_IPV4)\n+#define ETH_RSS_NONF_IPV6_UDP           (1ULL << ETH_PCTYPE_NONF_IPV6_UDP)\n+#define ETH_RSS_NONF_IPV6_TCP           (1ULL << ETH_PCTYPE_NONF_IPV6_TCP)\n+#define ETH_RSS_NONF_IPV6_SCTP          (1ULL << ETH_PCTYPE_NONF_IPV6_SCTP)\n+#define ETH_RSS_NONF_IPV6_OTHER         (1ULL << ETH_PCTYPE_NONF_IPV6_OTHER)\n+#define ETH_RSS_FRAG_IPV6               (1ULL << ETH_PCTYPE_FRAG_IPV6)\n+#define ETH_RSS_FCOE_OX                 (1ULL << ETH_PCTYPE_FCOE_OX)\n+#define ETH_RSS_FCOE_RX                 (1ULL << ETH_PCTYPE_FCOE_RX)\n+#define ETH_RSS_FCOE_OTHER              (1ULL << ETH_PCTYPE_FCOE_OTHER)\n+#define ETH_RSS_L2_PAYLOAD              (1ULL << ETH_PCTYPE_L2_PAYLOAD)\n \n #define ETH_RSS_IP ( \\\n \t\tETH_RSS_IPV4 | \\\n@@ -1361,6 +1362,11 @@ typedef int (*eth_get_flex_filter_t)(struct rte_eth_dev *dev,\n \t\t\tuint16_t *rx_queue);\n /**< @internal Get a flex filter rule on an Ethernet device */\n \n+typedef int (*eth_rx_classification_filter_ctl_t)(struct rte_eth_dev *dev,\n+\t\t\t\t\t\t  enum rte_eth_command cmd,\n+\t\t\t\t\t\t  void *arg);\n+/**< @internal receive classification filter control operations */\n+\n /**\n  * @internal A structure containing the functions exported by an Ethernet driver.\n  */\n@@ -1467,6 +1473,8 @@ struct eth_dev_ops {\n \teth_add_flex_filter_t          add_flex_filter;      /**< add flex filter. */\n \teth_remove_flex_filter_t       remove_flex_filter;   /**< remove flex filter. */\n \teth_get_flex_filter_t          get_flex_filter;      /**< get flex filter. */\n+\t/*common ccontrol function for receive classification filters*/\n+\teth_rx_classification_filter_ctl_t rx_classification_filter_ctl;\n };\n \n /**\n@@ -3557,6 +3565,30 @@ int rte_eth_dev_remove_flex_filter(uint8_t port_id, uint16_t index);\n int rte_eth_dev_get_flex_filter(uint8_t port_id, uint16_t index,\n \t\t\tstruct rte_flex_filter *filter, uint16_t *rx_queue);\n \n+\n+/**\n+ * Configure the receive classification filter, including hash function\n+ * selection. The commands are NIC specific in its exported public header\n+ * file. Different types of NIC may have different commands.\n+ * All the supported commands are defined in 'rte_eth_features.h'.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param cmd\n+ *   The command.\n+ * @param args\n+ *   A pointer to arguments defined specifically for the command.\n+ *\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if <port_id> is invalid.\n+ *   - others depends on the specific command implementation.\n+ */\n+int rte_eth_dev_rx_classification_filter_ctl(uint8_t port_id,\n+\t\t\t\t\t     enum rte_eth_command cmd,\n+\t\t\t\t\t     void *args);\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "3/6"
    ]
}