git: 1a34afa9541e - stable/13 - e1000: Restore VF interface random MAC
Kevin Bowling
kbowling at FreeBSD.org
Thu Apr 29 01:22:36 UTC 2021
The branch stable/13 has been updated by kbowling (ports committer):
URL: https://cgit.FreeBSD.org/src/commit/?id=1a34afa9541e9e086451786a168c6fed634eb05b
commit 1a34afa9541e9e086451786a168c6fed634eb05b
Author: Kevin Bowling <kbowling at FreeBSD.org>
AuthorDate: 2021-04-15 18:45:02 +0000
Commit: Kevin Bowling <kbowling at FreeBSD.org>
CommitDate: 2021-04-29 01:22:16 +0000
e1000: Restore VF interface random MAC
Restore 525e07418c77 after the iflib conversion of igb(4). This
reenables random MAC address generation when attaching to a VF with a
zeroed MAC.
PR: 253535
Reported by: Balaev PA <mail at void.so>
Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29785
(cherry picked from commit 68a46f11eadab48a1da9e3d3900569a6a1ce142e)
---
sys/dev/e1000/if_em.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index abc78952a560..25236bf9cb79 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1061,9 +1061,17 @@ em_if_attach_pre(if_ctx_t ctx)
}
if (!em_is_valid_ether_addr(hw->mac.addr)) {
- device_printf(dev, "Invalid MAC address\n");
- error = EIO;
- goto err_late;
+ if (adapter->vf_ifp) {
+ u8 addr[ETHER_ADDR_LEN];
+ arc4rand(&addr, sizeof(addr), 0);
+ addr[0] &= 0xFE;
+ addr[0] |= 0x02;
+ bcopy(addr, hw->mac.addr, sizeof(addr));
+ } else {
+ device_printf(dev, "Invalid MAC address\n");
+ error = EIO;
+ goto err_late;
+ }
}
/* Disable ULP support */
@@ -1924,6 +1932,13 @@ em_identify_hardware(if_ctx_t ctx)
device_printf(dev, "Setup init failure\n");
return;
}
+
+ /* Are we a VF device? */
+ if ((adapter->hw.mac.type == e1000_vfadapt) ||
+ (adapter->hw.mac.type == e1000_vfadapt_i350))
+ adapter->vf_ifp = 1;
+ else
+ adapter->vf_ifp = 0;
}
static int
More information about the dev-commits-src-branches
mailing list