aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ixl
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2021-08-20 14:45:30 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2021-08-20 21:21:48 +0000
commit0e5811a2a9a1b4a7e0c79b73e3b9b9d15d481577 (patch)
tree4f28e22a0c9db08ee7dd6b190db37a2707e19f74 /sys/dev/ixl
parent0d13f5343fafbf3067ffc33a507ffca0375c4417 (diff)
downloadsrc-0e5811a2a9a1b4a7e0c79b73e3b9b9d15d481577.tar.gz
src-0e5811a2a9a1b4a7e0c79b73e3b9b9d15d481577.zip
intel ethernet: Use ether_gen_addr(9)
Use ether_gen_addr(9) for VF MAC generation Reviewed by: Intel Networking (erj), kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31616
Diffstat (limited to 'sys/dev/ixl')
-rw-r--r--sys/dev/ixl/if_iavf.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c
index f6eb91c2a855..123db2e2461d 100644
--- a/sys/dev/ixl/if_iavf.c
+++ b/sys/dev/ixl/if_iavf.c
@@ -433,13 +433,9 @@ iavf_if_attach_pre(if_ctx_t ctx)
iavf_dbg_init(sc, "Resource Acquisition complete\n");
/* If no mac address was assigned just make a random one */
- if (!iavf_check_ether_addr(hw->mac.addr)) {
- u8 addr[ETHER_ADDR_LEN];
- arc4rand(&addr, sizeof(addr), 0);
- addr[0] &= 0xFE;
- addr[0] |= 0x02;
- bcopy(addr, hw->mac.addr, sizeof(addr));
- }
+ if (!iavf_check_ether_addr(hw->mac.addr))
+ ether_gen_addr(iflib_get_ifp(ctx),
+ (struct ether_addr *)hw->mac.addr);
bcopy(hw->mac.addr, hw->mac.perm_addr, ETHER_ADDR_LEN);
iflib_set_mac(ctx, hw->mac.addr);