Patrick Venture | d26fff4 | 2018-09-18 15:37:59 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 08f879c | 2019-03-18 10:51:42 -0700 | [diff] [blame^] | 3 | #include <ipmid/api.h> |
| 4 | |
Patrick Venture | d26fff4 | 2018-09-18 15:37:59 -0700 | [diff] [blame] | 5 | #include <cstdint> |
| 6 | |
| 7 | namespace ethstats |
| 8 | { |
| 9 | |
| 10 | /** |
| 11 | * @brief Ethstat Request structure. |
| 12 | */ |
| 13 | struct EthStatRequest |
| 14 | { |
Patrick Venture | 08f879c | 2019-03-18 10:51:42 -0700 | [diff] [blame^] | 15 | std::uint8_t statId; |
| 16 | std::uint8_t if_name_len; |
Patrick Venture | d26fff4 | 2018-09-18 15:37:59 -0700 | [diff] [blame] | 17 | } __attribute__((packed)); |
| 18 | |
| 19 | /** |
| 20 | * @brief Ethstat Reply structure. |
| 21 | */ |
| 22 | struct EthStatReply |
| 23 | { |
Patrick Venture | 08f879c | 2019-03-18 10:51:42 -0700 | [diff] [blame^] | 24 | std::uint8_t statId; |
| 25 | std::uint64_t value; |
Patrick Venture | d26fff4 | 2018-09-18 15:37:59 -0700 | [diff] [blame] | 26 | } __attribute__((packed)); |
| 27 | |
| 28 | enum EthernetStatisticsIds |
| 29 | { |
| 30 | RX_BYTES = 0, |
| 31 | RX_COMPRESSED = 1, |
| 32 | RX_CRC_ERRORS = 2, |
| 33 | RX_DROPPED = 3, |
| 34 | RX_ERRORS = 4, |
| 35 | RX_FIFO_ERRORS = 5, |
| 36 | RX_FRAME_ERRORS = 6, |
| 37 | RX_LENGTH_ERRORS = 7, |
| 38 | RX_MISSED_ERRORS = 8, |
| 39 | RX_NOHANDLER = 9, |
| 40 | RX_OVER_ERRORS = 10, |
| 41 | RX_PACKETS = 11, |
| 42 | TX_ABORTED_ERRORS = 12, |
| 43 | TX_BYTES = 13, |
| 44 | TX_CARRIER_ERRORS = 14, |
| 45 | TX_COMPRESSED = 15, |
| 46 | TX_DROPPED = 16, |
| 47 | TX_ERRORS = 17, |
| 48 | TX_FIFO_ERRORS = 18, |
| 49 | TX_HEARTBEAT_ERRORS = 19, |
| 50 | TX_PACKETS = 20, |
| 51 | TX_WINDOW_ERRORS = 21, |
| 52 | }; |
| 53 | |
Patrick Venture | 08f879c | 2019-03-18 10:51:42 -0700 | [diff] [blame^] | 54 | /** |
| 55 | * Handle the OEM IPMI EthStat Command. |
| 56 | * |
| 57 | * @param[in] cmd - the OEM command. |
| 58 | * @param[in] reqBuf - the IPMI request buffer. |
| 59 | * @param[in,out] replyCmdBuf - the IPMI reply buffer. |
| 60 | * @param[in,out] dataLen - the length of the request and reply. |
| 61 | * @return the IPMI result code. |
| 62 | */ |
| 63 | ipmi_ret_t handleEthStatCommand(ipmi_cmd_t cmd __attribute__((unused)), |
| 64 | const std::uint8_t* reqBuf, |
| 65 | std::uint8_t* replyCmdBuf, size_t* dataLen); |
| 66 | |
Patrick Venture | d26fff4 | 2018-09-18 15:37:59 -0700 | [diff] [blame] | 67 | } // namespace ethstats |