net: enable random address on Windows

IAVF PMD needs to generate a random MAC address if it is not configured
by host.
'random' is now supported on Windows.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Shivanshu Shukla <shivanshu.shukla@intel.com>
This commit is contained in:
Pallavi Kadam 2021-09-09 16:23:20 -07:00 committed by Thomas Monjalon
parent 3c6e581025
commit 876d40fe6d

View File

@ -10,16 +10,12 @@
void
rte_eth_random_addr(uint8_t *addr)
{
#ifdef RTE_EXEC_ENV_WINDOWS /* FIXME: random is not supported */
RTE_SET_USED(addr);
#else
uint64_t rand = rte_rand();
uint8_t *p = (uint8_t *)&rand;
rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN);
addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR; /* clear multicast bit */
addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */
#endif
}
void