Add Set Package and Channel Mask to ncsi-netlink utility
The NCSI driver has added two commands for setting the Package Mask
and the Channel Mask within a package. The ncsi-netlink utility does
not support these new commands.
Add the ability to set the package and the channel mask values.
Tested:
Instrumented the NCSI kernel driver to print mask values.
Issued 'ncsi-netlink -x 3 -j 0x3' and saw the NCSI driver print the
new package mask.
Issued 'ncsi-netlink -x 3 -p 0 -k 0x3' and saw the NCSI driver
print the new channel mask.
Change-Id: Icd2188e789de43f631fe26d9e751d564ba5f822f
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/src/ncsi_netlink_main.cpp b/src/ncsi_netlink_main.cpp
index 7808ef7..6657c60 100644
--- a/src/ncsi_netlink_main.cpp
+++ b/src/ncsi_netlink_main.cpp
@@ -157,6 +157,46 @@
{
return ncsi::clearInterface(indexInt);
}
+ else if (!(options)["pmask"].empty())
+ {
+ unsigned int mask{};
+ try
+ {
+ size_t lastChar{};
+ mask = std::stoul((options)["pmask"], &lastChar, 0);
+ if (lastChar < (options["pmask"].size()))
+ {
+ exitWithError("Package mask value is not valid", argv);
+ }
+ }
+ catch (const std::exception& e)
+ {
+ exitWithError("Package mask value is not valid", argv);
+ }
+ return ncsi::setPackageMask(indexInt, mask);
+ }
+ else if (!(options)["cmask"].empty())
+ {
+ if (packageInt == DEFAULT_VALUE)
+ {
+ exitWithError("Package is not specified", argv);
+ }
+ unsigned int mask{};
+ try
+ {
+ size_t lastChar{};
+ mask = stoul((options)["cmask"], &lastChar, 0);
+ if (lastChar < (options["cmask"].size()))
+ {
+ exitWithError("Channel mask value is not valid", argv);
+ }
+ }
+ catch (const std::exception& e)
+ {
+ exitWithError("Channel mask value is not valid", argv);
+ }
+ return ncsi::setChannelMask(indexInt, packageInt, mask);
+ }
else
{
exitWithError("No Command specified", argv);