git: 0a856847c58c - stable/13 - LinuxKPI: add eth_random_addr() and device_get_mac_address()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sun, 20 Feb 2022 18:15:29 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a856847c58cd1f511b327ab0661eb6ca98fa87e

commit 0a856847c58cd1f511b327ab0661eb6ca98fa87e
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-02-09 11:50:27 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-02-20 16:23:05 +0000

    LinuxKPI: add eth_random_addr() and device_get_mac_address()
    
    Add eth_random_addr() and a dummy of device_get_mac_address()
    pending OF (FDT) support needed by drivers.
    
    While here remove a white space in random_ether_addr().
    
    Reviewed by:    hselasky
    Differential Revision: https://reviews.freebsd.org/D34228
    
    (cherry picked from commit 3cd6d6ff527ad0a57d278e2911f59b22dbd402cf)
---
 sys/compat/linuxkpi/common/include/linux/etherdevice.h | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h
index 5d8671c00020..219ed55a880d 100644
--- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h
+++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h
@@ -28,6 +28,7 @@
 #define	_LINUXKPI_LINUX_ETHERDEVICE_H_
 
 #include <linux/types.h>
+#include <linux/device.h>
 
 #include <sys/random.h>
 #include <sys/libkern.h>
@@ -107,7 +108,7 @@ eth_zero_addr(u8 *pa)
 }
 
 static inline void
-random_ether_addr(u8 * dst)
+random_ether_addr(u8 *dst)
 {
 	arc4random_buf(dst, 6);
 
@@ -115,4 +116,19 @@ random_ether_addr(u8 * dst)
 	dst[0] |= 0x02;
 }
 
+static inline void
+eth_random_addr(u8 *dst)
+{
+
+	random_ether_addr(dst);
+}
+
+static inline int
+device_get_mac_address(struct device *dev, char *dst)
+{
+
+	/* XXX get mac address from FDT? */
+	return (-ENOENT);
+}
+
 #endif					/* _LINUXKPI_LINUX_ETHERDEVICE_H_ */