get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2229456,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229456/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260428090912.3461-2-przemyslaw.kitszel@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260428090912.3461-2-przemyslaw.kitszel@intel.com>",
    "date": "2026-04-28T09:09:11",
    "name": "[net-next,1/2] devlink, mlx5: add init/fini ops for shared devlink",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "654ccfdf1f8927dc93558e1e34f3b0a5ec2293d4",
    "submitter": {
        "id": 85252,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/85252/?format=api",
        "name": "Przemek Kitszel",
        "email": "przemyslaw.kitszel@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260428090912.3461-2-przemyslaw.kitszel@intel.com/mbox/",
    "series": [
        {
            "id": 501805,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/501805/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=501805",
            "date": "2026-04-28T09:09:11",
            "name": "devlink, ice, mlx5: add init/fini ops for shared devlink for ice to use",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/501805/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2229456/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2229456/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=AxGJi7Co;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4ZnZ2VhYz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 19:26:42 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id E7BAB838AB;\n\tTue, 28 Apr 2026 09:26:40 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id bWVfiSsMFKDs; Tue, 28 Apr 2026 09:26:40 +0000 (UTC)",
            "from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id EDA24838AF;\n\tTue, 28 Apr 2026 09:26:39 +0000 (UTC)",
            "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n by lists1.osuosl.org (Postfix) with ESMTP id A0C63231\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 09:26:38 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 86DC8838AB\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 09:26:38 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id 1laZe3nqOH0H for <intel-wired-lan@lists.osuosl.org>;\n Tue, 28 Apr 2026 09:26:37 +0000 (UTC)",
            "from mgamail.intel.com (mgamail.intel.com [192.198.163.7])\n by smtp1.osuosl.org (Postfix) with ESMTPS id 7EDF2838AF\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 09:26:37 +0000 (UTC)",
            "from orviesa003.jf.intel.com ([10.64.159.143])\n by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Apr 2026 02:26:37 -0700",
            "from irvmail002.ir.intel.com ([10.43.11.120])\n by orviesa003.jf.intel.com with ESMTP; 28 Apr 2026 02:26:33 -0700",
            "from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17])\n by irvmail002.ir.intel.com (Postfix) with ESMTP id D68C928188;\n Tue, 28 Apr 2026 10:26:30 +0100 (IST)"
        ],
        "X-Virus-Scanned": [
            "amavis at osuosl.org",
            "amavis at osuosl.org"
        ],
        "X-Comment": "SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ",
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 smtp1.osuosl.org EDA24838AF",
            "OpenDKIM Filter v2.11.0 smtp1.osuosl.org 7EDF2838AF"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1777368400;\n\tbh=4g5VmQV9ue4ae3D531te0HjiRpuGmKNPpczir6+dJzQ=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=AxGJi7Co8Ed5J6NICIN35tQNA+99A7Uom67MC62CpqvyHBOcMv6kkvDkde0V/EwpT\n\t KrqRairm1vT1XORhJq5EBg81ehtj90gB2uH4+Yhz8xCtOSEcBhXAwY3IpDzd86TKQg\n\t L66z3E5xGgTgBngSq5HxwFuhUUHtfYmEogWm6TchQI5A6bbTgihk46wOdJYlK/Jjua\n\t 3rGirFK1eemSUV7QHn+CnKoDlCTXyokodYfXGl+Q/ESXkivqOZwmmKxyBm1zuSybeZ\n\t sZMBKNH0x02AbqLBh2ovv3DfQYfVDwxMzSJY3/R/91VYTYq1spzMGUvtDgUSJ/a9XA\n\t F6b+4n0qbxgaA==",
        "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.7;\n helo=mgamail.intel.com; envelope-from=przemyslaw.kitszel@intel.com;\n receiver=<UNKNOWN>",
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp1.osuosl.org 7EDF2838AF",
        "X-CSE-ConnectionGUID": [
            "k/GHSDDTToaBbpF6JJqO9w==",
            "ayKi81XLStevZ5V8yU6sHA=="
        ],
        "X-CSE-MsgGUID": [
            "Q7DFgpyWRYa1Z1xIuBGQ+w==",
            "W81hOHn6TvqsDImOG9nIHg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6800,10657,11769\"; a=\"103731761\"",
            "E=Sophos;i=\"6.23,203,1770624000\"; d=\"scan'208\";a=\"103731761\"",
            "E=Sophos;i=\"6.23,203,1770624000\"; d=\"scan'208\";a=\"237861390\""
        ],
        "X-ExtLoop1": "1",
        "From": "Przemek Kitszel <przemyslaw.kitszel@intel.com>",
        "To": "netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,\n Jiri Pirko <jiri@resnulli.us>",
        "Cc": "intel-wired-lan@lists.osuosl.org,\n Tony Nguyen <anthony.l.nguyen@intel.com>,\n Jacob Keller <jacob.e.keller@intel.com>,\n Lukasz Czapnik <lukasz.czapnik@intel.com>,\n Jedrzej Jagielski <jedrzej.jagielski@intel.com>,\n Andrew Lunn <andrew+netdev@lunn.ch>,\n \"David S. Miller\" <davem@davemloft.net>,\n Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>,\n Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leon@kernel.org>,\n Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,\n Simon Horman <horms@kernel.org>,\n Przemek Kitszel <przemyslaw.kitszel@intel.com>,\n Aleksandr Loktionov <aleksandr.loktionov@intel.com>",
        "Date": "Tue, 28 Apr 2026 11:09:11 +0200",
        "Message-Id": "<20260428090912.3461-2-przemyslaw.kitszel@intel.com>",
        "X-Mailer": "git-send-email 2.39.3",
        "In-Reply-To": "<20260428090912.3461-1-przemyslaw.kitszel@intel.com>",
        "References": "<20260428090912.3461-1-przemyslaw.kitszel@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Mailman-Original-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1777368398; x=1808904398;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=yq/s9uKlS46UrpyeneLRebLiJ7P5fmJnlmahGIHlFwI=;\n b=dj9K7sNsEAQ3/57NFQKc98oqlEoKe1T5TVrlv9qgp4fCF1aeccB1yqk8\n o1HCP1KMQzU02S4hOPE7vhFp60FPsd3VTVmpcBvK8EqOgFsmfBchz7TVM\n 6NwwTfnWHVl2u+7XLwBFNjovK/Wk6et/QDzfGHZzK9w8j2hqKTKmHX3ix\n 6RxmTSjYU8/Z/bUNLHMHIkKU5xW+clXMV6ErygRtDtWtAjg5ji6Iu17n5\n 57xTyrwXUTfRFPyaTWQOktqcYnzBgK0YUrTPYFKCyH2fuxXWjd3XHhcHW\n X+VVmH3PuehkcbfAIDMl3oNBxF0tdom7XZFmxywQoGAfly4WD5TVZ7biW\n w==;",
        "X-Mailman-Original-Authentication-Results": [
            "smtp1.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com",
            "smtp1.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=dj9K7sNs"
        ],
        "Subject": "[Intel-wired-lan] [PATCH net-next 1/2] devlink,\n mlx5: add init/fini ops for shared devlink",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "Add .shd_init() and .shd_fini() ops, that will be called for the first\ndevlink_shd_get() (to initialize driver' priv data) and on the last\ndevlink_shd_put() (to allow for the cleanup). Both ops are optional.\n\n.shd_init() could return an error, which will stop creation of shd\ninstance. The initializer also gets an additional, optional param,\nthat driver could use for any needs.\n\nIf any of the callbacks will need to get devlink instance, it could\nbe accessed by shd_priv_to_devlink().\n\nBoth callbacks are called with devl_lock held and devlink registered.\n\nNext commit will make use of the callbacks, another one will make use also\nof the non-null additional param (outside of this series).\n\nReviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\nSigned-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>\n---\nfirst discussed at:\nhttps://lore.kernel.org/netdev/20260325063143.261806-3-przemyslaw.kitszel@intel.com\n\nSashiko suggested to convert devlink_shd_create() to return ERR_PTR(),\nand propagate that up to the driver. It think it will just make code more\nverbose for not much benefit. And drivers could just store err if they\nwant in the passed @init_param.\n\n---\n include/net/devlink.h                         | 26 +++++++++++++\n .../ethernet/mellanox/mlx5/core/sh_devlink.c  |  2 +-\n net/devlink/sh_dev.c                          | 39 ++++++++++++++++++-\n 3 files changed, 64 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/include/net/devlink.h b/include/net/devlink.h\nindex bcd31de1f890..5d3a1337bfa1 100644\n--- a/include/net/devlink.h\n+++ b/include/net/devlink.h\n@@ -1586,6 +1586,30 @@ struct devlink_ops {\n \t\t\t\t    struct devlink_rate *parent,\n \t\t\t\t    void *priv_child, void *priv_parent,\n \t\t\t\t    struct netlink_ext_ack *extack);\n+\n+\t/**\n+\t * shd_init: Shared devlink instance initializer\n+\t * @priv: shd_devlink' priv\n+\t * @init_param: additional param to pass to driver callback\n+\t *\n+\t * Called once when the shared instance is first created (by the first\n+\t * devlink_shd_get() call).\n+\t * Should initialize the driver's private data embedded in the shared\n+\t * devlink. May be NULL.\n+\t *\n+\t * Return: 0 on success, negative to prevent shared instance usage.\n+\t */\n+\tint (*shd_init)(void *priv, void *init_param);\n+\t/**\n+\t * shd_fini: Shared devlink instance finalizer\n+\t * @priv: shd_devlink' priv\n+\t *\n+\t * Called once when the last reference is dropped and the shared\n+\t * instance is destroyed. Should clean up the driver's private data.\n+\t * May be NULL.\n+\t */\n+\tvoid (*shd_fini)(void *priv);\n+\n \t/**\n \t * selftests_check() - queries if selftest is supported\n \t * @devlink: devlink instance\n@@ -1651,9 +1675,11 @@ void devlink_free(struct devlink *devlink);\n struct devlink *devlink_shd_get(const char *id,\n \t\t\t\tconst struct devlink_ops *ops,\n \t\t\t\tsize_t priv_size,\n+\t\t\t\tvoid *init_param,\n \t\t\t\tconst struct device_driver *driver);\n void devlink_shd_put(struct devlink *devlink);\n void *devlink_shd_get_priv(struct devlink *devlink);\n+struct devlink *shd_priv_to_devlink(void *priv);\n \n /**\n  * struct devlink_port_ops - Port operations\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c\nindex b925364765ac..1b8b1ce7e72d 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c\n@@ -43,7 +43,7 @@ int mlx5_shd_init(struct mlx5_core_dev *dev)\n \t*end = '\\0';\n \n \t/* Get or create shared devlink instance */\n-\tdevlink = devlink_shd_get(sn, &mlx5_shd_ops, 0, pdev->dev.driver);\n+\tdevlink = devlink_shd_get(sn, &mlx5_shd_ops, 0, NULL, pdev->dev.driver);\n \tkfree(sn);\n \tif (!devlink)\n \t\treturn -ENOMEM;\ndiff --git a/net/devlink/sh_dev.c b/net/devlink/sh_dev.c\nindex 85acce97e788..048a2a6adc9e 100644\n--- a/net/devlink/sh_dev.c\n+++ b/net/devlink/sh_dev.c\n@@ -34,6 +34,7 @@ static struct devlink_shd *devlink_shd_lookup(const char *id)\n static struct devlink_shd *devlink_shd_create(const char *id,\n \t\t\t\t\t      const struct devlink_ops *ops,\n \t\t\t\t\t      size_t priv_size,\n+\t\t\t\t\t      void *init_param,\n \t\t\t\t\t      const struct device_driver *driver)\n {\n \tstruct devlink_shd *shd;\n@@ -49,16 +50,30 @@ static struct devlink_shd *devlink_shd_create(const char *id,\n \tif (!shd->id)\n \t\tgoto err_devlink_free;\n \tshd->priv_size = priv_size;\n-\trefcount_set(&shd->refcount, 1);\n \n \tdevl_lock(devlink);\n \tdevl_register(devlink);\n+\n+\tif (ops->shd_init) {\n+\t\tint err;\n+\n+\t\terr = ops->shd_init(shd->priv, init_param);\n+\t\tif (err)\n+\t\t\tgoto err_unregister;\n+\t}\n+\n \tdevl_unlock(devlink);\n \n+\trefcount_set(&shd->refcount, 1);\n \tlist_add_tail(&shd->list, &shd_list);\n \n \treturn shd;\n \n+err_unregister:\n+\tdevl_unregister(devlink);\n+\tdevl_unlock(devlink);\n+\tkfree(shd->id);\n+\n err_devlink_free:\n \tdevlink_free(devlink);\n \treturn NULL;\n@@ -69,7 +84,12 @@ static void devlink_shd_destroy(struct devlink_shd *shd)\n \tstruct devlink *devlink = priv_to_devlink(shd);\n \n \tlist_del(&shd->list);\n+\n \tdevl_lock(devlink);\n+\n+\tif (devlink->ops->shd_fini)\n+\t\tdevlink->ops->shd_fini(shd->priv);\n+\n \tdevl_unregister(devlink);\n \tdevl_unlock(devlink);\n \tkfree(shd->id);\n@@ -81,6 +101,7 @@ static void devlink_shd_destroy(struct devlink_shd *shd)\n  * @id: Identifier string (e.g., serial number) for the shared instance\n  * @ops: Devlink operations structure\n  * @priv_size: Size of private data structure\n+ * @init_param: Passed to .shd_init() callback alongside driver's priv\n  * @driver: Driver associated with the shared devlink instance\n  *\n  * Get an existing shared devlink instance identified by @id, or create\n@@ -96,16 +117,17 @@ static void devlink_shd_destroy(struct devlink_shd *shd)\n struct devlink *devlink_shd_get(const char *id,\n \t\t\t\tconst struct devlink_ops *ops,\n \t\t\t\tsize_t priv_size,\n+\t\t\t\tvoid *init_param,\n \t\t\t\tconst struct device_driver *driver)\n {\n \tstruct devlink *devlink;\n \tstruct devlink_shd *shd;\n \n \tmutex_lock(&shd_mutex);\n \n \tshd = devlink_shd_lookup(id);\n \tif (!shd) {\n-\t\tshd = devlink_shd_create(id, ops, priv_size, driver);\n+\t\tshd = devlink_shd_create(id, ops, priv_size, init_param, driver);\n \t\tgoto unlock;\n \t}\n \n@@ -159,3 +181,16 @@ void *devlink_shd_get_priv(struct devlink *devlink)\n \treturn shd->priv;\n }\n EXPORT_SYMBOL_GPL(devlink_shd_get_priv);\n+\n+/** shd_priv_to_devlink - Get devlink instance from shd_devlink's priv\n+ * @priv: Driver's priv data\n+ *\n+ * Return: pointer to shared devlink instance the @priv belongs to.\n+ */\n+struct devlink *shd_priv_to_devlink(void *priv)\n+{\n+\tstruct devlink_shd *shd = container_of(priv, struct devlink_shd, priv);\n+\n+\treturn priv_to_devlink(shd);\n+}\n+EXPORT_SYMBOL_GPL(shd_priv_to_devlink);\n",
    "prefixes": [
        "net-next",
        "1/2"
    ]
}