get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7311,
    "url": "https://patches.dpdk.org/api/patches/7311/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1443615142-24381-2-git-send-email-bruce.richardson@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": "<1443615142-24381-2-git-send-email-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1443615142-24381-2-git-send-email-bruce.richardson@intel.com",
    "date": "2015-09-30T12:12:19",
    "name": "[dpdk-dev,1/4] ring: enhance rte_eth_from_rings",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "efaeb8a59d5c48e3dbe97375d0ebd089e890b541",
    "submitter": {
        "id": 20,
        "url": "https://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1443615142-24381-2-git-send-email-bruce.richardson@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7311/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7311/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 54FA48DAA;\n\tWed, 30 Sep 2015 14:13:26 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 1B2C25A55\n\tfor <dev@dpdk.org>; Wed, 30 Sep 2015 14:13:24 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga101.jf.intel.com with ESMTP; 30 Sep 2015 05:12:23 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga002.fm.intel.com with ESMTP; 30 Sep 2015 05:12:22 -0700",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tt8UCCMwX014968; Wed, 30 Sep 2015 13:12:22 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id t8UCCMYK024423;\n\tWed, 30 Sep 2015 13:12:22 +0100",
            "(from bricha3@localhost)\n\tby sivswdev01.ir.intel.com with  id t8UCCM7x024419;\n\tWed, 30 Sep 2015 13:12:22 +0100"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,612,1437462000\"; d=\"scan'208\";a=\"816163984\"",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 30 Sep 2015 13:12:19 +0100",
        "Message-Id": "<1443615142-24381-2-git-send-email-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1443615142-24381-1-git-send-email-bruce.richardson@intel.com>",
        "References": "<1443615142-24381-1-git-send-email-bruce.richardson@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 1/4] ring: enhance rte_eth_from_rings",
        "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": "The ring ethdev creation function creates an ethdev, but does not\nactually set it up for use. Even if it's just a single ring, the user\nstill needs to create a mempool, call rte_eth_dev_configure, then call\nrx and tx setup functions before the ethdev can be used.\n\nThis patch changes things so that the ethdev is fully set up after the\ncall to create the ethdev. The above-mentionned functions can still be\ncalled - as will be the case, for instance, if the NIC is created via\ncommandline parameters - but they no longer are essential.\n\nThe function now also sets rte_errno appropriately on error, so the\ncaller can get a better indication of why a call may have failed.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n drivers/net/ring/rte_eth_ring.c | 47 +++++++++++++++++++++++++++++++++++------\n 1 file changed, 41 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c\nindex 0ba36d5..bfd6f4e 100644\n--- a/drivers/net/ring/rte_eth_ring.c\n+++ b/drivers/net/ring/rte_eth_ring.c\n@@ -39,6 +39,7 @@\n #include <rte_string_fns.h>\n #include <rte_dev.h>\n #include <rte_kvargs.h>\n+#include <rte_errno.h>\n \n #define ETH_RING_NUMA_NODE_ACTION_ARG\t\"nodeaction\"\n #define ETH_RING_ACTION_CREATE\t\t\"CREATE\"\n@@ -276,10 +277,18 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],\n \tunsigned i;\n \n \t/* do some parameter checking */\n-\tif (rx_queues == NULL && nb_rx_queues > 0)\n+\tif (rx_queues == NULL && nb_rx_queues > 0) {\n+\t\trte_errno = EINVAL;\n \t\tgoto error;\n-\tif (tx_queues == NULL && nb_tx_queues > 0)\n+\t}\n+\tif (tx_queues == NULL && nb_tx_queues > 0) {\n+\t\trte_errno = EINVAL;\n+\t\tgoto error;\n+\t}\n+\tif (nb_rx_queues > RTE_PMD_RING_MAX_RX_RINGS) {\n+\t\trte_errno = EINVAL;\n \t\tgoto error;\n+\t}\n \n \tRTE_LOG(INFO, PMD, \"Creating rings-backed ethdev on numa socket %u\\n\",\n \t\t\tnuma_node);\n@@ -288,21 +297,43 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],\n \t * and internal (private) data\n \t */\n \tdata = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);\n-\tif (data == NULL)\n+\tif (data == NULL) {\n+\t\trte_errno = ENOMEM;\n \t\tgoto error;\n+\t}\n+\n+\tdata->rx_queues = rte_zmalloc_socket(name, sizeof(void *) * nb_rx_queues,\n+\t\t\t0, numa_node);\n+\tif (data->rx_queues == NULL) {\n+\t\trte_errno = ENOMEM;\n+\t\tgoto error;\n+\t}\n+\n+\tdata->tx_queues = rte_zmalloc_socket(name, sizeof(void *) * nb_tx_queues,\n+\t\t\t0, numa_node);\n+\tif (data->tx_queues == NULL) {\n+\t\trte_errno = ENOMEM;\n+\t\tgoto error;\n+\t}\n \n \tpci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, numa_node);\n-\tif (pci_dev == NULL)\n+\tif (pci_dev == NULL) {\n+\t\trte_errno = ENOMEM;\n \t\tgoto error;\n+\t}\n \n \tinternals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);\n-\tif (internals == NULL)\n+\tif (internals == NULL) {\n+\t\trte_errno = ENOMEM;\n \t\tgoto error;\n+\t}\n \n \t/* reserve an ethdev entry */\n \teth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);\n-\tif (eth_dev == NULL)\n+\tif (eth_dev == NULL) {\n+\t\trte_errno = ENOSPC;\n \t\tgoto error;\n+\t}\n \n \n \t/* now put it all together\n@@ -318,9 +349,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],\n \tinternals->nb_tx_queues = nb_tx_queues;\n \tfor (i = 0; i < nb_rx_queues; i++) {\n \t\tinternals->rx_ring_queues[i].rng = rx_queues[i];\n+\t\tdata->rx_queues[i] = &internals->rx_ring_queues[i];\n \t}\n \tfor (i = 0; i < nb_tx_queues; i++) {\n \t\tinternals->tx_ring_queues[i].rng = tx_queues[i];\n+\t\tdata->tx_queues[i] = &internals->tx_ring_queues[i];\n \t}\n \n \trte_ring_pmd.pci_drv.name = ring_ethdev_driver_name;\n@@ -350,6 +383,8 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],\n \treturn data->port_id;\n \n error:\n+\trte_free(data->rx_queues);\n+\trte_free(data->tx_queues);\n \trte_free(data);\n \trte_free(pci_dev);\n \trte_free(internals);\n",
    "prefixes": [
        "dpdk-dev",
        "1/4"
    ]
}