Show a patch.

GET /api/patches/245/
Content-Type: application/json
Vary: Accept

    "id": 245,
    "url": "",
    "web_url": "",
    "project": {
        "id": 1,
        "url": "",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "",
        "list_email": "",
        "web_url": "",
        "scm_url": "git://",
        "webscm_url": ""
    "msgid": "<>",
    "date": "2014-08-27T02:13:49",
    "name": "[dpdk-dev,v2,2/7] ethdev: define new ethdev API rx_classification_filter_ctl",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b90ec75a09c358c60743596b503025479499a7ec",
    "submitter": {
        "id": 47,
        "url": "",
        "name": "Wu, Jingjing",
        "email": ""
    "delegate": null,
    "mbox": "",
    "series": [],
    "comments": "",
    "check": "pending",
    "checks": "",
    "tags": {},
    "headers": {
        "Return-Path": "<>",
        "References": "<>",
        "X-Mailman-Version": "2.1.15",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,408,1406617200\"; d=\"scan'208\";a=\"593783863\"",
        "From": "Jingjing Wu <>",
        "X-List-Received-Date": "Wed, 27 Aug 2014 02:10:34 -0000",
        "X-BeenThere": "",
        "Message-Id": "<>",
        "Received": [
            "from ( [])\n\tby (Postfix) with ESMTP id 4747A58EE\n\tfor <>; Wed, 27 Aug 2014 04:10:33 +0200 (CEST)",
            "from ([])\n\tby with ESMTP; 26 Aug 2014 19:14:17 -0700",
            "from ([])\n\tby with ESMTP; 26 Aug 2014 19:14:15 -0700",
            "from (\n\t[])\n\tby with ESMTP id s7R2EEsb005232;\n\tWed, 27 Aug 2014 10:14:14 +0800",
            "from (localhost [])\n\tby (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s7R2EBCM030103; Wed, 27 Aug 2014 10:14:13 +0800",
            "(from wujingji@localhost)\n\tby (8.13.6/8.13.6/Submit) id s7R2EB8M030099; \n\tWed, 27 Aug 2014 10:14:11 +0800"
        "List-Post": "<>",
        "List-Help": "<>",
        "X-Mailer": "git-send-email",
        "Precedence": "list",
        "Date": "Wed, 27 Aug 2014 10:13:49 +0800",
        "Subject": "[dpdk-dev] [PATCH v2 2/7] ethdev: define new ethdev API\n\trx_classification_filter_ctl",
        "List-Archive": "<>",
        "X-ExtLoop1": "1",
        "List-Subscribe": "<>,\n\t<>",
        "List-Id": "patches and discussions about DPDK <>",
        "In-Reply-To": "<>",
        "List-Unsubscribe": "<>,\n\t<>",
        "To": ""
    "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 <>\nReviewed-by: Helin Zhang <>\nReviewed-by: Jing Chen <>\nReviewed-by: Jijiang Liu <>\n \n---\n lib/librte_ether/Makefile           |   3 +-\n lib/librte_ether/rte_eth_features.h |  65 ++++++++++++++++++++++\n lib/librte_ether/rte_ethdev.c       |  19 ++++++-\n lib/librte_ether/rte_ethdev.h       | 108 +++++++++++++++++++++++-------------\n 4 files changed, 155 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/\ndiff --git a/lib/librte_ether/rte_eth_features.h b/lib/librte_ether/rte_eth_features.h\nnew file mode 100644\nindex 0000000..ea77b69\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+/* 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+\tRTE_CMD_MAX = 255,\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": [