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/test/request_test.cpp b/requester/test/request_test.cpp
index 5239c12..234ff32 100644
--- a/requester/test/request_test.cpp
+++ b/requester/test/request_test.cpp
@@ -49,7 +49,7 @@
TEST_F(RequestIntfTest, 0Retries100msTimeout)
{
MockRequest request(fd, eid, event, std::move(requestMsg), 0,
- milliseconds(100), false);
+ milliseconds(100), 90000, false);
EXPECT_CALL(request, send())
.Times(Exactly(1))
.WillOnce(Return(PLDM_SUCCESS));
@@ -60,7 +60,7 @@
TEST_F(RequestIntfTest, 2Retries100msTimeout)
{
MockRequest request(fd, eid, event, std::move(requestMsg), 2,
- milliseconds(100), false);
+ milliseconds(100), 90000, false);
// send() is called a total of 3 times, the original plus two retries
EXPECT_CALL(request, send()).Times(3).WillRepeatedly(Return(PLDM_SUCCESS));
auto rc = request.start();
@@ -71,7 +71,7 @@
TEST_F(RequestIntfTest, 9Retries100msTimeoutRequestStoppedAfter1sec)
{
MockRequest request(fd, eid, event, std::move(requestMsg), 9,
- milliseconds(100), false);
+ milliseconds(100), 90000, false);
// send() will be called a total of 10 times, the original plus 9 retries.
// In a ideal scenario send() would have been called 10 times in 1 sec (when
// the timer is stopped) with a timeout of 100ms. Because there are delays
@@ -94,7 +94,7 @@
TEST_F(RequestIntfTest, 2Retries100msTimeoutsendReturnsError)
{
MockRequest request(fd, eid, event, std::move(requestMsg), 2,
- milliseconds(100), false);
+ milliseconds(100), 90000, false);
EXPECT_CALL(request, send()).Times(Exactly(1)).WillOnce(Return(PLDM_ERROR));
auto rc = request.start();
EXPECT_EQ(rc, PLDM_ERROR);