get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 64970,
    "url": "http://patches.dpdk.org/api/patches/64970/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1579539790-3882-34-git-send-email-matan@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": "<1579539790-3882-34-git-send-email-matan@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1579539790-3882-34-git-send-email-matan@mellanox.com",
    "date": "2020-01-20T17:03:05",
    "name": "[v1,33/38] mlx5: skip probing according to the vDPA mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "544e6ddefd448fc87691dfa615222dafc2fa4cd9",
    "submitter": {
        "id": 796,
        "url": "http://patches.dpdk.org/api/people/796/?format=api",
        "name": "Matan Azrad",
        "email": "matan@mellanox.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1579539790-3882-34-git-send-email-matan@mellanox.com/mbox/",
    "series": [
        {
            "id": 8223,
            "url": "http://patches.dpdk.org/api/series/8223/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8223",
            "date": "2020-01-20T17:02:37",
            "name": "Introduce mlx5 vDPA driver",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/8223/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/64970/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/64970/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D80B9A0526;\n\tMon, 20 Jan 2020 18:09:36 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F2E381C0D1;\n\tMon, 20 Jan 2020 18:04:12 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id DCC211BFB3\n for <dev@dpdk.org>; Mon, 20 Jan 2020 18:03:14 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n asafp@mellanox.com)\n with ESMTPS (AES256-SHA encrypted); 20 Jan 2020 19:03:14 +0200",
            "from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx\n [10.210.16.112])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00KH3BGq024424;\n Mon, 20 Jan 2020 19:03:14 +0200"
        ],
        "From": "Matan Azrad <matan@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n Thomas Monjalon <thomas@monjalon.net>",
        "Date": "Mon, 20 Jan 2020 17:03:05 +0000",
        "Message-Id": "<1579539790-3882-34-git-send-email-matan@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1579539790-3882-1-git-send-email-matan@mellanox.com>",
        "References": "<1579539790-3882-1-git-send-email-matan@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v1 33/38] mlx5: skip probing according to the\n\tvDPA mode",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Both, net/mlx5 PMD and vdpa/mlx5 drivers can probe the same Mellanox\ndevices.\n\nSkip net/mlx5 PMD probing while the device is in vDPA mode selected by\nthe device devargs provided by the user: vdpa=1.\n\nSkip vdpa/mlx5 PMD probing while the device is not in vDPA mode selected by\nthe device devargs provided by the user: vdpa=1.\n\nSigned-off-by: Matan Azrad <matan@mellanox.com>\n---\n drivers/common/mlx5/Makefile                    |  2 +-\n drivers/common/mlx5/meson.build                 |  2 +-\n drivers/common/mlx5/mlx5_common.c               | 36 +++++++++++++++++++++++++\n drivers/common/mlx5/mlx5_common.h               |  3 +++\n drivers/common/mlx5/rte_common_mlx5_version.map |  1 +\n drivers/net/mlx5/mlx5.c                         |  7 ++++-\n drivers/vdpa/mlx5/mlx5_vdpa.c                   |  7 ++++-\n 7 files changed, 54 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/drivers/common/mlx5/Makefile b/drivers/common/mlx5/Makefile\nindex 82403a2..aeacce3 100644\n--- a/drivers/common/mlx5/Makefile\n+++ b/drivers/common/mlx5/Makefile\n@@ -42,7 +42,7 @@ else\n LDLIBS += -libverbs -lmlx5\n endif\n \n-LDLIBS += -lrte_eal -lrte_pci\n+LDLIBS += -lrte_eal -lrte_pci -lrte_kvargs\n \n # A few warnings cannot be avoided in external headers.\n CFLAGS += -Wno-error=cast-qual -DNDEBUG -UPEDANTIC\ndiff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build\nindex 74419c6..8291a92 100644\n--- a/drivers/common/mlx5/meson.build\n+++ b/drivers/common/mlx5/meson.build\n@@ -37,7 +37,7 @@ endforeach\n \n if build\n \tallow_experimental_apis = true\n-\tdeps += ['hash', 'pci', 'net', 'eal']\n+\tdeps += ['hash', 'pci', 'net', 'eal', 'kvargs']\n \text_deps += libs\n \tsources = files(\n \t\t'mlx5_devx_cmds.c',\ndiff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c\nindex 2381208..f756b6b 100644\n--- a/drivers/common/mlx5/mlx5_common.c\n+++ b/drivers/common/mlx5/mlx5_common.c\n@@ -71,6 +71,42 @@\n \treturn 0;\n }\n \n+static int\n+mlx5_vdpa_check_handler(__rte_unused const char *key, const char *value,\n+\t\t\t__rte_unused void *opaque)\n+{\n+\tif (strcmp(value, \"1\"))\n+\t\treturn -1;\n+\treturn 0;\n+}\n+\n+int\n+mlx5_vdpa_mode_selected(struct rte_devargs *devargs)\n+{\n+\tstruct rte_kvargs *kvlist;\n+\tconst char *key = \"vdpa\";\n+\tint ret = 0;\n+\n+\tif (devargs == NULL)\n+\t\treturn 0;\n+\n+\tkvlist = rte_kvargs_parse(devargs->args, NULL);\n+\tif (kvlist == NULL)\n+\t\treturn 0;\n+\n+\tif (!rte_kvargs_count(kvlist, key))\n+\t\tgoto exit;\n+\n+\t/* Vdpa mode selected when there's a key-value pair: vdpa=1. */\n+\tif (rte_kvargs_process(kvlist, key, mlx5_vdpa_check_handler, NULL) < 0)\n+\t\tgoto exit;\n+\tret = 1;\n+\n+exit:\n+\trte_kvargs_free(kvlist);\n+\treturn ret;\n+}\n+\n #ifdef RTE_IBVERBS_LINK_DLOPEN\n \n /**\ndiff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h\nindex 9d464d4..aeaa7b9 100644\n--- a/drivers/common/mlx5/mlx5_common.h\n+++ b/drivers/common/mlx5/mlx5_common.h\n@@ -11,6 +11,8 @@\n #include <rte_pci.h>\n #include <rte_atomic.h>\n #include <rte_log.h>\n+#include <rte_kvargs.h>\n+#include <rte_devargs.h>\n \n #include \"mlx5_prm.h\"\n \n@@ -149,5 +151,6 @@ enum mlx5_cqe_status {\n }\n \n int mlx5_dev_to_pci_addr(const char *dev_path, struct rte_pci_addr *pci_addr);\n+int mlx5_vdpa_mode_selected(struct rte_devargs *devargs);\n \n #endif /* RTE_PMD_MLX5_COMMON_H_ */\ndiff --git a/drivers/common/mlx5/rte_common_mlx5_version.map b/drivers/common/mlx5/rte_common_mlx5_version.map\nindex 37a6902..16b9b34 100644\n--- a/drivers/common/mlx5/rte_common_mlx5_version.map\n+++ b/drivers/common/mlx5/rte_common_mlx5_version.map\n@@ -24,4 +24,5 @@ DPDK_20.02 {\n \tmlx5_devx_get_out_command_status;\n \n \tmlx5_dev_to_pci_addr;\n+\tmlx5_vdpa_mode_selected;\n };\ndiff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 75175c9..27cea8b 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -2956,7 +2956,12 @@ struct mlx5_flow_id_pool *\n \tstruct mlx5_dev_config dev_config;\n \tint ret;\n \n-\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+        if (mlx5_vdpa_mode_selected(pci_dev->device.devargs)) {\n+                DRV_LOG(DEBUG, \"Skip probing - should be probed by the vdpa\"\n+                        \" driver.\");\n+                return 1;\n+        }\n+ \tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n \t\tmlx5_pmd_socket_init();\n \tret = mlx5_init_once();\n \tif (ret) {\ndiff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c\nindex f27a1a4..2ceef18 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa.c\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c\n@@ -243,7 +243,7 @@\n  */\n static int\n mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n-\t\t    struct rte_pci_device *pci_dev __rte_unused)\n+\t\t    struct rte_pci_device *pci_dev)\n {\n \tstruct ibv_device **ibv_list;\n \tstruct ibv_device *ibv_match = NULL;\n@@ -252,6 +252,11 @@\n \tstruct mlx5_hca_attr attr;\n \tint ret;\n \n+\tif (!mlx5_vdpa_mode_selected(pci_dev->device.devargs)) {\n+\t\tDRV_LOG(DEBUG, \"Skip mlx5 vdpa probing - no \\\"vdpa=1\\\" in\"\n+\t\t\t\" devargs.\");\n+\t\treturn 1;\n+\t}\n \terrno = 0;\n \tibv_list = mlx5_glue->get_device_list(&ret);\n \tif (!ibv_list) {\n",
    "prefixes": [
        "v1",
        "33/38"
    ]
}