From patchwork Tue May 9 17:09:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13236034 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 860FE17AD7 for ; Tue, 9 May 2023 17:13:06 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F26AB for ; Tue, 9 May 2023 10:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683652385; x=1715188385; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Incsq6Pn1Z9IUkTEpPUdh20BK7H7a0CHw4oJRUlQoyg=; b=P06WeHW3rIoEjvI4Ta6KWL9DjuRp/st15VlHBSimpcefsr0IKd2CymnC nT4WcXm/V0689xkhZXk5IwKm2v71JU+i/lg18zRr8zK45LGgQTGwfkSDs goCC/bC2NLR6zq2AV1hdl7pQr7cJzp555SeADu5rJuxWwupBLD0xMAmnM 412l9phoNsRh69XTAXeWAiUe6VepycDROcNQgMc+JFioVK0gicIoZX7LO RaxO7kdUM89IBsxjzEu7RNjLBwUdOvO0IF+bVWh80NNm59mzOeqPnt7o9 g1cV4STaGu9k/2UhmvhW3Mrwq5+uqA8/BlJrtsNe61UK0ThMMJaqDbJbE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="339227620" X-IronPort-AV: E=Sophos;i="5.99,262,1677571200"; d="scan'208";a="339227620" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2023 10:13:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="729601142" X-IronPort-AV: E=Sophos;i="5.99,262,1677571200"; d="scan'208";a="729601142" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orsmga008.jf.intel.com with ESMTP; 09 May 2023 10:13:03 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Muhammad Husaini Zulkifli , anthony.l.nguyen@intel.com, sasha.neftin@intel.com, Naama Meir Subject: [PATCH net 1/3] igc: Clean the TX buffer and TX descriptor ring Date: Tue, 9 May 2023 10:09:33 -0700 Message-Id: <20230509170935.2237051-2-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230509170935.2237051-1-anthony.l.nguyen@intel.com> References: <20230509170935.2237051-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Muhammad Husaini Zulkifli There could be a race condition during link down where interrupt being generated and igc_clean_tx_irq() been called to perform the TX completion. Properly clear the TX buffer and TX descriptor ring to avoid those case. Fixes: 13b5b7fd6a4a ("igc: Add support for Tx/Rx rings") Signed-off-by: Muhammad Husaini Zulkifli Tested-by: Naama Meir Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/igc/igc_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 1c4676882082..5767e691b401 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -254,6 +254,13 @@ static void igc_clean_tx_ring(struct igc_ring *tx_ring) /* reset BQL for queue */ netdev_tx_reset_queue(txring_txq(tx_ring)); + /* Zero out the buffer ring */ + memset(tx_ring->tx_buffer_info, 0, + sizeof(*tx_ring->tx_buffer_info) * tx_ring->count); + + /* Zero out the descriptor ring */ + memset(tx_ring->desc, 0, tx_ring->size); + /* reset next_to_use and next_to_clean */ tx_ring->next_to_use = 0; tx_ring->next_to_clean = 0; From patchwork Tue May 9 17:09:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13236035 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD0AF182BD for ; Tue, 9 May 2023 17:13:06 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D029F3 for ; Tue, 9 May 2023 10:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683652385; x=1715188385; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1bcE1wzfvfpnBif2ENOLomp1qbl/hcHKpAgwo+UI0Sg=; b=j+hTUa3R9Y6Cahua/OdczyiysaE9Ywqu1eiwlJWr5lBPXNoYxjScs6kq nL3DqZYgpNINR1LkthXjsUAbG74tZ0kwWLWh2qyL8iyJ/RP4bmyOnctTZ 8xlwHSo323a7HJ/Dxupz7Uj41Qr3wiUOak+PHbQO4dYLcm0vuROey/KsP mv8gDwpHdWQZ08hkMYZrXrBSyfn3Ks5+gUosjZFbWvdmn4pm7FedcwD1w qvw6WBtH5BI4/MscIc4bZKqYw2HqLLGqlydlLMGV+35SeVJiwRGbF8AHE LWHb/xTdsexKpv7f5dlDlMh8Zs5WZpir0dro04VYuRTRID9yckV7L+WdM Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="339227627" X-IronPort-AV: E=Sophos;i="5.99,262,1677571200"; d="scan'208";a="339227627" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2023 10:13:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="729601145" X-IronPort-AV: E=Sophos;i="5.99,262,1677571200"; d="scan'208";a="729601145" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orsmga008.jf.intel.com with ESMTP; 09 May 2023 10:13:03 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Vinicius Costa Gomes , anthony.l.nguyen@intel.com, sasha.neftin@intel.com, Muhammad Husaini Zulkifli , Naama Meir Subject: [PATCH net 2/3] igc: Fix possible system crash when loading module Date: Tue, 9 May 2023 10:09:34 -0700 Message-Id: <20230509170935.2237051-3-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230509170935.2237051-1-anthony.l.nguyen@intel.com> References: <20230509170935.2237051-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Vinicius Costa Gomes Guarantee that when probe() is run again, PTM and PCI busmaster will be in the same state as it was if the driver was never loaded. Avoid an i225/i226 hardware issue that PTM requests can be made even though PCI bus mastering is not enabled. These unexpected PTM requests can crash some systems. So, "force" disable PTM and busmastering before removing the driver, so they can be re-enabled in the right order during probe(). This is more like a workaround and should be applicable for i225 and i226, in any platform. Fixes: 1b5d73fb8624 ("igc: Enable PCIe PTM") Signed-off-by: Vinicius Costa Gomes Reviewed-by: Muhammad Husaini Zulkifli Tested-by: Naama Meir Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 5767e691b401..5213f3da1fe7 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -6730,6 +6730,9 @@ static void igc_remove(struct pci_dev *pdev) igc_ptp_stop(adapter); + pci_disable_ptm(pdev); + pci_clear_master(pdev); + set_bit(__IGC_DOWN, &adapter->state); del_timer_sync(&adapter->watchdog_timer); From patchwork Tue May 9 17:09:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13236036 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5437519503 for ; Tue, 9 May 2023 17:13:07 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25BBBBE for ; Tue, 9 May 2023 10:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683652386; x=1715188386; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cPepQWlzZsaK6orMAe7HW0FNutCMdqMQPuFKOJdA/ls=; b=Mon/lZRctIhZObI0N2O3nkEAUmDj6Epv5RH8iOnchTaBghUZr/OJ7IHb gIi0U3fCTbp2NGnfvhHpqjdvaauL/Hl8VLDcWYrVb+fQI8cFjYgW5yYSN 0Q6gojCXuNOCRhUh19BNzDocuTjwlyX7bBibOSa2M908rEFvImN1rGwwi TrO2OTqh0NvVBBbnYsPHIhGZtp+jME+bw4iOe5HkKVz6m6dgDYxeSrZoN lH+VJXuTvsLAnNGvRhyjJfRnniRKxZa+Gyun4sIX8XUUrjB5qj130X2O0 yM5f9x5daJktp5Sgq4MClztrRKbh8qmPLsi7/EQ2nMTYjXWt91R12qOU8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="339227636" X-IronPort-AV: E=Sophos;i="5.99,262,1677571200"; d="scan'208";a="339227636" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2023 10:13:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="729601148" X-IronPort-AV: E=Sophos;i="5.99,262,1677571200"; d="scan'208";a="729601148" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orsmga008.jf.intel.com with ESMTP; 09 May 2023 10:13:03 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Aleksandr Loktionov , anthony.l.nguyen@intel.com, Pucha Himasekhar Reddy Subject: [PATCH net 3/3] igb: fix nvm.ops.read() error handling Date: Tue, 9 May 2023 10:09:35 -0700 Message-Id: <20230509170935.2237051-4-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230509170935.2237051-1-anthony.l.nguyen@intel.com> References: <20230509170935.2237051-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Aleksandr Loktionov Add error handling into igb_set_eeprom() function, in case nvm.ops.read() fails just quit with error code asap. Fixes: 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver") Signed-off-by: Aleksandr Loktionov Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 7d60da1b7bf4..99b6b21caa02 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -822,6 +822,8 @@ static int igb_set_eeprom(struct net_device *netdev, */ ret_val = hw->nvm.ops.read(hw, last_word, 1, &eeprom_buff[last_word - first_word]); + if (ret_val) + goto out; } /* Device's eeprom is always little-endian, word addressable */ @@ -839,7 +841,7 @@ static int igb_set_eeprom(struct net_device *netdev, /* Update the checksum if nvm write succeeded */ if (ret_val == 0) hw->nvm.ops.update(hw); - +out: igb_set_fw_version(adapter); kfree(eeprom_buff); return ret_val;