Skip to content

Commit

Permalink
meta-ampere: ipmid: correct dcmi get/set conf param commands
Browse files Browse the repository at this point in the history
By updating on the dbus interfaces, ipmid has to update the getDHCPEnable
function and dhcp object path.

Tested:
   1. Request to set configuration parameters
      $ipmitool dcmi set_conf_param activate_dhcp
   2. Request to get configuration parameters
      $ipmitool dcmi get_conf_param

Signed-off-by: Thang Tran <[email protected]>
  • Loading branch information
thangtran-ampere authored and thangqn-ampere committed Jan 12, 2023
1 parent b6e1229 commit 748e0ce
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
From 142e6982554431d507a3fe58ed100a1b883bf43d Mon Sep 17 00:00:00 2001
From: Thang Tran <[email protected]>
Date: Tue, 20 Dec 2022 12:58:25 +0700
Subject: [PATCH] update return type of getDHCPEnabled function

In the phosphor-dbus-interfaces, the DHCPEnabled has been changed
from bool to enum type, therefore this function has to be updated.

Tested:
1. Request to active dhcp successfully
$ipmitool dcmi set_conf_param activate_dhcp

Signed-off-by: Thang Tran <[email protected]>
---
dcmihandler.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 00e06f8..a17ae60 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -15,8 +15,11 @@
#include <sdbusplus/bus.hpp>
#include <variant>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Network/EthernetInterface/server.hpp>

using namespace phosphor::logging;
+using sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface;
+
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;

@@ -245,7 +248,7 @@ std::string getHostName(void)
return std::get<std::string>(value);
}

-bool getDHCPEnabled()
+EthernetInterface::DHCPConf getDHCPEnabled()
{
sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};

@@ -256,7 +259,7 @@ bool getDHCPEnabled()
auto value = ipmi::getDbusProperty(bus, service, ethernetObj.first,
ethernetIntf, "DHCPEnabled");

- return std::get<bool>(value);
+ return EthernetInterface::convertDHCPConfFromString(std::get<std::string>(value));
}

bool getDHCPOption(std::string prop)
@@ -1050,7 +1053,7 @@ ipmi_ret_t setDCMIConfParams(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t request,
case dcmi::DCMIConfigParameters::ActivateDHCP:

if ((requestData->data[0] & DCMI_ACTIVATE_DHCP_MASK) &&
- dcmi::getDHCPEnabled())
+ (dcmi::getDHCPEnabled() != EthernetInterface::DHCPConf::none))
{
// When these conditions are met we have to trigger DHCP
// protocol restart using the latest parameter settings, but
--
2.30.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 2fa5e91b5bc7641139d9469979490067852b8440 Mon Sep 17 00:00:00 2001
From: Thang Tran <[email protected]>
Date: Tue, 20 Dec 2022 14:12:01 +0700
Subject: [PATCH] Correct the dhcp object path

The object path which includes DHCPConfiguration interface is
"/xyz/openbmc_project/network/dhcp", it does not include "config".

Tested:
1. Get configuration params successfully
$ipmitool dcmi get_conf_param

Signed-off-by: Thang Tran <[email protected]>
---
dcmihandler.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dcmihandler.hpp b/dcmihandler.hpp
index 81c1e0b..303f6d0 100644
--- a/dcmihandler.hpp
+++ b/dcmihandler.hpp
@@ -48,7 +48,7 @@ static constexpr auto ethernetIntf =
"xyz.openbmc_project.Network.EthernetInterface";
static constexpr auto ethernetDefaultChannelNum = 0x1;
static constexpr auto networkRoot = "/xyz/openbmc_project/network";
-static constexpr auto dhcpObj = "/xyz/openbmc_project/network/config/dhcp";
+static constexpr auto dhcpObj = "/xyz/openbmc_project/network/dhcp";
static constexpr auto dhcpIntf =
"xyz.openbmc_project.Network.DHCPConfiguration";
static constexpr auto systemBusName = "org.freedesktop.systemd1";
--
2.30.0

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ SRC_URI += "\
file://0004-Revert-Confirm-presence-of-NIC-devices-described-in-.patch \
file://0005-dbus-sdr-support-static-FRU-s-ID-configuration.patch \
file://0006-Read-chassis-intrusion-status.patch \
file://0007-update-return-type-of-getDHCPEnabled-function.patch \
file://0008-Correct-the-dhcp-object-path.patch \
file://ampere-phosphor-softpoweroff \
file://ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
"
Expand Down

0 comments on commit 748e0ce

Please sign in to comment.