Show a patch.

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

{
    "id": 41083,
    "url": "http://patches.dpdk.org/api/patches/41083/",
    "web_url": "http://patches.dpdk.org/patch/41083/",
    "project": {
        "id": 1,
        "url": "http://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": "<20180614083047.10812-6-adrien.mazarguil@6wind.com>",
    "date": "2018-06-14T08:34:58",
    "name": "[v2,5/7] net/mlx5: add port representor awareness",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "802d6022435d78c8fbc2682861f2200902b3289b",
    "submitter": {
        "id": 165,
        "url": "http://patches.dpdk.org/api/people/165/",
        "name": "Adrien Mazarguil",
        "email": "adrien.mazarguil@6wind.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/41083/mbox/",
    "series": [
        {
            "id": 118,
            "url": "http://patches.dpdk.org/api/series/118/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=118",
            "date": "2018-06-14T08:34:47",
            "name": "net/mlx5: add port representor support",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/118/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41083/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41083/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<20180614083047.10812-1-adrien.mazarguil@6wind.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.11.0",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6F5D21E4BB;\n\tThu, 14 Jun 2018 10:35:17 +0200 (CEST)",
            "from mail-wr0-f193.google.com (mail-wr0-f193.google.com\n\t[209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 898931E49A\n\tfor <dev@dpdk.org>; Thu, 14 Jun 2018 10:35:14 +0200 (CEST)",
            "by mail-wr0-f193.google.com with SMTP id l41-v6so5437638wre.7\n\tfor <dev@dpdk.org>; Thu, 14 Jun 2018 01:35:14 -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\ta9-v6sm4338695wmh.38.2018.06.14.01.35.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Jun 2018 01:35:13 -0700 (PDT)"
        ],
        "References": "<20180525161814.13873-1-adrien.mazarguil@6wind.com>\n\t<20180614083047.10812-1-adrien.mazarguil@6wind.com>",
        "X-Google-Smtp-Source": "ADUXVKIzjuXBNJRsHjBv4olGUeMxRVY6xtG3Yo2GrgMjj7gprHkLMebVK/ei6K28l1cvsKERfSNmXA==",
        "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=yNUUjGItogqUZ+HSpP8/oe62lbl8J/hjOY7zS+xO7ZE=;\n\tb=fjPfuWHkVjpLymbcQVbgnWehh3GFCjekgbibyghx/BTeaYNcDQrdFY49w9J+WThUZB\n\tc34Ahvzhz2vQbCLnUKSATmM0kiWc/jIHuyP73mtYSEsp2yotiiLzeY2Ym2+lQdfp1N9l\n\t/1rFsYljBUFuwvx2fAgaIRZCWpbU3HmduA6qNbi6vs16k908JuTEwsxbG05vVW+DvLZP\n\twRcMt44+wJI5JIFNCJMC/sWZYPCkUYsTkVLprJMC0I7pI0OXQvtQ3i7cfnMG3y2oyOq8\n\txR8q0eHZmdwGD5w9CcRtNMc1LXq84c+ZWJ3HhBfJILM85QIhFLefjBf4AH3KB7pgz87x\n\t4HXg==",
        "MIME-Version": "1.0",
        "X-Received": "by 2002:adf:979c:: with SMTP id\n\ts28-v6mr1410129wrb.28.1528965314245; \n\tThu, 14 Jun 2018 01:35:14 -0700 (PDT)",
        "Message-ID": "<20180614083047.10812-6-adrien.mazarguil@6wind.com>",
        "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=yNUUjGItogqUZ+HSpP8/oe62lbl8J/hjOY7zS+xO7ZE=;\n\tb=ZIEPUEVG5Whl3zpNiNjXwtewBe4xJQ00CvWyqXCl4V1gELV2Blo2I4jBIFPOQr/VMd\n\tcZjSLD8NYj9GXcTZR86nZIB8hEuWtqj/x4hWVO/Re08O+/xz5PVhPz3IjlnmFh2XDg8r\n\tSHL/XJkmIAAkYzzJ3/itrS/zMm6pAJmF5TKwcJK/rGq9zEjKdJwN2DOhF0If7P7QKCV9\n\tqvYDlhPJaqQAYnLPcApiJ7e8qUFpfAvGN2glnNFeXBEGpHElwFvljrTdiMvQV30Hyf89\n\tzkBfwC99LW7a56fTkUTHhqYJNYN1MWVkqwyA8G4NP2n8uiMuMzUrpXtGZWYCp71uSuzd\n\tOfgQ==",
        "Delivered-To": "patchwork@dpdk.org",
        "Precedence": "list",
        "From": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "To": "Shahaf Shuler <shahafs@mellanox.com>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Thu, 14 Jun 2018 10:34:58 +0200",
        "X-Gm-Message-State": "APt69E2GKEkOkcODEyFN/SQb6GxTaP804Hpmlwu1FKVWIedlmXOfTrYH\n\tqJ8yTaXnweS/Ew/C7IspTmViKg==",
        "Cc": "dev@dpdk.org",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "X-BeenThere": "dev@dpdk.org",
        "Subject": "[dpdk-dev] [PATCH v2 5/7] net/mlx5: add port representor awareness"
    },
    "content": "The current PCI probing method is not aware of Verbs port representors,\nwhich appear as standard Verbs devices bound to the same PCI address and\ncannot be distinguished.\n\nProblem is that more often than not, the wrong Verbs device is used,\nresulting in unexpected traffic.\n\nThis patch adds necessary heuristics to bind affected driver instances to\nthe intended (i.e. non-representor) device.\n\n(Patch based on prior work from Yuanhan Liu)\n\nSigned-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>\n--\nv2 changes:\n\n- Fixed digit detection in mlx5_cmp_ibv_name() so that \"foo1\" and \"foo10\"\n  are compared on the integer conversion of \"1\" against \"10\" instead of \"\"\n  and \"0\".\n---\n drivers/net/mlx5/mlx5.c | 66 ++++++++++++++++++++++++++++++++++++++++----\n 1 file changed, 61 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex c9815d721..498f80c89 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -3,6 +3,7 @@\n  * Copyright 2015 Mellanox Technologies, Ltd\n  */\n \n+#include <ctype.h>\n #include <stddef.h>\n #include <unistd.h>\n #include <string.h>\n@@ -1170,6 +1171,34 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,\n }\n \n /**\n+ * Comparison callback to sort Verbs device names.\n+ *\n+ * This is meant to be used with qsort().\n+ *\n+ * @param a[in]\n+ *   Pointer to pointer to first Verbs device.\n+ * @param b[in]\n+ *   Pointer to pointer to second Verbs device.\n+ *\n+ * @return\n+ *   0 if both names 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_cmp_ibv_name(const void *a, const void *b)\n+{\n+\tconst char *name_a = (*(const struct ibv_device *const *)a)->name;\n+\tconst char *name_b = (*(const struct ibv_device *const *)b)->name;\n+\tsize_t i = 0;\n+\n+\twhile (name_a[i] && name_a[i] == name_b[i])\n+\t\t++i;\n+\twhile (i && isdigit(name_a[i - 1]) && isdigit(name_b[i - 1]))\n+\t\t--i;\n+\treturn atoi(name_a + i) - atoi(name_b + i);\n+}\n+\n+/**\n  * DPDK callback to register a PCI device.\n  *\n  * This function creates an Ethernet device for each port of a given\n@@ -1189,6 +1218,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n {\n \tstruct ibv_device **ibv_list;\n \tstruct rte_eth_dev **eth_list = NULL;\n+\tint n = 0;\n \tint vf;\n \tint ret;\n \n@@ -1210,6 +1240,9 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tDRV_LOG(ERR, \"cannot list devices, is ib_uverbs loaded?\");\n \t\treturn -rte_errno;\n \t}\n+\n+\tstruct ibv_device *ibv_match[ret + 1];\n+\n \twhile (ret-- > 0) {\n \t\tstruct rte_pci_addr pci_addr;\n \n@@ -1221,14 +1254,37 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t    pci_dev->addr.devid != pci_addr.devid ||\n \t\t    pci_dev->addr.function != pci_addr.function)\n \t\t\tcontinue;\n-\t\tDRV_LOG(INFO, \"PCI information matches, using device \\\"%s\\\"\",\n+\t\tDRV_LOG(INFO, \"PCI information matches for device \\\"%s\\\"\",\n \t\t\tibv_list[ret]->name);\n-\t\tbreak;\n+\t\tibv_match[n++] = ibv_list[ret];\n+\t}\n+\tibv_match[n] = NULL;\n+\tif (n > 1) {\n+\t\t/*\n+\t\t * The existence of several matching entries means port\n+\t\t * representors have been instantiated. No existing Verbs\n+\t\t * call nor /sys entries can tell them apart at this point.\n+\t\t *\n+\t\t * While definitely hackish, assume their names are numbered\n+\t\t * based on order of creation with master device first,\n+\t\t * followed by first port representor, followed by the\n+\t\t * second one and so on.\n+\t\t */\n+\t\tDRV_LOG(WARNING,\n+\t\t\t\"probing device with port representors involves\"\n+\t\t\t\" heuristics with uncertain outcome\");\n+\t\tqsort(ibv_match, n, sizeof(*ibv_match), mlx5_cmp_ibv_name);\n+\t\tDRV_LOG(WARNING, \"assuming \\\"%s\\\" is the master device\",\n+\t\t\tibv_match[0]->name);\n+\t\tfor (ret = 1; ret < n; ++ret)\n+\t\t\tDRV_LOG(WARNING,\n+\t\t\t\t\"assuming \\\"%s\\\" is port representor #%d\",\n+\t\t\t\tibv_match[ret]->name, ret - 1);\n \t}\n-\tif (ret >= 0)\n-\t\teth_list = mlx5_dev_spawn(&pci_dev->device, ibv_list[ret], vf);\n+\tif (n)\n+\t\teth_list = mlx5_dev_spawn(&pci_dev->device, ibv_match[0], vf);\n \tmlx5_glue->free_device_list(ibv_list);\n-\tif (!ret) {\n+\tif (!n) {\n \t\tDRV_LOG(WARNING,\n \t\t\t\"no Verbs device matches PCI device \" PCI_PRI_FMT \",\"\n \t\t\t\" are kernel drivers loaded?\",\n",
    "prefixes": [
        "v2",
        "5/7"
    ]
}