ixgbe: this patch adds support for DCB to the kernel and ixgbe driver
[linux-2.6.git] / include / linux / dcbnl.h
1 /*
2  * Copyright (c) 2008, Intel Corporation.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms and conditions of the GNU General Public License,
6  * version 2, as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15  * Place - Suite 330, Boston, MA 02111-1307 USA.
16  *
17  * Author: Lucy Liu <lucy.liu@intel.com>
18  */
19
20 #ifndef __LINUX_DCBNL_H__
21 #define __LINUX_DCBNL_H__
22
23 #define DCB_PROTO_VERSION 1
24
25 struct dcbmsg {
26         unsigned char      dcb_family;
27         __u8               cmd;
28         __u16              dcb_pad;
29 };
30
31 /**
32  * enum dcbnl_commands - supported DCB commands
33  *
34  * @DCB_CMD_UNDEFINED: unspecified command to catch errors
35  * @DCB_CMD_GSTATE: request the state of DCB in the device
36  * @DCB_CMD_SSTATE: set the state of DCB in the device
37  * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
38  * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
39  * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
40  * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
41  * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
42  * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
43  * @DCB_CMD_SET_ALL: apply all changes to the underlying device
44  * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
45  *                        device.  Only useful when using bonding.
46  */
47 enum dcbnl_commands {
48         DCB_CMD_UNDEFINED,
49
50         DCB_CMD_GSTATE,
51         DCB_CMD_SSTATE,
52
53         DCB_CMD_PGTX_GCFG,
54         DCB_CMD_PGTX_SCFG,
55         DCB_CMD_PGRX_GCFG,
56         DCB_CMD_PGRX_SCFG,
57
58         DCB_CMD_PFC_GCFG,
59         DCB_CMD_PFC_SCFG,
60
61         DCB_CMD_SET_ALL,
62         DCB_CMD_GPERM_HWADDR,
63
64         __DCB_CMD_ENUM_MAX,
65         DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
66 };
67
68
69 /**
70  * enum dcbnl_attrs - DCB top-level netlink attributes
71  *
72  * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
73  * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
74  * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
75  * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
76  * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
77  * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
78  * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
79  * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
80  * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
81  */
82 enum dcbnl_attrs {
83         DCB_ATTR_UNDEFINED,
84
85         DCB_ATTR_IFNAME,
86         DCB_ATTR_STATE,
87         DCB_ATTR_PFC_STATE,
88         DCB_ATTR_PFC_CFG,
89         DCB_ATTR_NUM_TC,
90         DCB_ATTR_PG_CFG,
91         DCB_ATTR_SET_ALL,
92         DCB_ATTR_PERM_HWADDR,
93
94         __DCB_ATTR_ENUM_MAX,
95         DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
96 };
97
98 /**
99  * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
100  *
101  * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
102  * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
103  * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
104  * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
105  * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
106  * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
107  * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
108  * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
109  * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
110  * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
111  * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
112  *
113  */
114 enum dcbnl_pfc_up_attrs {
115         DCB_PFC_UP_ATTR_UNDEFINED,
116
117         DCB_PFC_UP_ATTR_0,
118         DCB_PFC_UP_ATTR_1,
119         DCB_PFC_UP_ATTR_2,
120         DCB_PFC_UP_ATTR_3,
121         DCB_PFC_UP_ATTR_4,
122         DCB_PFC_UP_ATTR_5,
123         DCB_PFC_UP_ATTR_6,
124         DCB_PFC_UP_ATTR_7,
125         DCB_PFC_UP_ATTR_ALL,
126
127         __DCB_PFC_UP_ATTR_ENUM_MAX,
128         DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
129 };
130
131 /**
132  * enum dcbnl_pg_attrs - DCB Priority Group attributes
133  *
134  * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
135  * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
136  * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
137  * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
138  * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
139  * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
140  * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
141  * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
142  * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
143  * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
144  * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
145  * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
146  * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
147  * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
148  * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
149  * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
150  * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
151  * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
152  * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
153  * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
154  * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
155  *
156  */
157 enum dcbnl_pg_attrs {
158         DCB_PG_ATTR_UNDEFINED,
159
160         DCB_PG_ATTR_TC_0,
161         DCB_PG_ATTR_TC_1,
162         DCB_PG_ATTR_TC_2,
163         DCB_PG_ATTR_TC_3,
164         DCB_PG_ATTR_TC_4,
165         DCB_PG_ATTR_TC_5,
166         DCB_PG_ATTR_TC_6,
167         DCB_PG_ATTR_TC_7,
168         DCB_PG_ATTR_TC_MAX,
169         DCB_PG_ATTR_TC_ALL,
170
171         DCB_PG_ATTR_BW_ID_0,
172         DCB_PG_ATTR_BW_ID_1,
173         DCB_PG_ATTR_BW_ID_2,
174         DCB_PG_ATTR_BW_ID_3,
175         DCB_PG_ATTR_BW_ID_4,
176         DCB_PG_ATTR_BW_ID_5,
177         DCB_PG_ATTR_BW_ID_6,
178         DCB_PG_ATTR_BW_ID_7,
179         DCB_PG_ATTR_BW_ID_MAX,
180         DCB_PG_ATTR_BW_ID_ALL,
181
182         __DCB_PG_ATTR_ENUM_MAX,
183         DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
184 };
185
186 /**
187  * enum dcbnl_tc_attrs - DCB Traffic Class attributes
188  *
189  * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
190  * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
191  *                          Valid values are:  0-7
192  * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
193  *                                Some devices may not support changing the
194  *                                user priority map of a TC.
195  * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
196  *                                 0 - none
197  *                                 1 - group strict
198  *                                 2 - link strict
199  * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
200  *                            not configured to use link strict priority,
201  *                            this is the percentage of bandwidth of the
202  *                            priority group this traffic class belongs to
203  * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
204  *
205  */
206 enum dcbnl_tc_attrs {
207         DCB_TC_ATTR_PARAM_UNDEFINED,
208
209         DCB_TC_ATTR_PARAM_PGID,
210         DCB_TC_ATTR_PARAM_UP_MAPPING,
211         DCB_TC_ATTR_PARAM_STRICT_PRIO,
212         DCB_TC_ATTR_PARAM_BW_PCT,
213         DCB_TC_ATTR_PARAM_ALL,
214
215         __DCB_TC_ATTR_PARAM_ENUM_MAX,
216         DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
217 };
218
219 /**
220  * enum dcb_general_attr_values - general DCB attribute values
221  *
222  * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
223  *
224  */
225 enum dcb_general_attr_values {
226         DCB_ATTR_VALUE_UNDEFINED = 0xff
227 };
228
229
230 #endif /* __LINUX_DCBNL_H__ */