xref: /dpdk/drivers/net/bnxt/bnxt_util.c (revision 089e5ed727a15da2729cfee9b63533dd120bd04c)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2018 Broadcom
3  * All rights reserved.
4  */
5 
6 #include <inttypes.h>
7 #include <rte_ether.h>
8 
9 #include "bnxt_util.h"
10 
11 int bnxt_check_zero_bytes(const uint8_t *bytes, int len)
12 {
13 	int i;
14 
15 	for (i = 0; i < len; i++)
16 		if (bytes[i] != 0x00)
17 			return 0;
18 	return 1;
19 }
20 
21 void bnxt_eth_hw_addr_random(uint8_t *mac_addr)
22 {
23 	rte_eth_random_addr(mac_addr);
24 
25 	/* Set Organizationally Unique Identifier (OUI) prefix */
26 	mac_addr[0] = 0x00;
27 	mac_addr[1] = 0x0a;
28 	mac_addr[2] = 0xf7;
29 }
30