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