aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ixl/if_iavf.c
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2021-08-20 14:45:30 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2021-08-27 01:38:09 +0000
commit200842074ba60e8e4c8ab2776a3d2b85d3cd4101 (patch)
tree1d8a60c2d36d5e59acd38c76b7e1d9bd94e5b28d /sys/dev/ixl/if_iavf.c
parentf96130dbeeb1baf3480d5b95cfa34bd16650f17b (diff)
downloadsrc-200842074ba60e8e4c8ab2776a3d2b85d3cd4101.tar.gz
src-200842074ba60e8e4c8ab2776a3d2b85d3cd4101.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 (cherry picked from commit 0e5811a2a9a1b4a7e0c79b73e3b9b9d15d481577)
Diffstat (limited to 'sys/dev/ixl/if_iavf.c')
-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 066c565ec53e..72853a35138a 100644
--- a/sys/dev/ixl/if_iavf.c
+++ b/sys/dev/ixl/if_iavf.c
@@ -435,13 +435,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);