aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@suse.com>2014-02-25 20:15:12 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-27 15:59:09 -0500
commit589f5816f3f660aa4b1c93fc9eac58a1e807bbbb (patch)
treed7d8c17ad45d2670d7f705963056c0ef666cc448 /include/uapi
parent118ce7ab9785846e1c673f6130bee526c127206c (diff)
net: kdoc struct net_device flags and priv_flags
We have documentation for these flags but they're scattered all over the place. #defines don't allow documentation to be written easily so to help to start bringing some documentation together use the enums kdoc practice but keep the defines to allow userspace to be able to #ifdef them. I've verified the same values are assigned before and after with a simple userspace test program [0] and checksumming the output. [0] http://drvbp1.linux-foundation.org/~mcgrof/kdoc/netdev_flags/ mcgrof@gnat ~/tmp $ ./check-flags | sha1sum 0ec5b6b1840aa3bb9ce464e61c564820871c92c3 - Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Ben Hutchings <ben@decadent.org.uk> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: David Miller <davem@davemloft.net> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/if.h213
1 files changed, 161 insertions, 52 deletions
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index d758163b0e43..42ec87994cf6 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -27,64 +27,173 @@
27#define IFALIASZ 256 27#define IFALIASZ 256
28#include <linux/hdlc/ioctl.h> 28#include <linux/hdlc/ioctl.h>
29 29
30/* Standard interface flags (netdevice->flags). */ 30/**
31#define IFF_UP 0x1 /* interface is up */ 31 * enum net_device_flags - &struct net_device flags
32#define IFF_BROADCAST 0x2 /* broadcast address valid */ 32 *
33#define IFF_DEBUG 0x4 /* turn on debugging */ 33 * These are the &struct net_device flags, they can be set by drivers, the
34#define IFF_LOOPBACK 0x8 /* is a loopback net */ 34 * kernel and some can be triggered by userspace. Userspace can query and
35#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ 35 * set these flags using userspace utilities but there is also a sysfs
36#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 36 * entry available for all dev flags which can be queried and set. These flags
37#define IFF_RUNNING 0x40 /* interface RFC2863 OPER_UP */ 37 * are shared for all types of net_devices. The sysfs entries are available
38#define IFF_NOARP 0x80 /* no ARP protocol */ 38 * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs
39#define IFF_PROMISC 0x100 /* receive all packets */ 39 * are annotated below, note that only a few flags can be toggled and some
40#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ 40 * other flags are always always preserved from the original net_device flags
41 41 * even if you try to set them via sysfs. Flags which are always preserved
42#define IFF_MASTER 0x400 /* master of a load balancer */ 42 * are kept under the flag grouping @IFF_VOLATILE. Flags which are volatile
43#define IFF_SLAVE 0x800 /* slave of a load balancer */ 43 * are annotated below as such.
44 44 *
45#define IFF_MULTICAST 0x1000 /* Supports multicast */ 45 * You should have a pretty good reason to be extending these flags.
46 46 *
47#define IFF_PORTSEL 0x2000 /* can set media type */ 47 * @IFF_UP: interface is up. Can be toggled through sysfs.
48#define IFF_AUTOMEDIA 0x4000 /* auto media select active */ 48 * @IFF_BROADCAST: broadcast address valid. Volatile.
49#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ 49 * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs.
50 50 * @IFF_LOOPBACK: is a loopback net. Volatile.
51#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ 51 * @IFF_POINTOPOINT: interface is has p-p link. Volatile.
52#define IFF_DORMANT 0x20000 /* driver signals dormant */ 52 * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs.
53 * Volatile.
54 * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile.
55 * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile.
56 * @IFF_PROMISC: receive all packets. Can be toggled through sysfs.
57 * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through
58 * sysfs.
59 * @IFF_MASTER: master of a load balancer. Volatile.
60 * @IFF_SLAVE: slave of a load balancer. Volatile.
61 * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs.
62 * @IFF_PORTSEL: can set media type. Can be toggled through sysfs.
63 * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs.
64 * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled
65 * through sysfs.
66 * @IFF_LOWER_UP: driver signals L1 up. Volatile.
67 * @IFF_DORMANT: driver signals dormant. Volatile.
68 * @IFF_ECHO: echo sent packets. Volatile.
69 */
70enum net_device_flags {
71 IFF_UP = 1<<0, /* sysfs */
72 IFF_BROADCAST = 1<<1, /* volatile */
73 IFF_DEBUG = 1<<2, /* sysfs */
74 IFF_LOOPBACK = 1<<3, /* volatile */
75 IFF_POINTOPOINT = 1<<4, /* volatile */
76 IFF_NOTRAILERS = 1<<5, /* sysfs */
77 IFF_RUNNING = 1<<6, /* volatile */
78 IFF_NOARP = 1<<7, /* sysfs */
79 IFF_PROMISC = 1<<8, /* sysfs */
80 IFF_ALLMULTI = 1<<9, /* sysfs */
81 IFF_MASTER = 1<<10, /* volatile */
82 IFF_SLAVE = 1<<11, /* volatile */
83 IFF_MULTICAST = 1<<12, /* sysfs */
84 IFF_PORTSEL = 1<<13, /* sysfs */
85 IFF_AUTOMEDIA = 1<<14, /* sysfs */
86 IFF_DYNAMIC = 1<<15, /* sysfs */
87 IFF_LOWER_UP = 1<<16, /* volatile */
88 IFF_DORMANT = 1<<17, /* volatile */
89 IFF_ECHO = 1<<18, /* volatile */
90};
53 91
54#define IFF_ECHO 0x40000 /* echo sent packets */ 92#define IFF_UP IFF_UP
93#define IFF_BROADCAST IFF_BROADCAST
94#define IFF_DEBUG IFF_DEBUG
95#define IFF_LOOPBACK IFF_LOOPBACK
96#define IFF_POINTOPOINT IFF_POINTOPOINT
97#define IFF_NOTRAILERS IFF_NOTRAILERS
98#define IFF_RUNNING IFF_RUNNING
99#define IFF_NOARP IFF_NOARP
100#define IFF_PROMISC IFF_PROMISC
101#define IFF_ALLMULTI IFF_ALLMULTI
102#define IFF_MASTER IFF_MASTER
103#define IFF_SLAVE IFF_SLAVE
104#define IFF_MULTICAST IFF_MULTICAST
105#define IFF_PORTSEL IFF_PORTSEL
106#define IFF_AUTOMEDIA IFF_AUTOMEDIA
107#define IFF_DYNAMIC IFF_DYNAMIC
108#define IFF_LOWER_UP IFF_LOWER_UP
109#define IFF_DORMANT IFF_DORMANT
110#define IFF_ECHO IFF_ECHO
55 111
56#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ 112#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
57 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) 113 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
58 114
59/* Private (from user) interface flags (netdevice->priv_flags). */ 115/**
60#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */ 116 * enum net_device_priv_flags - &struct net_device priv_flags
61#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */ 117 *
62#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ 118 * These are the &struct net_device, they are only set internally
63#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ 119 * by drivers and used in the kernel. These flags are invisible to
64#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ 120 * userspace, this means that the order of these flags can change
65#define IFF_BONDING 0x20 /* bonding master or slave */ 121 * during any kernel release.
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 122 *
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ 123 * You should have a pretty good reason to be extending these flags.
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */ 124 *
69#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */ 125 * @IFF_802_1Q_VLAN: 802.1Q VLAN device
70#define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to 126 * @IFF_EBRIDGE: Ethernet bridging device
71 * release skb->dst 127 * @IFF_SLAVE_INACTIVE: bonding slave not the curr. active
72 */ 128 * @IFF_MASTER_8023AD: bonding master, 802.3ad
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ 129 * @IFF_MASTER_ALB: bonding master, balance-alb
74#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */ 130 * @IFF_BONDING: bonding master or slave
75#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */ 131 * @IFF_SLAVE_NEEDARP: need ARPs for validation
76#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */ 132 * @IFF_ISATAP: ISATAP interface (RFC4214)
77#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch 133 * @IFF_MASTER_ARPMON: bonding master, ARP mon in use
78 * datapath port */ 134 * @IFF_WAN_HDLC: WAN HDLC device
79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing 135 * @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
80 * skbs on transmit */ 136 * release skb->dst
81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ 137 * @IFF_DONT_BRIDGE: disallow bridging this ether dev
82#define IFF_TEAM_PORT 0x40000 /* device used as team port */ 138 * @IFF_DISABLE_NETPOLL: disable netpoll at run-time
83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */ 139 * @IFF_MACVLAN_PORT: device used as macvlan port
84#define IFF_LIVE_ADDR_CHANGE 0x100000 /* device supports hardware address 140 * @IFF_BRIDGE_PORT: device used as bridge port
85 * change when it's running */ 141 * @IFF_OVS_DATAPATH: device used as Open vSwitch datapath port
86#define IFF_MACVLAN 0x200000 /* Macvlan device */ 142 * @IFF_TX_SKB_SHARING: The interface supports sharing skbs on transmit
143 * @IFF_UNICAST_FLT: Supports unicast filtering
144 * @IFF_TEAM_PORT: device used as team port
145 * @IFF_SUPP_NOFCS: device supports sending custom FCS
146 * @IFF_LIVE_ADDR_CHANGE: device supports hardware address
147 * change when it's running
148 * @IFF_MACVLAN: Macvlan device
149 */
150enum netdev_priv_flags {
151 IFF_802_1Q_VLAN = 1<<0,
152 IFF_EBRIDGE = 1<<1,
153 IFF_SLAVE_INACTIVE = 1<<2,
154 IFF_MASTER_8023AD = 1<<3,
155 IFF_MASTER_ALB = 1<<4,
156 IFF_BONDING = 1<<5,
157 IFF_SLAVE_NEEDARP = 1<<6,
158 IFF_ISATAP = 1<<7,
159 IFF_MASTER_ARPMON = 1<<8,
160 IFF_WAN_HDLC = 1<<9,
161 IFF_XMIT_DST_RELEASE = 1<<10,
162 IFF_DONT_BRIDGE = 1<<11,
163 IFF_DISABLE_NETPOLL = 1<<12,
164 IFF_MACVLAN_PORT = 1<<13,
165 IFF_BRIDGE_PORT = 1<<14,
166 IFF_OVS_DATAPATH = 1<<15,
167 IFF_TX_SKB_SHARING = 1<<16,
168 IFF_UNICAST_FLT = 1<<17,
169 IFF_TEAM_PORT = 1<<18,
170 IFF_SUPP_NOFCS = 1<<19,
171 IFF_LIVE_ADDR_CHANGE = 1<<20,
172 IFF_MACVLAN = 1<<21,
173};
87 174
175#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
176#define IFF_EBRIDGE IFF_EBRIDGE
177#define IFF_SLAVE_INACTIVE IFF_SLAVE_INACTIVE
178#define IFF_MASTER_8023AD IFF_MASTER_8023AD
179#define IFF_MASTER_ALB IFF_MASTER_ALB
180#define IFF_BONDING IFF_BONDING
181#define IFF_SLAVE_NEEDARP IFF_SLAVE_NEEDARP
182#define IFF_ISATAP IFF_ISATAP
183#define IFF_MASTER_ARPMON IFF_MASTER_ARPMON
184#define IFF_WAN_HDLC IFF_WAN_HDLC
185#define IFF_XMIT_DST_RELEASE IFF_XMIT_DST_RELEASE
186#define IFF_DONT_BRIDGE IFF_DONT_BRIDGE
187#define IFF_DISABLE_NETPOLL IFF_DISABLE_NETPOLL
188#define IFF_MACVLAN_PORT IFF_MACVLAN_PORT
189#define IFF_BRIDGE_PORT IFF_BRIDGE_PORT
190#define IFF_OVS_DATAPATH IFF_OVS_DATAPATH
191#define IFF_TX_SKB_SHARING IFF_TX_SKB_SHARING
192#define IFF_UNICAST_FLT IFF_UNICAST_FLT
193#define IFF_TEAM_PORT IFF_TEAM_PORT
194#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS
195#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
196#define IFF_MACVLAN IFF_MACVLAN
88 197
89#define IF_GET_IFACE 0x0001 /* for querying only */ 198#define IF_GET_IFACE 0x0001 /* for querying only */
90#define IF_GET_PROTO 0x0002 199#define IF_GET_PROTO 0x0002