blob: bf6b707f76f47fcb5c3cbcd564edd23e43ac155f [file] [log] [blame]
Patrick Ventured26fff42018-09-18 15:37:59 -07001#pragma once
2
Patrick Venture08f879c2019-03-18 10:51:42 -07003#include <ipmid/api.h>
4
Patrick Ventured26fff42018-09-18 15:37:59 -07005#include <cstdint>
6
7namespace ethstats
8{
9
10/**
11 * @brief Ethstat Request structure.
12 */
13struct EthStatRequest
14{
Patrick Venture08f879c2019-03-18 10:51:42 -070015 std::uint8_t statId;
16 std::uint8_t if_name_len;
Patrick Ventured26fff42018-09-18 15:37:59 -070017} __attribute__((packed));
18
19/**
20 * @brief Ethstat Reply structure.
21 */
22struct EthStatReply
23{
Patrick Venture08f879c2019-03-18 10:51:42 -070024 std::uint8_t statId;
25 std::uint64_t value;
Patrick Ventured26fff42018-09-18 15:37:59 -070026} __attribute__((packed));
27
28enum 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 Venture08f879c2019-03-18 10:51:42 -070054/**
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 */
63ipmi_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 Ventured26fff42018-09-18 15:37:59 -070067} // namespace ethstats