git: 6dedd620cfe3 - stable/14 - LinuxKPI: add eth_hdr()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sat, 28 Sep 2024 10:38:21 UTC
The branch stable/14 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=6dedd620cfe35b6a0a637132c772c5f2c7c2b40b

commit 6dedd620cfe35b6a0a637132c772c5f2c7c2b40b
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-08-27 21:07:52 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-09-28 10:35:13 +0000

    LinuxKPI: add eth_hdr()
    
    Add an implementation of eth_hdr() needed by a wireless driver.
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D46462
    
    (cherry picked from commit 273cf7d36336eeed5fc2ad42e5e12a36e36650a0)
---
 sys/compat/linuxkpi/common/include/linux/if_ether.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/if_ether.h b/sys/compat/linuxkpi/common/include/linux/if_ether.h
index 3735ad2f5527..6676e8fc142f 100644
--- a/sys/compat/linuxkpi/common/include/linux/if_ether.h
+++ b/sys/compat/linuxkpi/common/include/linux/if_ether.h
@@ -34,6 +34,7 @@
 #define	_LINUXKPI_LINUX_IF_ETHER_H_
 
 #include <linux/types.h>
+#include <linux/skbuff.h>
 
 #include <net/ethernet.h>
 
@@ -69,4 +70,13 @@ struct ethhdr {
 	uint16_t	h_proto;
 } __packed;
 
+static inline struct ethhdr *
+eth_hdr(const struct sk_buff *skb)
+{
+	struct ethhdr *hdr;
+
+	hdr = (struct ethhdr *)skb_mac_header(skb);
+	return (hdr);
+}
+
 #endif	/* _LINUXKPI_LINUX_IF_ETHER_H_ */