Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/917740/?format=api
{ "id": 917740, "url": "http://patchwork.ozlabs.org/api/patches/917740/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180521170345.21706-1-sindhu.devale@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": "<20180521170345.21706-1-sindhu.devale@intel.com>", "list_archive_url": null, "date": "2018-05-21T17:03:45", "name": "i40iw: Remove link dependency on i40e", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": false, "hash": "db4cf0ed357e3c2fcdd12950511831cfb8906ad1", "submitter": { "id": 74125, "url": "http://patchwork.ozlabs.org/api/people/74125/?format=api", "name": "Devale, Sindhu", "email": "sindhu.devale@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/20180521170345.21706-1-sindhu.devale@intel.com/mbox/", "series": [ { "id": 45680, "url": "http://patchwork.ozlabs.org/api/series/45680/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=45680", "date": "2018-05-21T17:03:45", "name": "i40iw: Remove link dependency on i40e", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/45680/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/917740/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/917740/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.138; helo=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 AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 40qQ8b6bbmz9s1b\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 22 May 2018 03:03:27 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id D119586DAE;\n\tMon, 21 May 2018 17:03:25 +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 zU0v6Ket4tih; Mon, 21 May 2018 17:03:24 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3BB0B86321;\n\tMon, 21 May 2018 17:03:24 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id B58881C06DD\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 21 May 2018 17:02:28 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id B1C8A88D63\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 21 May 2018 17:02:28 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id pwwh1d0Ogq+S for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 21 May 2018 17:02:27 +0000 (UTC)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 3942588D36\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 21 May 2018 17:02:27 +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\t21 May 2018 10:02:26 -0700", "from jtkirshe-nuc.jf.intel.com ([134.134.177.59])\n\tby fmsmga005.fm.intel.com with ESMTP; 21 May 2018 10:02:25 -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.49,426,1520924400\"; d=\"scan'208\";a=\"230347124\"", "From": "Devale Sindhu <sindhu.devale@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 21 May 2018 10:03:45 -0700", "Message-Id": "<20180521170345.21706-1-sindhu.devale@intel.com>", "X-Mailer": "git-send-email 2.17.0", "X-Mailman-Approved-At": "Mon, 21 May 2018 17:03:23 +0000", "Subject": "[Intel-wired-lan] [PATCH] i40iw: Remove link dependency on i40e", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.24", "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": "Sindhu Devale <sindhu.devale@intel.com>", "MIME-Version": "1.0", "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: Sindhu Devale <sindhu.devale@intel.com>\n\nCurrently i40iw is dependent on i40e symbols\ni40e_register_client and i40e_unregister_client due to\nwhich i40iw cannot be loaded without i40e being loaded.\n\nThis patch allows rdma driver to build and load without\nlinking to LAN driver and without LAN driver being loaded\nfirst. Once the LAN driver is loaded, the rdma driver\nis notified through the netdevice notifiers to register\nas client to the LAN driver. Add function pointers to IDC\nregister/unregister in the private VSI structure. This\nallows a RDMA driver to build without linking to I40E.\n\nSigned-off-by: Devale Sindhu <sindhu.devale@intel.com>\n---\n drivers/infiniband/hw/i40iw/i40iw.h | 24 +++\n drivers/infiniband/hw/i40iw/i40iw_main.c | 141 ++++++++++++++++--\n drivers/infiniband/hw/i40iw/i40iw_utils.c | 5 +-\n drivers/net/ethernet/intel/i40e/i40e.h | 1 +\n drivers/net/ethernet/intel/i40e/i40e_client.h | 9 ++\n drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +\n 6 files changed, 173 insertions(+), 13 deletions(-)", "diff": "diff --git a/drivers/infiniband/hw/i40iw/i40iw.h b/drivers/infiniband/hw/i40iw/i40iw.h\nindex d5d8c1be345a..c6398b73a8da 100644\n--- a/drivers/infiniband/hw/i40iw/i40iw.h\n+++ b/drivers/infiniband/hw/i40iw/i40iw.h\n@@ -119,6 +119,30 @@\n #define I40IW_CQP_COMPL_SQ_WQE_FLUSHED 3\n #define I40IW_CQP_COMPL_RQ_SQ_WQE_FLUSHED 4\n \n+enum I40IW_IDC_STATE {\n+\tI40IW_STATE_INVALID,\n+\tI40IW_STATE_VALID,\n+\tI40IW_STATE_REG_FAILED\n+};\n+\n+struct i40iw_peer {\n+\tstruct module *module;\n+#define MAX_PEER_NAME_SIZE 8\n+\tchar name[MAX_PEER_NAME_SIZE];\n+\tenum I40IW_IDC_STATE state;\n+\tatomic_t ref_count;\n+\tint (*idc_reg_peer_driver)(struct i40e_client *i40iw_client);\n+\tint (*idc_unreg_peer_driver)(struct i40e_client *i40iw_client);\n+};\n+\n+struct i40iw_peer_drv {\n+\tstruct i40e_client i40iw_client;\n+\tstruct i40iw_peer peer;\n+};\n+\n+bool i40iw_is_new_peer(struct net_device *netdev);\n+void i40iw_reg_peer(void);\n+\n struct i40iw_cqp_compl_info {\n \tu32 op_ret_val;\n \tu16 maj_err_code;\ndiff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c\nindex 9cd0d3ef9057..65e1269f55f8 100644\n--- a/drivers/infiniband/hw/i40iw/i40iw_main.c\n+++ b/drivers/infiniband/hw/i40iw/i40iw_main.c\n@@ -78,6 +78,7 @@ MODULE_AUTHOR(\"Intel Corporation, <e1000-rdma@lists.sourceforge.net>\");\n MODULE_DESCRIPTION(\"Intel(R) Ethernet Connection X722 iWARP RDMA Driver\");\n MODULE_LICENSE(\"Dual BSD/GPL\");\n \n+static struct i40iw_peer_drv peer_drv;\n static struct i40e_client i40iw_client;\n static char i40iw_client_name[I40E_CLIENT_STR_LENGTH] = \"i40iw\";\n \n@@ -103,6 +104,30 @@ static struct notifier_block i40iw_netdevice_notifier = {\n \t.notifier_call = i40iw_netdevice_event\n };\n \n+/**\n+ * i40iw_open_inc_ref - Increment ref count for a open\n+ */\n+void i40iw_open_inc_ref(void)\n+{\n+\tatomic_inc(&peer_drv.peer.ref_count);\n+}\n+\n+/**\n+ * i40iw_open_dec_ref - Decrement ref count for a open\n+ */\n+void i40iw_open_dec_ref(void)\n+{\n+\tstruct i40iw_peer *peer;\n+\n+\tpeer = &peer_drv.peer;\n+\tif (peer->state == I40IW_STATE_VALID &&\n+\t atomic_dec_and_test(&peer->ref_count)) {\n+\t\tpeer->state = I40IW_STATE_INVALID;\n+\t\tpeer->idc_unreg_peer_driver(&peer_drv.i40iw_client);\n+\t\tmodule_put(peer->module);\n+\t}\n+}\n+\n /**\n * i40iw_find_i40e_handler - find a handler given a client info\n * @ldev: pointer to a client info\n@@ -1710,6 +1735,7 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client)\n \t\tif(iwdev->param_wq == NULL)\n \t\t\tbreak;\n \t\ti40iw_pr_info(\"i40iw_open completed\\n\");\n+\t\ti40iw_open_inc_ref();\n \t\treturn 0;\n \t} while (0);\n \n@@ -1801,6 +1827,7 @@ static void i40iw_close(struct i40e_info *ldev, struct i40e_client *client, bool\n \ti40iw_cm_teardown_connections(iwdev, NULL, NULL, true);\n \tdestroy_workqueue(iwdev->virtchnl_wq);\n \ti40iw_deinit_device(iwdev);\n+\ti40iw_open_dec_ref();\n }\n \n /**\n@@ -2024,6 +2051,104 @@ static const struct i40e_client_ops i40e_ops = {\n \t.vf_capable = i40iw_vf_capable\n };\n \n+/**\n+ * i40iw_is_new_peer - check netdev of the peer driver\n+ * @netdev: netdev of peer driver\n+ */\n+bool i40iw_is_new_peer(struct net_device *netdev)\n+{\n+\tstruct idc_srv_provider *sp;\n+\tstruct i40iw_peer *peer;\n+\n+\tpeer = &peer_drv.peer;\n+\tif (peer->state == I40IW_STATE_VALID)\n+\t\treturn false;\n+\n+\tif (netdev->dev.parent && netdev->dev.parent->driver &&\n+\t !strncmp(netdev->dev.parent->driver->name, peer->name, sizeof(peer->name))) {\n+\t\tsp = (struct idc_srv_provider *)netdev_priv(netdev);\n+\t\tif (sp->signature != IDC_SIGNATURE || sp->version)\n+\t\t\treturn false;\n+\n+\t\t/* Found the driver */\n+\t\tpeer->idc_reg_peer_driver = sp->idc_reg_peer_driver;\n+\t\tpeer->idc_unreg_peer_driver = sp->idc_unreg_peer_driver;\n+\t\tpeer->module = netdev->dev.parent->driver->owner;\n+\n+\t\treturn true;\n+\t}\n+\n+\treturn false;\n+}\n+\n+/**\n+ * i40iw_initialize_client - Setup client struct\n+ */\n+static void i40iw_initialize_client(void)\n+{\n+\tstruct i40e_client *i40iw_client = &peer_drv.i40iw_client;\n+\n+\ti40iw_client->version.major = CLIENT_IW_INTERFACE_VERSION_MAJOR;\n+\ti40iw_client->version.minor = CLIENT_IW_INTERFACE_VERSION_MINOR;\n+\ti40iw_client->version.build = CLIENT_IW_INTERFACE_VERSION_BUILD;\n+\ti40iw_client->ops = &i40e_ops;\n+\tmemcpy(i40iw_client->name, i40iw_client_name, I40E_CLIENT_STR_LENGTH);\n+\ti40iw_client->type = I40E_CLIENT_IWARP;\n+\tstrncpy(peer_drv.peer.name, \"i40e\", sizeof(peer_drv.peer.name));\n+}\n+\n+/**\n+ * i40iw_reg_peer - Register with peer\n+ */\n+void i40iw_reg_peer(void)\n+{\n+\tstruct i40iw_peer *peer;\n+\n+\tpeer = &peer_drv.peer;\n+\n+\tif (peer->state == I40IW_STATE_VALID)\n+\t\treturn;\n+\n+\tif (peer->idc_reg_peer_driver &&\n+\t !peer->idc_reg_peer_driver(&peer_drv.i40iw_client)) {\n+\t\tpeer->state = I40IW_STATE_VALID;\n+\t\ttry_module_get(peer->module);\n+\t} else {\n+\t\tpeer->state = I40IW_STATE_REG_FAILED;\n+\t}\n+}\n+\n+/**\n+ * i40iw_find_idc_peer - Search netdevs for a peer driver\n+ */\n+static void i40iw_find_idc_peer(void)\n+{\n+\tstruct net_device *dev;\n+\n+\trcu_read_lock();\n+\tfor_each_netdev_rcu(&init_net, dev) {\n+\t\tif (i40iw_is_new_peer(dev))\n+\t\t\tbreak;\n+\t}\n+\trcu_read_unlock();\n+\ti40iw_reg_peer();\n+}\n+\n+/**\n+ * i40iw_unreg_peer - Unregister with peer\n+ */\n+static void i40iw_unreg_peer(void)\n+{\n+\tstruct i40iw_peer *peer;\n+\n+\tpeer = &peer_drv.peer;\n+\tif (peer->state == I40IW_STATE_VALID) {\n+\t\tpeer->state = I40IW_STATE_INVALID;\n+\t\tpeer->idc_unreg_peer_driver(&peer_drv.i40iw_client);\n+\t\tmodule_put(peer->module);\n+\t}\n+}\n+\n /**\n * i40iw_init_module - driver initialization function\n *\n@@ -2032,20 +2157,12 @@ static const struct i40e_client_ops i40e_ops = {\n */\n static int __init i40iw_init_module(void)\n {\n-\tint ret;\n-\n-\tmemset(&i40iw_client, 0, sizeof(i40iw_client));\n-\ti40iw_client.version.major = CLIENT_IW_INTERFACE_VERSION_MAJOR;\n-\ti40iw_client.version.minor = CLIENT_IW_INTERFACE_VERSION_MINOR;\n-\ti40iw_client.version.build = CLIENT_IW_INTERFACE_VERSION_BUILD;\n-\ti40iw_client.ops = &i40e_ops;\n-\tmemcpy(i40iw_client.name, i40iw_client_name, I40E_CLIENT_STR_LENGTH);\n-\ti40iw_client.type = I40E_CLIENT_IWARP;\n \tspin_lock_init(&i40iw_handler_lock);\n-\tret = i40e_register_client(&i40iw_client);\n+\ti40iw_initialize_client();\n+\ti40iw_find_idc_peer();\n \ti40iw_register_notifiers();\n \n-\treturn ret;\n+\treturn 0;\n }\n \n /**\n@@ -2057,7 +2174,7 @@ static int __init i40iw_init_module(void)\n static void __exit i40iw_exit_module(void)\n {\n \ti40iw_unregister_notifiers();\n-\ti40e_unregister_client(&i40iw_client);\n+\ti40iw_unreg_peer();\n }\n \n module_init(i40iw_init_module);\ndiff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c\nindex a9ea966877f2..264939942da0 100644\n--- a/drivers/infiniband/hw/i40iw/i40iw_utils.c\n+++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c\n@@ -314,8 +314,11 @@ int i40iw_netdevice_event(struct notifier_block *notifier,\n \tevent_netdev = netdev_notifier_info_to_dev(ptr);\n \n \thdl = i40iw_find_netdev(event_netdev);\n-\tif (!hdl)\n+\tif (!hdl) {\n+\t\tif (i40iw_is_new_peer(event_netdev))\n+\t\t\ti40iw_reg_peer();\n \t\treturn NOTIFY_DONE;\n+\t}\n \n \tiwdev = &hdl->device;\n \tif (iwdev->init_state < RDMA_DEV_REGISTERED || iwdev->closing)\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 7a80652e2500..e3171b696848 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -789,6 +789,7 @@ struct i40e_vsi {\n } ____cacheline_internodealigned_in_smp;\n \n struct i40e_netdev_priv {\n+\tstruct idc_srv_provider prov_callbacks;\n \tstruct i40e_vsi *vsi;\n };\n \ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_client.h b/drivers/net/ethernet/intel/i40e/i40e_client.h\nindex 72994baf4941..95a47df9c104 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_client.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_client.h\n@@ -44,6 +44,15 @@ struct i40e_client;\n #define I40E_QUEUE_TYPE_PE_AEQ 0x80\n #define I40E_QUEUE_INVALID_IDX\t0xFFFF\n \n+#define IDC_SIGNATURE 0x494e54454c494443ULL\t/* INTELIDC */\n+struct idc_srv_provider {\n+\tu64 signature;\n+\tu8 version;\n+\tu8 rsvd[7];\n+\tint (*idc_reg_peer_driver)(struct i40e_client *client);\n+\tint (*idc_unreg_peer_driver)(struct i40e_client *client);\n+};\n+\n struct i40e_qv_info {\n \tu32 v_idx; /* msix_vector */\n \tu16 ceq_idx;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex b5daa5c9c7de..984001ae7680 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -11913,6 +11913,12 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)\n \tnp = netdev_priv(netdev);\n \tnp->vsi = vsi;\n \n+\tnp->prov_callbacks.signature = IDC_SIGNATURE;\n+\tnp->prov_callbacks.version = 0;\n+\tmemset(np->prov_callbacks.rsvd, 0, sizeof(np->prov_callbacks.rsvd));\n+\tnp->prov_callbacks.idc_reg_peer_driver = i40e_register_client;\n+\tnp->prov_callbacks.idc_unreg_peer_driver = i40e_unregister_client;\n+\n \thw_enc_features = NETIF_F_SG\t\t\t|\n \t\t\t NETIF_F_IP_CSUM\t\t|\n \t\t\t NETIF_F_IPV6_CSUM\t\t|\n", "prefixes": [] }