get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1125447,
    "url": "http://patchwork.ozlabs.org/api/patches/1125447/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190701071613.2315-1-alice.michael@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/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": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20190701071613.2315-1-alice.michael@intel.com>",
    "list_archive_url": null,
    "date": "2019-07-01T07:16:13",
    "name": "[next] i40e: Register RDMA client devices to the virtual platform bus",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": false,
    "hash": "4ffa21805a50b435f981627c0c05793f709b198b",
    "submitter": {
        "id": 71123,
        "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api",
        "name": "Michael, Alice",
        "email": "alice.michael@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190701071613.2315-1-alice.michael@intel.com/mbox/",
    "series": [
        {
            "id": 117091,
            "url": "http://patchwork.ozlabs.org/api/series/117091/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=117091",
            "date": "2019-07-01T07:16:13",
            "name": "[next] i40e: Register RDMA client devices to the virtual platform bus",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/117091/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1125447/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1125447/checks/",
    "tags": {},
    "related": [],
    "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@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 45cs1418dgz9s3Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  2 Jul 2019 01:36:39 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 595EA85F11;\n\tMon,  1 Jul 2019 15:36:38 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 61uA0pBg3-cb; Mon,  1 Jul 2019 15:36:37 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 6059385EBB;\n\tMon,  1 Jul 2019 15:36:37 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id A399E1BF2BC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  1 Jul 2019 15:36:35 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 9EF5685E07\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  1 Jul 2019 15:36:35 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id kSZ4M7AOmXpr for <intel-wired-lan@lists.osuosl.org>;\n\tMon,  1 Jul 2019 15:36:34 +0000 (UTC)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 773A285B18\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  1 Jul 2019 15:36:34 +0000 (UTC)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t01 Jul 2019 08:36:33 -0700",
            "from alicemic-1.jf.intel.com ([10.166.17.62])\n\tby orsmga004.jf.intel.com with ESMTP; 01 Jul 2019 08:36:33 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.63,439,1557212400\"; d=\"scan'208\";a=\"314920890\"",
        "From": "Alice Michael <alice.michael@intel.com>",
        "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Mon,  1 Jul 2019 03:16:13 -0400",
        "Message-Id": "<20190701071613.2315-1-alice.michael@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [next PATCH] i40e: Register RDMA client devices\n\tto the virtual platform bus",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<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\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Saleem@osuosl.org, Shiraz Saleem <shiraz.saleem@intel.com>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Shiraz Saleem <shiraz.saleem@intel.com>\n\nRegister RDMA client devices to the virtual platform bus. The\nunified RDMA driver 'irdma' registers as a platform driver and\nwill bind to these devices. This model is inspired by the discussion\nin [1]. It realizes a single RDMA driver capable of working with\nmultiple LAN drivers over multi-generation Intel HW supporting RDMA.\nThere is also no load ordering dependencies between i40e and irdma.\n\nSummary of changes:\n* Register a platform client device per PF and unregister the platform\n  device when PF goes away.\n* Add 2 new client ops.\n\t* i40e_client_device_register() which is called during RDMA\n\t  probe() per PF. Validate client drv OPs and schedule service\n\t  task to call open()\n\t* i40e_client_device_unregister() called during RDMA remove()\n\t  per PF. Call client close() and release_qvlist.\n* The global register/unregister calls exported for i40iw are retained until i40iw is\n   removed from the kernel.\n\n[1] https://patchwork.kernel.org/patch/10815567/\n\nSigned-off-by: Saleem, Shiraz <shiraz.saleem@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_client.c | 116 ++++++++++++++----\n drivers/net/ethernet/intel/i40e/i40e_client.h |   8 ++\n 2 files changed, 102 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c b/drivers/net/ethernet/intel/i40e/i40e_client.c\nindex e81530ca08d0..133950d190a6 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_client.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_client.c\n@@ -30,11 +30,17 @@ static int i40e_client_update_vsi_ctxt(struct i40e_info *ldev,\n \t\t\t\t       bool is_vf, u32 vf_id,\n \t\t\t\t       u32 flag, u32 valid_flag);\n \n+static int i40e_client_device_register(struct i40e_info *ldev);\n+\n+static void i40e_client_device_unregister(struct i40e_info *ldev);\n+\n static struct i40e_ops i40e_lan_ops = {\n \t.virtchnl_send = i40e_client_virtchnl_send,\n \t.setup_qvlist = i40e_client_setup_qvlist,\n \t.request_reset = i40e_client_request_reset,\n \t.update_vsi_ctxt = i40e_client_update_vsi_ctxt,\n+\t.client_device_register = i40e_client_device_register,\n+\t.client_device_unregister = i40e_client_device_unregister,\n };\n \n /**\n@@ -71,6 +77,10 @@ int i40e_client_get_params(struct i40e_vsi *vsi, struct i40e_params *params)\n \treturn 0;\n }\n \n+static void i40e_client_device_release(struct device *dev)\n+{\n+}\n+\n /**\n  * i40e_notify_client_of_vf_msg - call the client vf message callback\n  * @vsi: the VSI with the message\n@@ -287,9 +297,7 @@ static void i40e_client_add_instance(struct i40e_pf *pf)\n \tstruct i40e_client_instance *cdev = NULL;\n \tstruct netdev_hw_addr *mac = NULL;\n \tstruct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];\n-\n-\tif (!registered_client || pf->cinst)\n-\t\treturn;\n+\tstruct platform_device *platform_dev;\n \n \tcdev = kzalloc(sizeof(*cdev), GFP_KERNEL);\n \tif (!cdev)\n@@ -308,6 +316,12 @@ static void i40e_client_add_instance(struct i40e_pf *pf)\n \tcdev->lan_info.fw_maj_ver = pf->hw.aq.fw_maj_ver;\n \tcdev->lan_info.fw_min_ver = pf->hw.aq.fw_min_ver;\n \tcdev->lan_info.fw_build = pf->hw.aq.fw_build;\n+\tplatform_dev = &cdev->lan_info.platform_dev;\n+\tplatform_dev->name = \"i40e_rdma\";\n+\tplatform_dev->id = PLATFORM_DEVID_AUTO;\n+\tplatform_dev->id_auto = true;\n+\tplatform_dev->dev.release = i40e_client_device_release;\n+\tplatform_dev->dev.parent = &pf->pdev->dev;\n \tset_bit(__I40E_CLIENT_INSTANCE_NONE, &cdev->state);\n \n \tif (i40e_client_get_params(vsi, &cdev->lan_info.params)) {\n@@ -323,10 +337,12 @@ static void i40e_client_add_instance(struct i40e_pf *pf)\n \telse\n \t\tdev_err(&pf->pdev->dev, \"MAC address list is empty!\\n\");\n \n-\tcdev->client = registered_client;\n+\tcdev->client = NULL;\n \tpf->cinst = cdev;\n \n-\ti40e_client_update_msix_info(pf);\n+\tcdev->lan_info.msix_count = pf->num_iwarp_msix;\n+\tcdev->lan_info.msix_entries = &pf->msix_entries[pf->iwarp_base_vector];\n+\tplatform_device_register(platform_dev);\n }\n \n /**\n@@ -347,7 +363,7 @@ void i40e_client_del_instance(struct i40e_pf *pf)\n  **/\n void i40e_client_subtask(struct i40e_pf *pf)\n {\n-\tstruct i40e_client *client = registered_client;\n+\tstruct i40e_client *client;\n \tstruct i40e_client_instance *cdev;\n \tstruct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];\n \tint ret = 0;\n@@ -361,9 +377,11 @@ void i40e_client_subtask(struct i40e_pf *pf)\n \t    test_bit(__I40E_CONFIG_BUSY, pf->state))\n \t\treturn;\n \n-\tif (!client || !cdev)\n+\tif (!cdev || !cdev->client)\n \t\treturn;\n \n+\tclient = cdev->client;\n+\n \t/* Here we handle client opens. If the client is down, and\n \t * the netdev is registered, then open the client.\n \t */\n@@ -424,16 +442,7 @@ int i40e_lan_add_device(struct i40e_pf *pf)\n \t\t pf->hw.pf_id, pf->hw.bus.bus_id,\n \t\t pf->hw.bus.device, pf->hw.bus.func);\n \n-\t/* If a client has already been registered, we need to add an instance\n-\t * of it to our new LAN device.\n-\t */\n-\tif (registered_client)\n-\t\ti40e_client_add_instance(pf);\n-\n-\t/* Since in some cases register may have happened before a device gets\n-\t * added, we can schedule a subtask to go initiate the clients if\n-\t * they can be launched at probe time.\n-\t */\n+\ti40e_client_add_instance(pf);\n \tset_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);\n \ti40e_service_event_schedule(pf);\n \n@@ -453,6 +462,8 @@ int i40e_lan_del_device(struct i40e_pf *pf)\n \tstruct i40e_device *ldev, *tmp;\n \tint ret = -ENODEV;\n \n+\tplatform_device_unregister(&pf->cinst->lan_info.platform_dev);\n+\n \t/* First, remove any client instance. */\n \ti40e_client_del_instance(pf);\n \n@@ -505,10 +516,7 @@ static void i40e_client_release(struct i40e_client *client)\n \t\t\t\t \"Client %s instance for PF id %d closed\\n\",\n \t\t\t\t client->name, pf->hw.pf_id);\n \t\t}\n-\t\t/* delete the client instance */\n-\t\ti40e_client_del_instance(pf);\n-\t\tdev_info(&pf->pdev->dev, \"Deleted client instance of Client %s\\n\",\n-\t\t\t client->name);\n+\t\tcdev->client = NULL;\n \t\tclear_bit(__I40E_SERVICE_SCHED, pf->state);\n \t}\n \tmutex_unlock(&i40e_device_mutex);\n@@ -527,7 +535,7 @@ static void i40e_client_prepare(struct i40e_client *client)\n \tmutex_lock(&i40e_device_mutex);\n \tlist_for_each_entry(ldev, &i40e_devices, list) {\n \t\tpf = ldev->pf;\n-\t\ti40e_client_add_instance(pf);\n+\t\tpf->cinst->client = registered_client;\n \t\t/* Start the client subtask */\n \t\tset_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);\n \t\ti40e_service_event_schedule(pf);\n@@ -733,6 +741,70 @@ static int i40e_client_update_vsi_ctxt(struct i40e_info *ldev,\n \treturn err;\n }\n \n+static int i40e_client_device_register(struct i40e_info *ldev)\n+{\n+\tstruct i40e_client *client;\n+\tstruct i40e_pf *pf;\n+\n+\tif (!ldev) {\n+\t\tpr_err(\"Failed to reg client dev: ldev ptr NULL\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tclient = ldev->client;\n+\tpf = ldev->pf;\n+\tif (!client) {\n+\t\tpr_err(\"Failed to reg client dev: client ptr NULL\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (!ldev->ops || !client->ops) {\n+\t\tpr_err(\"Failed to reg client dev: client dev peer_ops/ops NULL\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (client->version.major != I40E_CLIENT_VERSION_MAJOR ||\n+\t    client->version.minor != I40E_CLIENT_VERSION_MINOR) {\n+\t\tpr_err(\"i40e: Failed to register client %s due to mismatched client interface version\\n\",\n+\t\t       client->name);\n+\t\tpr_err(\"Client is using version: %02d.%02d.%02d while LAN driver supports %s\\n\",\n+\t\t       client->version.major, client->version.minor,\n+\t\t       client->version.build,\n+\t\t       i40e_client_interface_version_str);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tpf->cinst->client = ldev->client;\n+\tset_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);\n+\ti40e_service_event_schedule(pf);\n+\n+\treturn 0;\n+}\n+\n+static void i40e_client_device_unregister(struct i40e_info *ldev)\n+{\n+\tstruct i40e_pf *pf = ldev->pf;\n+\tstruct i40e_client_instance *cdev = pf->cinst;\n+\n+\twhile (test_and_set_bit(__I40E_SERVICE_SCHED, pf->state))\n+\t\tusleep_range(500, 1000);\n+\n+\tif (!cdev || !cdev->client || !cdev->client->ops ||\n+\t    !cdev->client->ops->close) {\n+\t\tdev_err(&pf->pdev->dev, \"Cannot close client device\\n\");\n+\t\treturn;\n+\t}\n+\tcdev->client->ops->close(&cdev->lan_info, cdev->client, false);\n+\tclear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);\n+\ti40e_client_release_qvlist(&cdev->lan_info);\n+\tpf->cinst->client = NULL;\n+\tclear_bit(__I40E_SERVICE_SCHED, pf->state);\n+}\n+\n+/* Retain legacy global registration/unregistration calls till i40iw is\n+ * deprecated from the kernel. The irdma unified driver does not use these\n+ * exported symbols.\n+ */\n /**\n  * i40e_register_client - Register a i40e client driver with the L2 driver\n  * @client: pointer to the i40e_client struct\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_client.h b/drivers/net/ethernet/intel/i40e/i40e_client.h\nindex 72994baf4941..0cfdb35e93d6 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_client.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_client.h\n@@ -4,6 +4,8 @@\n #ifndef _I40E_CLIENT_H_\n #define _I40E_CLIENT_H_\n \n+#include <linux/platform_device.h>\n+\n #define I40E_CLIENT_STR_LENGTH 10\n \n /* Client interface version should be updated anytime there is a change in the\n@@ -80,6 +82,7 @@ struct i40e_params {\n \n /* Structure to hold Lan device info for a client device */\n struct i40e_info {\n+\tstruct platform_device platform_dev;\n \tstruct i40e_client_version version;\n \tu8 lanmac[6];\n \tstruct net_device *netdev;\n@@ -97,6 +100,7 @@ struct i40e_info {\n \tstruct i40e_qvlist_info *qvlist_info;\n \tstruct i40e_params params;\n \tstruct i40e_ops *ops;\n+\tstruct i40e_client *client;\n \n \tu16 msix_count;\t /* number of msix vectors*/\n \t/* Array down below will be dynamically allocated based on msix_count */\n@@ -132,6 +136,10 @@ struct i40e_ops {\n \t\t\t       struct i40e_client *client,\n \t\t\t       bool is_vf, u32 vf_id,\n \t\t\t       u32 flag, u32 valid_flag);\n+\n+\tint (*client_device_register)(struct i40e_info *ldev);\n+\n+\tvoid (*client_device_unregister)(struct i40e_info *ldev);\n };\n \n struct i40e_client_ops {\n",
    "prefixes": [
        "next"
    ]
}