Show a patch.

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

{
    "id": 365,
    "url": "https://patches.dpdk.org/api/patches/365/?format=api",
    "web_url": "https://patches.dpdk.org/patch/365/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "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": "<1410503639-10753-5-git-send-email-jijiang.liu@intel.com>",
    "date": "2014-09-12T06:33:55",
    "name": "[dpdk-dev,v3,4/8] librte_ether:add a common filter API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0e2f80051f475fb992de76233dca35da5e7ecf60",
    "submitter": {
        "id": 52,
        "url": "https://patches.dpdk.org/api/people/52/?format=api",
        "name": "Jijiang Liu",
        "email": "jijiang.liu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/365/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/365/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/365/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,511,1406617200\"; d=\"scan'208\";a=\"477052394\"",
        "Precedence": "list",
        "X-Mailman-Version": "2.1.15",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "References": "<1410503639-10753-1-git-send-email-jijiang.liu@intel.com>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v3 4/8]librte_ether:add a common filter API",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 31B98B397;\n\tFri, 12 Sep 2014 08:29:02 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 380E0B397\n\tfor <dev@dpdk.org>; Fri, 12 Sep 2014 08:28:59 +0200 (CEST)",
            "from azsmga001.ch.intel.com ([10.2.17.19])\n\tby fmsmga101.fm.intel.com with ESMTP; 11 Sep 2014 23:34:15 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby azsmga001.ch.intel.com with ESMTP; 11 Sep 2014 23:34:14 -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 s8C6YCLc005980;\n\tFri, 12 Sep 2014 14:34:12 +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 s8C6YA1U010816; Fri, 12 Sep 2014 14:34:12 +0800",
            "(from jijiangl@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8C6YAZN010812; \n\tFri, 12 Sep 2014 14:34:10 +0800"
        ],
        "To": "dev@dpdk.org",
        "X-Mailer": "git-send-email 1.7.4.1",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-ExtLoop1": "1",
        "Date": "Fri, 12 Sep 2014 14:33:55 +0800",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "From": "Jijiang Liu <jijiang.liu@intel.com>",
        "In-Reply-To": "<1410503639-10753-1-git-send-email-jijiang.liu@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<1410503639-10753-5-git-send-email-jijiang.liu@intel.com>",
        "Return-Path": "<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 VxLAN tunnel filter implementation is based on\nit.\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>\n\n---\n lib/librte_ether/Makefile       |    1 +\n lib/librte_ether/rte_eth_ctrl.h |  152 +++++++++++++++++++++++++++++++++++++++\n lib/librte_ether/rte_ethdev.c   |   32 ++++++++\n lib/librte_ether/rte_ethdev.h   |   56 +++++++++++---\n 4 files changed, 229 insertions(+), 12 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..3e2bf45\n--- /dev/null\n+++ b/lib/librte_ether/rte_eth_ctrl.h\n@@ -0,0 +1,152 @@\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_TUNNEL,\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+/**** TUNNEL FILTER DATA DEFINATION *** */\n+\n+#define ETH_TUNNEL_FILTER_OMAC  0x01\n+#define ETH_TUNNEL_FILTER_OIP   0x02\n+#define ETH_TUNNEL_FILTER_TENID 0x04\n+#define ETH_TUNNEL_FILTER_IMAC  0x08\n+#define ETH_TUNNEL_FILTER_IVLAN 0x10\n+#define ETH_TUNNEL_FILTER_IIP   0x20\n+\n+#define RTE_TUNNEL_FLAGS_TO_QUEUE 1\n+\n+/*\n+ * Tunneled filter type\n+ */\n+enum rte_tunnel_filter_type {\n+\tRTE_TUNNEL_FILTER_TYPE_NONE = 0,\n+\tRTE_TUNNEL_FILTER_OIP = ETH_TUNNEL_FILTER_OIP,\n+\tRTE_TUNNEL_FILTER_IMAC_IVLAN =\n+\t\tETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_IVLAN,\n+\tRTE_TUNNEL_FILTER_IMAC_IVLAN_TENID =\n+\t\tETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_IVLAN |\n+\t\tETH_TUNNEL_FILTER_TENID,\n+\tRTE_TUNNEL_FILTER_IMAC_TENID =\n+\t\tETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_TENID,\n+\tRTE_TUNNEL_FILTER_IMAC = ETH_TUNNEL_FILTER_IMAC,\n+\tRTE_TUNNEL_FILTER_OMAC_TENID_IMAC =\n+\t\tETH_TUNNEL_FILTER_OMAC | ETH_TUNNEL_FILTER_TENID |\n+\t\tETH_TUNNEL_FILTER_IMAC,\n+\tRTE_TUNNEL_FILTER_IIP = ETH_TUNNEL_FILTER_IIP,\n+\tRTE_TUNNEL_FILTER_TYPE_MAX,\n+};\n+\n+/**\n+ *  Select IPv4 or IPv6 for tunnel filters.\n+ */\n+enum rte_tunnel_iptype {\n+\tRTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4. */\n+\tRTE_TUNNEL_IPTYPE_IPV6,     /**< IPv6. */\n+};\n+\n+/**\n+ * Tunneled type.\n+ */\n+enum rte_eth_tunnel_type {\n+\tRTE_TUNNEL_TYPE_NONE = 0,\n+\tRTE_TUNNEL_TYPE_VXLAN,\n+\tRTE_TUNNEL_TYPE_GENEVE,\n+\tRTE_TUNNEL_TYPE_TEREDO,\n+\tRTE_TUNNEL_TYPE_NVGRE,\n+\tRTE_TUNNEL_TYPE_MAX,\n+};\n+\n+/**\n+ * Tunnel Packet filter configuration.\n+ */\n+struct rte_eth_tunnel_filter_conf {\n+\tstruct ether_addr *outer_mac;  /**< Outer MAC address fiter. */\n+\tstruct ether_addr *inner_mac;  /**< Inner MAC address fiter. */\n+\tuint16_t inner_vlan;           /**< Inner VLAN fiter. */\n+\tenum rte_tunnel_iptype ip_type; /**< IP address type. */\n+\tunion {\n+\t\tuint32_t ipv4_addr;    /**< IPv4 source address to match. */\n+\t\tuint32_t ipv6_addr[4]; /**< IPv6 source address to match. */\n+\t} ip_addr; /**< IPv4/IPv6 source address to match (union of above). */\n+\n+\tuint8_t filter_type;           /**< Filter type. */\n+\tuint8_t to_queue;       /**< Use MAC and VLAN to point to a queue. */\n+\tenum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type. */\n+\tuint32_t tenant_id;            /** < Tenant number. */\n+\tuint16_t queue_id;             /** < queue number. */\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 325edb1..e5b24f5 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -3065,3 +3065,35 @@ 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+}\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 74ac313..156d05b 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@@ -716,18 +717,6 @@ struct rte_eth_udp_tunnel {\n };\n \n /**\n- * Tunneled type.\n- */\n-enum rte_eth_tunnel_type {\n-\tRTE_TUNNEL_TYPE_NONE = 0,\n-\tRTE_TUNNEL_TYPE_VXLAN,\n-\tRTE_TUNNEL_TYPE_GENEVE,\n-\tRTE_TUNNEL_TYPE_TEREDO,\n-\tRTE_TUNNEL_TYPE_NVGRE,\n-\tRTE_TUNNEL_TYPE_MAX,\n-};\n-\n-/**\n  *  Possible l4type of FDIR filters.\n  */\n enum rte_l4type {\n@@ -1393,6 +1382,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@@ -1501,6 +1496,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@@ -3633,6 +3629,42 @@ 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_filter.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, enum 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_filter.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, enum 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",
        "v3",
        "4/8"
    ]
}