Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * INET     An implementation of the TCP/IP protocol suite for the LINUX
0004  *      operating system.  INET is implemented using the  BSD Socket
0005  *      interface as the means of communication with the user level.
0006  *
0007  *      Global definitions for the Ethernet IEEE 802.3 interface.
0008  *
0009  * Version: @(#)if_ether.h  1.0.1a  02/08/94
0010  *
0011  * Author:  Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
0012  *      Donald Becker, <becker@super.org>
0013  *      Alan Cox, <alan@lxorguk.ukuu.org.uk>
0014  *      Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
0015  */
0016 #ifndef _LINUX_IF_ETHER_H
0017 #define _LINUX_IF_ETHER_H
0018 
0019 #include <linux/skbuff.h>
0020 #include <uapi/linux/if_ether.h>
0021 
0022 static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
0023 {
0024     return (struct ethhdr *)skb_mac_header(skb);
0025 }
0026 
0027 /* Prefer this version in TX path, instead of
0028  * skb_reset_mac_header() + eth_hdr()
0029  */
0030 static inline struct ethhdr *skb_eth_hdr(const struct sk_buff *skb)
0031 {
0032     return (struct ethhdr *)skb->data;
0033 }
0034 
0035 static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb)
0036 {
0037     return (struct ethhdr *)skb_inner_mac_header(skb);
0038 }
0039 
0040 int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
0041 
0042 extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
0043 
0044 #endif  /* _LINUX_IF_ETHER_H */