All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/2] igb_main: Assign random MAC address instead of fail in case of invalid one
@ 2022-05-12  9:39 ` lixue liang
  0 siblings, 0 replies; 16+ messages in thread
From: lixue liang @ 2022-05-12  9:39 UTC (permalink / raw)
  To: jesse.brandeburg, anthony.l.nguyen, kuba, intel-wired-lan, netdev
  Cc: lixue liang, kernel test robot

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.

Since the MAC address can be modified ,then add a random valid MAC address
to replace the invalid MAC address in the driver can be workable, it can
continue to finish the loading ,and output the relevant log reminder.

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

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index a513570c2ad6..746233befade 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -3359,10 +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)) {
-		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");
+		eth_hw_addr_random(netdev);
+		ether_addr_copy(hw->mac.addr, netdev->dev_addr);
+		dev_err(&pdev->dev,
+			"Invalid MAC Address, already assigned random MAC Address\n");
 	}
 
 	igb_set_default_mac_filter(adapter);
-- 
2.27.0


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

end of thread, other threads:[~2022-05-31 20:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  9:39 [PATCH v2 2/2] igb_main: Assign random MAC address instead of fail in case of invalid one lixue liang
2022-05-12  9:39 ` [Intel-wired-lan] " lixue liang
2022-05-12 13:55 ` Paul Menzel
2022-05-12 13:55   ` Paul Menzel
2022-05-13  3:25   ` 梁礼学
2022-05-13  3:47   ` 梁礼学
2022-05-13  5:00   ` lixue liang
     [not found]   ` <DM6PR11MB46576A8E6EBCB81E29FA49DC9BD69@DM6PR11MB4657.namprd11.prod.outlook.com>
2022-05-25  8:30     ` Palczewski, Mateusz
2022-05-30  3:19   ` [PATCH v3 3/3] " Lixue Liang
2022-05-30  3:19     ` [Intel-wired-lan] " Lixue Liang
2022-05-30  7:47     ` Paul Menzel
2022-05-30  7:47       ` [Intel-wired-lan] " Paul Menzel
2022-05-30 10:58   ` [PATCH v3] " Lixue Liang
2022-05-30 10:58     ` [Intel-wired-lan] " Lixue Liang
2022-05-31 20:36     ` Tony Nguyen
2022-05-31 20:36       ` [Intel-wired-lan] " Tony Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.