kni: update kernel API to set random MAC address

Message ID 20211103125950.3895442-1-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series kni: update kernel API to set random MAC address |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Ferruh Yigit Nov. 3, 2021, 12:59 p.m. UTC
  Previously used 'random_ether_addr()' API is removed in upstream kernel
with commit
Commit ba530fea8ca1 ("ethernet: remove random_ether_addr()")

Replacement API 'eth_random_addr()' is around since v3.6 [1], so
simply switching to this API without any version checks.

[1]
0a4dd594982a ("etherdevice: Rename random_ether_addr to eth_random_addr")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 kernel/linux/kni/kni_misc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
  

Comments

Thomas Monjalon Nov. 8, 2021, 10:53 a.m. UTC | #1
03/11/2021 13:59, Ferruh Yigit:
> Previously used 'random_ether_addr()' API is removed in upstream kernel
> with commit
> Commit ba530fea8ca1 ("ethernet: remove random_ether_addr()")
> 
> Replacement API 'eth_random_addr()' is around since v3.6 [1], so
> simply switching to this API without any version checks.
> 
> [1]
> 0a4dd594982a ("etherdevice: Rename random_ether_addr to eth_random_addr")
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks.
  

Patch

diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c
index 2b464c438113..f4944e1ddf33 100644
--- a/kernel/linux/kni/kni_misc.c
+++ b/kernel/linux/kni/kni_misc.c
@@ -399,11 +399,8 @@  kni_ioctl_create(struct net *net, uint32_t ioctl_num,
 	if (is_valid_ether_addr(dev_info.mac_addr))
 		memcpy(net_dev->dev_addr, dev_info.mac_addr, ETH_ALEN);
 	else
-		/*
-		 * Generate random mac address. eth_random_addr() is the
-		 * newer version of generating mac address in kernel.
-		 */
-		random_ether_addr(net_dev->dev_addr);
+		/* Generate random MAC address. */
+		eth_random_addr(net_dev->dev_addr);
 
 	if (dev_info.mtu)
 		net_dev->mtu = dev_info.mtu;