svn commit: r308429 - head/sys/dev/e1000
Sean Bruno
sbruno at FreeBSD.org
Mon Nov 7 22:24:39 UTC 2016
Author: sbruno
Date: Mon Nov 7 22:24:37 2016
New Revision: 308429
URL: https://svnweb.freebsd.org/changeset/base/308429
Log:
The igb driver currently requires a VF interface to have a non-zero MAC
address, but the associated PF is giving the VF an all zeros MAC address
when one is not administratively assigned. The driver should check for
this case and generate a random address, similar to how the linux igbvf
driver does.
Submitted by: skoumjian at juniper.net (Scott Koumjian)
MFH: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8399
Modified:
head/sys/dev/e1000/if_igb.c
Modified: head/sys/dev/e1000/if_igb.c
==============================================================================
--- head/sys/dev/e1000/if_igb.c Mon Nov 7 21:15:39 2016 (r308428)
+++ head/sys/dev/e1000/if_igb.c Mon Nov 7 22:24:37 2016 (r308429)
@@ -590,11 +590,20 @@ igb_attach(device_t dev)
error = EIO;
goto err_late;
}
- /* Check its sanity */
- if (!igb_is_valid_ether_addr(adapter->hw.mac.addr)) {
- device_printf(dev, "Invalid MAC address\n");
- error = EIO;
- goto err_late;
+
+ /* Check its sanity */
+ if (!igb_is_valid_ether_addr(adapter->hw.mac.addr)) {
+ if (adapter->vf_ifp) {
+ u8 addr[ETHER_ADDR_LEN];
+ arc4rand(&addr, sizeof(addr), 0);
+ addr[0] &= 0xFE;
+ addr[0] |= 0x02;
+ bcopy(addr, adapter->hw.mac.addr, sizeof(addr));
+ } else {
+ device_printf(dev, "Invalid MAC address\n");
+ error = EIO;
+ goto err_late;
+ }
}
/* Setup OS specific network interface */
More information about the svn-src-head
mailing list