blob: aa2051ca1ea83eda6c95c52d4ccbda32cb81c10f [file] [log] [blame]
Eddie Jamesfa1f5c02020-09-17 15:12:46 -05001#pragma once
2
3#include <span>
Jeremy Kerr8a76d892024-07-26 17:19:57 +08004#include <string>
Eddie Jamesfa1f5c02020-09-17 15:12:46 -05005
Ratan Guptabbe45792018-03-23 00:22:55 +05306namespace phosphor
7{
8namespace network
9{
10namespace ncsi
11{
12
Ratan Guptaed5d7ff2018-03-23 00:27:52 +053013constexpr auto DEFAULT_VALUE = -1;
14constexpr auto NONE = 0;
15
Jeremy Kerr8d9af022024-07-26 16:47:16 +080016struct Interface
17{
Jeremy Kerrbc22f812024-07-29 17:43:35 +080018 /* @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 Kerr8d9af022024-07-26 16:47:16 +080074 int ifindex;
75};
76
Jeremy Kerr8a76d892024-07-26 17:19:57 +080077std::string to_string(Interface& interface);
78
Gunnar Mills57d9c502018-09-14 14:42:34 -050079} // namespace ncsi
80} // namespace network
81} // namespace phosphor