get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 5879,
    "url": "https://patches.dpdk.org/api/patches/5879/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1435407905-11608-2-git-send-email-liang-min.wang@intel.com/",
    "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1435407905-11608-2-git-send-email-liang-min.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1435407905-11608-2-git-send-email-liang-min.wang@intel.com",
    "date": "2015-06-27T12:25:02",
    "name": "[dpdk-dev,v11,1/4] ethdev: add apis to support access device info",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "901dfa04e941252dba0d5e3ea3914691f91b11cf",
    "submitter": {
        "id": 250,
        "url": "https://patches.dpdk.org/api/people/250/?format=api",
        "name": "Liang-Min Larry Wang",
        "email": "liang-min.wang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1435407905-11608-2-git-send-email-liang-min.wang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/5879/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/5879/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id BB814C9A4;\n\tSat, 27 Jun 2015 14:25:18 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 8B9FE5A59\n\tfor <dev@dpdk.org>; Sat, 27 Jun 2015 14:25:14 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP; 27 Jun 2015 05:25:09 -0700",
            "from unknown (HELO lwang14-MOBL6.amr.corp.intel.com)\n\t([10.254.234.138])\n\tby fmsmga001.fm.intel.com with ESMTP; 27 Jun 2015 05:25:09 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.13,689,1427785200\"; d=\"scan'208\";a=\"735860360\"",
        "From": "Liang-Min Larry Wang <liang-min.wang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Sat, 27 Jun 2015 08:25:02 -0400",
        "Message-Id": "<1435407905-11608-2-git-send-email-liang-min.wang@intel.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1435407905-11608-1-git-send-email-liang-min.wang@intel.com>",
        "References": "<1432946276-9424-1-git-send-email-liang-min.wang@intel.com>\n\t<1435407905-11608-1-git-send-email-liang-min.wang@intel.com>",
        "Cc": "Liang-Min Larry Wang <liang-min.wang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v11 1/4] ethdev: add apis to support access\n\tdevice info",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "add new apis:\n- rte_eth_dev_default_mac_addr_set\n- rte_eth_dev_reg_length\n- rte_eth_dev_reg_info\n- rte_eth_dev_eeprom_length\n- rte_eth_dev_get_eeprom\n- rte_eth_dev_set_eeprom\n\nto enable reading device parameters (mac-addr, register,\neeprom) based upon ethtool alike\ndata parameter specification.\n\nSigned-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>\n---\n lib/librte_ether/Makefile              |   1 +\n lib/librte_ether/rte_eth_dev_info.h    |  57 ++++++++++++++++\n lib/librte_ether/rte_ethdev.c          |  99 ++++++++++++++++++++++++++++\n lib/librte_ether/rte_ethdev.h          | 117 +++++++++++++++++++++++++++++++++\n lib/librte_ether/rte_ether_version.map |   6 ++\n 5 files changed, 280 insertions(+)\n create mode 100644 lib/librte_ether/rte_eth_dev_info.h",
    "diff": "diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile\nindex c0e5768..05209e9 100644\n--- a/lib/librte_ether/Makefile\n+++ b/lib/librte_ether/Makefile\n@@ -51,6 +51,7 @@ SRCS-y += rte_ethdev.c\n SYMLINK-y-include += rte_ether.h\n SYMLINK-y-include += rte_ethdev.h\n SYMLINK-y-include += rte_eth_ctrl.h\n+SYMLINK-y-include += rte_eth_dev_info.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_dev_info.h b/lib/librte_ether/rte_eth_dev_info.h\nnew file mode 100644\nindex 0000000..6848051\n--- /dev/null\n+++ b/lib/librte_ether/rte_eth_dev_info.h\n@@ -0,0 +1,57 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015 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_DEV_INFO_H_\n+#define _RTE_ETH_DEV_INFO_H_\n+\n+/*\n+ * Placeholder for accessing device registers\n+ */\n+struct rte_dev_reg_info {\n+\tvoid *buf; /**< Buffer for register */\n+\tuint32_t offset; /**< Offset for 1st register to fetch */\n+\tuint32_t leng; /**< Number of registers to fetch */\n+\tuint32_t version; /**< Device version */\n+};\n+\n+/*\n+ * Placeholder for accessing device eeprom\n+ */\n+struct rte_dev_eeprom_info {\n+\tvoid *buf; /**< Buffer for eeprom */\n+\tuint32_t offset; /**< Offset for 1st eeprom location to access */\n+\tuint32_t leng; /**< Length of eeprom region to access */\n+\tuint32_t magic; /**< Device ID */\n+};\n+\n+#endif /* _RTE_ETH_DEV_INFO_H_ */\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 02cd07f..9a33330 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -2751,6 +2751,30 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)\n }\n \n int\n+rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\n+\t\tPMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n+\t\treturn -ENODEV;\n+\t}\n+\n+\tif (!is_valid_assigned_ether_addr(addr))\n+\t\treturn -EINVAL;\n+\n+\tdev = &rte_eth_devices[port_id];\n+\tFUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);\n+\n+\t/* Update default address in NIC data structure */\n+\tether_addr_copy(addr, &dev->data->mac_addrs[0]);\n+\n+\t(*dev->dev_ops->mac_addr_set)(dev, addr);\n+\n+\treturn 0;\n+}\n+\n+int\n rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,\n \t\t\t\tuint16_t rx_mode, uint8_t on)\n {\n@@ -3644,3 +3668,78 @@ rte_eth_dev_set_mc_addr_list(uint8_t port_id,\n \tFUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);\n \treturn dev->dev_ops->set_mc_addr_list(dev, mc_addr_set, nb_mc_addr);\n }\n+\n+int\n+rte_eth_dev_reg_length(uint8_t port_id)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\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->get_reg_length, -ENOTSUP);\n+\treturn (*dev->dev_ops->get_reg_length)(dev);\n+}\n+\n+int\n+rte_eth_dev_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\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->get_reg, -ENOTSUP);\n+\treturn (*dev->dev_ops->get_reg)(dev, info);\n+}\n+\n+int\n+rte_eth_dev_eeprom_length(uint8_t port_id)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\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->get_eeprom_length, -ENOTSUP);\n+\treturn (*dev->dev_ops->get_eeprom_length)(dev);\n+}\n+\n+int\n+rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\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->get_eeprom, -ENOTSUP);\n+\treturn (*dev->dev_ops->get_eeprom)(dev, info);\n+}\n+\n+int\n+rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)\n+{\n+\tstruct rte_eth_dev *dev;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\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->set_eeprom, -ENOTSUP);\n+\treturn (*dev->dev_ops->set_eeprom)(dev, info);\n+}\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex f1219ac..94d7be0 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -182,6 +182,7 @@ extern \"C\" {\n #include <rte_devargs.h>\n #include \"rte_ether.h\"\n #include \"rte_eth_ctrl.h\"\n+#include \"rte_eth_dev_info.h\"\n \n struct rte_mbuf;\n \n@@ -1233,6 +1234,24 @@ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,\n \t\t\t\t      uint32_t nb_mc_addr);\n /**< @internal set the list of multicast addresses on an Ethernet device */\n \n+typedef int (*eth_get_reg_length_t)(struct rte_eth_dev *dev);\n+/**< @internal Retrieve device register count  */\n+\n+typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,\n+\t\t\t\tstruct rte_dev_reg_info *info);\n+/**< @internal Retrieve registers  */\n+\n+typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);\n+/**< @internal Retrieve eeprom size  */\n+\n+typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,\n+\t\t\t\tstruct rte_dev_eeprom_info *info);\n+/**< @internal Retrieve eeprom data  */\n+\n+typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,\n+\t\t\t\tstruct rte_dev_eeprom_info *info);\n+/**< @internal Program eeprom data  */\n+\n #ifdef RTE_NIC_BYPASS\n \n enum {\n@@ -1372,6 +1391,17 @@ struct eth_dev_ops {\n \treta_update_t reta_update;\n \t/** Query redirection table. */\n \treta_query_t reta_query;\n+\n+\teth_get_reg_length_t get_reg_length;\n+\t/**< Get # of registers */\n+\teth_get_reg_t get_reg;\n+\t/**< Get registers */\n+\teth_get_eeprom_length_t get_eeprom_length;\n+\t/**< Get eeprom length */\n+\teth_get_eeprom_t get_eeprom;\n+\t/**< Get eeprom data */\n+\teth_set_eeprom_t set_eeprom;\n+\t/**< Set eeprom */\n   /* bypass control */\n #ifdef RTE_NIC_BYPASS\n   bypass_init_t bypass_init;\n@@ -2987,6 +3017,20 @@ int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,\n int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr);\n \n /**\n+ * Set the default MAC address.\n+ *\n+ * @param port\n+ *   The port identifier of the Ethernet device.\n+ * @param mac_addr\n+ *   New default MAC address.\n+ * @return\n+ *   - (0) if successful, or *mac_addr* didn't exist.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port* invalid.\n+ */\n+int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr *mac_addr);\n+\n+/**\n  * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device.\n  *\n  * @param port\n@@ -3616,6 +3660,79 @@ int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,\n int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,\n \t\tstruct rte_eth_rxtx_callback *user_cb);\n \n+/**\n+ * Retrieve number of available registers for access\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @return\n+ *   - (>=0) number of registers 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_reg_length(uint8_t port_id);\n+\n+/**\n+ * Retrieve device registers and register attributes\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param info\n+ *   The template includes buffer for register data and attribute to be filled.\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_reg_info(uint8_t port_id, struct rte_dev_reg_info *info);\n+\n+/**\n+ * Retrieve size of device EEPROM\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @return\n+ *   - (>=0) EEPROM size 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_eeprom_length(uint8_t port_id);\n+\n+/**\n+ * Retrieve EEPROM and EEPROM attribute\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param info\n+ *   The template includes buffer for return EEPROM data and\n+ *   EEPROM attributes to be filled.\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_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);\n+\n+/**\n+ * Program EEPROM with provided data\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param info\n+ *   The template includes EEPROM data for programming and\n+ *   EEPROM attributes to be filled\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_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map\nindex 012a82e..40d025b 100644\n--- a/lib/librte_ether/rte_ether_version.map\n+++ b/lib/librte_ether/rte_ether_version.map\n@@ -102,6 +102,12 @@ DPDK_2.0 {\n \trte_eth_tx_queue_setup;\n \trte_eth_xstats_get;\n \trte_eth_xstats_reset;\n+\trte_eth_dev_default_mac_addr_set;\n+\trte_eth_dev_reg_length;\n+\trte_eth_dev_reg_info;\n+\trte_eth_dev_eeprom_length;\n+\trte_eth_dev_get_eeprom;\n+\trte_eth_dev_set_eeprom;\n \n \tlocal: *;\n };\n",
    "prefixes": [
        "dpdk-dev",
        "v11",
        "1/4"
    ]
}