summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2018-11-28 11:02:43 -0800
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-01-11 16:59:29 +0000
commit583171207c4f9a091abe3f867cc415e7f9aa514b (patch)
tree66b0b2749541d4fea840ee00a684c585e362a678
parent54012504ba816fd0659b497a3c7e1c50f7c0f2d7 (diff)
downloadphosphor-host-ipmid-583171207c4f9a091abe3f867cc415e7f9aa514b.tar.gz
phosphor-host-ipmid-583171207c4f9a091abe3f867cc415e7f9aa514b.zip
ipmid: channel: add max transfer size property
Each channel can have a different maximum transfer size. This should be exposed so that it is easier to tell how many bytes it is possible to send or receive on a given channel. Change-Id: Ie277eb7a802edc1deeefe201a7560d371920f519 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
-rw-r--r--user_channel/channel_layer.cpp5
-rw-r--r--user_channel/channel_layer.hpp8
-rw-r--r--user_channel/channel_mgmt.cpp9
-rw-r--r--user_channel/channel_mgmt.hpp9
4 files changed, 31 insertions, 0 deletions
diff --git a/user_channel/channel_layer.cpp b/user_channel/channel_layer.cpp
index d173208..4cab58f 100644
--- a/user_channel/channel_layer.cpp
+++ b/user_channel/channel_layer.cpp
@@ -79,6 +79,11 @@ int getChannelActiveSessions(const uint8_t chNum)
return getChannelConfigObject().getChannelActiveSessions(chNum);
}
+size_t getChannelMaxTransferSize(uint8_t chNum)
+{
+ return getChannelConfigObject().getChannelMaxTransferSize(chNum);
+}
+
ipmi_ret_t ipmiChannelInit()
{
getChannelConfigObject();
diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp
index abaa0bf..87e791c 100644
--- a/user_channel/channel_layer.hpp
+++ b/user_channel/channel_layer.hpp
@@ -225,6 +225,14 @@ EChannelSessSupported getChannelSessionSupport(const uint8_t chNum);
*/
int getChannelActiveSessions(const uint8_t chNum);
+/** @brief determines maximum transfer size for a channel
+ *
+ * @param[in] chNum - channel number
+ *
+ * @return maximum bytes that can be transferred on this channel
+ */
+size_t getChannelMaxTransferSize(uint8_t chNum);
+
/** @brief initializes channel management
*
* @return IPMI_CC_OK for success, others for failure.
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index 0ece27e..310ac2b 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -62,6 +62,7 @@ static constexpr const char* propertiesChangedSignal = "PropertiesChanged";
static constexpr const char* nameString = "name";
static constexpr const char* isValidString = "is_valid";
static constexpr const char* activeSessionsString = "active_sessions";
+static constexpr const char* maxTransferSizeString = "max_transfer_size";
static constexpr const char* channelInfoString = "channel_info";
static constexpr const char* mediumTypeString = "medium_type";
static constexpr const char* protocolTypeString = "protocol_type";
@@ -86,6 +87,7 @@ static constexpr const uint8_t defaultSessionSupported =
static constexpr const uint8_t defaultAuthType =
static_cast<uint8_t>(EAuthType::none);
static constexpr const bool defaultIsIpmiState = false;
+static constexpr size_t smallChannelSize = 64;
std::unique_ptr<sdbusplus::bus::match_t> chPropertiesSignal(nullptr);
@@ -419,6 +421,11 @@ int ChannelConfig::getChannelActiveSessions(const uint8_t chNum)
return channelData[chNum].activeSessCount;
}
+size_t ChannelConfig::getChannelMaxTransferSize(uint8_t chNum)
+{
+ return channelData[chNum].maxTransferSize;
+}
+
ipmi_ret_t ChannelConfig::getChannelInfo(const uint8_t chNum,
ChannelInfo& chInfo)
{
@@ -941,6 +948,8 @@ int ChannelConfig::loadChannelConfig()
jsonChData[isValidString].get<bool>();
channelData[chNum].activeSessCount =
jsonChData.value(activeSessionsString, 0);
+ channelData[chNum].maxTransferSize =
+ jsonChData.value(maxTransferSizeString, smallChannelSize);
Json jsonChInfo = jsonChData[channelInfoString].get<Json>();
if (jsonChInfo.is_null())
{
diff --git a/user_channel/channel_mgmt.hpp b/user_channel/channel_mgmt.hpp
index d696075..3de5fa8 100644
--- a/user_channel/channel_mgmt.hpp
+++ b/user_channel/channel_mgmt.hpp
@@ -62,6 +62,7 @@ struct ChannelData
uint8_t activeSessCount;
ChannelInfo chInfo;
ChannelAccessData chAccess;
+ size_t maxTransferSize;
};
class ChannelConfig;
@@ -112,6 +113,14 @@ class ChannelConfig
*/
int getChannelActiveSessions(const uint8_t chNum);
+ /** @brief determines maximum transfer size for a channel
+ *
+ * @param[in] chNum - channel number
+ *
+ * @return maximum bytes that can be transferred on this channel
+ */
+ size_t getChannelMaxTransferSize(uint8_t chNum);
+
/** @brief provides channel info details
*
* @param[in] chNum - channel number
OpenPOWER on IntegriCloud