dcbnl.h 10 KB

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