netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] igb_main:Added invalid mac address handling in igb_probe
@ 2022-05-11  8:07 lixue liang
  2022-05-11 13:39 ` kernel test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lixue liang @ 2022-05-11  8:07 UTC (permalink / raw)
  To: jesse.brandeburg, anthony.l.nguyen, kuba, intel-wired-lan, netdev
  Cc: lixue liang

In some cases, when the user uses igb_set_eeprom to modify
the mac address to be invalid, the igb driver will fail to load.
If there is no network card device, the user must modify it to
a valid mac address by other means. It is only the invalid
mac address that causes the driver The fatal problem of
loading failure will cause most users no choice but to trouble.

Since the mac address may be changed to be invalid, it must
also be changed to a valid mac address, then add a random
valid mac address to replace the invalid mac address in the
driver, continue to load the igb network card driver,
and output the relevant log reminder. vital to the user.

Signed-off-by: lixue liang <lianglixue@greatwall.com.cn>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 34b33b21e0dc..a513570c2ad6 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -3359,9 +3359,10 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	eth_hw_addr_set(netdev, hw->mac.addr);
 
 	if (!is_valid_ether_addr(netdev->dev_addr)) {
-		dev_err(&pdev->dev, "Invalid MAC Address\n");
-		err = -EIO;
-		goto err_eeprom;
+		eth_random_addr(netdev->dev_addr);
+		memcpy(hw->mac.addr, netdev->dev_addr, netdev->addr_len);
+		dev_info(&pdev->dev,
+			 "Invalid Mac Address, already got random Mac Address\n");
 	}
 
 	igb_set_default_mac_filter(adapter);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-11 18:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-11  8:07 [PATCH] igb_main:Added invalid mac address handling in igb_probe lixue liang
2022-05-11 13:39 ` kernel test robot
2022-05-11 14:33 ` Alexander H Duyck
2022-05-11 14:53 ` [Intel-wired-lan] " Paul Menzel
2022-05-11 18:40 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).