git: 273cf7d36336 - main - LinuxKPI: add eth_hdr()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sun, 01 Sep 2024 13:28:03 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=273cf7d36336eeed5fc2ad42e5e12a36e36650a0

commit 273cf7d36336eeed5fc2ad42e5e12a36e36650a0
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-08-27 21:07:52 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-08-31 21:35:02 +0000

    LinuxKPI: add eth_hdr()
    
    Add an implementation of eth_hdr() needed by a wireless driver.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D46462
---
 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_ */