Skip to content

Commit d6858e1

Browse files
committed
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-06-12 (igc, igb) This series contains updates to igc and igb drivers. Husaini clears Tx rings when interface is brought down for igc. Vinicius disables PTM and PCI busmaster when removing igc driver. Alex adds error check and path for NVM read error on igb. * '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: igb: fix nvm.ops.read() error handling igc: Fix possible system crash when loading module igc: Clean the TX buffer and TX descriptor ring ==================== Link: https://lore.kernel.org/r/20230612205208.115292-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 361b688 + 48a821f commit d6858e1

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

drivers/net/ethernet/intel/igb/igb_ethtool.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,8 @@ static int igb_set_eeprom(struct net_device *netdev,
822822
*/
823823
ret_val = hw->nvm.ops.read(hw, last_word, 1,
824824
&eeprom_buff[last_word - first_word]);
825+
if (ret_val)
826+
goto out;
825827
}
826828

827829
/* Device's eeprom is always little-endian, word addressable */
@@ -841,6 +843,7 @@ static int igb_set_eeprom(struct net_device *netdev,
841843
hw->nvm.ops.update(hw);
842844

843845
igb_set_fw_version(adapter);
846+
out:
844847
kfree(eeprom_buff);
845848
return ret_val;
846849
}

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ static void igc_clean_tx_ring(struct igc_ring *tx_ring)
254254
/* reset BQL for queue */
255255
netdev_tx_reset_queue(txring_txq(tx_ring));
256256

257+
/* Zero out the buffer ring */
258+
memset(tx_ring->tx_buffer_info, 0,
259+
sizeof(*tx_ring->tx_buffer_info) * tx_ring->count);
260+
261+
/* Zero out the descriptor ring */
262+
memset(tx_ring->desc, 0, tx_ring->size);
263+
257264
/* reset next_to_use and next_to_clean */
258265
tx_ring->next_to_use = 0;
259266
tx_ring->next_to_clean = 0;
@@ -267,7 +274,7 @@ static void igc_clean_tx_ring(struct igc_ring *tx_ring)
267274
*/
268275
void igc_free_tx_resources(struct igc_ring *tx_ring)
269276
{
270-
igc_clean_tx_ring(tx_ring);
277+
igc_disable_tx_ring(tx_ring);
271278

272279
vfree(tx_ring->tx_buffer_info);
273280
tx_ring->tx_buffer_info = NULL;
@@ -6723,6 +6730,9 @@ static void igc_remove(struct pci_dev *pdev)
67236730

67246731
igc_ptp_stop(adapter);
67256732

6733+
pci_disable_ptm(pdev);
6734+
pci_clear_master(pdev);
6735+
67266736
set_bit(__IGC_DOWN, &adapter->state);
67276737

67286738
del_timer_sync(&adapter->watchdog_timer);

0 commit comments

Comments
 (0)