get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1224511,
    "url": "http://patchwork.ozlabs.org/api/patches/1224511/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200116230610.1868-2-shiraz.saleem@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": "<20200116230610.1868-2-shiraz.saleem@intel.com>",
    "list_archive_url": null,
    "date": "2020-01-16T23:06:10",
    "name": "[2/2] i40e: Register a virtbus device to provide RDMA",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c49576e0a85bf1391d420b04fb73399265f36d00",
    "submitter": {
        "id": 69500,
        "url": "http://patchwork.ozlabs.org/api/people/69500/?format=api",
        "name": "Saleem, Shiraz",
        "email": "shiraz.saleem@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/20200116230610.1868-2-shiraz.saleem@intel.com/mbox/",
    "series": [
        {
            "id": 153688,
            "url": "http://patchwork.ozlabs.org/api/series/153688/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=153688",
            "date": "2020-01-16T23:06:10",
            "name": "[1/2] i40e: Move client header location",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/153688/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1224511/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1224511/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; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.138;\n\thelo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 47zKZv23xSz9s1x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 17 Jan 2020 10:07:03 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id C1CBD86BB9;\n\tThu, 16 Jan 2020 23:07:01 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 3YThf4f40BWy; Thu, 16 Jan 2020 23:06:57 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 06A64869E6;\n\tThu, 16 Jan 2020 23:06:57 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id BF8781BF39D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 16 Jan 2020 23:06:55 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id BA9A020482\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 16 Jan 2020 23:06:55 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 71o8hUQEQQV2 for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 16 Jan 2020 23:06:52 +0000 (UTC)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby silver.osuosl.org (Postfix) with ESMTPS id CA107203CA\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 16 Jan 2020 23:06:52 +0000 (UTC)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t16 Jan 2020 15:06:52 -0800",
            "from nmaznan-mobl1.gar.corp.intel.com (HELO\n\tssaleem-MOBL.amr.corp.intel.com) ([10.254.99.102])\n\tby fmsmga005.fm.intel.com with ESMTP; 16 Jan 2020 15:06:51 -0800"
        ],
        "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.70,327,1574150400\"; d=\"scan'208\";a=\"424242460\"",
        "From": "Shiraz Saleem <shiraz.saleem@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu, 16 Jan 2020 17:06:10 -0600",
        "Message-Id": "<20200116230610.1868-2-shiraz.saleem@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20200116230610.1868-1-shiraz.saleem@intel.com>",
        "References": "<20200116230610.1868-1-shiraz.saleem@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH 2/2] i40e: Register a virtbus device to\n\tprovide RDMA",
        "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": "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": "Register client virtbus device on the virtbus for the RDMA\nvirtbus driver (irdma) to bind to. It allows to realize a\nsingle RDMA driver capable of working with multiple netdev\ndrivers over multi-generation Intel HW supporting RDMA.\nThere is also no load ordering dependencies between i40e and\nirdma.\n\nSummary of changes:\n* Support to add/remove virtbus devices\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\n  until i40iw is removed from the kernel.\n\nSigned-off-by: Mustafa Ismail <mustafa.ismail@intel.com>\nSigned-off-by: Shiraz Saleem <shiraz.saleem@intel.com>\n---\n drivers/net/ethernet/intel/Kconfig            |   1 +\n drivers/net/ethernet/intel/i40e/i40e_client.c | 137 ++++++++++++++++++++++----\n include/linux/net/intel/i40e_client.h         |  15 +++\n 3 files changed, 133 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig\nindex 154e2e8..90d6fb1 100644\n--- a/drivers/net/ethernet/intel/Kconfig\n+++ b/drivers/net/ethernet/intel/Kconfig\n@@ -241,6 +241,7 @@ config I40E\n \ttristate \"Intel(R) Ethernet Controller XL710 Family support\"\n \timply PTP_1588_CLOCK\n \tdepends on PCI\n+\tselect VIRTUAL_BUS\n \t---help---\n \t  This driver supports Intel(R) Ethernet Controller XL710 Family of\n \t  devices.  For more information on how to identify your adapter, go\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c b/drivers/net/ethernet/intel/i40e/i40e_client.c\nindex befd301..15e8cd8 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_client.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_client.c\n@@ -1,6 +1,7 @@\n // SPDX-License-Identifier: GPL-2.0\n /* Copyright(c) 2013 - 2018 Intel Corporation. */\n \n+#include <linux/net/intel/i40e_client.h>\n #include <linux/list.h>\n #include <linux/errno.h>\n #include <linux/net/intel/i40e_client.h>\n@@ -30,11 +31,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@@ -275,6 +282,38 @@ void i40e_client_update_msix_info(struct i40e_pf *pf)\n \tcdev->lan_info.msix_entries = &pf->msix_entries[pf->iwarp_base_vector];\n }\n \n+static void i40e_virtdev_release(struct virtbus_device *vdev)\n+{\n+\tstruct i40e_virtbus_device *i40e_vdev =\n+\t\t\tcontainer_of(vdev, struct i40e_virtbus_device, vdev);\n+\n+\tkfree(i40e_vdev);\n+}\n+\n+static int i40e_init_client_virtdev(struct i40e_info *ldev)\n+{\n+\tstruct pci_dev *pdev = ldev->pcidev;\n+\tstruct i40e_virtbus_device *i40e_vdev;\n+\tint ret;\n+\n+\ti40e_vdev = kzalloc(sizeof(*i40e_vdev), GFP_KERNEL);\n+\tif (!i40e_vdev)\n+\t\treturn -ENOMEM;\n+\n+\ti40e_vdev->vdev.name = I40E_PEER_RDMA_NAME;\n+\ti40e_vdev->vdev.dev.parent = &pdev->dev;\n+\ti40e_vdev->vdev.release = i40e_virtdev_release;\n+\ti40e_vdev->ldev = ldev;\n+\n+\tret = virtbus_dev_register(&i40e_vdev->vdev);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tldev->vdev = &i40e_vdev->vdev;\n+\n+\treturn 0;\n+}\n+\n /**\n  * i40e_client_add_instance - add a client instance struct to the instance list\n  * @pf: pointer to the board struct\n@@ -288,9 +327,6 @@ static void i40e_client_add_instance(struct i40e_pf *pf)\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-\n \tcdev = kzalloc(sizeof(*cdev), GFP_KERNEL);\n \tif (!cdev)\n \t\treturn;\n@@ -310,11 +346,8 @@ static void i40e_client_add_instance(struct i40e_pf *pf)\n \tcdev->lan_info.fw_build = pf->hw.aq.fw_build;\n \tset_bit(__I40E_CLIENT_INSTANCE_NONE, &cdev->state);\n \n-\tif (i40e_client_get_params(vsi, &cdev->lan_info.params)) {\n-\t\tkfree(cdev);\n-\t\tcdev = NULL;\n-\t\treturn;\n-\t}\n+\tif (i40e_client_get_params(vsi, &cdev->lan_info.params))\n+\t\tgoto free_cdev;\n \n \tmac = list_first_entry(&cdev->lan_info.netdev->dev_addrs.list,\n \t\t\t       struct netdev_hw_addr, list);\n@@ -326,7 +359,17 @@ static void i40e_client_add_instance(struct i40e_pf *pf)\n \tcdev->client = registered_client;\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+\n+\tif (i40e_init_client_virtdev(&cdev->lan_info))\n+\t\tgoto free_cdev;\n+\n+\treturn;\n+\n+free_cdev:\n+\tkfree(cdev);\n+\tpf->cinst = NULL;\n }\n \n /**\n@@ -337,6 +380,11 @@ static void i40e_client_add_instance(struct i40e_pf *pf)\n static\n void i40e_client_del_instance(struct i40e_pf *pf)\n {\n+\tstruct i40e_virtbus_device *i40e_vdev;\n+\n+\ti40e_vdev = container_of(pf->cinst->lan_info.vdev,\n+\t\t\t\t struct i40e_virtbus_device, vdev);\n+\ti40e_vdev->ldev = NULL;\n \tkfree(pf->cinst);\n \tpf->cinst = NULL;\n }\n@@ -347,7 +395,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 +409,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 +474,8 @@ 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+\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 \tset_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state);\n \ti40e_service_event_schedule(pf);\n \n@@ -453,6 +495,8 @@ int i40e_lan_del_device(struct i40e_pf *pf)\n \tstruct i40e_device *ldev, *tmp;\n \tint ret = -ENODEV;\n \n+\tvirtbus_dev_unregister(pf->cinst->lan_info.vdev);\n+\n \t/* First, remove any client instance. */\n \ti40e_client_del_instance(pf);\n \n@@ -733,6 +777,59 @@ 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+\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/include/linux/net/intel/i40e_client.h b/include/linux/net/intel/i40e_client.h\nindex 72994ba..5c81261 100644\n--- a/include/linux/net/intel/i40e_client.h\n+++ b/include/linux/net/intel/i40e_client.h\n@@ -4,6 +4,9 @@\n #ifndef _I40E_CLIENT_H_\n #define _I40E_CLIENT_H_\n \n+#include <linux/virtual_bus.h>\n+\n+#define I40E_PEER_RDMA_NAME\t\"i40e_rdma\"\n #define I40E_CLIENT_STR_LENGTH 10\n \n /* Client interface version should be updated anytime there is a change in the\n@@ -84,6 +87,7 @@ struct i40e_info {\n \tu8 lanmac[6];\n \tstruct net_device *netdev;\n \tstruct pci_dev *pcidev;\n+\tstruct virtbus_device *vdev;\n \tu8 __iomem *hw_addr;\n \tu8 fid;\t/* function id, PF id or VF id */\n #define I40E_CLIENT_FTYPE_PF 0\n@@ -97,6 +101,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@@ -107,6 +112,11 @@ struct i40e_info {\n \tu32 fw_build;                   /* firmware build number */\n };\n \n+struct i40e_virtbus_device {\n+\tstruct virtbus_device vdev;\n+\tstruct i40e_info *ldev;\n+};\n+\n #define I40E_CLIENT_RESET_LEVEL_PF   1\n #define I40E_CLIENT_RESET_LEVEL_CORE 2\n #define I40E_CLIENT_VSI_FLAG_TCP_ENABLE  BIT(1)\n@@ -132,6 +142,11 @@ 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 \n struct i40e_client_ops {\n",
    "prefixes": [
        "2/2"
    ]
}