Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1178776/?format=api
{ "id": 1178776, "url": "http://patchwork.ozlabs.org/api/patches/1178776/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191017164004.1645-1-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": "<20191017164004.1645-1-shiraz.saleem@intel.com>", "list_archive_url": null, "date": "2019-10-17T16:40:04", "name": "i40e: Register multi-function device to provide RDMA", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "ce66cdfd52d225c4e80873be185b18c90bf00668", "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/20191017164004.1645-1-shiraz.saleem@intel.com/mbox/", "series": [ { "id": 136856, "url": "http://patchwork.ozlabs.org/api/series/136856/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=136856", "date": "2019-10-17T16:40:04", "name": "i40e: Register multi-function device to provide RDMA", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/136856/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1178776/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1178776/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 46vFJw6F4Kz9sPJ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 18 Oct 2019 03:40:31 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 529A787A50;\n\tThu, 17 Oct 2019 16:40:30 +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 zV-X5UUHH7CL; Thu, 17 Oct 2019 16:40:26 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 22A4B87A2D;\n\tThu, 17 Oct 2019 16:40:26 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 5D9021BF4E3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Oct 2019 16:40:24 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 54F2B8798E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Oct 2019 16:40:24 +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 4QA7sWGRTWsd for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Oct 2019 16:40:22 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 0C41687967\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 17 Oct 2019 16:40:21 +0000 (UTC)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t17 Oct 2019 09:40:21 -0700", "from ssaleem-mobl.amr.corp.intel.com ([10.122.128.45])\n\tby fmsmga002.fm.intel.com with ESMTP; 17 Oct 2019 09:40:20 -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.67,308,1566889200\"; d=\"scan'208\";a=\"226227729\"", "From": "Shiraz Saleem <shiraz.saleem@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Thu, 17 Oct 2019 11:40:04 -0500", "Message-Id": "<20191017164004.1645-1-shiraz.saleem@intel.com>", "X-Mailer": "git-send-email 2.21.0", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH] i40e: Register multi-function 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": "Mustafa Ismail <mustafa.ismail@intel.com>,\n\tShiraz 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: Mustafa Ismail <mustafa.ismail@intel.com>\n\nRegister multi-function devices (MFD) for the RDMA platform\nfunction (irdma) driver to bind to. It realizes a single RDMA\ndriver capable of working with multiple LAN drivers over\nmulti-generation Intel HW supporting RDMA. There is also no load\nordering dependencies between i40e and irdma.\n\nSummary of changes:\n* Support to add/remove MFD 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/infiniband/hw/i40iw/Makefile | 1 -\n drivers/infiniband/hw/i40iw/i40iw.h | 2 +-\n drivers/net/ethernet/intel/Kconfig | 1 +\n drivers/net/ethernet/intel/i40e/i40e.h | 3 +-\n drivers/net/ethernet/intel/i40e/i40e_client.c | 138 ++++++++++++++--\n drivers/net/ethernet/intel/i40e/i40e_client.h | 203 -----------------------\n include/linux/net/intel/i40e_client.h | 224 ++++++++++++++++++++++++++\n 7 files changed, 350 insertions(+), 222 deletions(-)\n delete mode 100644 drivers/net/ethernet/intel/i40e/i40e_client.h\n create mode 100644 include/linux/net/intel/i40e_client.h", "diff": "diff --git a/drivers/infiniband/hw/i40iw/Makefile b/drivers/infiniband/hw/i40iw/Makefile\nindex 8942f82..34da9eb 100644\n--- a/drivers/infiniband/hw/i40iw/Makefile\n+++ b/drivers/infiniband/hw/i40iw/Makefile\n@@ -1,5 +1,4 @@\n # SPDX-License-Identifier: GPL-2.0\n-ccflags-y := -I $(srctree)/drivers/net/ethernet/intel/i40e\n \n obj-$(CONFIG_INFINIBAND_I40IW) += i40iw.o\n \ndiff --git a/drivers/infiniband/hw/i40iw/i40iw.h b/drivers/infiniband/hw/i40iw/i40iw.h\nindex 8feec35..3197e35 100644\n--- a/drivers/infiniband/hw/i40iw/i40iw.h\n+++ b/drivers/infiniband/hw/i40iw/i40iw.h\n@@ -57,7 +57,7 @@\n #include \"i40iw_d.h\"\n #include \"i40iw_hmc.h\"\n \n-#include <i40e_client.h>\n+#include <linux/net/intel/i40e_client.h>\n #include \"i40iw_type.h\"\n #include \"i40iw_p.h\"\n #include <rdma/i40iw-abi.h>\ndiff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig\nindex 154e2e8..5d4603c 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 MFD_CORE\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.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 2af9f63..ed7c721 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -38,7 +38,7 @@\n #include <net/xdp_sock.h>\n #include \"i40e_type.h\"\n #include \"i40e_prototype.h\"\n-#include \"i40e_client.h\"\n+#include <linux/net/intel/i40e_client.h>\n #include <linux/avf/virtchnl.h>\n #include \"i40e_virtchnl_pf.h\"\n #include \"i40e_txrx.h\"\n@@ -655,6 +655,7 @@ struct i40e_pf {\n \tu16 last_sw_conf_valid_flags;\n \t/* List to keep previous DDP profiles to be rolled back in the future */\n \tstruct list_head ddp_old_prof;\n+\tint peer_idx;\n };\n \n /**\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c b/drivers/net/ethernet/intel/i40e/i40e_client.c\nindex e81530c..ca1bb71 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_client.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_client.c\n@@ -6,8 +6,9 @@\n \n #include \"i40e.h\"\n #include \"i40e_prototype.h\"\n-#include \"i40e_client.h\"\n+#include <linux/net/intel/i40e_client.h>\n \n+static struct mfd_cell i40e_mfd_cells[] = ASSIGN_PEER_INFO;\n static const char i40e_client_interface_version_str[] = I40E_CLIENT_VERSION_STR;\n static struct i40e_client *registered_client;\n static LIST_HEAD(i40e_devices);\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,55 @@ 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 DEFINE_IDA(i40e_peer_index_ida);\n+\n+static int i40e_init_peer_devices(struct i40e_pf *pf)\n+{\n+\tstruct i40e_peer_dev_platform_data *platform_data;\n+\tstruct pci_dev *pdev = pf->pdev;\n+\tint status = 0;\n+\tint i;\n+\n+\tplatform_data = kcalloc(ARRAY_SIZE(i40e_mfd_cells),\n+\t\t\t\tsizeof(*platform_data), GFP_KERNEL);\n+\tif (!platform_data)\n+\t\treturn -ENOMEM;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(i40e_mfd_cells); i++) {\n+\t\t/* don't create an RDMA MFD device if NIC does not\n+\t\t * support RDMA functionality\n+\t\t */\n+\t\tif (i40e_mfd_cells[i].id == I40E_PEER_RDMA_ID &&\n+\t\t !(I40E_FLAG_IWARP_ENABLED & pf->flags)) {\n+\t\t\tdev_warn(&pf->pdev->dev,\n+\t\t\t\t \"RDMA not supported with this config\\n\");\n+\t\t\tcontinue;\n+\t\t}\n+\t\tplatform_data[i].ldev = &pf->cinst->lan_info;\n+\t\ti40e_mfd_cells[i].platform_data = &platform_data[i];\n+\t\ti40e_mfd_cells[i].pdata_size = sizeof(platform_data);\n+\t}\n+\n+\tstatus = ida_simple_get(&i40e_peer_index_ida, 0, 0, GFP_KERNEL);\n+\tif (status < 0) {\n+\t\tdev_err(&pdev->dev,\n+\t\t\t\"failed to get unique index for device\\n\");\n+\t\treturn status;\n+\t}\n+\n+\tpf->peer_idx = status;\n+\tstatus = mfd_add_devices(&pf->pdev->dev, pf->peer_idx,\n+\t\t\t\t i40e_mfd_cells, ARRAY_SIZE(i40e_mfd_cells),\n+\t\t\t\t NULL, 0, NULL);\n+\n+\tif (status)\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"Failure adding MFD devs for peers: %d\\n\", status);\n+\n+\tkfree(platform_data);\n+\treturn status;\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 +344,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@@ -326,7 +379,11 @@ 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+\ti40e_init_peer_devices(pf);\n+\tset_bit(__I40E_CLIENT_INSTANCE_NONE, &cdev->state);\n }\n \n /**\n@@ -347,7 +404,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 +418,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 +483,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 +504,8 @@ int i40e_lan_del_device(struct i40e_pf *pf)\n \tstruct i40e_device *ldev, *tmp;\n \tint ret = -ENODEV;\n \n+\tmfd_remove_devices(&pf->pdev->dev);\n+\n \t/* First, remove any client instance. */\n \ti40e_client_del_instance(pf);\n \n@@ -733,6 +786,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/drivers/net/ethernet/intel/i40e/i40e_client.h b/drivers/net/ethernet/intel/i40e/i40e_client.h\ndeleted file mode 100644\nindex 72994ba..0000000\n--- a/drivers/net/ethernet/intel/i40e/i40e_client.h\n+++ /dev/null\n@@ -1,203 +0,0 @@\n-/* SPDX-License-Identifier: GPL-2.0 */\n-/* Copyright(c) 2013 - 2018 Intel Corporation. */\n-\n-#ifndef _I40E_CLIENT_H_\n-#define _I40E_CLIENT_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- * existing APIs or data structures.\n- */\n-#define I40E_CLIENT_VERSION_MAJOR 0\n-#define I40E_CLIENT_VERSION_MINOR 01\n-#define I40E_CLIENT_VERSION_BUILD 00\n-#define I40E_CLIENT_VERSION_STR \\\n-\t__stringify(I40E_CLIENT_VERSION_MAJOR) \".\" \\\n-\t__stringify(I40E_CLIENT_VERSION_MINOR) \".\" \\\n-\t__stringify(I40E_CLIENT_VERSION_BUILD)\n-\n-struct i40e_client_version {\n-\tu8 major;\n-\tu8 minor;\n-\tu8 build;\n-\tu8 rsvd;\n-};\n-\n-enum i40e_client_state {\n-\t__I40E_CLIENT_NULL,\n-\t__I40E_CLIENT_REGISTERED\n-};\n-\n-enum i40e_client_instance_state {\n-\t__I40E_CLIENT_INSTANCE_NONE,\n-\t__I40E_CLIENT_INSTANCE_OPENED,\n-};\n-\n-struct i40e_ops;\n-struct i40e_client;\n-\n-/* HW does not define a type value for AEQ; only for RX/TX and CEQ.\n- * In order for us to keep the interface simple, SW will define a\n- * unique type value for AEQ.\n- */\n-#define I40E_QUEUE_TYPE_PE_AEQ 0x80\n-#define I40E_QUEUE_INVALID_IDX\t0xFFFF\n-\n-struct i40e_qv_info {\n-\tu32 v_idx; /* msix_vector */\n-\tu16 ceq_idx;\n-\tu16 aeq_idx;\n-\tu8 itr_idx;\n-};\n-\n-struct i40e_qvlist_info {\n-\tu32 num_vectors;\n-\tstruct i40e_qv_info qv_info[1];\n-};\n-\n-#define I40E_CLIENT_MSIX_ALL 0xFFFFFFFF\n-\n-/* set of LAN parameters useful for clients managed by LAN */\n-\n-/* Struct to hold per priority info */\n-struct i40e_prio_qos_params {\n-\tu16 qs_handle; /* qs handle for prio */\n-\tu8 tc; /* TC mapped to prio */\n-\tu8 reserved;\n-};\n-\n-#define I40E_CLIENT_MAX_USER_PRIORITY 8\n-/* Struct to hold Client QoS */\n-struct i40e_qos_params {\n-\tstruct i40e_prio_qos_params prio_qos[I40E_CLIENT_MAX_USER_PRIORITY];\n-};\n-\n-struct i40e_params {\n-\tstruct i40e_qos_params qos;\n-\tu16 mtu;\n-};\n-\n-/* Structure to hold Lan device info for a client device */\n-struct i40e_info {\n-\tstruct i40e_client_version version;\n-\tu8 lanmac[6];\n-\tstruct net_device *netdev;\n-\tstruct pci_dev *pcidev;\n-\tu8 __iomem *hw_addr;\n-\tu8 fid;\t/* function id, PF id or VF id */\n-#define I40E_CLIENT_FTYPE_PF 0\n-#define I40E_CLIENT_FTYPE_VF 1\n-\tu8 ftype; /* function type, PF or VF */\n-\tvoid *pf;\n-\n-\t/* All L2 params that could change during the life span of the PF\n-\t * and needs to be communicated to the client when they change\n-\t */\n-\tstruct i40e_qvlist_info *qvlist_info;\n-\tstruct i40e_params params;\n-\tstruct i40e_ops *ops;\n-\n-\tu16 msix_count;\t /* number of msix vectors*/\n-\t/* Array down below will be dynamically allocated based on msix_count */\n-\tstruct msix_entry *msix_entries;\n-\tu16 itr_index; /* Which ITR index the PE driver is suppose to use */\n-\tu16 fw_maj_ver; /* firmware major version */\n-\tu16 fw_min_ver; /* firmware minor version */\n-\tu32 fw_build; /* firmware build number */\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-\n-struct i40e_ops {\n-\t/* setup_q_vector_list enables queues with a particular vector */\n-\tint (*setup_qvlist)(struct i40e_info *ldev, struct i40e_client *client,\n-\t\t\t struct i40e_qvlist_info *qv_info);\n-\n-\tint (*virtchnl_send)(struct i40e_info *ldev, struct i40e_client *client,\n-\t\t\t u32 vf_id, u8 *msg, u16 len);\n-\n-\t/* If the PE Engine is unresponsive, RDMA driver can request a reset.\n-\t * The level helps determine the level of reset being requested.\n-\t */\n-\tvoid (*request_reset)(struct i40e_info *ldev,\n-\t\t\t struct i40e_client *client, u32 level);\n-\n-\t/* API for the RDMA driver to set certain VSI flags that control\n-\t * PE Engine.\n-\t */\n-\tint (*update_vsi_ctxt)(struct i40e_info *ldev,\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-\n-struct i40e_client_ops {\n-\t/* Should be called from register_client() or whenever PF is ready\n-\t * to create a specific client instance.\n-\t */\n-\tint (*open)(struct i40e_info *ldev, struct i40e_client *client);\n-\n-\t/* Should be called when netdev is unavailable or when unregister\n-\t * call comes in. If the close is happenening due to a reset being\n-\t * triggered set the reset bit to true.\n-\t */\n-\tvoid (*close)(struct i40e_info *ldev, struct i40e_client *client,\n-\t\t bool reset);\n-\n-\t/* called when some l2 managed parameters changes - mtu */\n-\tvoid (*l2_param_change)(struct i40e_info *ldev,\n-\t\t\t\tstruct i40e_client *client,\n-\t\t\t\tstruct i40e_params *params);\n-\n-\tint (*virtchnl_receive)(struct i40e_info *ldev,\n-\t\t\t\tstruct i40e_client *client, u32 vf_id,\n-\t\t\t\tu8 *msg, u16 len);\n-\n-\t/* called when a VF is reset by the PF */\n-\tvoid (*vf_reset)(struct i40e_info *ldev,\n-\t\t\t struct i40e_client *client, u32 vf_id);\n-\n-\t/* called when the number of VFs changes */\n-\tvoid (*vf_enable)(struct i40e_info *ldev,\n-\t\t\t struct i40e_client *client, u32 num_vfs);\n-\n-\t/* returns true if VF is capable of specified offload */\n-\tint (*vf_capable)(struct i40e_info *ldev,\n-\t\t\t struct i40e_client *client, u32 vf_id);\n-};\n-\n-/* Client device */\n-struct i40e_client_instance {\n-\tstruct list_head list;\n-\tstruct i40e_info lan_info;\n-\tstruct i40e_client *client;\n-\tunsigned long state;\n-};\n-\n-struct i40e_client {\n-\tstruct list_head list;\t\t/* list of registered clients */\n-\tchar name[I40E_CLIENT_STR_LENGTH];\n-\tstruct i40e_client_version version;\n-\tunsigned long state;\t\t/* client state */\n-\tatomic_t ref_cnt; /* Count of all the client devices of this kind */\n-\tu32 flags;\n-#define I40E_CLIENT_FLAGS_LAUNCH_ON_PROBE\tBIT(0)\n-#define I40E_TX_FLAGS_NOTIFY_OTHER_EVENTS\tBIT(2)\n-\tu8 type;\n-#define I40E_CLIENT_IWARP 0\n-\tconst struct i40e_client_ops *ops; /* client ops provided by the client */\n-};\n-\n-static inline bool i40e_client_is_registered(struct i40e_client *client)\n-{\n-\treturn test_bit(__I40E_CLIENT_REGISTERED, &client->state);\n-}\n-\n-/* used by clients */\n-int i40e_register_client(struct i40e_client *client);\n-int i40e_unregister_client(struct i40e_client *client);\n-\n-#endif /* _I40E_CLIENT_H_ */\ndiff --git a/include/linux/net/intel/i40e_client.h b/include/linux/net/intel/i40e_client.h\nnew file mode 100644\nindex 0000000..9167946\n--- /dev/null\n+++ b/include/linux/net/intel/i40e_client.h\n@@ -0,0 +1,224 @@\n+/* SPDX-License-Identifier: GPL-2.0 */\n+/* Copyright(c) 2013 - 2018 Intel Corporation. */\n+\n+#ifndef _I40E_CLIENT_H_\n+#define _I40E_CLIENT_H_\n+\n+#include <linux/mfd/core.h>\n+\n+#define I40E_PEER_RDMA_NAME\t\"i40e_rdma\"\n+#define I40E_PEER_RDMA_ID\tPLATFORM_DEVID_AUTO\n+\n+#define I40E_CLIENT_STR_LENGTH 10\n+\n+/* Client interface version should be updated anytime there is a change in the\n+ * existing APIs or data structures.\n+ */\n+#define I40E_CLIENT_VERSION_MAJOR 0\n+#define I40E_CLIENT_VERSION_MINOR 01\n+#define I40E_CLIENT_VERSION_BUILD 00\n+#define I40E_CLIENT_VERSION_STR \\\n+\t__stringify(I40E_CLIENT_VERSION_MAJOR) \".\" \\\n+\t__stringify(I40E_CLIENT_VERSION_MINOR) \".\" \\\n+\t__stringify(I40E_CLIENT_VERSION_BUILD)\n+\n+struct i40e_client_version {\n+\tu8 major;\n+\tu8 minor;\n+\tu8 build;\n+\tu8 rsvd;\n+};\n+\n+enum i40e_client_state {\n+\t__I40E_CLIENT_NULL,\n+\t__I40E_CLIENT_REGISTERED\n+};\n+\n+enum i40e_client_instance_state {\n+\t__I40E_CLIENT_INSTANCE_NONE,\n+\t__I40E_CLIENT_INSTANCE_OPENED,\n+};\n+\n+struct i40e_ops;\n+struct i40e_client;\n+\n+/* HW does not define a type value for AEQ; only for RX/TX and CEQ.\n+ * In order for us to keep the interface simple, SW will define a\n+ * unique type value for AEQ.\n+ */\n+#define I40E_QUEUE_TYPE_PE_AEQ 0x80\n+#define I40E_QUEUE_INVALID_IDX\t0xFFFF\n+\n+struct i40e_qv_info {\n+\tu32 v_idx; /* msix_vector */\n+\tu16 ceq_idx;\n+\tu16 aeq_idx;\n+\tu8 itr_idx;\n+};\n+\n+struct i40e_qvlist_info {\n+\tu32 num_vectors;\n+\tstruct i40e_qv_info qv_info[1];\n+};\n+\n+#define I40E_CLIENT_MSIX_ALL 0xFFFFFFFF\n+\n+/* set of LAN parameters useful for clients managed by LAN */\n+\n+/* Struct to hold per priority info */\n+struct i40e_prio_qos_params {\n+\tu16 qs_handle; /* qs handle for prio */\n+\tu8 tc; /* TC mapped to prio */\n+\tu8 reserved;\n+};\n+\n+#define I40E_CLIENT_MAX_USER_PRIORITY 8\n+/* Struct to hold Client QoS */\n+struct i40e_qos_params {\n+\tstruct i40e_prio_qos_params prio_qos[I40E_CLIENT_MAX_USER_PRIORITY];\n+};\n+\n+struct i40e_params {\n+\tstruct i40e_qos_params qos;\n+\tu16 mtu;\n+};\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+\tstruct pci_dev *pcidev;\n+\tu8 __iomem *hw_addr;\n+\tu8 fid;\t/* function id, PF id or VF id */\n+#define I40E_CLIENT_FTYPE_PF 0\n+#define I40E_CLIENT_FTYPE_VF 1\n+\tu8 ftype; /* function type, PF or VF */\n+\tvoid *pf;\n+\n+\t/* All L2 params that could change during the life span of the PF\n+\t * and needs to be communicated to the client when they change\n+\t */\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+\tstruct msix_entry *msix_entries;\n+\tu16 itr_index; /* Which ITR index the PE driver is suppose to use */\n+\tu16 fw_maj_ver; /* firmware major version */\n+\tu16 fw_min_ver; /* firmware minor version */\n+\tu32 fw_build; /* firmware build number */\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+\n+struct i40e_ops {\n+\t/* setup_q_vector_list enables queues with a particular vector */\n+\tint (*setup_qvlist)(struct i40e_info *ldev, struct i40e_client *client,\n+\t\t\t struct i40e_qvlist_info *qv_info);\n+\n+\tint (*virtchnl_send)(struct i40e_info *ldev, struct i40e_client *client,\n+\t\t\t u32 vf_id, u8 *msg, u16 len);\n+\n+\t/* If the PE Engine is unresponsive, RDMA driver can request a reset.\n+\t * The level helps determine the level of reset being requested.\n+\t */\n+\tvoid (*request_reset)(struct i40e_info *ldev,\n+\t\t\t struct i40e_client *client, u32 level);\n+\n+\t/* API for the RDMA driver to set certain VSI flags that control\n+\t * PE Engine.\n+\t */\n+\tint (*update_vsi_ctxt)(struct i40e_info *ldev,\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+\t/* Should be called from register_client() or whenever PF is ready\n+\t * to create a specific client instance.\n+\t */\n+\tint (*open)(struct i40e_info *ldev, struct i40e_client *client);\n+\n+\t/* Should be called when netdev is unavailable or when unregister\n+\t * call comes in. If the close is happenening due to a reset being\n+\t * triggered set the reset bit to true.\n+\t */\n+\tvoid (*close)(struct i40e_info *ldev, struct i40e_client *client,\n+\t\t bool reset);\n+\n+\t/* called when some l2 managed parameters changes - mtu */\n+\tvoid (*l2_param_change)(struct i40e_info *ldev,\n+\t\t\t\tstruct i40e_client *client,\n+\t\t\t\tstruct i40e_params *params);\n+\n+\tint (*virtchnl_receive)(struct i40e_info *ldev,\n+\t\t\t\tstruct i40e_client *client, u32 vf_id,\n+\t\t\t\tu8 *msg, u16 len);\n+\n+\t/* called when a VF is reset by the PF */\n+\tvoid (*vf_reset)(struct i40e_info *ldev,\n+\t\t\t struct i40e_client *client, u32 vf_id);\n+\n+\t/* called when the number of VFs changes */\n+\tvoid (*vf_enable)(struct i40e_info *ldev,\n+\t\t\t struct i40e_client *client, u32 num_vfs);\n+\n+\t/* returns true if VF is capable of specified offload */\n+\tint (*vf_capable)(struct i40e_info *ldev,\n+\t\t\t struct i40e_client *client, u32 vf_id);\n+};\n+\n+/* Client device */\n+struct i40e_client_instance {\n+\tstruct list_head list;\n+\tstruct i40e_info lan_info;\n+\tstruct i40e_client *client;\n+\tunsigned long state;\n+};\n+\n+struct i40e_client {\n+\tstruct list_head list;\t\t/* list of registered clients */\n+\tchar name[I40E_CLIENT_STR_LENGTH];\n+\tstruct i40e_client_version version;\n+\tunsigned long state;\t\t/* client state */\n+\tatomic_t ref_cnt; /* Count of all the client devices of this kind */\n+\tu32 flags;\n+#define I40E_CLIENT_FLAGS_LAUNCH_ON_PROBE\tBIT(0)\n+#define I40E_TX_FLAGS_NOTIFY_OTHER_EVENTS\tBIT(2)\n+\tu8 type;\n+#define I40E_CLIENT_IWARP 0\n+\tconst struct i40e_client_ops *ops; /* client ops provided by the client */\n+};\n+\n+static inline bool i40e_client_is_registered(struct i40e_client *client)\n+{\n+\treturn test_bit(__I40E_CLIENT_REGISTERED, &client->state);\n+}\n+\n+/* used by clients */\n+int i40e_register_client(struct i40e_client *client);\n+int i40e_unregister_client(struct i40e_client *client);\n+\n+#define ASSIGN_PEER_INFO\t\t\t\t\t\t\\\n+{\t\t\t\t\t\t\t\t\t\\\n+\t{ .name = I40E_PEER_RDMA_NAME, .id = I40E_PEER_RDMA_ID },\t\\\n+}\n+\n+struct i40e_peer_dev_platform_data {\n+\tstruct i40e_info *ldev;\n+};\n+\n+#endif /* _I40E_CLIENT_H_ */\n", "prefixes": [] }