get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 100782,
    "url": "http://patches.dpdk.org/api/patches/100782/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211007184350.73858-15-srikanth.k@oneconvergence.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": "<20211007184350.73858-15-srikanth.k@oneconvergence.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211007184350.73858-15-srikanth.k@oneconvergence.com",
    "date": "2021-10-07T18:43:23",
    "name": "[v2,14/41] net/mlx5: add open IB device routines",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": false,
    "hash": "0f9e14f81da9ebafe781ff099c4ab7cdb2ea4823",
    "submitter": {
        "id": 2368,
        "url": "http://patches.dpdk.org/api/people/2368/?format=api",
        "name": "Srikanth Kaka",
        "email": "srikanth.k@oneconvergence.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20211007184350.73858-15-srikanth.k@oneconvergence.com/mbox/",
    "series": [
        {
            "id": 19455,
            "url": "http://patches.dpdk.org/api/series/19455/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19455",
            "date": "2021-10-07T18:43:09",
            "name": "add MLX5 FreeBSD support",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/19455/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/100782/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/100782/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 6373DA034F;\n\tFri,  8 Oct 2021 12:57:17 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4D1B64117F;\n\tFri,  8 Oct 2021 12:56:13 +0200 (CEST)",
            "from mail-pj1-f48.google.com (mail-pj1-f48.google.com\n [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id 0F05D411E0\n for <dev@dpdk.org>; Thu,  7 Oct 2021 20:44:52 +0200 (CEST)",
            "by mail-pj1-f48.google.com with SMTP id\n ls14-20020a17090b350e00b001a00e2251c8so5832479pjb.4\n for <dev@dpdk.org>; Thu, 07 Oct 2021 11:44:51 -0700 (PDT)",
            "from srikanth-ThinkPad-T450.domain.name ([136.185.113.102])\n by smtp.gmail.com with ESMTPSA id c11sm3311586pji.38.2021.10.07.11.44.48\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 07 Oct 2021 11:44:50 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=oneconvergence.com; s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=TqaLTr2FEirTzgXk1Ixyd2oWhuZS7xQXzt0WLyuC/pg=;\n b=gAzguV6GUXjfU7wGts7onmK5OizR08mMSvXp1FFrt3JGw1tMBWyuJ+wq8y01S6Izmp\n Kmco3n8C3sVkmjqo193t073uyQwkTY4R6kkn1W4NlLkjVWjMi/FmnVzCNlsPWWhObZSI\n 7j8FQkzKdnE48eyJuPUsvJlMOLF9eQTixxs3g=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=TqaLTr2FEirTzgXk1Ixyd2oWhuZS7xQXzt0WLyuC/pg=;\n b=LciER8eSseG3hk6C3NzF+zSwpU7IXLdjcF9V1FxwfaP7b9rC3YlIp7b3O/sMBrjhMT\n Q2BgjKz+4D46bvyJfrfbJ/H7xZV9jSMlUO3vJs4Bxy4QfBcfZE7yNODf5rXw5gHwzLKk\n lEQIGNQN739hm5gEX23PN5al3MQkgniR30o+9gxzKOB1CiGnMzfl/dAoEcc9MalnJwWa\n KjYeUHQqiY7lNiYSA7mzSeAfG2is5NXUlKpawfUX51JN5fNcGx72I8tALDILRbFw19p0\n PZDmn8kLWtsvnp66Ev8FbAm9bMPAn+tT7+ChOZrrXdC3QUVbXQqhi1huqP29hfH6AvfJ\n 5ThQ==",
        "X-Gm-Message-State": "AOAM533hKnayqjNpvtKTWP4xh1YG3HJ7sXT6pffRQhCxVbntjjAXT0h9\n DvZOfJ5unaTj5br32WoAuJC8ng==",
        "X-Google-Smtp-Source": "\n ABdhPJzkPrZbG54oTYqS8J2k+aldzdV0dJ8UDSH9fdTmqXGDmb51Xoqco+WZnkXv7jyF6bIWD0wnrQ==",
        "X-Received": "by 2002:a17:90a:e38f:: with SMTP id\n b15mr6968818pjz.76.1633632291214;\n Thu, 07 Oct 2021 11:44:51 -0700 (PDT)",
        "From": "Srikanth Kaka <srikanth.k@oneconvergence.com>",
        "To": "Matan Azrad <matan@nvidia.com>,\n Viacheslav Ovsiienko <viacheslavo@nvidia.com>",
        "Cc": "dev@dpdk.org, Vag Singh <vag.singh@oneconvergence.com>,\n Anand Thulasiram <avelu@juniper.net>,\n Srikanth Kaka <srikanth.k@oneconvergence.com>",
        "Date": "Fri,  8 Oct 2021 00:13:23 +0530",
        "Message-Id": "<20211007184350.73858-15-srikanth.k@oneconvergence.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20211007184350.73858-1-srikanth.k@oneconvergence.com>",
        "References": "<20211007184350.73858-1-srikanth.k@oneconvergence.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Mailman-Approved-At": "Fri, 08 Oct 2021 12:55:54 +0200",
        "Subject": "[dpdk-dev] [PATCH v2 14/41] net/mlx5: add open IB device routines",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "The mlx5_os_open_device(), mlx5_config_doorbell_mapping_env(),\nmlx5_restore_doorbell_mapping_env(), mlx5_alloc_verbs_buf() and\nmlx5_free_verbs_buf() are equivalent to Linux APIs of the same\nname\n\nSigned-off-by: Srikanth Kaka <srikanth.k@oneconvergence.com>\nSigned-off-by: Vag Singh <vag.singh@oneconvergence.com>\nSigned-off-by: Anand Thulasiram <avelu@juniper.net>\n---\n drivers/net/mlx5/freebsd/mlx5_os.c | 155 +++++++++++++++++++++++++++++\n 1 file changed, 155 insertions(+)",
    "diff": "diff --git a/drivers/net/mlx5/freebsd/mlx5_os.c b/drivers/net/mlx5/freebsd/mlx5_os.c\nindex 1d8e627988..53f74b9d85 100644\n--- a/drivers/net/mlx5/freebsd/mlx5_os.c\n+++ b/drivers/net/mlx5/freebsd/mlx5_os.c\n@@ -5,16 +5,28 @@\n  */\n \n #include <stddef.h>\n+#include <unistd.h>\n+#include <string.h>\n #include <stdint.h>\n #include <stdlib.h>\n #include <errno.h>\n \n+#include <rte_malloc.h>\n+#include <ethdev_driver.h>\n+#include <rte_eal_paging.h>\n+\n #include <mlx5_glue.h>\n+#include <mlx5_devx_cmds.h>\n #include <mlx5_common.h>\n+#include <mlx5_common_mr.h>\n \n #include \"mlx5_defs.h\"\n #include \"mlx5.h\"\n+#include \"mlx5_common_os.h\"\n+#include \"mlx5_rxtx.h\"\n #include \"mlx5_autoconf.h\"\n+#include \"mlx5_mr.h\"\n+#include \"mlx5_verbs.h\"\n \n /**\n  * Get mlx5 device attributes. The glue function query_device_ex() is called\n@@ -86,6 +98,149 @@ mlx5_os_get_dev_attr(void *ctx, struct mlx5_dev_attr *device_attr)\n \treturn err;\n }\n \n+/**\n+ * Verbs callback to allocate a memory. This function should allocate the space\n+ * according to the size provided residing inside a huge page.\n+ * Please note that all allocation must respect the alignment from libmlx5\n+ * (i.e. currently rte_mem_page_size()).\n+ *\n+ * @param[in] size\n+ *   The size in bytes of the memory to allocate.\n+ * @param[in] data\n+ *   A pointer to the callback data.\n+ *\n+ * @return\n+ *   Allocated buffer, NULL otherwise and rte_errno is set.\n+ */\n+static void *\n+mlx5_alloc_verbs_buf(size_t size, void *data)\n+{\n+\tstruct mlx5_dev_ctx_shared *sh = data;\n+\tvoid *ret;\n+\tsize_t alignment = rte_mem_page_size();\n+\tif (alignment == (size_t)-1) {\n+\t\tDRV_LOG(ERR, \"Failed to get mem page size\");\n+\t\trte_errno = ENOMEM;\n+\t\treturn NULL;\n+\t}\n+\n+\tMLX5_ASSERT(data != NULL);\n+\tret = mlx5_malloc(0, size, alignment, sh->numa_node);\n+\tif (!ret && size)\n+\t\trte_errno = ENOMEM;\n+\treturn ret;\n+}\n+\n+/**\n+ * Verbs callback to free a memory.\n+ *\n+ * @param[in] ptr\n+ *   A pointer to the memory to free.\n+ * @param[in] data\n+ *   A pointer to the callback data.\n+ */\n+static void\n+mlx5_free_verbs_buf(void *ptr, void *data __rte_unused)\n+{\n+\tMLX5_ASSERT(data != NULL);\n+\tmlx5_free(ptr);\n+}\n+\n+static int\n+mlx5_config_doorbell_mapping_env(const struct mlx5_dev_config *config)\n+{\n+\tchar *env;\n+\tint value;\n+\n+\tMLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);\n+\t/* Get environment variable to store. */\n+\tenv = getenv(MLX5_SHUT_UP_BF);\n+\tvalue = env ? !!strcmp(env, \"0\") : MLX5_ARG_UNSET;\n+\tif (config->dbnc == MLX5_ARG_UNSET)\n+\t\tsetenv(MLX5_SHUT_UP_BF, MLX5_SHUT_UP_BF_DEFAULT, 1);\n+\telse\n+\t\tsetenv(MLX5_SHUT_UP_BF,\n+\t\t       config->dbnc == MLX5_TXDB_NCACHED ? \"1\" : \"0\", 1);\n+\treturn value;\n+}\n+\n+static void\n+mlx5_restore_doorbell_mapping_env(int value)\n+{\n+\tMLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);\n+\t/* Restore the original environment variable state. */\n+\tif (value == MLX5_ARG_UNSET)\n+\t\tunsetenv(MLX5_SHUT_UP_BF);\n+\telse\n+\t\tsetenv(MLX5_SHUT_UP_BF, value ? \"1\" : \"0\", 1);\n+}\n+\n+/**\n+ * Function API to open IB device.\n+ *\n+ * This function calls the Linux glue APIs to open a device.\n+ *\n+ * @param[in] spawn\n+ *   Pointer to the IB device attributes (name, port, etc).\n+ * @param[out] config\n+ *   Pointer to device configuration structure.\n+ * @param[out] sh\n+ *   Pointer to shared context structure.\n+ *\n+ * @return\n+ *   0 on success, a positive error value otherwise.\n+ */\n+int\n+mlx5_os_open_device(const struct mlx5_dev_spawn_data *spawn,\n+\t\t     const struct mlx5_dev_config *config,\n+\t\t     struct mlx5_dev_ctx_shared *sh)\n+{\n+\tint dbmap_env;\n+\tint err = 0;\n+\n+\tpthread_mutex_init(&sh->txpp.mutex, NULL);\n+\t/*\n+\t * Configure environment variable \"MLX5_BF_SHUT_UP\"\n+\t * before the device creation. The rdma_core library\n+\t * checks the variable at device creation and\n+\t * stores the result internally.\n+\t */\n+\tdbmap_env = mlx5_config_doorbell_mapping_env(config);\n+\t/* Try to open IB device with DV first, then usual Verbs. */\n+\terrno = 0;\n+\tsh->ctx = mlx5_glue->dv_open_device(spawn->phys_dev);\n+\tif (sh->ctx) {\n+\t\tsh->devx = 1;\n+\t\tDRV_LOG(DEBUG, \"DevX is supported\");\n+\t\t/* The device is created, no need for environment. */\n+\t\tmlx5_restore_doorbell_mapping_env(dbmap_env);\n+\t} else {\n+\t\t/* The environment variable is still configured. */\n+\t\tsh->ctx = mlx5_glue->open_device(spawn->phys_dev);\n+\t\terr = errno ? errno : ENODEV;\n+\t\t/*\n+\t\t * The environment variable is not needed anymore,\n+\t\t * all device creation attempts are completed.\n+\t\t */\n+\t\tmlx5_restore_doorbell_mapping_env(dbmap_env);\n+\t\tif (!sh->ctx)\n+\t\t\treturn err;\n+\t\tDRV_LOG(DEBUG, \"DevX is NOT supported\");\n+\t\terr = 0;\n+\t}\n+\tif (!err && sh->ctx) {\n+\t\t/* Hint libmlx5 to use PMD allocator for data plane resources */\n+\t\tmlx5_glue->dv_set_context_attr(sh->ctx,\n+\t\t\tMLX5DV_CTX_ATTR_BUF_ALLOCATORS,\n+\t\t\t(void *)((uintptr_t)&(struct mlx5dv_ctx_allocators){\n+\t\t\t\t.alloc = &mlx5_alloc_verbs_buf,\n+\t\t\t\t.free = &mlx5_free_verbs_buf,\n+\t\t\t\t.data = sh,\n+\t\t\t}));\n+\t}\n+\treturn err;\n+}\n+\n /**\n  * Set the reg_mr and dereg_mr call backs\n  *\n",
    "prefixes": [
        "v2",
        "14/41"
    ]
}