Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A12D2C433FE for ; Thu, 3 Nov 2022 12:57:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3A7B3415A3; Thu, 3 Nov 2022 12:57:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3A7B3415A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1667480262; bh=lUqal39d0dtrWY2rH9neqaYOF/qH8xjxmc1qA3n830s=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=r2mpQk6baVI98ys3Pa+gxChZXNQeDIJd4b3nAUlzcPDYG3kFy/enkQD6zLPAqvSDz ENrzu0o9k8ObIeMZw2wPgjIHqrTSRieWQdrJKDsRmb+MdGGYrE9w8ab9MsJW3xinA8 hlXgdoyG8OIO0mP4Q42MA7SmtuI/NPNyPZtvKlbce8rhzG/gfbUzyXu2V1iXDFEesB KNENgRCNhhVm8s12E2fsFkaoMHikH+YNy1ZwEUkmItaCpJN+4Rnqtb1QWUuFR77dj6 2JxXPVGynsG27aNxgAaUA2AEYYC16VKCt28T4oG+iFIyoqCqhktRuy+OO+MuA52GEf stlfkN4tzthBw== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Q3rZYxEAwVu; Thu, 3 Nov 2022 12:57:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 00D2041609; Thu, 3 Nov 2022 12:57:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 00D2041609 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 637D11BF404 for ; Thu, 3 Nov 2022 12:57:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3C1824161F for ; Thu, 3 Nov 2022 12:57:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3C1824161F X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d85OcmOAD8n5 for ; Thu, 3 Nov 2022 12:57:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3DE0F415A3 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by smtp4.osuosl.org (Postfix) with ESMTPS id 3DE0F415A3 for ; Thu, 3 Nov 2022 12:57:38 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6500,9779,10519"; a="308389704" X-IronPort-AV: E=Sophos;i="5.96,235,1665471600"; d="scan'208";a="308389704" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2022 05:57:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10519"; a="665956214" X-IronPort-AV: E=Sophos;i="5.96,235,1665471600"; d="scan'208";a="665956214" Received: from s240.igk.intel.com (HELO s048.nql.local) ([10.102.18.202]) by orsmga008.jf.intel.com with ESMTP; 03 Nov 2022 05:57:25 -0700 From: Jan Sokolowski To: intel-wired-lan@lists.osuosl.org Date: Thu, 3 Nov 2022 14:00:02 +0100 Message-Id: <20221103130003.2329-1-jan.sokolowski@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667480258; x=1699016258; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Jcm33ztV3hctmprpwo4EiBcBv0MgKNnz+BMwuGlPSw8=; b=Yz3cg2YWoKxgt4tEL/8+luSl/rSE1MTbZ8zVowCNtou1P6WOHihdJSHB 7dLoDI6G7EmhXRan+I8R+taOmxz53BBg0hb8aicTWnGZlYrsz7mr1Q9PQ xnrE/ufVq3aE/S0/fUAhNAoKw4p0Wavj5Gpdvk7k40sUomJrzWb5A6NwU WkO7jpYa2Jhh+kuwYZ8lQ4cOgi5T7bP7oK9qf/QzC+Kn05uREq36dbruA FKwknzPrghM214qC/cgRm1vCWG6/YUfxUo/u7T/H3GOn0ABiKHnYDWMSx u3JqPBq4TmL7slF+9nuoRWPThaVFf5KXmf70L5SbS3ReI097Tnk7dXWBI A==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Yz3cg2YW Subject: [Intel-wired-lan] [PATCH net v3 1/2] iavf: Fix shutdown pci callback to match the remove one X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Slawomir Laba Make the flow for pci shutdown be the same to the pci remove. iavf_shutdown was implementing an incomplete version of iavf_remove. It misses several calls to the kernel like iavf_free_misc_irq, iavf_reset_interrupt_capability, iounmap that might break the system on reboot or hibernation. Implement the call of iavf_remove directly in iavf_shutdown to close this gap. Fixes: 5eae00c57f5e ("i40evf: main driver core") Signed-off-by: Slawomir Laba Signed-off-by: Mateusz Palczewski Tested-by: Marek Szlosek --- v2: Fixed author --- drivers/net/ethernet/intel/iavf/iavf_main.c | 40 +++++++-------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 3fc572341781..7cd5bbab8f0f 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -4805,34 +4805,6 @@ int iavf_process_config(struct iavf_adapter *adapter) return 0; } -/** - * iavf_shutdown - Shutdown the device in preparation for a reboot - * @pdev: pci device structure - **/ -static void iavf_shutdown(struct pci_dev *pdev) -{ - struct iavf_adapter *adapter = iavf_pdev_to_adapter(pdev); - struct net_device *netdev = adapter->netdev; - - netif_device_detach(netdev); - - if (netif_running(netdev)) - iavf_close(netdev); - - if (iavf_lock_timeout(&adapter->crit_lock, 5000)) - dev_warn(&adapter->pdev->dev, "failed to acquire crit_lock in %s\n", __FUNCTION__); - /* Prevent the watchdog from running. */ - iavf_change_state(adapter, __IAVF_REMOVE); - adapter->aq_required = 0; - mutex_unlock(&adapter->crit_lock); - -#ifdef CONFIG_PM - pci_save_state(pdev); - -#endif - pci_disable_device(pdev); -} - /** * iavf_probe - Device Initialization Routine * @pdev: PCI device information struct @@ -5172,6 +5144,18 @@ static void iavf_remove(struct pci_dev *pdev) pci_disable_device(pdev); } +/** + * iavf_shutdown - Shutdown the device in preparation for a reboot + * @pdev: pci device structure + **/ +static void iavf_shutdown(struct pci_dev *pdev) +{ + iavf_remove(pdev); + + if (system_state == SYSTEM_POWER_OFF) + pci_set_power_state(pdev, PCI_D3hot); +} + static SIMPLE_DEV_PM_OPS(iavf_pm_ops, iavf_suspend, iavf_resume); static struct pci_driver iavf_driver = { -- 2.31.1 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan