Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/780090/?format=api
{ "id": 780090, "url": "http://patchwork.ozlabs.org/api/patches/780090/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170623082451.32671-3-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": "<20170623082451.32671-3-alice.michael@intel.com>", "list_archive_url": null, "date": "2017-06-23T08:24:44", "name": "[next,S74-V2,03/10] i40evf: prevent VF close returning before state tranistions to DOWN", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "49875223bfed5d35b3316740cdd521b33d0edd40", "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/20170623082451.32671-3-alice.michael@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/780090/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/780090/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" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 3wvP600LvCz9sNW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 24 Jun 2017 02:28:56 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 91639879F4;\n\tFri, 23 Jun 2017 16:28:54 +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 6BIYR4PSLGCD; Fri, 23 Jun 2017 16:28:50 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id A9D118791B;\n\tFri, 23 Jun 2017 16:28:50 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 7F1621C26F5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 23 Jun 2017 16:28:49 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 77F6688DD3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 23 Jun 2017 16:28:49 +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 scJq20tQWmKj for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 23 Jun 2017 16:28:48 +0000 (UTC)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 70C2588CBB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 23 Jun 2017 16:28:48 +0000 (UTC)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga105.jf.intel.com with ESMTP; 23 Jun 2017 09:28:48 -0700", "from unknown (HELO localhost.jf.intel.com) ([10.166.16.121])\n\tby fmsmga001.fm.intel.com with ESMTP; 23 Jun 2017 09:28:48 -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-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.39,379,1493708400\"; d=\"scan'208\";\n\ta=\"1163958843\"", "From": "Alice Michael <alice.michael@intel.com>", "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org", "Date": "Fri, 23 Jun 2017 04:24:44 -0400", "Message-Id": "<20170623082451.32671-3-alice.michael@intel.com>", "X-Mailer": "git-send-email 2.9.3", "In-Reply-To": "<20170623082451.32671-1-alice.michael@intel.com>", "References": "<20170623082451.32671-1-alice.michael@intel.com>", "Cc": "Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S74-V2 03/10] i40evf: prevent VF\n\tclose returning before state tranistions to DOWN", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.18-1", "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>", "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: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>\n\nCurrently i40evf_close() can return before state transitions to\n__I40EVF_DOWN because of the latency involved in processing and\nreceiving response from PF driver and scheduling of VF watchdog_task.\nDue to this inconsistency an immediate call to i40evf_open() fails\nbecause state is still DOWN_PENDING.\n\nWhen a VF interface is in up state and we try to add it as slave,\nThe bonding driver calls dev_close() and dev_open() in short duration\nresulting in dev_open returning error. The ifenslave command needs\nto be run again for dev_open to succeed.\n\nThis fix ensures that watchdog timer is scheduled immediately after\nadmin queue operations are scheduled in i40evf_down(). In addition a\nwait condition is added at the end of i40evf_close so that function\nwont return when state is still DOWN_PENDING. The timeout value is\nchosen after some profiling and includes some buffer.\n\nSigned-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>\n---\n drivers/net/ethernet/intel/i40evf/i40evf.h | 2 ++\n drivers/net/ethernet/intel/i40evf/i40evf_main.c | 19 +++++++++++++++++++\n drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 4 +++-\n 3 files changed, 24 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h\nindex 7901cc8..52cf38f 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf.h\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf.h\n@@ -43,6 +43,7 @@\n #include <linux/bitops.h>\n #include <linux/timer.h>\n #include <linux/workqueue.h>\n+#include <linux/wait.h>\n #include <linux/delay.h>\n #include <linux/gfp.h>\n #include <linux/skbuff.h>\n@@ -194,6 +195,7 @@ struct i40evf_adapter {\n \tstruct work_struct adminq_task;\n \tstruct delayed_work client_task;\n \tstruct delayed_work init_task;\n+\twait_queue_head_t down_waitqueue;\n \tstruct i40e_q_vector *q_vectors;\n \tstruct list_head vlan_filter_list;\n \tchar misc_vector_name[IFNAMSIZ + 9];\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\nindex 6422273..b4566c6 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n@@ -1143,6 +1143,7 @@ void i40evf_down(struct i40evf_adapter *adapter)\n \t}\n \n \tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n+\tmod_timer_pending(&adapter->watchdog_timer, jiffies + 1);\n }\n \n /**\n@@ -1794,6 +1795,7 @@ static void i40evf_disable_vf(struct i40evf_adapter *adapter)\n \tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n \tadapter->flags &= ~I40EVF_FLAG_RESET_PENDING;\n \tadapter->state = __I40EVF_DOWN;\n+\twake_up(&adapter->down_waitqueue);\n \tdev_info(&adapter->pdev->dev, \"Reset task did not complete, VF disabled\\n\");\n }\n \n@@ -1939,6 +1941,7 @@ static void i40evf_reset_task(struct work_struct *work)\n \t\ti40evf_irq_enable(adapter, true);\n \t} else {\n \t\tadapter->state = __I40EVF_DOWN;\n+\t\twake_up(&adapter->down_waitqueue);\n \t}\n \n \treturn;\n@@ -2238,6 +2241,7 @@ static int i40evf_open(struct net_device *netdev)\n static int i40evf_close(struct net_device *netdev)\n {\n \tstruct i40evf_adapter *adapter = netdev_priv(netdev);\n+\tint status;\n \n \tif (adapter->state <= __I40EVF_DOWN_PENDING)\n \t\treturn 0;\n@@ -2255,7 +2259,18 @@ static int i40evf_close(struct net_device *netdev)\n \t * still active and can DMA into memory. Resources are cleared in\n \t * i40evf_virtchnl_completion() after we get confirmation from the PF\n \t * driver that the rings have been stopped.\n+\t *\n+\t * Also, we wait for state to transition to __I40EVF_DOWN before\n+\t * returning. State change occurs in i40evf_virtchnl_completion() after\n+\t * VF resources are released (which occurs after PF driver processes and\n+\t * responds to admin queue commands).\n \t */\n+\n+\tstatus = wait_event_timeout(adapter->down_waitqueue,\n+\t\t\t\t adapter->state == __I40EVF_DOWN,\n+\t\t\t\t msecs_to_jiffies(200));\n+\tif (!status)\n+\t\tnetdev_warn(netdev, \"Device resources not yet released\\n\");\n \treturn 0;\n }\n \n@@ -2684,6 +2699,7 @@ static void i40evf_init_task(struct work_struct *work)\n \tadapter->state = __I40EVF_DOWN;\n \tset_bit(__I40E_VSI_DOWN, adapter->vsi.state);\n \ti40evf_misc_irq_enable(adapter);\n+\twake_up(&adapter->down_waitqueue);\n \n \tadapter->rss_key = kzalloc(adapter->rss_key_size, GFP_KERNEL);\n \tadapter->rss_lut = kzalloc(adapter->rss_lut_size, GFP_KERNEL);\n@@ -2845,6 +2861,9 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tschedule_delayed_work(&adapter->init_task,\n \t\t\t msecs_to_jiffies(5 * (pdev->devfn & 0x07)));\n \n+\t/* Setup the wait queue for indicating transition to down status */\n+\tinit_waitqueue_head(&adapter->down_waitqueue);\n+\n \treturn 0;\n \n err_ioremap:\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c\nindex d2bb250..6c403bf 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c\n@@ -991,8 +991,10 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,\n \tcase VIRTCHNL_OP_DISABLE_QUEUES:\n \t\ti40evf_free_all_tx_resources(adapter);\n \t\ti40evf_free_all_rx_resources(adapter);\n-\t\tif (adapter->state == __I40EVF_DOWN_PENDING)\n+\t\tif (adapter->state == __I40EVF_DOWN_PENDING) {\n \t\t\tadapter->state = __I40EVF_DOWN;\n+\t\t\twake_up(&adapter->down_waitqueue);\n+\t\t}\n \t\tbreak;\n \tcase VIRTCHNL_OP_VERSION:\n \tcase VIRTCHNL_OP_CONFIG_IRQ_MAP:\n", "prefixes": [ "next", "S74-V2", "03/10" ] }