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