get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52192,
    "url": "http://patches.dpdk.org/api/patches/52192/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1554300882-23990-1-git-send-email-viacheslavo@mellanox.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": "<1554300882-23990-1-git-send-email-viacheslavo@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1554300882-23990-1-git-send-email-viacheslavo@mellanox.com",
    "date": "2019-04-03T14:14:42",
    "name": "[1/1] net/mlx5: fix device probing for old kernel drivers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "583b2fb9a0cf1c876402c04c279b61d518212931",
    "submitter": {
        "id": 1102,
        "url": "http://patches.dpdk.org/api/people/1102/?format=api",
        "name": "Slava Ovsiienko",
        "email": "viacheslavo@mellanox.com"
    },
    "delegate": {
        "id": 6624,
        "url": "http://patches.dpdk.org/api/users/6624/?format=api",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1554300882-23990-1-git-send-email-viacheslavo@mellanox.com/mbox/",
    "series": [
        {
            "id": 4088,
            "url": "http://patches.dpdk.org/api/series/4088/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4088",
            "date": "2019-04-03T14:14:42",
            "name": "[1/1] net/mlx5: fix device probing for old kernel drivers",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4088/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/52192/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/52192/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 2685F5A6E;\n\tWed,  3 Apr 2019 16:14:50 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id 250DB5A6A\n\tfor <dev@dpdk.org>; Wed,  3 Apr 2019 16:14:49 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tviacheslavo@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 3 Apr 2019 17:14:48 +0300",
            "from pegasus12.mtr.labs.mlnx. (pegasus12.mtr.labs.mlnx\n\t[10.210.17.40])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x33EEmoo029725;\n\tWed, 3 Apr 2019 17:14:48 +0300"
        ],
        "From": "Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "shahafs@mellanox.com",
        "Date": "Wed,  3 Apr 2019 14:14:42 +0000",
        "Message-Id": "<1554300882-23990-1-git-send-email-viacheslavo@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "Subject": "[dpdk-dev] [PATCH 1/1] net/mlx5: fix device probing for old kernel\n\tdrivers",
        "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": "Retrieving network interface index via Netlink fails in\ncase of old mlx5 kernel drivers installed - mlx5_nl_ifindex()\nroutine fails due to wrong Netlink reply message sent by the\nold drivers. This error was ignored in previous versions of\nprobing. For single devices ifindex was retrieved via sysfs\nand link control was not lost, so problem just was not noticed.\nIn order to support MLX5 PMD functioning over old kernel drivers\nthis patch adds ifindex retrieving via sysfs into probing routine.\nIt is worth to note this method works for master/single device only.\n\nFixes: ad74bc619504 (\"net/mlx5: support multiport IB device during probing\")\n\nSigned-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c        | 35 +++++++++++++++++++++++++++++++----\n drivers/net/mlx5/mlx5.h        |  1 +\n drivers/net/mlx5/mlx5_ethdev.c | 28 ++++++++++++++--------------\n 3 files changed, 46 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 7d322b6..9aa5f0b 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -1772,12 +1772,39 @@ struct mlx5_dev_spawn_data {\n \t\t\t\tlist[ns].ifindex = mlx5_nl_ifindex\n \t\t\t\t\t(nl_rdma, list[ns].ibv_dev->name, 1);\n \t\t\tif (!list[ns].ifindex) {\n+\t\t\t\tchar ifname[IF_NAMESIZE];\n+\n \t\t\t\t/*\n-\t\t\t\t * No network interface index found for the\n-\t\t\t\t * specified device, it means there it is not\n-\t\t\t\t * a representor/master.\n+\t\t\t\t * Netlink failed, it may happen with old\n+\t\t\t\t * mlx5 kernel drivers. We can assume we have\n+\t\t\t\t * old driver because here we are processing\n+\t\t\t\t * single ports IB devices. Let's try sysfs\n+\t\t\t\t * to retrieve the ifindex. The method works\n+\t\t\t\t * for master device only.\n \t\t\t\t */\n-\t\t\t\tcontinue;\n+\t\t\t\tif (nd > 1) {\n+\t\t\t\t\t/*\n+\t\t\t\t\t * Multiple devices found, assume\n+\t\t\t\t\t * representors, can not distinguish\n+\t\t\t\t\t * master/representor and retrieve\n+\t\t\t\t\t * ifindex via sysfs.\n+\t\t\t\t\t */\n+\t\t\t\t\tcontinue;\n+\t\t\t\t}\n+\t\t\t\tret = mlx5_get_master_ifname\n+\t\t\t\t\t(ibv_match[i]->ibdev_path, &ifname);\n+\t\t\t\tif (!ret)\n+\t\t\t\t\tlist[ns].ifindex =\n+\t\t\t\t\t\tif_nametoindex(ifname);\n+\t\t\t\tif (!list[ns].ifindex) {\n+\t\t\t\t\t/*\n+\t\t\t\t\t * No network interface index found\n+\t\t\t\t\t * for the specified device, it means\n+\t\t\t\t\t * there it is neither representor\n+\t\t\t\t\t * nor master.\n+\t\t\t\t\t */\n+\t\t\t\t\tcontinue;\n+\t\t\t\t}\n \t\t\t}\n \t\t\tret = -1;\n \t\t\tif (nl_route >= 0)\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 4f6c1b7..6552691 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -327,6 +327,7 @@ struct mlx5_priv {\n /* mlx5_ethdev.c */\n \n int mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]);\n+int mlx5_get_master_ifname(const char *ibdev_path, char (*ifname)[IF_NAMESIZE]);\n unsigned int mlx5_ifindex(const struct rte_eth_dev *dev);\n int mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr);\n int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu);\ndiff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c\nindex 7273bd9..8a251aa 100644\n--- a/drivers/net/mlx5/mlx5_ethdev.c\n+++ b/drivers/net/mlx5/mlx5_ethdev.c\n@@ -127,21 +127,18 @@ struct ethtool_link_settings {\n  * @return\n  *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n-static int\n-mlx5_get_master_ifname(const struct rte_eth_dev *dev,\n-\t\t       char (*ifname)[IF_NAMESIZE])\n+int\n+mlx5_get_master_ifname(const char *ibdev_path, char (*ifname)[IF_NAMESIZE])\n {\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n \tDIR *dir;\n \tstruct dirent *dent;\n \tunsigned int dev_type = 0;\n \tunsigned int dev_port_prev = ~0u;\n \tchar match[IF_NAMESIZE] = \"\";\n \n-\tassert(priv);\n-\tassert(priv->sh);\n+\tassert(ibdev_path);\n \t{\n-\t\tMKSTR(path, \"%s/device/net\", priv->sh->ibdev_path);\n+\t\tMKSTR(path, \"%s/device/net\", ibdev_path);\n \n \t\tdir = opendir(path);\n \t\tif (dir == NULL) {\n@@ -161,7 +158,7 @@ struct ethtool_link_settings {\n \t\t\tcontinue;\n \n \t\tMKSTR(path, \"%s/device/net/%s/%s\",\n-\t\t      priv->sh->ibdev_path, name,\n+\t\t      ibdev_path, name,\n \t\t      (dev_type ? \"dev_id\" : \"dev_port\"));\n \n \t\tfile = fopen(path, \"rb\");\n@@ -222,15 +219,18 @@ struct ethtool_link_settings {\n mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tunsigned int ifindex =\n-\t\tpriv->nl_socket_rdma >= 0 ?\n-\t\tmlx5_nl_ifindex(priv->nl_socket_rdma,\n-\t\t\t\tpriv->sh->ibdev_name,\n-\t\t\t\tpriv->ibv_port) : 0;\n+\tunsigned int ifindex;\n \n+\tassert(priv);\n+\tassert(priv->sh);\n+\tifindex = priv->nl_socket_rdma >= 0 ?\n+\t\t  mlx5_nl_ifindex(priv->nl_socket_rdma,\n+\t\t\t\t  priv->sh->ibdev_name,\n+\t\t\t\t  priv->ibv_port) : 0;\n \tif (!ifindex) {\n \t\tif (!priv->representor)\n-\t\t\treturn mlx5_get_master_ifname(dev, ifname);\n+\t\t\treturn mlx5_get_master_ifname(priv->sh->ibdev_path,\n+\t\t\t\t\t\t      ifname);\n \t\trte_errno = ENXIO;\n \t\treturn -rte_errno;\n \t}\n",
    "prefixes": [
        "1/1"
    ]
}