Changeset 78822 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- May 28, 2019 2:30:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/network/NetPerf.cpp
r76870 r78822 86 86 #define NETPERF_MIN_COOL_DOWN 1000 /* 1s */ 87 87 88 /** Maximum socket buffer size possible (bytes). */ 89 #define NETPERF_MAX_BUF_SIZE _128M 90 /** Minimum socket buffer size possible (bytes). */ 91 #define NETPERF_MIN_BUF_SIZE 256 92 88 93 /** The length of the length prefix used when submitting parameters and 89 94 * results. */ … … 142 147 /** Server: Quit after the first client. */ 143 148 bool fSingleClient; 149 /** Send and receive buffer sizes for TCP sockets, zero if to use defaults. */ 150 uint32_t cbBufferSize; 144 151 /** @} */ 145 152 … … 235 242 { "--check-data", 'C', RTGETOPT_REQ_NOTHING }, 236 243 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 244 { "--buffer-size", 'b', RTGETOPT_REQ_UINT32 }, 237 245 { "--help", 'h', RTGETOPT_REQ_NOTHING } /* for Usage() */ 238 246 }; … … 303 311 case 'C': 304 312 pszHelp = "Check payload data at the receiving end"; 313 break; 314 case 'b': 315 pszHelp = "Send and receive buffer sizes for TCP"; 305 316 break; 306 317 case 'v': … … 1136 1147 RTTestIPrintf(RTTESTLVL_ALWAYS, "Failed to get client details: %Rrc\n", rc); 1137 1148 Addr.enmType = RTNETADDRTYPE_INVALID; 1149 } 1150 1151 /* 1152 * Adjust send and receive buffer sizes if necessary. 1153 */ 1154 if (pParams->cbBufferSize) 1155 { 1156 rc = RTTcpSetBufferSize(hSocket, pParams->cbBufferSize); 1157 if (RT_FAILURE(rc)) 1158 return RTTestIFailedRc(rc, "Failed to set socket buffer sizes to %#x: %Rrc\n", pParams->cbBufferSize, rc); 1138 1159 } 1139 1160 … … 1639 1660 1640 1661 /* 1662 * Adjust send and receive buffer sizes if necessary. 1663 */ 1664 if (pParams->cbBufferSize) 1665 { 1666 rc = RTTcpSetBufferSize(hSocket, pParams->cbBufferSize); 1667 if (RT_FAILURE(rc)) 1668 return RTTestIFailedRc(rc, "Failed to set socket buffer sizes to %#x: %Rrc\n", pParams->cbBufferSize, rc); 1669 } 1670 1671 /* 1641 1672 * Verify the super secret Start Connect Id to start the connection. 1642 1673 */ … … 1794 1825 Params.cMsCoolDown = NETPERF_DEFAULT_COOL_DOWN; 1795 1826 Params.cbPacket = NETPERF_DEFAULT_PKT_SIZE_LATENCY; 1827 Params.cbBufferSize = 0; 1796 1828 1797 1829 Params.hSocket = NIL_RTSOCKET; … … 1922 1954 break; 1923 1955 1956 case 'b': 1957 Params.cbBufferSize = ValueUnion.u32; 1958 if ( ( Params.cbBufferSize < NETPERF_MIN_BUF_SIZE 1959 || Params.cbBufferSize > NETPERF_MAX_BUF_SIZE) 1960 && Params.cbBufferSize != 0) 1961 { 1962 RTTestFailed(g_hTest, "Invalid packet size %u bytes, valid range: %u-%u or 0\n", 1963 Params.cbBufferSize, NETPERF_MIN_BUF_SIZE, NETPERF_MAX_BUF_SIZE); 1964 return RTTestSummaryAndDestroy(g_hTest); 1965 } 1966 break; 1967 1924 1968 default: 1925 1969 return RTGetOptPrintError(rc, &ValueUnion);
Note:
See TracChangeset
for help on using the changeset viewer.