Add a generic netlink family for NCSI. This supports three commands; NCSI_CMD_PKG_INFO which returns information on packages and their associated channels, NCSI_CMD_SET_INTERFACE which allows a specific package or package/channel combination to be set as the preferred choice, and NCSI_CMD_CLEAR_INTERFACE which clears any preferred setting.
Showing the changes to include/uapi/linux (1 of 6 files). Show all
Unified · Split
| @@ -0,0 +1,115 @@ | |||
| 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 | |||
| 10 | #ifndef __UAPI_NCSI_NETLINK_H__ | ||
| 11 | #define __UAPI_NCSI_NETLINK_H__ | ||
| 12 | |||
| 13 | /** | ||
| 14 | * enum ncsi_nl_commands - supported NCSI commands | ||
| 15 | * | ||
| 16 | * @NCSI_CMD_UNSPEC: unspecified command to catch errors | ||
| 17 | * @NCSI_CMD_PKG_INFO: list package and channel attributes. Requires | ||
| 18 | * NCSI_ATTR_IFINDEX. If NCSI_ATTR_PACKAGE_ID is specified returns the | ||
| 19 | * specific package and its channels - otherwise a dump request returns | ||
| 20 | * all packages and their associated channels. | ||
| 21 | * @NCSI_CMD_SET_INTERFACE: set preferred package and channel combination. | ||
| 22 | * Requires NCSI_ATTR_IFINDEX and the preferred NCSI_ATTR_PACKAGE_ID and | ||
| 23 | * optionally the preferred NCSI_ATTR_CHANNEL_ID. | ||
| 24 | * @NCSI_CMD_CLEAR_INTERFACE: clear any preferred package/channel combination. | ||
| 25 | * Requires NCSI_ATTR_IFINDEX. | ||
| 26 | * @NCSI_CMD_MAX: highest command number | ||
| 27 | */ | ||
| 28 | enum ncsi_nl_commands { | ||
| 29 | NCSI_CMD_UNSPEC, | ||
| 30 | NCSI_CMD_PKG_INFO, | ||
| 31 | NCSI_CMD_SET_INTERFACE, | ||
| 32 | NCSI_CMD_CLEAR_INTERFACE, | ||
| 33 | |||
| 34 | __NCSI_CMD_AFTER_LAST, | ||
| 35 | NCSI_CMD_MAX = __NCSI_CMD_AFTER_LAST - 1 | ||
| 36 | }; | ||
| 37 | |||
| 38 | /** | ||
| 39 | * enum ncsi_nl_attrs - General NCSI netlink attributes | ||
| 40 | * | ||
| 41 | * @NCSI_ATTR_UNSPEC: unspecified attributes to catch errors | ||
| 42 | * @NCSI_ATTR_IFINDEX: ifindex of network device using NCSI | ||
| 43 | * @NCSI_ATTR_PACKAGE_LIST: nested array of NCSI_PKG_ATTR attributes | ||
| 44 | * @NCSI_ATTR_PACKAGE_ID: package ID | ||
| 45 | * @NCSI_ATTR_CHANNEL_ID: channel ID | ||
| 46 | * @NCSI_ATTR_MAX: highest attribute number | ||
| 47 | */ | ||
| 48 | enum ncsi_nl_attrs { | ||
| 49 | NCSI_ATTR_UNSPEC, | ||
| 50 | NCSI_ATTR_IFINDEX, | ||
| 51 | NCSI_ATTR_PACKAGE_LIST, | ||
| 52 | NCSI_ATTR_PACKAGE_ID, | ||
| 53 | NCSI_ATTR_CHANNEL_ID, | ||
| 54 | |||
| 55 | __NCSI_ATTR_AFTER_LAST, | ||
| 56 | NCSI_ATTR_MAX = __NCSI_ATTR_AFTER_LAST - 1 | ||
| 57 | }; | ||
| 58 | |||
| 59 | /** | ||
| 60 | * enum ncsi_nl_pkg_attrs - NCSI netlink package-specific attributes | ||
| 61 | * | ||
| 62 | * @NCSI_PKG_ATTR_UNSPEC: unspecified attributes to catch errors | ||
| 63 | * @NCSI_PKG_ATTR: nested array of package attributes | ||
| 64 | * @NCSI_PKG_ATTR_ID: package ID | ||
| 65 | * @NCSI_PKG_ATTR_FORCED: flag signifying a package has been set as preferred | ||
| 66 | * @NCSI_PKG_ATTR_CHANNEL_LIST: nested array of NCSI_CHANNEL_ATTR attributes | ||
| 67 | * @NCSI_PKG_ATTR_MAX: highest attribute number | ||
| 68 | */ | ||
| 69 | enum ncsi_nl_pkg_attrs { | ||
| 70 | NCSI_PKG_ATTR_UNSPEC, | ||
| 71 | NCSI_PKG_ATTR, | ||
| 72 | NCSI_PKG_ATTR_ID, | ||
| 73 | NCSI_PKG_ATTR_FORCED, | ||
| 74 | NCSI_PKG_ATTR_CHANNEL_LIST, | ||
| 75 | |||
| 76 | __NCSI_PKG_ATTR_AFTER_LAST, | ||
| 77 | NCSI_PKG_ATTR_MAX = __NCSI_PKG_ATTR_AFTER_LAST - 1 | ||
| 78 | }; | ||
| 79 | |||
| 80 | /** | ||
| 81 | * enum ncsi_nl_channel_attrs - NCSI netlink channel-specific attributes | ||
| 82 | * | ||
| 83 | * @NCSI_CHANNEL_ATTR_UNSPEC: unspecified attributes to catch errors | ||
| 84 | * @NCSI_CHANNEL_ATTR: nested array of channel attributes | ||
| 85 | * @NCSI_CHANNEL_ATTR_ID: channel ID | ||
| 86 | * @NCSI_CHANNEL_ATTR_VERSION_MAJOR: channel major version number | ||
| 87 | * @NCSI_CHANNEL_ATTR_VERSION_MINOR: channel minor version number | ||
| 88 | * @NCSI_CHANNEL_ATTR_VERSION_STR: channel version string | ||
| 89 | * @NCSI_CHANNEL_ATTR_LINK_STATE: channel link state flags | ||
| 90 | * @NCSI_CHANNEL_ATTR_ACTIVE: channels with this flag are in | ||
| 91 | * NCSI_CHANNEL_ACTIVE state | ||
| 92 | * @NCSI_CHANNEL_ATTR_FORCED: flag signifying a channel has been set as | ||
| 93 | * preferred | ||
| 94 | * @NCSI_CHANNEL_ATTR_VLAN_LIST: nested array of NCSI_CHANNEL_ATTR_VLAN_IDs | ||
| 95 | * @NCSI_CHANNEL_ATTR_VLAN_ID: VLAN ID being filtered on this channel | ||
| 96 | * @NCSI_CHANNEL_ATTR_MAX: highest attribute number | ||
| 97 | */ | ||
| 98 | enum ncsi_nl_channel_attrs { | ||
| 99 | NCSI_CHANNEL_ATTR_UNSPEC, | ||
| 100 | NCSI_CHANNEL_ATTR, | ||
| 101 | NCSI_CHANNEL_ATTR_ID, | ||
| 102 | NCSI_CHANNEL_ATTR_VERSION_MAJOR, | ||
| 103 | NCSI_CHANNEL_ATTR_VERSION_MINOR, | ||
| 104 | NCSI_CHANNEL_ATTR_VERSION_STR, | ||
| 105 | NCSI_CHANNEL_ATTR_LINK_STATE, | ||
| 106 | NCSI_CHANNEL_ATTR_ACTIVE, | ||
| 107 | NCSI_CHANNEL_ATTR_FORCED, | ||
| 108 | NCSI_CHANNEL_ATTR_VLAN_LIST, | ||
| 109 | NCSI_CHANNEL_ATTR_VLAN_ID, | ||
| 110 | |||
| 111 | __NCSI_CHANNEL_ATTR_AFTER_LAST, | ||
| 112 | NCSI_CHANNEL_ATTR_MAX = __NCSI_CHANNEL_ATTR_AFTER_LAST - 1 | ||
| 113 | }; | ||
| 114 | |||
| 115 | #endif /* __UAPI_NCSI_NETLINK_H__ */ | ||