12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * INET An implementation of the TCP/IP protocol suite for the LINUX 41da177e4SLinus Torvalds * operating system. INET is implemented using the BSD Socket 51da177e4SLinus Torvalds * interface as the means of communication with the user level. 61da177e4SLinus Torvalds * 71da177e4SLinus Torvalds * Global definitions for the Ethernet IEEE 802.3 interface. 81da177e4SLinus Torvalds * 91da177e4SLinus Torvalds * Version: @(#)if_ether.h 1.0.1a 02/08/94 101da177e4SLinus Torvalds * 111da177e4SLinus Torvalds * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 121da177e4SLinus Torvalds * Donald Becker, <becker@super.org> 13113aa838SAlan Cox * Alan Cox, <alan@lxorguk.ukuu.org.uk> 141da177e4SLinus Torvalds * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 151da177e4SLinus Torvalds */ 161da177e4SLinus Torvalds #ifndef _LINUX_IF_ETHER_H 171da177e4SLinus Torvalds #define _LINUX_IF_ETHER_H 181da177e4SLinus Torvalds 191da177e4SLinus Torvalds #include <linux/skbuff.h> 20607ca46eSDavid Howells #include <uapi/linux/if_ether.h> 211da177e4SLinus Torvalds eth_hdr(const struct sk_buff * skb)221da177e4SLinus Torvaldsstatic inline struct ethhdr *eth_hdr(const struct sk_buff *skb) 231da177e4SLinus Torvalds { 2498e399f8SArnaldo Carvalho de Melo return (struct ethhdr *)skb_mac_header(skb); 251da177e4SLinus Torvalds } 2620380731SArnaldo Carvalho de Melo 2796cc4b69SEric Dumazet /* Prefer this version in TX path, instead of 2896cc4b69SEric Dumazet * skb_reset_mac_header() + eth_hdr() 2996cc4b69SEric Dumazet */ skb_eth_hdr(const struct sk_buff * skb)3096cc4b69SEric Dumazetstatic inline struct ethhdr *skb_eth_hdr(const struct sk_buff *skb) 3196cc4b69SEric Dumazet { 3296cc4b69SEric Dumazet return (struct ethhdr *)skb->data; 3396cc4b69SEric Dumazet } 3496cc4b69SEric Dumazet inner_eth_hdr(const struct sk_buff * skb)35af67eb9eSAlexander Duyckstatic inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb) 36af67eb9eSAlexander Duyck { 37af67eb9eSAlexander Duyck return (struct ethhdr *)skb_inner_mac_header(skb); 38af67eb9eSAlexander Duyck } 39af67eb9eSAlexander Duyck 403b04dddeSStephen Hemminger int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 413b04dddeSStephen Hemminger 427ffc49a6SMichael Chan extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 437ffc49a6SMichael Chan 441da177e4SLinus Torvalds #endif /* _LINUX_IF_ETHER_H */ 45