dcbnl.h 11 KB

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