DCB: Add interface to query the state of PFC feature.
[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  * @DCB_CMD_GCAP: request the DCB capabilities of the device
47  * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
48  * @DCB_CMD_SNUMTCS: set the number of traffic classes
49  */
50 enum dcbnl_commands {
51         DCB_CMD_UNDEFINED,
52
53         DCB_CMD_GSTATE,
54         DCB_CMD_SSTATE,
55
56         DCB_CMD_PGTX_GCFG,
57         DCB_CMD_PGTX_SCFG,
58         DCB_CMD_PGRX_GCFG,
59         DCB_CMD_PGRX_SCFG,
60
61         DCB_CMD_PFC_GCFG,
62         DCB_CMD_PFC_SCFG,
63
64         DCB_CMD_SET_ALL,
65         DCB_CMD_GPERM_HWADDR,
66         DCB_CMD_GCAP,
67         DCB_CMD_GNUMTCS,
68         DCB_CMD_SNUMTCS,
69         DCB_CMD_PFC_GSTATE,
70         DCB_CMD_PFC_SSTATE,
71
72         __DCB_CMD_ENUM_MAX,
73         DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
74 };
75
76
77 /**
78  * enum dcbnl_attrs - DCB top-level netlink attributes
79  *
80  * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
81  * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
82  * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
83  * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
84  * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
85  * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
86  * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
87  * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
88  * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
89  * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
90  * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
91  */
92 enum dcbnl_attrs {
93         DCB_ATTR_UNDEFINED,
94
95         DCB_ATTR_IFNAME,
96         DCB_ATTR_STATE,
97         DCB_ATTR_PFC_STATE,
98         DCB_ATTR_PFC_CFG,
99         DCB_ATTR_NUM_TC,
100         DCB_ATTR_PG_CFG,
101         DCB_ATTR_SET_ALL,
102         DCB_ATTR_PERM_HWADDR,
103         DCB_ATTR_CAP,
104         DCB_ATTR_NUMTCS,
105
106         __DCB_ATTR_ENUM_MAX,
107         DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
108 };
109
110 /**
111  * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
112  *
113  * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
114  * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
115  * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
116  * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
117  * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
118  * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
119  * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
120  * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
121  * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
122  * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
123  * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
124  *
125  */
126 enum dcbnl_pfc_up_attrs {
127         DCB_PFC_UP_ATTR_UNDEFINED,
128
129         DCB_PFC_UP_ATTR_0,
130         DCB_PFC_UP_ATTR_1,
131         DCB_PFC_UP_ATTR_2,
132         DCB_PFC_UP_ATTR_3,
133         DCB_PFC_UP_ATTR_4,
134         DCB_PFC_UP_ATTR_5,
135         DCB_PFC_UP_ATTR_6,
136         DCB_PFC_UP_ATTR_7,
137         DCB_PFC_UP_ATTR_ALL,
138
139         __DCB_PFC_UP_ATTR_ENUM_MAX,
140         DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
141 };
142
143 /**
144  * enum dcbnl_pg_attrs - DCB Priority Group attributes
145  *
146  * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
147  * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
148  * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
149  * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
150  * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
151  * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
152  * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
153  * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
154  * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
155  * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
156  * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
157  * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
158  * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
159  * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
160  * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
161  * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
162  * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
163  * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
164  * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
165  * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
166  * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
167  *
168  */
169 enum dcbnl_pg_attrs {
170         DCB_PG_ATTR_UNDEFINED,
171
172         DCB_PG_ATTR_TC_0,
173         DCB_PG_ATTR_TC_1,
174         DCB_PG_ATTR_TC_2,
175         DCB_PG_ATTR_TC_3,
176         DCB_PG_ATTR_TC_4,
177         DCB_PG_ATTR_TC_5,
178         DCB_PG_ATTR_TC_6,
179         DCB_PG_ATTR_TC_7,
180         DCB_PG_ATTR_TC_MAX,
181         DCB_PG_ATTR_TC_ALL,
182
183         DCB_PG_ATTR_BW_ID_0,
184         DCB_PG_ATTR_BW_ID_1,
185         DCB_PG_ATTR_BW_ID_2,
186         DCB_PG_ATTR_BW_ID_3,
187         DCB_PG_ATTR_BW_ID_4,
188         DCB_PG_ATTR_BW_ID_5,
189         DCB_PG_ATTR_BW_ID_6,
190         DCB_PG_ATTR_BW_ID_7,
191         DCB_PG_ATTR_BW_ID_MAX,
192         DCB_PG_ATTR_BW_ID_ALL,
193
194         __DCB_PG_ATTR_ENUM_MAX,
195         DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
196 };
197
198 /**
199  * enum dcbnl_tc_attrs - DCB Traffic Class attributes
200  *
201  * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
202  * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
203  *                          Valid values are:  0-7
204  * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
205  *                                Some devices may not support changing the
206  *                                user priority map of a TC.
207  * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
208  *                                 0 - none
209  *                                 1 - group strict
210  *                                 2 - link strict
211  * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
212  *                            not configured to use link strict priority,
213  *                            this is the percentage of bandwidth of the
214  *                            priority group this traffic class belongs to
215  * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
216  *
217  */
218 enum dcbnl_tc_attrs {
219         DCB_TC_ATTR_PARAM_UNDEFINED,
220
221         DCB_TC_ATTR_PARAM_PGID,
222         DCB_TC_ATTR_PARAM_UP_MAPPING,
223         DCB_TC_ATTR_PARAM_STRICT_PRIO,
224         DCB_TC_ATTR_PARAM_BW_PCT,
225         DCB_TC_ATTR_PARAM_ALL,
226
227         __DCB_TC_ATTR_PARAM_ENUM_MAX,
228         DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
229 };
230
231 /**
232  * enum dcbnl_cap_attrs - DCB Capability attributes
233  *
234  * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
235  * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
236  * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
237  * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
238  * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
239  *                               traffic class mapping
240  * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
241  *                                number of traffic classes the device
242  *                                can be configured to use for Priority Groups
243  * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
244  *                                 number of traffic classes the device can be
245  *                                 configured to use for Priority Flow Control
246  * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
247  * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
248  *                             Notification
249  */
250 enum dcbnl_cap_attrs {
251         DCB_CAP_ATTR_UNDEFINED,
252         DCB_CAP_ATTR_ALL,
253         DCB_CAP_ATTR_PG,
254         DCB_CAP_ATTR_PFC,
255         DCB_CAP_ATTR_UP2TC,
256         DCB_CAP_ATTR_PG_TCS,
257         DCB_CAP_ATTR_PFC_TCS,
258         DCB_CAP_ATTR_GSP,
259         DCB_CAP_ATTR_BCN,
260
261         __DCB_CAP_ATTR_ENUM_MAX,
262         DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
263 };
264
265 /**
266  * enum dcbnl_numtcs_attrs - number of traffic classes
267  *
268  * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
269  * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
270  * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
271  *                               priority groups
272  * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
273  *                                support priority flow control
274  */
275 enum dcbnl_numtcs_attrs {
276         DCB_NUMTCS_ATTR_UNDEFINED,
277         DCB_NUMTCS_ATTR_ALL,
278         DCB_NUMTCS_ATTR_PG,
279         DCB_NUMTCS_ATTR_PFC,
280
281         __DCB_NUMTCS_ATTR_ENUM_MAX,
282         DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
283 };
284
285 /**
286  * enum dcb_general_attr_values - general DCB attribute values
287  *
288  * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
289  *
290  */
291 enum dcb_general_attr_values {
292         DCB_ATTR_VALUE_UNDEFINED = 0xff
293 };
294
295
296 #endif /* __LINUX_DCBNL_H__ */