get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 138225,
    "url": "http://patchwork.dpdk.org/api/patches/138225/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1710262359-14217-3-git-send-email-roretzla@linux.microsoft.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1710262359-14217-3-git-send-email-roretzla@linux.microsoft.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1710262359-14217-3-git-send-email-roretzla@linux.microsoft.com",
    "date": "2024-03-12T16:52:39",
    "name": "[v5,2/2] eal: initialize shared plugins on Windows",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "b34000d25e6d955d8549d42279930a5242c9f3e1",
    "submitter": {
        "id": 2077,
        "url": "http://patchwork.dpdk.org/api/people/2077/?format=api",
        "name": "Tyler Retzlaff",
        "email": "roretzla@linux.microsoft.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patchwork.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1710262359-14217-3-git-send-email-roretzla@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 31482,
            "url": "http://patchwork.dpdk.org/api/series/31482/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=31482",
            "date": "2024-03-12T16:52:37",
            "name": "eal: initialize shared plugins on Windows",
            "version": 5,
            "mbox": "http://patchwork.dpdk.org/series/31482/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/138225/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/138225/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 B447343C93;\n\tTue, 12 Mar 2024 17:52:52 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9CE5442D55;\n\tTue, 12 Mar 2024 17:52:45 +0100 (CET)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 22690427E0\n for <dev@dpdk.org>; Tue, 12 Mar 2024 17:52:42 +0100 (CET)",
            "by linux.microsoft.com (Postfix, from userid 1086)\n id 6BBF020B74C3; Tue, 12 Mar 2024 09:52:41 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 6BBF020B74C3",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1710262361;\n bh=4MZbQEcFT9UWX9tvgJDbN1sj6KxM0XRGuqq8PLNI9MU=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=n3URk4PHT6jvZzvPeAUZZb+emCwmhqLyUKhPQ5fwT3Gk4QvbyREBVyMQRXPSdZzr2\n 6VNNkJkZ/O1AhqGudhXjw0tczZSm81GDa0DkbPXdT/XweHJdtCWwQ6Bn8htQ8rLQhC\n iRuDXK5WRX2L70U5kBjH83LaAJkWiJKuJKXGWS7Y=",
        "From": "Tyler Retzlaff <roretzla@linux.microsoft.com>",
        "To": "dev@dpdk.org",
        "Cc": "Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>,\n Tyler Retzlaff <roretzla@linux.microsoft.com>",
        "Subject": "[PATCH v5 2/2] eal: initialize shared plugins on Windows",
        "Date": "Tue, 12 Mar 2024 09:52:39 -0700",
        "Message-Id": "<1710262359-14217-3-git-send-email-roretzla@linux.microsoft.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1710262359-14217-1-git-send-email-roretzla@linux.microsoft.com>",
        "References": "<1701976851-17275-1-git-send-email-roretzla@linux.microsoft.com>\n <1710262359-14217-1-git-send-email-roretzla@linux.microsoft.com>",
        "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"
    },
    "content": "When EAL is built with MSVC it is possible to dynamically load plugins\non Windows. Hook eal_plugins_init into rte_eal_init if built with MSVC\nand provide code to load plugins on Windows.\n\nSigned-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>\nAcked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>\n---\n lib/eal/common/eal_common_options.c | 90 ++++++++++++++++++++++++++++++-------\n lib/eal/windows/eal.c               |  8 ++++\n 2 files changed, 83 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c\nindex e541f07..bd3f332 100644\n--- a/lib/eal/common/eal_common_options.c\n+++ b/lib/eal/common/eal_common_options.c\n@@ -18,9 +18,7 @@\n #include <libgen.h>\n #endif\n #include <sys/stat.h>\n-#ifndef RTE_EXEC_ENV_WINDOWS\n #include <dirent.h>\n-#endif\n \n #include <rte_string_fns.h>\n #include <rte_eal.h>\n@@ -123,10 +121,8 @@ struct shared_driver {\n static struct shared_driver_list solib_list =\n TAILQ_HEAD_INITIALIZER(solib_list);\n \n-#ifndef RTE_EXEC_ENV_WINDOWS\n /* Default path of external loadable drivers */\n static const char *default_solib_dir = RTE_EAL_PMD_PATH;\n-#endif\n \n /*\n  * Stringified version of solib path used by dpdk-pmdinfo.py\n@@ -391,12 +387,12 @@ struct device_option {\n }\n \n #ifdef RTE_EXEC_ENV_WINDOWS\n-int\n-eal_plugins_init(void)\n-{\n-\treturn 0;\n-}\n+#define SOEXT    \".dll\"\n #else\n+#define SOEXT    \".so\"\n+#endif\n+\n+#define SOABIEXT  SOEXT\".\"ABI_VERSION\n \n static int\n eal_plugindir_init(const char *path)\n@@ -417,12 +413,14 @@ struct device_option {\n \n \twhile ((dent = readdir(d)) != NULL) {\n \t\tstruct stat sb;\n-\t\tint nlen = strnlen(dent->d_name, sizeof(dent->d_name));\n+\t\tsize_t nlen = strnlen(dent->d_name, sizeof(dent->d_name));\n \n-\t\t/* check if name ends in .so or .so.ABI_VERSION */\n-\t\tif (strcmp(&dent->d_name[nlen - 3], \".so\") != 0 &&\n-\t\t    strcmp(&dent->d_name[nlen - 4 - strlen(ABI_VERSION)],\n-\t\t\t   \".so.\"ABI_VERSION) != 0)\n+\t\tif (nlen < strlen(SOABIEXT))\n+\t\t\tcontinue;\n+\n+\t\t/* check if name ends in SOEXT or SOABIEXT */\n+\t\tif (strcmp(&dent->d_name[nlen - strlen(SOEXT)], SOEXT) != 0 &&\n+\t\t    strcmp(&dent->d_name[nlen - strlen(SOABIEXT)], SOABIEXT) != 0)\n \t\t\tcontinue;\n \n \t\tsnprintf(sopath, sizeof(sopath), \"%s/%s\", path, dent->d_name);\n@@ -440,6 +438,68 @@ struct device_option {\n \treturn (dent == NULL) ? 0 : -1;\n }\n \n+#ifdef RTE_EXEC_ENV_WINDOWS\n+static void*\n+eal_dlopen(const char *pathname)\n+{\n+\tvoid *retval = NULL;\n+\tstruct stat pathstat;\n+\tchar *fullpath = _fullpath(NULL, pathname, 0);\n+\n+\tconst char *loadpath = fullpath;\n+\tDWORD loadflags = 0;\n+\n+\tif (fullpath == NULL) {\n+\t\tRTE_LOG_LINE(ERR, EAL, \"Error expanding full path for %s, %s\",\n+\t\tpathname, strerror(errno));\n+\t} else {\n+\t\t/* Verify that the path exists */\n+\t\tif ((stat(fullpath, &pathstat) != 0) && (errno == ENOENT)) {\n+\t\t\t/* not a full or relative path, try a load from default dirs */\n+\t\t\tloadpath = pathname;\n+\t\t\tloadflags = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS;\n+\t\t}\n+\n+\t\tretval = LoadLibraryExA(loadpath, NULL, loadflags);\n+\t\tif (retval == NULL)\n+\t\t\tRTE_LOG_LINE(ERR, EAL, \"Error loading %s, error code: %lu\",\n+\t\t\t    loadpath, GetLastError());\n+\t}\n+\n+\tfree(fullpath);\n+\treturn retval;\n+}\n+\n+static int\n+is_shared_build(void)\n+{\n+\tint shared = 0;\n+\tHMODULE apphandle = NULL;\n+\tHMODULE libhandle = NULL;\n+\n+\t/* if fail to get handle, assume statically linked */\n+\tapphandle = GetModuleHandleA(NULL);\n+\tif (apphandle == NULL) {\n+\t\tRTE_LOG_LINE(ERR, EAL, \"Cannot get handle to the app\");\n+\t\tgoto out;\n+\t}\n+\n+\t/* if fail to get handle, assume statically linked */\n+\tif (GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |\n+\t    GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,\n+\t    (LPCSTR)&eal_plugins_init,\n+\t    &libhandle)) {\n+\t\tif (apphandle != libhandle) {\n+\t\t\t/* lib and app handles are different. */\n+\t\t\t/* Therefore lib is dynamically linked */\n+\t\t\tshared = 1;\n+\t\t}\n+\t}\n+\n+out:\n+\treturn shared;\n+}\n+#else\n static int\n verify_perms(const char *dirpath)\n {\n@@ -547,6 +607,7 @@ struct device_option {\n \tEAL_LOG(INFO, \"Detected static linkage of DPDK\");\n \treturn 0;\n }\n+#endif\n \n int\n eal_plugins_init(void)\n@@ -585,7 +646,6 @@ struct device_option {\n \t}\n \treturn 0;\n }\n-#endif\n \n /*\n  * Parse the coremask given as argument (hexadecimal string) and fill\ndiff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c\nindex 52f0e74..dc2bcb7 100644\n--- a/lib/eal/windows/eal.c\n+++ b/lib/eal/windows/eal.c\n@@ -305,6 +305,14 @@ enum rte_proc_type_t\n \tif (fctret < 0)\n \t\texit(1);\n \n+#ifdef RTE_TOOLCHAIN_MSVC\n+\tif (eal_plugins_init() < 0) {\n+\t\trte_eal_init_alert(\"Cannot init plugins\");\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n+#endif\n+\n \tif (eal_option_device_parse()) {\n \t\trte_errno = ENODEV;\n \t\treturn -1;\n",
    "prefixes": [
        "v5",
        "2/2"
    ]
}