1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * INET An implementation of the TCP/IP protocol suite for the LINUX 4*4882a593Smuzhiyun * operating system. INET is implemented using the BSD Socket 5*4882a593Smuzhiyun * interface as the means of communication with the user level. 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Global definitions for the Ethernet IEEE 802.3 interface. 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * Version: @(#)if_ether.h 1.0.1a 02/08/94 10*4882a593Smuzhiyun * 11*4882a593Smuzhiyun * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 12*4882a593Smuzhiyun * Donald Becker, <becker@super.org> 13*4882a593Smuzhiyun * Alan Cox, <alan@lxorguk.ukuu.org.uk> 14*4882a593Smuzhiyun * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 15*4882a593Smuzhiyun */ 16*4882a593Smuzhiyun #ifndef _LINUX_IF_ETHER_H 17*4882a593Smuzhiyun #define _LINUX_IF_ETHER_H 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun #include <linux/skbuff.h> 20*4882a593Smuzhiyun #include <uapi/linux/if_ether.h> 21*4882a593Smuzhiyun eth_hdr(const struct sk_buff * skb)22*4882a593Smuzhiyunstatic inline struct ethhdr *eth_hdr(const struct sk_buff *skb) 23*4882a593Smuzhiyun { 24*4882a593Smuzhiyun return (struct ethhdr *)skb_mac_header(skb); 25*4882a593Smuzhiyun } 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun /* Prefer this version in TX path, instead of 28*4882a593Smuzhiyun * skb_reset_mac_header() + eth_hdr() 29*4882a593Smuzhiyun */ skb_eth_hdr(const struct sk_buff * skb)30*4882a593Smuzhiyunstatic inline struct ethhdr *skb_eth_hdr(const struct sk_buff *skb) 31*4882a593Smuzhiyun { 32*4882a593Smuzhiyun return (struct ethhdr *)skb->data; 33*4882a593Smuzhiyun } 34*4882a593Smuzhiyun inner_eth_hdr(const struct sk_buff * skb)35*4882a593Smuzhiyunstatic inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb) 36*4882a593Smuzhiyun { 37*4882a593Smuzhiyun return (struct ethhdr *)skb_inner_mac_header(skb); 38*4882a593Smuzhiyun } 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun #endif /* _LINUX_IF_ETHER_H */ 45