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