kernel: backport switch user API changes after r36283
[openwrt.git] / target / linux / generic / patches-3.6 / a03-swconfig-revert-UAPI-disintegration.patch
1 --- a/include/linux/switch.h
2 +++ b/include/linux/switch.h
3 @@ -13,11 +13,95 @@
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_PORTMAP,
39 +       SWITCH_ATTR_CPU_PORT,
40 +       /* attributes */
41 +       SWITCH_ATTR_OP_ID,
42 +       SWITCH_ATTR_OP_TYPE,
43 +       SWITCH_ATTR_OP_NAME,
44 +       SWITCH_ATTR_OP_PORT,
45 +       SWITCH_ATTR_OP_VLAN,
46 +       SWITCH_ATTR_OP_VALUE_INT,
47 +       SWITCH_ATTR_OP_VALUE_STR,
48 +       SWITCH_ATTR_OP_VALUE_PORTS,
49 +       SWITCH_ATTR_OP_DESCRIPTION,
50 +       /* port lists */
51 +       SWITCH_ATTR_PORT,
52 +       SWITCH_ATTR_MAX
53 +};
54 +
55 +enum {
56 +       /* port map */
57 +       SWITCH_PORTMAP_PORTS,
58 +       SWITCH_PORTMAP_SEGMENT,
59 +       SWITCH_PORTMAP_VIRT,
60 +       SWITCH_PORTMAP_MAX
61 +};
62 +
63 +/* commands */
64 +enum {
65 +       SWITCH_CMD_UNSPEC,
66 +       SWITCH_CMD_GET_SWITCH,
67 +       SWITCH_CMD_NEW_ATTR,
68 +       SWITCH_CMD_LIST_GLOBAL,
69 +       SWITCH_CMD_GET_GLOBAL,
70 +       SWITCH_CMD_SET_GLOBAL,
71 +       SWITCH_CMD_LIST_PORT,
72 +       SWITCH_CMD_GET_PORT,
73 +       SWITCH_CMD_SET_PORT,
74 +       SWITCH_CMD_LIST_VLAN,
75 +       SWITCH_CMD_GET_VLAN,
76 +       SWITCH_CMD_SET_VLAN
77 +};
78 +
79 +/* data types */
80 +enum switch_val_type {
81 +       SWITCH_TYPE_UNSPEC,
82 +       SWITCH_TYPE_INT,
83 +       SWITCH_TYPE_STRING,
84 +       SWITCH_TYPE_PORTS,
85 +       SWITCH_TYPE_NOVAL,
86 +};
87 +
88 +/* port nested attributes */
89 +enum {
90 +       SWITCH_PORT_UNSPEC,
91 +       SWITCH_PORT_ID,
92 +       SWITCH_PORT_FLAG_TAGGED,
93 +       SWITCH_PORT_ATTR_MAX
94 +};
95 +
96 +#define SWITCH_ATTR_DEFAULTS_OFFSET    0x1000
97 +
98 +#ifdef __KERNEL__
99  
100  struct switch_dev;
101  struct switch_op;
102 @@ -164,4 +248,6 @@ struct switch_attr {
103         int max;
104  };
105  
106 -#endif /* _LINUX_SWITCH_H */
107 +#endif
108 +
109 +#endif