get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2374,
    "url": "https://patches.dpdk.org/api/patches/2374/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421664027-17971-10-git-send-email-mukawa@igel.co.jp/",
    "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": "<1421664027-17971-10-git-send-email-mukawa@igel.co.jp>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1421664027-17971-10-git-send-email-mukawa@igel.co.jp",
    "date": "2015-01-19T10:40:25",
    "name": "[dpdk-dev,v4,09/11] ethdev: Add one dev_type paramerter to rte_eth_dev_allocate",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2da3a5575aa2f2ad21ff0a2338e49f0273c8855b",
    "submitter": {
        "id": 64,
        "url": "https://patches.dpdk.org/api/people/64/?format=api",
        "name": "Tetsuya Mukawa",
        "email": "mukawa@igel.co.jp"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421664027-17971-10-git-send-email-mukawa@igel.co.jp/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2374/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2374/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 256375ABA;\n\tMon, 19 Jan 2015 11:41:45 +0100 (CET)",
            "from mail-pd0-f171.google.com (mail-pd0-f171.google.com\n\t[209.85.192.171]) by dpdk.org (Postfix) with ESMTP id 885E65AB7\n\tfor <dev@dpdk.org>; Mon, 19 Jan 2015 11:41:24 +0100 (CET)",
            "by mail-pd0-f171.google.com with SMTP id fp1so14534854pdb.2\n\tfor <dev@dpdk.org>; Mon, 19 Jan 2015 02:41:23 -0800 (PST)",
            "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby mx.google.com with ESMTPSA id\n\ta13sm11337588pdm.44.2015.01.19.02.41.22\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 19 Jan 2015 02:41:23 -0800 (PST)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=Ss1/1jLF2HT6m7vrn8seoNS4wiDKPEAmB8tCnMVEMM0=;\n\tb=RgryCbJ+tnkJFyqNuLAmcW/NBdpXfjdWhVPDZhbMZLP2EbXiKgvldr53YY9bMemwWH\n\tZ2pjgNQCDRv1oYkOoSSrgXprmGAgh/tjUnol20tzzMTQZyv+9/MEWbLJ9woFkXTsqW2v\n\t5DYUMqYtms2x7bLhSv1MWizIWZP1NtK+44VW/GfqirEr16hDDlBGH8rJXD6N6pQOto0S\n\tkJjVQ7/mndwwbsvqg6sA0KILdH0X9vgfXNwpt71ojW/glH07e++/m3Auq6BVhjDH79d2\n\tn1/e6DR+BvVhNlIthW5jI8URxaAd0pvJer5zBtiPyZ9+fyXSISWZtZ2yBjrWSGfPXGMp\n\tPbDQ==",
        "X-Gm-Message-State": "ALoCoQmhOqjJKNR3DAeUQcBziAoNqu5u75QyLp/qvb86tMn3DKVKrJrCkRqGF6/Ui1pO9Auc0qSm",
        "X-Received": "by 10.68.130.4 with SMTP id oa4mr34072573pbb.95.1421664083852;\n\tMon, 19 Jan 2015 02:41:23 -0800 (PST)",
        "From": "Tetsuya Mukawa <mukawa@igel.co.jp>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 19 Jan 2015 19:40:25 +0900",
        "Message-Id": "<1421664027-17971-10-git-send-email-mukawa@igel.co.jp>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1421664027-17971-1-git-send-email-mukawa@igel.co.jp>",
        "References": "<1418106629-22227-2-git-send-email-mukawa@igel.co.j>\n\t<1421664027-17971-1-git-send-email-mukawa@igel.co.jp>",
        "Subject": "[dpdk-dev] [PATCH v4 09/11] ethdev: Add one dev_type paramerter to\n\trte_eth_dev_allocate",
        "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": "This new parameter is needed to keep device type like physical or virtual.\nPort detaching processes are different between physical and virtual.\nThis paramerter lets detaching function know a device type of the port.\n\nv4:\n- Fix comments of rte_eth_dev_type.\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n app/test/virtual_pmd.c                       |  2 +-\n lib/librte_ether/rte_ethdev.c                | 14 ++++++++++++--\n lib/librte_ether/rte_ethdev.h                | 25 ++++++++++++++++++++++++-\n lib/librte_pmd_af_packet/rte_eth_af_packet.c |  2 +-\n lib/librte_pmd_bond/rte_eth_bond_api.c       |  2 +-\n lib/librte_pmd_pcap/rte_eth_pcap.c           |  2 +-\n lib/librte_pmd_ring/rte_eth_ring.c           |  2 +-\n lib/librte_pmd_xenvirt/rte_eth_xenvirt.c     |  2 +-\n 8 files changed, 42 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c\nindex 9fac95d..8d3a5ff 100644\n--- a/app/test/virtual_pmd.c\n+++ b/app/test/virtual_pmd.c\n@@ -556,7 +556,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,\n \t\tgoto err;\n \n \t/* reserve an ethdev entry */\n-\teth_dev = rte_eth_dev_allocate(name);\n+\teth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PHYSICAL);\n \tif (eth_dev == NULL)\n \t\tgoto err;\n \ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex e572ef4..d9bf24c 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -232,7 +232,7 @@ rte_eth_dev_allocate_new_port(void)\n }\n \n struct rte_eth_dev *\n-rte_eth_dev_allocate(const char *name)\n+rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)\n {\n \tuint8_t port_id;\n \tstruct rte_eth_dev *eth_dev;\n@@ -256,6 +256,7 @@ rte_eth_dev_allocate(const char *name)\n \tsnprintf(eth_dev->data->name, sizeof(eth_dev->data->name), \"%s\", name);\n \teth_dev->data->port_id = port_id;\n \teth_dev->attached = DEV_CONNECTED;\n+\teth_dev->dev_type = type;\n \tnb_ports++;\n \treturn eth_dev;\n }\n@@ -276,6 +277,7 @@ rte_eth_dev_free(const char *name)\n \t}\n \n \teth_dev->attached = 0;\n+\teth_dev->dev_type = RTE_ETH_DEV_UNKNOWN;\n \tnb_ports--;\n \treturn eth_dev;\n }\n@@ -296,7 +298,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,\n \tsnprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, \"%d:%d.%d\",\n \t\t\tpci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);\n \n-\teth_dev = rte_eth_dev_allocate(ethdev_name);\n+\teth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PHYSICAL);\n \tif (eth_dev == NULL)\n \t\treturn -ENOMEM;\n \n@@ -422,6 +424,14 @@ rte_eth_dev_count(void)\n \treturn (nb_ports);\n }\n \n+enum rte_eth_dev_type\n+rte_eth_dev_get_device_type(uint8_t port_id)\n+{\n+\tif (rte_eth_dev_validate_port(port_id) == DEV_INVALID)\n+\t\treturn -1;\n+\treturn rte_eth_devices[port_id].dev_type;\n+}\n+\n void\n rte_eth_dev_save(struct rte_eth_dev *devs)\n {\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex c0b98dc..8b0bad6 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -1548,6 +1548,17 @@ struct eth_dev_ops {\n };\n \n /**\n+ * The eth device type\n+ */\n+enum rte_eth_dev_type {\n+\tRTE_ETH_DEV_UNKNOWN,\t/**< unknown device type */\n+\tRTE_ETH_DEV_PHYSICAL,\n+\t\t/**< Physical function and Virtual function devices of NIC */\n+\tRTE_ETH_DEV_VIRTUAL,\t/**< non hardware device */\n+\tRTE_ETH_DEV_MAX\t\t/**< max value of this enum */\n+};\n+\n+/**\n  * @internal\n  * The generic data structure associated with each ethernet device.\n  *\n@@ -1566,6 +1577,7 @@ struct rte_eth_dev {\n \tstruct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */\n \tstruct rte_eth_dev_cb_list callbacks; /**< User application callbacks */\n \tuint8_t attached; /**< Flag indicating the port is attached */\n+\tenum rte_eth_dev_type dev_type; /**< Flag indicating the device type */\n };\n \n struct rte_eth_dev_sriov {\n@@ -1643,6 +1655,15 @@ extern uint8_t rte_eth_dev_count(void);\n \n /**\n  * Function for internal use by port hotplug functions.\n+ * Get the device type to know whether the device is physical or virtual.\n+ * @param\tport_id\tThe pointer to the port id\n+ * @return\n+ *   - Device type.\n+ */\n+extern enum rte_eth_dev_type rte_eth_dev_get_device_type(uint8_t port_id);\n+\n+/**\n+ * Function for internal use by port hotplug functions.\n  * Copies current ethdev structures to the specified pointer.\n  *\n  * @param\tdevs\tThe pointer to the ethdev structures\n@@ -1728,10 +1749,12 @@ extern struct rte_eth_dev *rte_eth_dev_allocated(const char *name);\n  * to that slot for the driver to use.\n  *\n  * @param\tname\tUnique identifier name for each Ethernet device\n+ * @param\ttype\tDevice type of this Ethernet device\n  * @return\n  *   - Slot in the rte_dev_devices array for a new device;\n  */\n-struct rte_eth_dev *rte_eth_dev_allocate(const char *name);\n+struct rte_eth_dev *rte_eth_dev_allocate(const char *name,\n+\t\tenum rte_eth_dev_type type);\n \n /**\n  * Function for internal use by dummy drivers primarily, e.g. ring-based\ndiff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c b/lib/librte_pmd_af_packet/rte_eth_af_packet.c\nindex 755780a..ff44ba7 100644\n--- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c\n+++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c\n@@ -651,7 +651,7 @@ rte_pmd_init_internals(const char *name,\n \t}\n \n \t/* reserve an ethdev entry */\n-\t*eth_dev = rte_eth_dev_allocate(name);\n+\t*eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);\n \tif (*eth_dev == NULL)\n \t\tgoto error;\n \ndiff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c\nindex 4ab3267..7a6a5f7 100644\n--- a/lib/librte_pmd_bond/rte_eth_bond_api.c\n+++ b/lib/librte_pmd_bond/rte_eth_bond_api.c\n@@ -235,7 +235,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n \t}\n \n \t/* reserve an ethdev entry */\n-\teth_dev = rte_eth_dev_allocate(name);\n+\teth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);\n \tif (eth_dev == NULL) {\n \t\tRTE_BOND_LOG(ERR, \"Unable to allocate rte_eth_dev\");\n \t\tgoto err;\ndiff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c\nindex f12d1e7..5da92a3 100644\n--- a/lib/librte_pmd_pcap/rte_eth_pcap.c\n+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c\n@@ -710,7 +710,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,\n \t\tgoto error;\n \n \t/* reserve an ethdev entry */\n-\t*eth_dev = rte_eth_dev_allocate(name);\n+\t*eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);\n \tif (*eth_dev == NULL)\n \t\tgoto error;\n \ndiff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c\nindex 4f1b6ed..d901053 100644\n--- a/lib/librte_pmd_ring/rte_eth_ring.c\n+++ b/lib/librte_pmd_ring/rte_eth_ring.c\n@@ -256,7 +256,7 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],\n \t\tgoto error;\n \n \t/* reserve an ethdev entry */\n-\teth_dev = rte_eth_dev_allocate(name);\n+\teth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);\n \tif (eth_dev == NULL)\n \t\tgoto error;\n \ndiff --git a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c\nindex 04e30c9..bc403d6 100644\n--- a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c\n+++ b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c\n@@ -648,7 +648,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,\n \t\tgoto err;\n \n \t/* reserve an ethdev entry */\n-\teth_dev = rte_eth_dev_allocate(name);\n+\teth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);\n \tif (eth_dev == NULL)\n \t\tgoto err;\n \n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "09/11"
    ]
}