get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42309,
    "url": "http://patches.dpdk.org/api/patches/42309/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180705083934.5535-9-adrien.mazarguil@6wind.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20180705083934.5535-9-adrien.mazarguil@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180705083934.5535-9-adrien.mazarguil@6wind.com",
    "date": "2018-07-05T08:45:39",
    "name": "[v4,08/10] net/mlx5: probe port representors in natural order",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "87f9adc584f91c4d559a4e722362b2c26615ba2c",
    "submitter": {
        "id": 165,
        "url": "http://patches.dpdk.org/api/people/165/?format=api",
        "name": "Adrien Mazarguil",
        "email": "adrien.mazarguil@6wind.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180705083934.5535-9-adrien.mazarguil@6wind.com/mbox/",
    "series": [
        {
            "id": 413,
            "url": "http://patches.dpdk.org/api/series/413/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=413",
            "date": "2018-07-05T08:45:22",
            "name": "net/mlx5: add port representor support",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/413/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42309/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/42309/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2FBE31C3A9;\n\tThu,  5 Jul 2018 10:45:59 +0200 (CEST)",
            "from mail-wm0-f66.google.com (mail-wm0-f66.google.com\n\t[74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 814281C3A3\n\tfor <dev@dpdk.org>; Thu,  5 Jul 2018 10:45:56 +0200 (CEST)",
            "by mail-wm0-f66.google.com with SMTP id b188-v6so9713149wme.3\n\tfor <dev@dpdk.org>; Thu, 05 Jul 2018 01:45:56 -0700 (PDT)",
            "from 6wind.com (host.78.145.23.62.rev.coltfrance.com.\n\t[62.23.145.78]) by smtp.gmail.com with ESMTPSA id\n\t77-v6sm5031472wmq.22.2018.07.05.01.45.55\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 05 Jul 2018 01:45:55 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to;\n\tbh=VXghhL2Z7+VjFqQkx0R/BCV4LUBo98GUAsAKz1Dsfx8=;\n\tb=gTHBmySYHBQHoLvZAoF0Xe2V4bN3rZ/UdTVO1zNxJfCjkumCdkOJlaoK2vb0g3FXRv\n\tj5NazypJ2yv1uMFhdeAi6RrxJvNBlfkxAylfMF+L6bp/Wc10IXHQZ8cO/+hFKJ4VfnMy\n\ta9HcA1xbgIFT04sPnmDk9MRed7WKh3RpGOEmUffexkPtRttoK9nP9l477VAjJzPb12tR\n\tNQvAnLGfX6cNh8H8+IYH1lU5ZR2f//vN5l5Clbgm72i6Es6FLy7+qu7rDpqTjidBbCzA\n\tf337cIWqR+PWQoPY1+nSDGAmEtjsSkXIa8B0vYGD+d1aMGaaN0LgM/glI+oLAQJ7O+8W\n\tqr9g==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to;\n\tbh=VXghhL2Z7+VjFqQkx0R/BCV4LUBo98GUAsAKz1Dsfx8=;\n\tb=nuK8owX0ZlL+LVo343hc++FUGFoFZaeuSf1/oo5+T4Oigm578P734tPSJbuK4GBEJV\n\tz4xBJIcLkhMSjXzkmiLN/mgBdPebRu5VcRAqjAeu7RkJ+9IO+IMS5fmuyEZNnHebx170\n\tmo2D1Y847bWW6oguAKIMYBrYvobz+mGSyN69R4tZHecTDLEW92vraGB8m5hrzcJffYFu\n\t3UwA8DIZ9d50Doc3it24Ls8uXQ+VsnPh+225YL/40fTd6mclKOXflyVEwEPuojdO28HA\n\tKyGx+b+qSRkvYTvHsAAkoUGNshaqfZmCkGjXWOtJG+YJMzJpRqDKAndK5/eJID5Guqsq\n\tfZag==",
        "X-Gm-Message-State": "APt69E15aqX0KN+i+hwmW+EYxyCTopr0HRseO6rCWPRFDiJ88tRWu02k\n\txV1DsGq8itnTBWXuVUlfoHBG8A==",
        "X-Google-Smtp-Source": "AAOMgpc9v+juxXacGpW533+Jaa6K3EW747X1SDJ04m8spU45EkIdAz3I5xM1Klayj7Oc9UInCg4jMA==",
        "X-Received": "by 2002:adf:fc47:: with SMTP id\n\te7-v6mr3765255wrs.157.1530780356289; \n\tThu, 05 Jul 2018 01:45:56 -0700 (PDT)",
        "Date": "Thu, 5 Jul 2018 10:45:39 +0200",
        "From": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "To": "Shahaf Shuler <shahafs@mellanox.com>",
        "Cc": "dev@dpdk.org",
        "Message-ID": "<20180705083934.5535-9-adrien.mazarguil@6wind.com>",
        "References": "<20180704172322.22571-1-adrien.mazarguil@6wind.com>\n\t<20180705083934.5535-1-adrien.mazarguil@6wind.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "In-Reply-To": "<20180705083934.5535-1-adrien.mazarguil@6wind.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "Subject": "[dpdk-dev] [PATCH v4 08/10] net/mlx5: probe port representors in\n\tnatural order",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Port representors are probed in whatever unspecified order\nibv_get_device_list() returns them.\n\nThis is counterintuitive to users since DPDK port IDs assignment almost\nnever follows the same sequence as representor IDs. Additionally, the\nmaster device does not necessarily inherit the lowest DPDK port ID.\n\nSigned-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>\n--\nv3 changes:\n\n- This patch was not present in prior revisions.\n---\n drivers/net/mlx5/mlx5.c | 95 ++++++++++++++++++++++++++++++++++----------\n 1 file changed, 74 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex c02afbb82..6592480bf 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -1168,6 +1168,52 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,\n \treturn NULL;\n }\n \n+/** Data associated with devices to spawn. */\n+struct mlx5_dev_spawn_data {\n+\tunsigned int ifindex; /**< Network interface index. */\n+\tstruct mlx5_switch_info info; /**< Switch information. */\n+\tstruct ibv_device *ibv_dev; /**< Associated IB device. */\n+\tstruct rte_eth_dev *eth_dev; /**< Associated Ethernet device. */\n+};\n+\n+/**\n+ * Comparison callback to sort device data.\n+ *\n+ * This is meant to be used with qsort().\n+ *\n+ * @param a[in]\n+ *   Pointer to pointer to first data object.\n+ * @param b[in]\n+ *   Pointer to pointer to second data object.\n+ *\n+ * @return\n+ *   0 if both objects are equal, less than 0 if the first argument is less\n+ *   than the second, greater than 0 otherwise.\n+ */\n+static int\n+mlx5_dev_spawn_data_cmp(const void *a, const void *b)\n+{\n+\tconst struct mlx5_switch_info *si_a =\n+\t\t&((const struct mlx5_dev_spawn_data *)a)->info;\n+\tconst struct mlx5_switch_info *si_b =\n+\t\t&((const struct mlx5_dev_spawn_data *)b)->info;\n+\tint ret;\n+\n+\t/* Master device first. */\n+\tret = si_b->master - si_a->master;\n+\tif (ret)\n+\t\treturn ret;\n+\t/* Then representor devices. */\n+\tret = si_b->representor - si_a->representor;\n+\tif (ret)\n+\t\treturn ret;\n+\t/* Unidentified devices come last in no specific order. */\n+\tif (!si_a->representor)\n+\t\treturn 0;\n+\t/* Order representors by name. */\n+\treturn si_a->port_name - si_b->port_name;\n+}\n+\n /**\n  * DPDK callback to register a PCI device.\n  *\n@@ -1218,9 +1264,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t}\n \tibv_match[n] = NULL;\n \n-\tunsigned int ifindex[n];\n-\tstruct mlx5_switch_info info[n];\n-\tstruct rte_eth_dev *eth_list[n];\n+\tstruct mlx5_dev_spawn_data list[n];\n \tint nl_route = n ? mlx5_nl_init(0, NETLINK_ROUTE) : -1;\n \tint nl_rdma = n ? mlx5_nl_init(0, NETLINK_RDMA) : -1;\n \tunsigned int i;\n@@ -1242,16 +1286,19 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t *    bail out.\n \t */\n \tfor (i = 0; i != n; ++i) {\n+\t\tlist[i].ibv_dev = ibv_match[i];\n+\t\tlist[i].eth_dev = NULL;\n \t\tif (nl_rdma < 0)\n-\t\t\tifindex[i] = 0;\n+\t\t\tlist[i].ifindex = 0;\n \t\telse\n-\t\t\tifindex[i] = mlx5_nl_ifindex(nl_rdma,\n-\t\t\t\t\t\t     ibv_match[i]->name);\n+\t\t\tlist[i].ifindex = mlx5_nl_ifindex\n+\t\t\t\t(nl_rdma, list[i].ibv_dev->name);\n \t\tif (nl_route < 0 ||\n-\t\t    !ifindex[i] ||\n-\t\t    mlx5_nl_switch_info(nl_route, ifindex[i], &info[i])) {\n-\t\t\tifindex[i] = 0;\n-\t\t\tmemset(&info[i], 0, sizeof(info[i]));\n+\t\t    !list[i].ifindex ||\n+\t\t    mlx5_nl_switch_info(nl_route, list[i].ifindex,\n+\t\t\t\t\t&list[i].info)) {\n+\t\t\tlist[i].ifindex = 0;\n+\t\t\tmemset(&list[i].info, 0, sizeof(list[i].info));\n \t\t\tcontinue;\n \t\t}\n \t}\n@@ -1261,7 +1308,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tclose(nl_route);\n \t/* Count unidentified devices. */\n \tfor (u = 0, i = 0; i != n; ++i)\n-\t\tif (!info[i].master && !info[i].representor)\n+\t\tif (!list[i].info.master && !list[i].info.representor)\n \t\t\t++u;\n \tif (u) {\n \t\tif (n == 1 && u == 1) {\n@@ -1275,6 +1322,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t\tn = 0;\n \t\t}\n \t}\n+\t/*\n+\t * Sort list to probe devices in natural order for users convenience\n+\t * (i.e. master first, then representors from lowest to highest ID).\n+\t */\n+\tif (n)\n+\t\tqsort(list, n, sizeof(*list), mlx5_dev_spawn_data_cmp);\n \tswitch (pci_dev->id.device_id) {\n \tcase PCI_DEVICE_ID_MELLANOX_CONNECTX4VF:\n \tcase PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF:\n@@ -1288,15 +1341,15 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \tfor (i = 0; i != n; ++i) {\n \t\tuint32_t restore;\n \n-\t\teth_list[i] = mlx5_dev_spawn(&pci_dev->device, ibv_match[i],\n-\t\t\t\t\t     vf, &info[i]);\n-\t\tif (!eth_list[i])\n+\t\tlist[i].eth_dev = mlx5_dev_spawn\n+\t\t\t(&pci_dev->device, list[i].ibv_dev, vf, &list[i].info);\n+\t\tif (!list[i].eth_dev)\n \t\t\tbreak;\n-\t\trestore = eth_list[i]->data->dev_flags;\n-\t\trte_eth_copy_pci_info(eth_list[i], pci_dev);\n+\t\trestore = list[i].eth_dev->data->dev_flags;\n+\t\trte_eth_copy_pci_info(list[i].eth_dev, pci_dev);\n \t\t/* Restore non-PCI flags cleared by the above call. */\n-\t\teth_list[i]->data->dev_flags |= restore;\n-\t\trte_eth_dev_probing_finish(eth_list[i]);\n+\t\tlist[i].eth_dev->data->dev_flags |= restore;\n+\t\trte_eth_dev_probing_finish(list[i].eth_dev);\n \t}\n \tmlx5_glue->free_device_list(ibv_list);\n \tif (!n) {\n@@ -1317,10 +1370,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tret = -rte_errno;\n \t\t/* Roll back. */\n \t\twhile (i--) {\n-\t\t\tmlx5_dev_close(eth_list[i]);\n+\t\t\tmlx5_dev_close(list[i].eth_dev);\n \t\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n-\t\t\t\trte_free(eth_list[i]->data->dev_private);\n-\t\t\tclaim_zero(rte_eth_dev_release_port(eth_list[i]));\n+\t\t\t\trte_free(list[i].eth_dev->data->dev_private);\n+\t\t\tclaim_zero(rte_eth_dev_release_port(list[i].eth_dev));\n \t\t}\n \t\t/* Restore original error. */\n \t\trte_errno = -ret;\n",
    "prefixes": [
        "v4",
        "08/10"
    ]
}