summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>2019-01-22 00:20:15 +0530
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-04-01 18:32:49 +0000
commit75b480be0428832e57e3a9e29f571f2b7a3848d4 (patch)
treef1b4afb457d53df442e9f0b0903c92c020d2fe4d
parent1c8ee4902c5bb87a300cf7da1edec415ab5f5f79 (diff)
downloadphosphor-host-ipmid-75b480be0428832e57e3a9e29f571f2b7a3848d4.tar.gz
phosphor-host-ipmid-75b480be0428832e57e3a9e29f571f2b7a3848d4.zip
Fix: Set Lan Configuration parameter
Allow individual parameter changes to take effect based on timer. i.e. setting any one LAN parameter change will take effect even without Set In Progress parameter update Verification: Verified lan settings change to static alone using ipmitool lan and manually issued parameter update without SET_IN_PROGRESS change. Change-Id: I2a9f8e8ef94ecb23da8bac38a6b49249544e8975 Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
-rw-r--r--transporthandler.cpp46
1 files changed, 31 insertions, 15 deletions
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 8172cc4..7d678a8 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -382,6 +382,35 @@ struct set_lan_t
uint8_t data[8]; // Per IPMI spec, not expecting more than this size
} __attribute__((packed));
+ipmi_ret_t checkAndUpdateNetwork(int channel)
+{
+ auto channelConf = getChannelConfig(channel);
+ using namespace std::chrono_literals;
+ // time to wait before applying the network changes.
+ constexpr auto networkTimeout = 10000000us; // 10 sec
+
+ // Skip the timer. Expecting more update as we are in SET_IN_PROGRESS
+ if (channelConf->lan_set_in_progress == SET_IN_PROGRESS)
+ {
+ return IPMI_CC_OK;
+ }
+
+ // Start the timer, if it is direct single param update without
+ // SET_IN_PROGRESS or many params updated through SET_IN_PROGRESS to
+ // SET_COMPLETE Note: Even for update with SET_IN_PROGRESS, don't apply the
+ // changes immediately, as ipmitool sends each param individually
+ // through SET_IN_PROGRESS to SET_COMPLETE.
+ channelConf->flush = true;
+ if (!networkTimer)
+ {
+ log<level::ERR>("Network timer is not instantiated");
+ return IPMI_CC_UNSPECIFIED_ERROR;
+ }
+ // start the timer.
+ networkTimer->start(networkTimeout);
+ return IPMI_CC_OK;
+}
+
ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request,
ipmi_response_t response,
@@ -391,11 +420,6 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_ret_t rc = IPMI_CC_OK;
*data_len = 0;
- using namespace std::chrono_literals;
-
- // time to wait before applying the network changes.
- constexpr auto networkTimeout = 10000000us; // 10 sec
-
char ipaddr[INET_ADDRSTRLEN];
char netmask[INET_ADDRSTRLEN];
char gateway[INET_ADDRSTRLEN];
@@ -494,20 +518,10 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
entry("ADDRESS=%s", channelConf->ipaddr.c_str()),
entry("GATEWAY=%s", channelConf->gateway.c_str()),
entry("VLAN=%d", channelConf->vlanID));
-
- if (!networkTimer)
- {
- log<level::ERR>("Network timer is not instantiated");
- return IPMI_CC_UNSPECIFIED_ERROR;
- }
-
- // start/restart the timer
- networkTimer->start(networkTimeout);
}
else if (reqptr->data[0] == SET_IN_PROGRESS) // Set In Progress
{
channelConf->lan_set_in_progress = SET_IN_PROGRESS;
- channelConf->flush = true;
}
}
break;
@@ -515,8 +529,10 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
default:
{
rc = IPMI_CC_PARM_NOT_SUPPORTED;
+ return rc;
}
}
+ rc = checkAndUpdateNetwork(channel);
return rc;
}
OpenPOWER on IntegriCloud