dcbnl.h 11 KB

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