Show a patch.

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

{
    "id": 449,
    "url": "https://patches.dpdk.org/api/patches/449/",
    "web_url": "https://patches.dpdk.org/patch/449/",
    "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": "<1411442991-15386-2-git-send-email-jijiang.liu@intel.com>",
    "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": "https://patches.dpdk.org/api/people/52/",
        "name": "Jijiang Liu",
        "email": "jijiang.liu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/449/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/449/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/449/checks/",
    "tags": {},
    "headers": {
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-ExtLoop1": "1",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH 1/5]librte_ether:use new filter framework",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Precedence": "list",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "From": "Jijiang Liu <jijiang.liu@intel.com>",
        "Message-Id": "<1411442991-15386-2-git-send-email-jijiang.liu@intel.com>",
        "Date": "Tue, 23 Sep 2014 11:29:47 +0800",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,577,1406617200\"; d=\"scan'208\";a=\"479342915\"",
        "To": "dev@dpdk.org",
        "References": "<1411442991-15386-1-git-send-email-jijiang.liu@intel.com>",
        "In-Reply-To": "<1411442991-15386-1-git-send-email-jijiang.liu@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "X-BeenThere": "dev@dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Errors-To": "dev-bounces@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 5AAC25920;\n\tTue, 23 Sep 2014 05:23:58 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id DDDF7333\n\tfor <dev@dpdk.org>; Tue, 23 Sep 2014 05:23:55 +0200 (CEST)",
            "from azsmga001.ch.intel.com ([10.2.17.19])\n\tby fmsmga102.fm.intel.com with ESMTP; 22 Sep 2014 20:30:00 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby azsmga001.ch.intel.com with ESMTP; 22 Sep 2014 20:29:59 -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 s8N3Tvxb009990;\n\tTue, 23 Sep 2014 11:29:57 +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 s8N3TtRe015428; Tue, 23 Sep 2014 11:29:57 +0800",
            "(from jijiangl@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8N3Ttbm015424; \n\tTue, 23 Sep 2014 11:29:55 +0800"
        ],
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Introduce a new filter framewok in librte_ether. As to the implemetation discussion, please refer to \nhttp://dpdk.org/ml/archives/dev/2014-September/005179.html, and VF MACVLAN filter implementation is based on it.\n\n\nSigned-off-by: Jijiang Liu <jijiang.liu@intel.com>\nAcked-by: Helin Zhang <helin.zhang@intel.com>\nAcked-by: Jingjing Wu <jingjing.wu@intel.com>\nAcked-by: Changchun Ouyang <changchun.ouyang@intel.com>\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": [
        "dpdk-dev",
        "1/5"
    ]
}