ncsi.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Copyright Samuel Mendoza-Jonas, IBM Corporation 2018.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. */
  9. #ifndef __UAPI_NCSI_NETLINK_H__
  10. #define __UAPI_NCSI_NETLINK_H__
  11. /**
  12. * enum ncsi_nl_commands - supported NCSI commands
  13. *
  14. * @NCSI_CMD_UNSPEC: unspecified command to catch errors
  15. * @NCSI_CMD_PKG_INFO: list package and channel attributes. Requires
  16. * NCSI_ATTR_IFINDEX. If NCSI_ATTR_PACKAGE_ID is specified returns the
  17. * specific package and its channels - otherwise a dump request returns
  18. * all packages and their associated channels.
  19. * @NCSI_CMD_SET_INTERFACE: set preferred package and channel combination.
  20. * Requires NCSI_ATTR_IFINDEX and the preferred NCSI_ATTR_PACKAGE_ID and
  21. * optionally the preferred NCSI_ATTR_CHANNEL_ID.
  22. * @NCSI_CMD_CLEAR_INTERFACE: clear any preferred package/channel combination.
  23. * Requires NCSI_ATTR_IFINDEX.
  24. * @NCSI_CMD_SEND_CMD: send NC-SI command to network card.
  25. * Requires NCSI_ATTR_IFINDEX, NCSI_ATTR_PACKAGE_ID
  26. * and NCSI_ATTR_CHANNEL_ID.
  27. * @NCSI_CMD_SET_PACKAGE_MASK: set a whitelist of allowed packages.
  28. * Requires NCSI_ATTR_IFINDEX and NCSI_ATTR_PACKAGE_MASK.
  29. * @NCSI_CMD_SET_CHANNEL_MASK: set a whitelist of allowed channels.
  30. * Requires NCSI_ATTR_IFINDEX, NCSI_ATTR_PACKAGE_ID, and
  31. * NCSI_ATTR_CHANNEL_MASK. If NCSI_ATTR_CHANNEL_ID is present it sets
  32. * the primary channel.
  33. * @NCSI_CMD_MAX: highest command number
  34. */
  35. enum ncsi_nl_commands {
  36. NCSI_CMD_UNSPEC,
  37. NCSI_CMD_PKG_INFO,
  38. NCSI_CMD_SET_INTERFACE,
  39. NCSI_CMD_CLEAR_INTERFACE,
  40. NCSI_CMD_SEND_CMD,
  41. NCSI_CMD_SET_PACKAGE_MASK,
  42. NCSI_CMD_SET_CHANNEL_MASK,
  43. __NCSI_CMD_AFTER_LAST,
  44. NCSI_CMD_MAX = __NCSI_CMD_AFTER_LAST - 1
  45. };
  46. /**
  47. * enum ncsi_nl_attrs - General NCSI netlink attributes
  48. *
  49. * @NCSI_ATTR_UNSPEC: unspecified attributes to catch errors
  50. * @NCSI_ATTR_IFINDEX: ifindex of network device using NCSI
  51. * @NCSI_ATTR_PACKAGE_LIST: nested array of NCSI_PKG_ATTR attributes
  52. * @NCSI_ATTR_PACKAGE_ID: package ID
  53. * @NCSI_ATTR_CHANNEL_ID: channel ID
  54. * @NCSI_ATTR_DATA: command payload
  55. * @NCSI_ATTR_MULTI_FLAG: flag to signal that multi-mode should be enabled with
  56. * NCSI_CMD_SET_PACKAGE_MASK or NCSI_CMD_SET_CHANNEL_MASK.
  57. * @NCSI_ATTR_PACKAGE_MASK: 32-bit mask of allowed packages.
  58. * @NCSI_ATTR_CHANNEL_MASK: 32-bit mask of allowed channels.
  59. * @NCSI_ATTR_MAX: highest attribute number
  60. */
  61. enum ncsi_nl_attrs {
  62. NCSI_ATTR_UNSPEC,
  63. NCSI_ATTR_IFINDEX,
  64. NCSI_ATTR_PACKAGE_LIST,
  65. NCSI_ATTR_PACKAGE_ID,
  66. NCSI_ATTR_CHANNEL_ID,
  67. NCSI_ATTR_DATA,
  68. NCSI_ATTR_MULTI_FLAG,
  69. NCSI_ATTR_PACKAGE_MASK,
  70. NCSI_ATTR_CHANNEL_MASK,
  71. __NCSI_ATTR_AFTER_LAST,
  72. NCSI_ATTR_MAX = __NCSI_ATTR_AFTER_LAST - 1
  73. };
  74. /**
  75. * enum ncsi_nl_pkg_attrs - NCSI netlink package-specific attributes
  76. *
  77. * @NCSI_PKG_ATTR_UNSPEC: unspecified attributes to catch errors
  78. * @NCSI_PKG_ATTR: nested array of package attributes
  79. * @NCSI_PKG_ATTR_ID: package ID
  80. * @NCSI_PKG_ATTR_FORCED: flag signifying a package has been set as preferred
  81. * @NCSI_PKG_ATTR_CHANNEL_LIST: nested array of NCSI_CHANNEL_ATTR attributes
  82. * @NCSI_PKG_ATTR_MAX: highest attribute number
  83. */
  84. enum ncsi_nl_pkg_attrs {
  85. NCSI_PKG_ATTR_UNSPEC,
  86. NCSI_PKG_ATTR,
  87. NCSI_PKG_ATTR_ID,
  88. NCSI_PKG_ATTR_FORCED,
  89. NCSI_PKG_ATTR_CHANNEL_LIST,
  90. __NCSI_PKG_ATTR_AFTER_LAST,
  91. NCSI_PKG_ATTR_MAX = __NCSI_PKG_ATTR_AFTER_LAST - 1
  92. };
  93. /**
  94. * enum ncsi_nl_channel_attrs - NCSI netlink channel-specific attributes
  95. *
  96. * @NCSI_CHANNEL_ATTR_UNSPEC: unspecified attributes to catch errors
  97. * @NCSI_CHANNEL_ATTR: nested array of channel attributes
  98. * @NCSI_CHANNEL_ATTR_ID: channel ID
  99. * @NCSI_CHANNEL_ATTR_VERSION_MAJOR: channel major version number
  100. * @NCSI_CHANNEL_ATTR_VERSION_MINOR: channel minor version number
  101. * @NCSI_CHANNEL_ATTR_VERSION_STR: channel version string
  102. * @NCSI_CHANNEL_ATTR_LINK_STATE: channel link state flags
  103. * @NCSI_CHANNEL_ATTR_ACTIVE: channels with this flag are in
  104. * NCSI_CHANNEL_ACTIVE state
  105. * @NCSI_CHANNEL_ATTR_FORCED: flag signifying a channel has been set as
  106. * preferred
  107. * @NCSI_CHANNEL_ATTR_VLAN_LIST: nested array of NCSI_CHANNEL_ATTR_VLAN_IDs
  108. * @NCSI_CHANNEL_ATTR_VLAN_ID: VLAN ID being filtered on this channel
  109. * @NCSI_CHANNEL_ATTR_MAX: highest attribute number
  110. */
  111. enum ncsi_nl_channel_attrs {
  112. NCSI_CHANNEL_ATTR_UNSPEC,
  113. NCSI_CHANNEL_ATTR,
  114. NCSI_CHANNEL_ATTR_ID,
  115. NCSI_CHANNEL_ATTR_VERSION_MAJOR,
  116. NCSI_CHANNEL_ATTR_VERSION_MINOR,
  117. NCSI_CHANNEL_ATTR_VERSION_STR,
  118. NCSI_CHANNEL_ATTR_LINK_STATE,
  119. NCSI_CHANNEL_ATTR_ACTIVE,
  120. NCSI_CHANNEL_ATTR_FORCED,
  121. NCSI_CHANNEL_ATTR_VLAN_LIST,
  122. NCSI_CHANNEL_ATTR_VLAN_ID,
  123. __NCSI_CHANNEL_ATTR_AFTER_LAST,
  124. NCSI_CHANNEL_ATTR_MAX = __NCSI_CHANNEL_ATTR_AFTER_LAST - 1
  125. };
  126. #endif /* __UAPI_NCSI_NETLINK_H__ */