Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1282828/?format=api
{ "id": 1282828, "url": "http://patchwork.ozlabs.org/api/patches/1282828/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200504164349.1523441-9-jeffrey.t.kirsher@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": "<20200504164349.1523441-9-jeffrey.t.kirsher@intel.com>", "list_archive_url": null, "date": "2020-05-04T16:43:49", "name": "[net-next,v3,9/9] i40e: Register a virtbus device to provide RDMA", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "4589f63df2193a9d7aed7e94f3cf32cb175310af", "submitter": { "id": 473, "url": "http://patchwork.ozlabs.org/api/people/473/?format=api", "name": "Kirsher, Jeffrey T", "email": "jeffrey.t.kirsher@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/20200504164349.1523441-9-jeffrey.t.kirsher@intel.com/mbox/", "series": [ { "id": 174549, "url": "http://patchwork.ozlabs.org/api/series/174549/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=174549", "date": "2020-05-04T16:43:44", "name": "[net-next,v3,1/9] Implementation of Virtual Bus", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/174549/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1282828/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1282828/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 spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)", "ozlabs.org;\n dmarc=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 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49G7wr0wW3z9sP7\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 5 May 2020 02:44:12 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id A209286123;\n\tMon, 4 May 2020 16:44:10 +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 XkISdqEEXHSM; Mon, 4 May 2020 16:44:02 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 7959A86064;\n\tMon, 4 May 2020 16:43:59 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by ash.osuosl.org (Postfix) with ESMTP id 360991BF857\n for <intel-wired-lan@lists.osuosl.org>; Mon, 4 May 2020 16:43:56 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by fraxinus.osuosl.org (Postfix) with ESMTP id 32A2B86B1C\n for <intel-wired-lan@lists.osuosl.org>; Mon, 4 May 2020 16:43:56 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id psn7-1gKGR6w for <intel-wired-lan@lists.osuosl.org>;\n Mon, 4 May 2020 16:43:53 +0000 (UTC)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by fraxinus.osuosl.org (Postfix) with ESMTPS id 7489286B1A\n for <intel-wired-lan@lists.osuosl.org>; Mon, 4 May 2020 16:43:53 +0000 (UTC)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 May 2020 09:43:52 -0700", "from jtkirshe-desk1.jf.intel.com ([134.134.177.86])\n by fmsmga006.fm.intel.com with ESMTP; 04 May 2020 09:43:52 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "IronPort-SDR": [ "\n Ow1RrZzZrPRgQiolHi9P/M7b17AyWt9iUW7hqUKxxMQc7myt6QF/K48EnhEPTTLtFrl+Dh5a10\n G/2xwizFoODg==", "\n pDJNg/p7Mr2r/XYbLXqwLiR7moZOGZhh5nUe1B2CEJyHidHqUwfwNjWSDXv/4xpKXGwm53LP3G\n Wz90gXx1arvg==" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.73,352,1583222400\"; d=\"scan'208\";a=\"461073936\"", "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 4 May 2020 09:43:49 -0700", "Message-Id": "<20200504164349.1523441-9-jeffrey.t.kirsher@intel.com>", "X-Mailer": "git-send-email 2.26.2", "In-Reply-To": "<20200504164349.1523441-1-jeffrey.t.kirsher@intel.com>", "References": "<20200504164349.1523441-1-jeffrey.t.kirsher@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [net-next v3 9/9] i40e: Register a virtbus device\n to provide 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 <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>", "Cc": "Mustafa Ismail <mustafa.ismail@intel.com>,\n 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 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>\nTested-by: Andrew Bowers <andrewx.bowers@intel.com>\nSigned-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>\n---\n drivers/net/ethernet/intel/Kconfig | 1 +\n drivers/net/ethernet/intel/i40e/i40e_client.c | 131 +++++++++++++++---\n include/linux/net/intel/i40e_client.h | 15 ++\n 3 files changed, 127 insertions(+), 20 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig\nindex 1a5d51b0f294..7a61e9d5e36e 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 befd3018183f..fdce8af3ec4f 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,37 @@ 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.match_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+\tldev->vdev = &i40e_vdev->vdev;\n+\n+\tret = virtbus_register_device(&i40e_vdev->vdev);\n+\tif (ret)\n+\t\treturn ret;\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 +326,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 +345,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 +358,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@@ -347,7 +389,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 +403,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 +468,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 +489,8 @@ int i40e_lan_del_device(struct i40e_pf *pf)\n \tstruct i40e_device *ldev, *tmp;\n \tint ret = -ENODEV;\n \n+\tvirtbus_unregister_device(pf->cinst->lan_info.vdev);\n+\n \t/* First, remove any client instance. */\n \ti40e_client_del_instance(pf);\n \n@@ -733,6 +771,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 72994baf4941..4a83648cf5fd 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\"intel,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": [ "net-next", "v3", "9/9" ] }