Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/972035/?format=api
{ "id": 972035, "url": "http://patchwork.ozlabs.org/api/patches/972035/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180920002319.10971-9-anirudh.venkataramanan@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": "<20180920002319.10971-9-anirudh.venkataramanan@intel.com>", "list_archive_url": null, "date": "2018-09-20T00:23:11", "name": "[08/16] ice: Change pf state behavior to protect reset path", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "41f3c43159a60c4674cbbd1c473921ce8989e6f5", "submitter": { "id": 73601, "url": "http://patchwork.ozlabs.org/api/people/73601/?format=api", "name": "Anirudh Venkataramanan", "email": "anirudh.venkataramanan@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/20180920002319.10971-9-anirudh.venkataramanan@intel.com/mbox/", "series": [ { "id": 66525, "url": "http://patchwork.ozlabs.org/api/series/66525/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=66525", "date": "2018-09-20T00:23:03", "name": "Implementation updates for ice", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/66525/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/972035/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/972035/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.137; helo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 42FyBg3SRQz9sBJ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 20 Sep 2018 10:23:39 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 0656C865A5;\n\tThu, 20 Sep 2018 00:23:38 +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 afAgLCWi_yfF; Thu, 20 Sep 2018 00:23:35 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 86524876F7;\n\tThu, 20 Sep 2018 00:23:35 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 42EA81C08AF\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:23:31 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 3F909227F5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:23:31 +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 0gCIqB0G5gVX for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:23:28 +0000 (UTC)", "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby silver.osuosl.org (Postfix) with ESMTPS id F22E930948\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 20 Sep 2018 00:23:24 +0000 (UTC)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Sep 2018 17:23:23 -0700", "from shasta.jf.intel.com ([10.166.241.11])\n\tby fmsmga006.fm.intel.com with ESMTP; 19 Sep 2018 17:23: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.53,396,1531810800\"; d=\"scan'208\";a=\"265057698\"", "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 19 Sep 2018 17:23:11 -0700", "Message-Id": "<20180920002319.10971-9-anirudh.venkataramanan@intel.com>", "X-Mailer": "git-send-email 2.14.3", "In-Reply-To": "<20180920002319.10971-1-anirudh.venkataramanan@intel.com>", "References": "<20180920002319.10971-1-anirudh.venkataramanan@intel.com>", "Subject": "[Intel-wired-lan] [PATCH 08/16] ice: Change pf state behavior to\n\tprotect reset path", "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>", "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: Dave Ertman <david.m.ertman@intel.com>\n\nCurrently, there is no bit, or set of bits, that protect the entirety\nof the reset path.\n\nIf the reset is originated by the driver, then the relevant\none of the following bits will be set when the reset is scheduled:\n__ICE_PFR_REQ\n__ICE_CORER_REQ\n__ICE_GLOBR_REQ\nThis bit will not be cleared until after the rebuild has completed.\n\nIf the reset is originated by the FW, then the first the driver knows of\nit will be the reception of the OICR interrupt. The __ICE_RESET_OICR_RECV\nbit will be set in the interrupt handler. This will also be the indicator\nin a SW originated reset that we have completed the pre-OICR tasks and\nhave informed the FW that a reset was requested.\n\nTo utilize these bits, change the function:\nice_is_reset_recovery_pending()\n\tto be:\nice_is_reset_in_progress()\n\nThe new function will check all of the above bits in the pf->state and\nwill return a true if one or more of these bits are set.\n\nSigned-off-by: Dave Ertman <david.m.ertman@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n[Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> cleaned up commit message]\n---\n drivers/net/ethernet/intel/ice/ice.h | 2 +-\n drivers/net/ethernet/intel/ice/ice_lib.c | 13 +++++----\n drivers/net/ethernet/intel/ice/ice_lib.h | 2 +-\n drivers/net/ethernet/intel/ice/ice_main.c | 44 +++++++++++++++----------------\n 4 files changed, 31 insertions(+), 30 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex e84a612ffa71..9cce4cb91401 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -124,7 +124,7 @@ enum ice_state {\n \t__ICE_DOWN,\n \t__ICE_NEEDS_RESTART,\n \t__ICE_PREPARED_FOR_RESET,\t/* set by driver when prepared */\n-\t__ICE_RESET_RECOVERY_PENDING,\t/* set by driver when reset starts */\n+\t__ICE_RESET_OICR_RECV,\t\t/* set by driver after rcv reset OICR */\n \t__ICE_PFR_REQ,\t\t\t/* set by driver and peers */\n \t__ICE_CORER_REQ,\t\t/* set by driver and peers */\n \t__ICE_GLOBR_REQ,\t\t/* set by driver and peers */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 3d6d8a33b7bc..da9199d220a0 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -2250,7 +2250,7 @@ int ice_vsi_release(struct ice_vsi *vsi)\n \t * currently. This is done to avoid check_flush_dependency() warning\n \t * on this wq\n \t */\n-\tif (vsi->netdev && !ice_is_reset_recovery_pending(pf->state)) {\n+\tif (vsi->netdev && !ice_is_reset_in_progress(pf->state)) {\n \t\tunregister_netdev(vsi->netdev);\n \t\tfree_netdev(vsi->netdev);\n \t\tvsi->netdev = NULL;\n@@ -2280,7 +2280,7 @@ int ice_vsi_release(struct ice_vsi *vsi)\n \t * free VSI netdev when PF is not in reset recovery pending state,\\\n \t * for ex: during rmmod.\n \t */\n-\tif (!ice_is_reset_recovery_pending(pf->state))\n+\tif (!ice_is_reset_in_progress(pf->state))\n \t\tice_vsi_clear(vsi);\n \n \treturn 0;\n@@ -2367,10 +2367,13 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)\n }\n \n /**\n- * ice_is_reset_recovery_pending - schedule a reset\n+ * ice_is_reset_in_progress - check for a reset in progress\n * @state: pf state field\n */\n-bool ice_is_reset_recovery_pending(unsigned long *state)\n+bool ice_is_reset_in_progress(unsigned long *state)\n {\n-\treturn test_bit(__ICE_RESET_RECOVERY_PENDING, state);\n+\treturn test_bit(__ICE_RESET_OICR_RECV, state) ||\n+\t test_bit(__ICE_PFR_REQ, state) ||\n+\t test_bit(__ICE_CORER_REQ, state) ||\n+\t test_bit(__ICE_GLOBR_REQ, state);\n }\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h\nindex a76cde895bf3..4265464ee3d3 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -54,7 +54,7 @@ ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id);\n \n int ice_vsi_rebuild(struct ice_vsi *vsi);\n \n-bool ice_is_reset_recovery_pending(unsigned long *state);\n+bool ice_is_reset_in_progress(unsigned long *state);\n \n void ice_vsi_free_q_vectors(struct ice_vsi *vsi);\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 0abf0aef366d..65e882b8277e 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -364,21 +364,17 @@ static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type)\n \tdev_dbg(dev, \"reset_type 0x%x requested\\n\", reset_type);\n \tWARN_ON(in_interrupt());\n \n-\t/* PFR is a bit of a special case because it doesn't result in an OICR\n-\t * interrupt. Set pending bit here which otherwise gets set in the\n-\t * OICR handler.\n-\t */\n-\tif (reset_type == ICE_RESET_PFR)\n-\t\tset_bit(__ICE_RESET_RECOVERY_PENDING, pf->state);\n-\n \tice_prepare_for_reset(pf);\n \n \t/* trigger the reset */\n \tif (ice_reset(hw, reset_type)) {\n \t\tdev_err(dev, \"reset %d failed\\n\", reset_type);\n \t\tset_bit(__ICE_RESET_FAILED, pf->state);\n-\t\tclear_bit(__ICE_RESET_RECOVERY_PENDING, pf->state);\n+\t\tclear_bit(__ICE_RESET_OICR_RECV, pf->state);\n \t\tclear_bit(__ICE_PREPARED_FOR_RESET, pf->state);\n+\t\tclear_bit(__ICE_PFR_REQ, pf->state);\n+\t\tclear_bit(__ICE_CORER_REQ, pf->state);\n+\t\tclear_bit(__ICE_GLOBR_REQ, pf->state);\n \t\treturn;\n \t}\n \n@@ -389,8 +385,8 @@ static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type)\n \tif (reset_type == ICE_RESET_PFR) {\n \t\tpf->pfr_count++;\n \t\tice_rebuild(pf);\n-\t\tclear_bit(__ICE_RESET_RECOVERY_PENDING, pf->state);\n \t\tclear_bit(__ICE_PREPARED_FOR_RESET, pf->state);\n+\t\tclear_bit(__ICE_PFR_REQ, pf->state);\n \t}\n }\n \n@@ -405,14 +401,14 @@ static void ice_reset_subtask(struct ice_pf *pf)\n \t/* When a CORER/GLOBR/EMPR is about to happen, the hardware triggers an\n \t * OICR interrupt. The OICR handler (ice_misc_intr) determines what type\n \t * of reset is pending and sets bits in pf->state indicating the reset\n-\t * type and __ICE_RESET_RECOVERY_PENDING. So, if the latter bit is set\n+\t * type and __ICE_RESET_OICR_RECV. So, if the latter bit is set\n \t * prepare for pending reset if not already (for PF software-initiated\n \t * global resets the software should already be prepared for it as\n \t * indicated by __ICE_PREPARED_FOR_RESET; for global resets initiated\n \t * by firmware or software on other PFs, that bit is not set so prepare\n \t * for the reset now), poll for reset done, rebuild and return.\n \t */\n-\tif (ice_is_reset_recovery_pending(pf->state)) {\n+\tif (test_bit(__ICE_RESET_OICR_RECV, pf->state)) {\n \t\tclear_bit(__ICE_GLOBR_RECV, pf->state);\n \t\tclear_bit(__ICE_CORER_RECV, pf->state);\n \t\tif (!test_bit(__ICE_PREPARED_FOR_RESET, pf->state))\n@@ -428,19 +424,22 @@ static void ice_reset_subtask(struct ice_pf *pf)\n \t\t\t/* clear bit to resume normal operations, but\n \t\t\t * ICE_NEEDS_RESTART bit is set incase rebuild failed\n \t\t\t */\n-\t\t\tclear_bit(__ICE_RESET_RECOVERY_PENDING, pf->state);\n+\t\t\tclear_bit(__ICE_RESET_OICR_RECV, pf->state);\n \t\t\tclear_bit(__ICE_PREPARED_FOR_RESET, pf->state);\n+\t\t\tclear_bit(__ICE_PFR_REQ, pf->state);\n+\t\t\tclear_bit(__ICE_CORER_REQ, pf->state);\n+\t\t\tclear_bit(__ICE_GLOBR_REQ, pf->state);\n \t\t}\n \n \t\treturn;\n \t}\n \n \t/* No pending resets to finish processing. Check for new resets */\n-\tif (test_and_clear_bit(__ICE_PFR_REQ, pf->state))\n+\tif (test_bit(__ICE_PFR_REQ, pf->state))\n \t\treset_type = ICE_RESET_PFR;\n-\tif (test_and_clear_bit(__ICE_CORER_REQ, pf->state))\n+\tif (test_bit(__ICE_CORER_REQ, pf->state))\n \t\treset_type = ICE_RESET_CORER;\n-\tif (test_and_clear_bit(__ICE_GLOBR_REQ, pf->state))\n+\tif (test_bit(__ICE_GLOBR_REQ, pf->state))\n \t\treset_type = ICE_RESET_GLOBR;\n \t/* If no valid reset type requested just return */\n \tif (reset_type == ICE_RESET_INVAL)\n@@ -1029,7 +1028,7 @@ static void ice_service_task(struct work_struct *work)\n \tice_reset_subtask(pf);\n \n \t/* bail if a reset/recovery cycle is pending or rebuild failed */\n-\tif (ice_is_reset_recovery_pending(pf->state) ||\n+\tif (ice_is_reset_in_progress(pf->state) ||\n \t test_bit(__ICE_SUSPENDED, pf->state) ||\n \t test_bit(__ICE_NEEDS_RESTART, pf->state)) {\n \t\tice_service_task_complete(pf);\n@@ -1250,8 +1249,7 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)\n \t\t * We also make note of which reset happened so that peer\n \t\t * devices/drivers can be informed.\n \t\t */\n-\t\tif (!test_and_set_bit(__ICE_RESET_RECOVERY_PENDING,\n-\t\t\t\t pf->state)) {\n+\t\tif (!test_and_set_bit(__ICE_RESET_OICR_RECV, pf->state)) {\n \t\t\tif (reset == ICE_RESET_CORER)\n \t\t\t\tset_bit(__ICE_CORER_RECV, pf->state);\n \t\t\telse if (reset == ICE_RESET_GLOBR)\n@@ -1265,7 +1263,7 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)\n \t\t\t * is received and set back to false after the driver\n \t\t\t * has determined that the hardware is out of reset.\n \t\t\t *\n-\t\t\t * __ICE_RESET_RECOVERY_PENDING in pf->state indicates\n+\t\t\t * __ICE_RESET_OICR_RECV in pf->state indicates\n \t\t\t * that a post reset rebuild is required before the\n \t\t\t * driver is operational again. This is set above.\n \t\t\t *\n@@ -1355,7 +1353,7 @@ static int ice_req_irq_msix_misc(struct ice_pf *pf)\n \t * lost during reset. Note that this function is called only during\n \t * rebuild path and not while reset is in progress.\n \t */\n-\tif (ice_is_reset_recovery_pending(pf->state))\n+\tif (ice_is_reset_in_progress(pf->state))\n \t\tgoto skip_req_irq;\n \n \t/* reserve one vector in irq_tracker for misc interrupts */\n@@ -1637,7 +1635,7 @@ static int ice_setup_pf_sw(struct ice_pf *pf)\n \tstruct ice_vsi *vsi;\n \tint status = 0;\n \n-\tif (ice_is_reset_recovery_pending(pf->state))\n+\tif (ice_is_reset_in_progress(pf->state))\n \t\treturn -EBUSY;\n \n \tvsi = ice_pf_vsi_setup(pf, pf->hw.port_info);\n@@ -2203,7 +2201,7 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)\n \t}\n \n \tif (test_bit(__ICE_DOWN, pf->state) ||\n-\t ice_is_reset_recovery_pending(pf->state)) {\n+\t ice_is_reset_in_progress(pf->state)) {\n \t\tnetdev_err(netdev, \"can't set mac %pM. device not ready\\n\",\n \t\t\t mac);\n \t\treturn -EBUSY;\n@@ -3280,7 +3278,7 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)\n \t}\n \t/* if a reset is in progress, wait for some time for it to complete */\n \tdo {\n-\t\tif (ice_is_reset_recovery_pending(pf->state)) {\n+\t\tif (ice_is_reset_in_progress(pf->state)) {\n \t\t\tcount++;\n \t\t\tusleep_range(1000, 2000);\n \t\t} else {\n", "prefixes": [ "08/16" ] }