Show a patch.

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

{
    "id": 105,
    "url": "https://patches.dpdk.org/api/patches/105/",
    "web_url": "https://patches.dpdk.org/patch/105/",
    "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": "<1406535955-31070-3-git-send-email-helin.zhang@intel.com>",
    "date": "2014-07-28T08:25:51",
    "name": "[dpdk-dev,v2,2/6] ethdev: add new ops of 'is_command_supported' and 'rx_classification_filter_ctl'",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "057d87a2e6bd71a520ea5a21ee723afb88c6cd5c",
    "submitter": {
        "id": 14,
        "url": "https://patches.dpdk.org/api/people/14/",
        "name": "Helin Zhang",
        "email": "helin.zhang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/105/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/105/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/105/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Date": "Mon, 28 Jul 2014 16:25:51 +0800",
        "In-Reply-To": "<1406535955-31070-1-git-send-email-helin.zhang@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<1406535955-31070-1-git-send-email-helin.zhang@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 mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 2CB43B361\n\tfor <dev@dpdk.org>; Mon, 28 Jul 2014 10:24:37 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga102.fm.intel.com with ESMTP; 28 Jul 2014 01:26:21 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 28 Jul 2014 01:26:09 -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 s6S8Q7kQ022882;\n\tMon, 28 Jul 2014 16:26:07 +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 s6S8Q3q3031194; Mon, 28 Jul 2014 16:26:05 +0800",
            "(from hzhan75@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s6S8Q3ce031190; \n\tMon, 28 Jul 2014 16:26:03 +0800"
        ],
        "From": "Helin Zhang <helin.zhang@intel.com>",
        "Precedence": "list",
        "X-ExtLoop1": "1",
        "Message-Id": "<1406535955-31070-3-git-send-email-helin.zhang@intel.com>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v2 2/6] ethdev: add new ops of\n\t'is_command_supported' and 'rx_classification_filter_ctl'",
        "X-List-Received-Date": "Mon, 28 Jul 2014 08:24:38 -0000",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<hzhan75@shecgisg004.sh.intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.01,747,1400050800\"; d=\"scan'208\";a=\"568219922\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "Two ops of 'is_command_supported' and\n'rx_classification_filter_ctl' are added. New header\nfile of 'rte_eth_features.h' is added.\n* 'is_command_supported': It is for capability discovery,\n  that is to check if specific feature/command is\n  supported on a port.\n* 'rx_classification_filter_ctl': It is for receive\n  classification filter configuring. e.g. selecting hash\n  function, possibly configuring flow director. It is a\n  common API where a lot of commands can be implemented\n  for different sub features, to avoid defining quite a\n  lot of ops for device specific features.\n* 'rte_eth_features.h': It includes all the feature\n  commands which can be checked and processed in above\n  two ops. Also it may include other commands for future\n  implementations.\n\nSigned-off-by: Helin Zhang <helin.zhang@intel.com>\n---\n lib/librte_ether/Makefile           |  1 +\n lib/librte_ether/rte_eth_features.h | 73 +++++++++++++++++++++++++++++++++++++\n lib/librte_ether/rte_ethdev.c       | 31 ++++++++++++++++\n lib/librte_ether/rte_ethdev.h       | 55 ++++++++++++++++++++++++++++\n 4 files changed, 160 insertions(+)\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..8089723 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_features.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_features.h b/lib/librte_ether/rte_eth_features.h\nnew file mode 100644\nindex 0000000..983d7c6\n--- /dev/null\n+++ b/lib/librte_ether/rte_eth_features.h\n@@ -0,0 +1,73 @@\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+\t/**< Unknown command */\n+\tRTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE,\n+\t/**< Get symmetric hash enable per pctype */\n+\tRTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE,\n+\t/**< Set symmetric hash enable per pctype */\n+\tRTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT,\n+\t/**< Get symmetric hash enable per port */\n+\tRTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT,\n+\t/**< Set symmetric hash enable per port */\n+\tRTE_CMD_GET_FILTER_SWAP,\n+\t/**< Get filter swap configurations */\n+\tRTE_CMD_SET_FILTER_SWAP,\n+\t/**< Set filter swap configurations */\n+\tRTE_CMD_GET_HASH_FUNCTION,\n+\t/**< Get hash function */\n+\tRTE_CMD_SET_HASH_FUNCTION,\n+\t/**< Set hash function */\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..dfeb804 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -3002,3 +3002,34 @@ 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_is_command_supported(uint8_t port_id, enum rte_eth_command cmd)\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->is_command_supported, -ENOTSUP);\n+\treturn (*dev->dev_ops->is_command_supported)(dev, cmd);\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 dd36605..5c5d84e 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@@ -1240,6 +1241,15 @@ typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,\n \t\t\t\t  uint8_t rule_id);\n /**< @internal Remove a traffic mirroring rule on an Ethernet device */\n \n+typedef int (*eth_is_command_supported_t)(struct rte_eth_dev *dev,\n+\t\t\t\t\t  enum rte_eth_command cmd);\n+/**< @internal check if the command is supported by the 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 #ifdef RTE_NIC_BYPASS\n \n enum {\n@@ -1467,6 +1477,10 @@ 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_is_command_supported_t     is_command_supported;\n+\t/**< check if a command is supported. */\n+\teth_rx_classification_filter_ctl_t rx_classification_filter_ctl;\n+\t/**< common control function of hw hash */\n };\n \n /**\n@@ -3557,6 +3571,47 @@ 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 if the command is supported by an Ethernet device. All the commands\n+ * 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+ *\n+ * @return\n+ *   - (> 0) The command is supported.\n+ *   - (0) The command is not supported.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if <port_id> is invalid.\n+ */\n+int rte_eth_dev_is_command_supported(uint8_t port_id,\n+\t\t\t\t     enum rte_eth_command cmd);\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",
        "v2",
        "2/6"
    ]
}