generic: disintegrate UAPI from include/linux/switch.h
[openwrt.git] / target / linux / generic / patches-3.3 / a03-swconfig-revert-UAPI-disintegration.patch
1 --- a/include/linux/switch.h
2 +++ b/include/linux/switch.h
3 @@ -13,11 +13,86 @@
4   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5   * GNU General Public License for more details.
6   */
7 -#ifndef _LINUX_SWITCH_H
8 -#define _LINUX_SWITCH_H
9  
10 +#ifndef __LINUX_SWITCH_H
11 +#define __LINUX_SWITCH_H
12 +
13 +#include <linux/types.h>
14 +#include <linux/netdevice.h>
15 +#include <linux/netlink.h>
16 +#include <linux/genetlink.h>
17 +#ifndef __KERNEL__
18 +#include <netlink/netlink.h>
19 +#include <netlink/genl/genl.h>
20 +#include <netlink/genl/ctrl.h>
21 +#else
22  #include <net/genetlink.h>
23 -#include <uapi/linux/switch.h>
24 +#endif
25 +
26 +/* main attributes */
27 +enum {
28 +       SWITCH_ATTR_UNSPEC,
29 +       /* global */
30 +       SWITCH_ATTR_TYPE,
31 +       /* device */
32 +       SWITCH_ATTR_ID,
33 +       SWITCH_ATTR_DEV_NAME,
34 +       SWITCH_ATTR_ALIAS,
35 +       SWITCH_ATTR_NAME,
36 +       SWITCH_ATTR_VLANS,
37 +       SWITCH_ATTR_PORTS,
38 +       SWITCH_ATTR_CPU_PORT,
39 +       /* attributes */
40 +       SWITCH_ATTR_OP_ID,
41 +       SWITCH_ATTR_OP_TYPE,
42 +       SWITCH_ATTR_OP_NAME,
43 +       SWITCH_ATTR_OP_PORT,
44 +       SWITCH_ATTR_OP_VLAN,
45 +       SWITCH_ATTR_OP_VALUE_INT,
46 +       SWITCH_ATTR_OP_VALUE_STR,
47 +       SWITCH_ATTR_OP_VALUE_PORTS,
48 +       SWITCH_ATTR_OP_DESCRIPTION,
49 +       /* port lists */
50 +       SWITCH_ATTR_PORT,
51 +       SWITCH_ATTR_MAX
52 +};
53 +
54 +/* commands */
55 +enum {
56 +       SWITCH_CMD_UNSPEC,
57 +       SWITCH_CMD_GET_SWITCH,
58 +       SWITCH_CMD_NEW_ATTR,
59 +       SWITCH_CMD_LIST_GLOBAL,
60 +       SWITCH_CMD_GET_GLOBAL,
61 +       SWITCH_CMD_SET_GLOBAL,
62 +       SWITCH_CMD_LIST_PORT,
63 +       SWITCH_CMD_GET_PORT,
64 +       SWITCH_CMD_SET_PORT,
65 +       SWITCH_CMD_LIST_VLAN,
66 +       SWITCH_CMD_GET_VLAN,
67 +       SWITCH_CMD_SET_VLAN
68 +};
69 +
70 +/* data types */
71 +enum switch_val_type {
72 +       SWITCH_TYPE_UNSPEC,
73 +       SWITCH_TYPE_INT,
74 +       SWITCH_TYPE_STRING,
75 +       SWITCH_TYPE_PORTS,
76 +       SWITCH_TYPE_NOVAL,
77 +};
78 +
79 +/* port nested attributes */
80 +enum {
81 +       SWITCH_PORT_UNSPEC,
82 +       SWITCH_PORT_ID,
83 +       SWITCH_PORT_FLAG_TAGGED,
84 +       SWITCH_PORT_ATTR_MAX
85 +};
86 +
87 +#define SWITCH_ATTR_DEFAULTS_OFFSET    0x1000
88 +
89 +#ifdef __KERNEL__
90  
91  struct switch_dev;
92  struct switch_op;
93 @@ -157,4 +232,6 @@ struct switch_attr {
94         int max;
95  };
96  
97 -#endif /* _LINUX_SWITCH_H */
98 +#endif
99 +
100 +#endif