Eddie James | fa1f5c0 | 2020-09-17 15:12:46 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <span> |
Jeremy Kerr | 8a76d89 | 2024-07-26 17:19:57 +0800 | [diff] [blame] | 4 | #include <string> |
Eddie James | fa1f5c0 | 2020-09-17 15:12:46 -0500 | [diff] [blame] | 5 | |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 6 | namespace phosphor |
| 7 | { |
| 8 | namespace network |
| 9 | { |
| 10 | namespace ncsi |
| 11 | { |
| 12 | |
Ratan Gupta | ed5d7ff | 2018-03-23 00:27:52 +0530 | [diff] [blame] | 13 | constexpr auto DEFAULT_VALUE = -1; |
| 14 | constexpr auto NONE = 0; |
| 15 | |
Jeremy Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame] | 16 | struct Interface |
| 17 | { |
Jeremy Kerr | bc22f81 | 2024-07-29 17:43:35 +0800 | [diff] [blame] | 18 | /* @brief This function will ask underlying NCSI driver |
| 19 | * to send an OEM command (command type 0x50) with |
| 20 | * the specified payload as the OEM data. |
| 21 | * This function talks with the NCSI driver over |
| 22 | * netlink messages. |
| 23 | * @param[in] package - NCSI Package. |
| 24 | * @param[in] channel - Channel number with in the package. |
| 25 | * @param[in] opcode - NCSI Send Command sub-operation |
| 26 | * @param[in] payload - OEM data to send. |
| 27 | * @returns 0 on success and negative value for failure. |
| 28 | */ |
| 29 | int sendOemCommand(int package, int channel, int opcode, |
| 30 | std::span<const unsigned char> payload); |
| 31 | |
| 32 | /* @brief This function will ask underlying NCSI driver |
| 33 | * to set a specific package or package/channel |
| 34 | * combination as the preferred choice. |
| 35 | * This function talks with the NCSI driver over |
| 36 | * netlink messages. |
| 37 | * @param[in] package - NCSI Package. |
| 38 | * @param[in] channel - Channel number with in the package. |
| 39 | * @returns 0 on success and negative value for failure. |
| 40 | */ |
| 41 | int setChannel(int package, int channel); |
| 42 | |
| 43 | /* @brief This function will ask underlying NCSI driver |
| 44 | * to clear any preferred setting from the interface. |
| 45 | * This function talks with the NCSI driver over |
| 46 | * netlink messages. |
| 47 | * @returns 0 on success and negative value for failure. |
| 48 | */ |
| 49 | int clearInterface(); |
| 50 | |
| 51 | /* @brief This function is used to dump all the info |
| 52 | * of the package and the channels underlying |
| 53 | * the package. |
| 54 | * @param[in] package - NCSI Package. |
| 55 | * @returns 0 on success and negative value for failure. |
| 56 | */ |
| 57 | int getInfo(int package); |
| 58 | |
| 59 | /* @brief This function assigns a mask controlling responses to AEN from a |
| 60 | * package. |
| 61 | * @param[in] mask - A 32-bit mask integer |
| 62 | * @returns 0 on success and negative value for failure. |
| 63 | */ |
| 64 | int setPackageMask(unsigned int mask); |
| 65 | |
| 66 | /* @brief This function sets the AEN mask for the channels inside the |
| 67 | * selected package. |
| 68 | * @param[in] package - NCSI Package. |
| 69 | * @param[in] mask - A 32-bit mask integer |
| 70 | * @returns 0 on success and negative value for failure. |
| 71 | */ |
| 72 | int setChannelMask(int package, unsigned int mask); |
| 73 | |
Jeremy Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame] | 74 | int ifindex; |
| 75 | }; |
| 76 | |
Jeremy Kerr | 8a76d89 | 2024-07-26 17:19:57 +0800 | [diff] [blame] | 77 | std::string to_string(Interface& interface); |
| 78 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 79 | } // namespace ncsi |
| 80 | } // namespace network |
| 81 | } // namespace phosphor |