Change the send Buffer size dynamically
On a Linux system the send buffer size has defaulted
to around 90k, and when a pldm message is sent via
the pldm_send() that is bigger than 90k, we get an error
ENOBUFS (No buffer space avilable).
This commit would dynamically change the socket parameter
(SO_SNDBUF) to set the new maximum socket send buffer size
so that we can successfully send the message.
Tested By:
1. hard coded the current buffer size value to 10 and forced
the buffer size to be increase for mutiple commands & was able
to power on the host with out any problems.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I5f7a3948ea019b4dc983cf5e1926cfc128c02084
diff --git a/requester/handler.hpp b/requester/handler.hpp
index 6290526..ff7f33d 100644
--- a/requester/handler.hpp
+++ b/requester/handler.hpp
@@ -9,6 +9,8 @@
#include "pldmd/dbus_impl_requester.hpp"
#include "request.hpp"
+#include <sys/socket.h>
+
#include <function2/function2.hpp>
#include <sdbusplus/timer.hpp>
#include <sdeventplus/event.hpp>
@@ -91,6 +93,7 @@
* @param[in] fd - fd of MCTP communications socket
* @param[in] event - reference to PLDM daemon's main event loop
* @param[in] requester - reference to Requester object
+ * @param[in] currentSendbuffSize - current send buffer size
* @param[in] verbose - verbose tracing flag
* @param[in] instanceIdExpiryInterval - instance ID expiration interval
* @param[in] numRetries - number of request retries
@@ -98,14 +101,15 @@
*/
explicit Handler(
int fd, sdeventplus::Event& event, pldm::dbus_api::Requester& requester,
- bool verbose,
+ int currentSendbuffSize, bool verbose,
std::chrono::seconds instanceIdExpiryInterval =
std::chrono::seconds(INSTANCE_ID_EXPIRATION_INTERVAL),
uint8_t numRetries = static_cast<uint8_t>(NUMBER_OF_REQUEST_RETRIES),
std::chrono::milliseconds responseTimeOut =
std::chrono::milliseconds(RESPONSE_TIME_OUT)) :
fd(fd),
- event(event), requester(requester), verbose(verbose),
+ event(event), requester(requester),
+ currentSendbuffSize(currentSendbuffSize), verbose(verbose),
instanceIdExpiryInterval(instanceIdExpiryInterval),
numRetries(numRetries), responseTimeOut(responseTimeOut)
{}
@@ -165,7 +169,7 @@
auto request = std::make_unique<RequestInterface>(
fd, eid, event, std::move(requestMsg), numRetries, responseTimeOut,
- verbose);
+ currentSendbuffSize, verbose);
auto timer = std::make_unique<phosphor::Timer>(
event.get(), instanceIdExpiryCallBack);
@@ -240,6 +244,7 @@
int fd; //!< file descriptor of MCTP communications socket
sdeventplus::Event& event; //!< reference to PLDM daemon's main event loop
pldm::dbus_api::Requester& requester; //!< reference to Requester object
+ int currentSendbuffSize; //!< current Send Buffer size
bool verbose; //!< verbose tracing flag
std::chrono::seconds
instanceIdExpiryInterval; //!< Instance ID expiration interval