Add support for sending NCSI command
Provide a means to send an OEM command to an NIC via NCSI netlink.
This may be invoked from a systemd Unit file to configure NIC
behavior.
Some NICs provide OEM commands to influence their behavior, for
example maintaining full speed even when the host is down instead
of negotiating a lower speed for power.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Change-Id: Id920b618422e8fbfc51984fbf932045bfb5e56e6
diff --git a/src/ncsi_util.hpp b/src/ncsi_util.hpp
index db754fe..eaa076d 100644
--- a/src/ncsi_util.hpp
+++ b/src/ncsi_util.hpp
@@ -1,3 +1,7 @@
+#pragma once
+
+#include <span>
+
namespace phosphor
{
namespace network
@@ -9,6 +13,20 @@
constexpr auto NONE = 0;
/* @brief This function will ask underlying NCSI driver
+ * to send an OEM command (command type 0x50) with
+ * the specified payload as the OEM data.
+ * This function talks with the NCSI driver over
+ * netlink messages.
+ * @param[in] ifindex - Interface Index.
+ * @param[in] package - NCSI Package.
+ * @param[in] channel - Channel number with in the package.
+ * @param[in] payload - OEM data to send.
+ * @returns 0 on success and negative value for failure.
+ */
+int sendOemCommand(int ifindex, int package, int channel,
+ std::span<const unsigned char> payload);
+
+/* @brief This function will ask underlying NCSI driver
* to set a specific package or package/channel
* combination as the preferred choice.
* This function talks with the NCSI driver over