Show a patch.

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

    "id": 449,
    "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-09-23T03:29:47",
    "name": "[dpdk-dev,1/5] librte_ether:use new filter framework",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "09cea45ea8f231703c676073850877554d32a803",
    "submitter": {
        "id": 52,
        "url": "",
        "name": "Jijiang Liu",
        "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,577,1406617200\"; d=\"scan'208\";a=\"479342915\"",
        "Date": "Tue, 23 Sep 2014 11:29:47 +0800",
        "List-Help": "<>",
        "X-BeenThere": "",
        "Message-Id": "<>",
        "X-Original-To": "",
        "Received": [
            "from [] (localhost [IPv6:::1])\n\tby (Postfix) with ESMTP id 5AAC25920;\n\tTue, 23 Sep 2014 05:23:58 +0200 (CEST)",
            "from ( [])\n\tby (Postfix) with ESMTP id DDDF7333\n\tfor <>; Tue, 23 Sep 2014 05:23:55 +0200 (CEST)",
            "from ([])\n\tby with ESMTP; 22 Sep 2014 20:30:00 -0700",
            "from ([])\n\tby with ESMTP; 22 Sep 2014 20:29:59 -0700",
            "from (\n\t[])\n\tby with ESMTP id s8N3Tvxb009990;\n\tTue, 23 Sep 2014 11:29:57 +0800",
            "from (localhost [])\n\tby (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s8N3TtRe015428; Tue, 23 Sep 2014 11:29:57 +0800",
            "(from jijiangl@localhost)\n\tby (8.13.6/8.13.6/Submit) id s8N3Ttbm015424; \n\tTue, 23 Sep 2014 11:29:55 +0800"
        "List-Post": "<>",
        "Subject": "[dpdk-dev] [PATCH 1/5]librte_ether:use new filter framework",
        "Sender": "\"dev\" <>",
        "X-Mailer": "git-send-email",
        "Precedence": "list",
        "From": "Jijiang Liu <>",
        "List-Archive": "<>",
        "X-ExtLoop1": "1",
        "List-Subscribe": "<>,\n\t<>",
        "List-Id": "patches and discussions about DPDK <>",
        "Delivered-To": "",
        "In-Reply-To": "<>",
        "List-Unsubscribe": "<>,\n\t<>",
        "To": "",
        "Errors-To": ""
    "content": "Introduce a new filter framewok in librte_ether. As to the implemetation discussion, please refer to \n, and VF MACVLAN filter implementation is based on it.\n\n\nSigned-off-by: Jijiang Liu <>\nAcked-by: Helin Zhang <>\nAcked-by: Jingjing Wu <>\nAcked-by: Changchun Ouyang <>\n\n---\n lib/librte_ether/Makefile       |    1 +\n lib/librte_ether/rte_eth_ctrl.h |   79 +++++++++++++++++++++++++++++++++++++++\n lib/librte_ether/rte_ethdev.c   |   33 ++++++++++++++++\n lib/librte_ether/rte_ethdev.h   |   48 +++++++++++++++++++++++-\n 4 files changed, 160 insertions(+), 1 deletions(-)\n create mode 100644 lib/librte_ether/rte_eth_ctrl.h",
    "diff": "diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile\nindex b310f8b..a461c31 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_ctrl.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_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h\nnew file mode 100644\nindex 0000000..66745a6\n--- /dev/null\n+++ b/lib/librte_ether/rte_eth_ctrl.h\n@@ -0,0 +1,79 @@\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_CTRL_H_\n+#define _RTE_ETH_CTRL_H_\n+\n+/**\n+ * @file\n+ *\n+ * Ethernet device features and related data structures used\n+ * by control APIs should be defined in this file.\n+ *\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/**\n+ * Feature filter types\n+ */\n+enum rte_filter_type {\n+\tRTE_ETH_FILTER_NONE = 0,\n+\tRTE_ETH_FILTER_RSS,\n+\tRTE_ETH_FILTER_FDIR,\n+\tRTE_ETH_FILTER_MAX,\n+};\n+\n+/**\n+ * All generic operations to filters\n+ */\n+enum rte_filter_op {\n+\tRTE_ETH_FILTER_OP_NONE = 0,\n+\t/**< used to check whether the type filter is supported */\n+\tRTE_ETH_FILTER_OP_ADD,      /**< add filter entry */\n+\tRTE_ETH_FILTER_OP_UPDATE,   /**< update filter entry */\n+\tRTE_ETH_FILTER_OP_DELETE,   /**< delete filter entry */\n+\tRTE_ETH_FILTER_OP_GET,      /**< get filter entry */\n+\tRTE_ETH_FILTER_OP_SET,      /**< configurations */\n+\tRTE_ETH_FILTER_OP_GET_INFO,\n+\t/**< get information of filter, such as status or statistics */\n+\tRTE_ETH_FILTER_OP_MAX,\n+};\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_ETH_CTRL_H_ */\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex fd1010a..a3f45a6 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -3002,3 +3002,36 @@ 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_filter_supported(uint8_t port_id, enum rte_filter_type filter_type)\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+\n+\tdev = &rte_eth_devices[port_id];\n+\tFUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);\n+\treturn (*dev->dev_ops->filter_ctrl)(dev, filter_type,\n+\t\t\t\tRTE_ETH_FILTER_OP_NONE, NULL);\n+}\n+\n+int\n+rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,\n+\t\t       enum rte_filter_op filter_op, void *arg)\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+\n+\tdev = &rte_eth_devices[port_id];\n+\tFUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);\n+\treturn (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op, arg);\n+}\n+\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 50df654..1ac5e5c 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_ctrl.h\"\n \n /**\n  * A structure used to retrieve statistics for an Ethernet port.\n@@ -1361,6 +1362,12 @@ 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_filter_ctrl_t)(struct rte_eth_dev *dev,\n+\t\t\t\t enum rte_filter_type filter_type,\n+\t\t\t\t enum rte_filter_op filter_op,\n+\t\t\t\t void *arg);\n+/**< @internal Take operations to assigned filter type on an Ethernet device */\n+\n /**\n  * @internal A structure containing the functions exported by an Ethernet driver.\n  */\n@@ -1467,6 +1474,7 @@ 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+\teth_filter_ctrl_t              filter_ctrl;          /**< common filter control*/\n };\n \n /**\n@@ -2878,7 +2886,7 @@ int rte_eth_dev_rss_reta_query(uint8_t port,\n  * @return\n  *   - (0) if successful.\n  *   - (-ENOTSUP) if hardware doesn't support.\n-  *  - (-ENODEV) if *port_id* invalid.\n+ *   - (-ENODEV) if *port_id* invalid.\n  *   - (-EINVAL) if bad parameter.\n  */\n int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr,\n@@ -3557,6 +3565,44 @@ 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+ * Check whether the filter type is supported on an Ethernet device.\n+ * All the supported filter types are defined in 'rte_eth_ctrl.h'.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param filter_type\n+ *   filter type.\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support this filter type.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ */\n+int rte_eth_dev_filter_supported(uint8_t port_id,\n+\t\t\t\tenum rte_filter_type filter_type);\n+\n+/**\n+ * Take operations to assigned filter type on an Ethernet device.\n+ * All the supported operations and filter types are defined in 'rte_eth_ctrl.h'.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param filter_type\n+ *   filter type.\n+  * @param filter_op\n+ *   The operation taken to assigned filter.\n+ * @param arg\n+ *   A pointer to arguments defined specifically for the operation.\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_eth_dev_filter_ctrl(uint8_t port_id,\n+\t\t\tenum rte_filter_type filter_type,\n+\t\t\tenum rte_filter_op filter_op, void *arg);\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [