[v3,2/3] lib/net: fix support of random
Checks
Commit Message
IAVF PMD needs to generate a random MAC address if it is not configured
by host.
'random' is now supported on Windows.
Fixes: 16f0d03098cb ("net: build on Windows")
Cc: fady@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
lib/net/rte_ether.c | 4 ----
1 file changed, 4 deletions(-)
Comments
Ack-by: Shivanshu Shukla <shivanshu.shukla@intel.com>
-----Original Message-----
From: Kadam, Pallavi <pallavi.kadam@intel.com>
Sent: Thursday, September 9, 2021 4:23 PM
To: dev@dpdk.org
Cc: thomas@monjalon.net; Zhang, Qi Z <qi.z.zhang@intel.com>; fady@mellanox.com; Narcisa.Vasile@microsoft.com; dmitry.kozliuk@gmail.com; Yigit, Ferruh <ferruh.yigit@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>; Shukla, Shivanshu <shivanshu.shukla@intel.com>; Kadam, Pallavi <pallavi.kadam@intel.com>
Subject: [PATCH v3 2/3] lib/net: fix support of random
IAVF PMD needs to generate a random MAC address if it is not configured by host.
'random' is now supported on Windows.
Fixes: 16f0d03098cb ("net: build on Windows")
Cc: fady@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
lib/net/rte_ether.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/lib/net/rte_ether.c b/lib/net/rte_ether.c index 34605838b5..ced65ed9f3 100644
--- a/lib/net/rte_ether.c
+++ b/lib/net/rte_ether.c
@@ -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
--
2.31.1.windows.1
10/09/2021 01:23, Pallavi Kadam:
> IAVF PMD needs to generate a random MAC address if it is not configured
> by host.
> 'random' is now supported on Windows.
This patch can be the first of this series
to respect the dependency order.
> Fixes: 16f0d03098cb ("net: build on Windows")
> Cc: fady@mellanox.com
> Cc: stable@dpdk.org
This commit log does not explain why it was disabled before,
and what makes it possible now, but for sure,
there is no need to backport.
I will remove above lines.
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
> 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
> }
On 9/30/2021 9:46 AM, Thomas Monjalon wrote:
> 10/09/2021 01:23, Pallavi Kadam:
>> IAVF PMD needs to generate a random MAC address if it is not configured
>> by host.
>> 'random' is now supported on Windows.
> This patch can be the first of this series
> to respect the dependency order.
>
>> Fixes: 16f0d03098cb ("net: build on Windows")
>> Cc: fady@mellanox.com
>> Cc: stable@dpdk.org
> This commit log does not explain why it was disabled before,
> and what makes it possible now, but for sure,
At the time rte_rand was not exported to Windows.
We were adding the files to eal/common as and when required in the
Windows build.
So, rte_random.c was added in 21.02 release after Fady's patch was
already merged.
> there is no need to backport.
ok
> I will remove above lines.
Thank you!
>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>> 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
>> }
>
>
@@ -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