treewide: fix replace nbd@openwrt.org with nbd@nbd.name
[openwrt.git] / target / linux / generic / files / include / uapi / linux / switch.h
1 /*
2  * switch.h: Switch configuration API
3  *
4  * Copyright (C) 2008 Felix Fietkau <nbd@nbd.name>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  */
16
17 #ifndef _UAPI_LINUX_SWITCH_H
18 #define _UAPI_LINUX_SWITCH_H
19
20 #include <linux/types.h>
21 #include <linux/netdevice.h>
22 #include <linux/netlink.h>
23 #include <linux/genetlink.h>
24 #ifndef __KERNEL__
25 #include <netlink/netlink.h>
26 #include <netlink/genl/genl.h>
27 #include <netlink/genl/ctrl.h>
28 #endif
29
30 /* main attributes */
31 enum {
32         SWITCH_ATTR_UNSPEC,
33         /* global */
34         SWITCH_ATTR_TYPE,
35         /* device */
36         SWITCH_ATTR_ID,
37         SWITCH_ATTR_DEV_NAME,
38         SWITCH_ATTR_ALIAS,
39         SWITCH_ATTR_NAME,
40         SWITCH_ATTR_VLANS,
41         SWITCH_ATTR_PORTS,
42         SWITCH_ATTR_PORTMAP,
43         SWITCH_ATTR_CPU_PORT,
44         /* attributes */
45         SWITCH_ATTR_OP_ID,
46         SWITCH_ATTR_OP_TYPE,
47         SWITCH_ATTR_OP_NAME,
48         SWITCH_ATTR_OP_PORT,
49         SWITCH_ATTR_OP_VLAN,
50         SWITCH_ATTR_OP_VALUE_INT,
51         SWITCH_ATTR_OP_VALUE_STR,
52         SWITCH_ATTR_OP_VALUE_PORTS,
53         SWITCH_ATTR_OP_VALUE_LINK,
54         SWITCH_ATTR_OP_DESCRIPTION,
55         /* port lists */
56         SWITCH_ATTR_PORT,
57         SWITCH_ATTR_MAX
58 };
59
60 enum {
61         /* port map */
62         SWITCH_PORTMAP_PORTS,
63         SWITCH_PORTMAP_SEGMENT,
64         SWITCH_PORTMAP_VIRT,
65         SWITCH_PORTMAP_MAX
66 };
67
68 /* commands */
69 enum {
70         SWITCH_CMD_UNSPEC,
71         SWITCH_CMD_GET_SWITCH,
72         SWITCH_CMD_NEW_ATTR,
73         SWITCH_CMD_LIST_GLOBAL,
74         SWITCH_CMD_GET_GLOBAL,
75         SWITCH_CMD_SET_GLOBAL,
76         SWITCH_CMD_LIST_PORT,
77         SWITCH_CMD_GET_PORT,
78         SWITCH_CMD_SET_PORT,
79         SWITCH_CMD_LIST_VLAN,
80         SWITCH_CMD_GET_VLAN,
81         SWITCH_CMD_SET_VLAN
82 };
83
84 /* data types */
85 enum switch_val_type {
86         SWITCH_TYPE_UNSPEC,
87         SWITCH_TYPE_INT,
88         SWITCH_TYPE_STRING,
89         SWITCH_TYPE_PORTS,
90         SWITCH_TYPE_LINK,
91         SWITCH_TYPE_NOVAL,
92 };
93
94 /* port nested attributes */
95 enum {
96         SWITCH_PORT_UNSPEC,
97         SWITCH_PORT_ID,
98         SWITCH_PORT_FLAG_TAGGED,
99         SWITCH_PORT_ATTR_MAX
100 };
101
102 /* link nested attributes */
103 enum {
104         SWITCH_LINK_UNSPEC,
105         SWITCH_LINK_FLAG_LINK,
106         SWITCH_LINK_FLAG_DUPLEX,
107         SWITCH_LINK_FLAG_ANEG,
108         SWITCH_LINK_FLAG_TX_FLOW,
109         SWITCH_LINK_FLAG_RX_FLOW,
110         SWITCH_LINK_SPEED,
111         SWITCH_LINK_FLAG_EEE_100BASET,
112         SWITCH_LINK_FLAG_EEE_1000BASET,
113         SWITCH_LINK_ATTR_MAX,
114 };
115
116 #define SWITCH_ATTR_DEFAULTS_OFFSET     0x1000
117
118
119 #endif /* _UAPI_LINUX_SWITCH_H */