From 04fc174d50fd19d6ae78fd2fd2faae221acff807 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:25:49 +0200 Subject: Adding upstream version 2.2.0+dfsg. Signed-off-by: Daniel Baumann --- src/Launch.cpp | 101 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 37 deletions(-) (limited to 'src/Launch.cpp') diff --git a/src/Launch.cpp b/src/Launch.cpp index 9f0c633..721f95e 100644 --- a/src/Launch.cpp +++ b/src/Launch.cpp @@ -167,7 +167,7 @@ void server_spawn(struct thread_Settings *thread) { } static void clientside_client_basic (struct thread_Settings *thread, Client *theClient) { - setTransferID(thread, 0); + setTransferID(thread, NORMAL); #ifdef HAVE_THREAD_DEBUG if (isBounceBack(thread)) { thread_debug("Launch: spawn client bounce-back mode, size = %d", thread->mBurstSize); @@ -176,24 +176,12 @@ static void clientside_client_basic (struct thread_Settings *thread, Client *the } #endif SockAddr_remoteAddr(thread); - // Bounceback start delays the connect too - if (isBounceBack(thread)) { - if (isTxStartTime(thread)) { - theClient->mySockInit(); - clock_usleep_abstime(&thread->txstart_epoch); - } else if (isTxHoldback(thread)) { - unsetTxHoldback(thread); - theClient->mySockInit(); - clock_usleep(&thread->txholdback_timer); - } - } - theClient->my_connect(true); + theClient->my_connect(false); if ((thread->mThreads > 1) && !isNoConnectSync(thread) && !isCompat(thread)) // When -P > 1 then all threads finish connect before starting traffic theClient->BarrierClient(thread->connects_done); if (theClient->isConnected()) { - if ((thread->mThreads > 1) || isSumOnly(thread)) - Iperf_push_host(thread); + Iperf_push_host(thread); theClient->StartSynch(); theClient->Run(); } @@ -201,9 +189,9 @@ static void clientside_client_basic (struct thread_Settings *thread, Client *the static void clientside_client_reverse (struct thread_Settings *thread, \ struct thread_Settings *reverse_client, Client *theClient) { - setTransferID(thread, 0); + setTransferID(thread, NORMAL); SockAddr_remoteAddr(thread); - theClient->my_connect(true); + theClient->my_connect(false); #ifdef HAVE_THREAD_DEBUG thread_debug("Launch: client spawn thread reverse (sock=%d)", thread->mSock); #endif @@ -212,7 +200,7 @@ static void clientside_client_reverse (struct thread_Settings *thread, \ theClient->BarrierClient(thread->connects_done); if (theClient->isConnected()) { FAIL((!reverse_client || !(thread->mSock > 0)), "Reverse test failed to start per thread settings or socket problem", thread); - setTransferID(reverse_client, 1); + setTransferID(reverse_client, REVERSED); theClient->StartSynch(); reverse_client->mSock = thread->mSock; // use the same socket for both directions reverse_client->mThreadMode = kMode_Server; @@ -220,8 +208,7 @@ static void clientside_client_reverse (struct thread_Settings *thread, \ setNoUDPfin(reverse_client); // disable the fin report - no need reverse_client->size_local = sizeof(iperf_sockaddr); getsockname(reverse_client->mSock, reinterpret_cast(&reverse_client->local), &reverse_client->size_local); - if ((thread->mThreads > 1) || isSumOnly(thread)) - Iperf_push_host(reverse_client); + Iperf_push_host(reverse_client); thread_start(reverse_client); if (theClient->myJob) FreeReport(theClient->myJob); @@ -230,20 +217,17 @@ static void clientside_client_reverse (struct thread_Settings *thread, \ static void clientside_client_fullduplex (struct thread_Settings *thread, \ struct thread_Settings *reverse_client, Client *theClient) { - setTransferID(thread, 0); + setTransferID(thread, NORMAL); SockAddr_remoteAddr(thread); if (!isBounceBack(thread)) { - thread->mFullDuplexReport = InitSumReport(thread, -1, 1); + thread->mFullDuplexReport = InitSumReport(thread, -1, true); } Settings_Copy(thread, &reverse_client, SHALLOW_COPY); - if ((thread->mThreads > 1) || isSumOnly(thread) || \ - (!(thread->mThreads > 1) && !isEnhanced(thread))) { - Iperf_push_host(thread); - Iperf_push_host(reverse_client); - } + Iperf_push_host(thread); + Iperf_push_host(reverse_client); assert(reverse_client != NULL); - setTransferID(reverse_client, 1); - theClient->my_connect(true); + setTransferID(reverse_client, REVERSED); + theClient->my_connect(false); #ifdef HAVE_THREAD_DEBUG thread_debug("Launch: client spawn thread fullduplex (sock=%d)", thread->mSock); #endif @@ -270,7 +254,7 @@ static void serverside_client_fullduplex (struct thread_Settings *thread, Client #ifdef HAVE_THREAD_DEBUG thread_debug("Launch: Listener spawn client thread (fd sock=%d)", thread->mSock); #endif - setTransferID(thread, 1); + setTransferID(thread, REVERSED); if (theClient->StartSynch() != -1) { theClient->Run(); } @@ -280,7 +264,7 @@ static void serverside_client_bidir (struct thread_Settings *thread, Client *the #ifdef HAVE_THREAD_DEBUG thread_debug("Launch: Listener spawn client thread (bidir sock=%d)", thread->mSock); #endif - setTransferID(thread, 1); + setTransferID(thread, REVERSED); SockAddr_zeroAddress(&thread->peer); SockAddr_remoteAddr(thread); if (thread->mReportMode == kReport_CSV) { @@ -324,7 +308,7 @@ void client_spawn (struct thread_Settings *thread) { thread_setscheduler(thread); #endif // start up the client - setTransferID(thread, 0); + setTransferID(thread, NORMAL); theClient = new Client(thread); // let the reporter thread go first in the case of -P greater than 1 Condition_Lock(reporter_state.await); @@ -400,10 +384,21 @@ void client_init(struct thread_Settings *clients) { if (isIncrSrcIP(clients) && (clients->mLocalhost != NULL)) { next->incrsrcip = i; } + if (isTxStartTime(clients)) { + // break apart -P first pkt sends by some usecs + // this allows the listener thread to spawn a server, connect() and open + // a new socket for subsequent threads. This issue is most + // notable with --tx-starttime and -P > 1 + // use max cores & a max aggregate delay to limit this so it's bounded +#define MAXCORES 10 +#define MAXDELAY 20000 // 20 ms + next->sendfirst_pacing = (i % MAXCORES) * (MAXDELAY / MAXCORES); + } if (isIncrDstIP(clients)) { next->incrdstip = i; // force a setHostname SockAddr_zeroAddress(&next->peer); + setNoSettReport(next); } else if (clients->mBindPort) { // Increment the source port of none of the quintuple is being change or the user requests it if ((!isIncrDstPort(clients) && !isIncrDstIP(clients) && !isIncrSrcIP(clients)) || isIncrSrcPort(clients)) { @@ -419,11 +414,22 @@ void client_init(struct thread_Settings *clients) { itr->runNow = next; itr = next; } - if ((isBounceBack(clients) || isConnectOnly(clients) || isPeriodicBurst(clients)) \ - && (isWorkingLoadUp(clients) || isWorkingLoadDown(clients))) { + if (isWorkingLoadUp(clients) || isWorkingLoadDown(clients)) { int working_load_threads = (clients->mWorkingLoadThreads == 0) ? 1 : clients->mWorkingLoadThreads; while (working_load_threads--) { Settings_Copy(clients, &next, DEEP_COPY); + if (isUDP(next)) { + unsetUDP(next); + unsetBWSet(next); + setNoSettReport(next); + next->mAppRate=0; + } + if (isLoadCCA(next)) { + unsetCongestionControl(next); + } + if (isIsochronous(next)) { + unsetIsochronous(next); + } if (next != NULL) { unsetBounceBack(next); unsetConnectOnly(next); @@ -439,15 +445,24 @@ void client_init(struct thread_Settings *clients) { } else if (isWorkingLoadDown(clients)) { setReverse(next); } - if (isBounceBack(clients) && (clients->mWorkingLoadThreads > 1)) { - Iperf_push_host(clients); - } + Iperf_push_host(clients); // Bump the bounceback time to include the delay time if (next->txholdback_timer.tv_sec || next->txholdback_timer.tv_usec) { // mAmount units are 10 ms next->mAmount += (next->txholdback_timer.tv_sec * 100); next->mAmount += (next->txholdback_timer.tv_usec / 10000); } + if (isLoadCCA(next)) { + char *tmp = new char[strlen(next->mLoadCCA) + 1]; + if (tmp) { + if (next->mCongestion) + DELETE_ARRAY(next->mCongestion); + setCongestionControl(next); + strcpy(tmp, next->mLoadCCA); + tmp[strlen(next->mLoadCCA)] = '\0'; + next->mCongestion = tmp; + } + } itr->runNow = next; itr = next; } @@ -475,4 +490,16 @@ void listeners_init(struct thread_Settings *listener) { itr = next; } } + // See if a working load TCP listener is needed + if (isUDP(listener) && (isWorkingLoadUp(listener) || isWorkingLoadDown(listener))) { + Settings_Copy(listener, &next, DEEP_COPY); + if (next != NULL) { + unsetUDP(next); + next->mAppRate = 0; + unsetBWSet(next); + setNoSettReport(next); + itr->runNow = next; + itr = next; + } + } } -- cgit v1.2.3