diff options
-rw-r--r-- | patches/iperf-2.0.2/generic/iperf_fix_locking.diff | 97 | ||||
-rw-r--r-- | patches/iperf-2.0.2/generic/iperf_gnumalloc_cross_compile.diff | 24 | ||||
-rw-r--r-- | patches/iperf-2.0.2/generic/series | 2 | ||||
-rw-r--r-- | rules/Kconfig | 1 | ||||
-rw-r--r-- | rules/iperf.in | 8 | ||||
-rw-r--r-- | rules/iperf.make | 131 |
6 files changed, 263 insertions, 0 deletions
diff --git a/patches/iperf-2.0.2/generic/iperf_fix_locking.diff b/patches/iperf-2.0.2/generic/iperf_fix_locking.diff new file mode 100644 index 000000000..9ec511c37 --- /dev/null +++ b/patches/iperf-2.0.2/generic/iperf_fix_locking.diff @@ -0,0 +1,97 @@ +Subject: iperf: fix locking +From: Ingo Molnar <mingo@elte.hu> +fix iperf locking - it was burning CPU time while polling +unnecessarily, instead of using the proper wait primitives. + +Signed-off-by: Ingo Molnar <mingo@elte.hu> +--- + compat/Thread.c | 3 --- + src/Reporter.c | 13 +++++++++---- + src/main.cpp | 2 ++ + 3 files changed, 11 insertions(+), 7 deletions(-) +Index: iperf-2.0.2/compat/Thread.c +=================================================================== +--- iperf-2.0.2.orig/compat/Thread.c ++++ iperf-2.0.2/compat/Thread.c +@@ -405,9 +405,6 @@ int thread_numuserthreads( void ) { + void thread_rest ( void ) { + #if defined( HAVE_THREAD ) + #if defined( HAVE_POSIX_THREAD ) +- // TODO add checks for sched_yield or pthread_yield and call that +- // if available +- usleep( 0 ); + #else // Win32 + SwitchToThread( ); + #endif +Index: iperf-2.0.2/src/Reporter.c +=================================================================== +--- iperf-2.0.2.orig/src/Reporter.c ++++ iperf-2.0.2/src/Reporter.c +@@ -111,6 +111,7 @@ report_statistics multiple_reports[kRepo + char buffer[64]; // Buffer for printing + ReportHeader *ReportRoot = NULL; + extern Condition ReportCond; ++extern Condition ReportDoneCond; + int reporter_process_report ( ReportHeader *report ); + void process_report ( ReportHeader *report ); + int reporter_handle_packet( ReportHeader *report ); +@@ -338,7 +339,7 @@ void ReportPacket( ReportHeader* agent, + // item + while ( index == 0 ) { + Condition_Signal( &ReportCond ); +- thread_rest(); ++ Condition_Wait( &ReportDoneCond ); + index = agent->reporterindex; + } + agent->agentindex = 0; +@@ -346,7 +347,7 @@ void ReportPacket( ReportHeader* agent, + // Need to make sure that reporter is not about to be "lapped" + while ( index - 1 == agent->agentindex ) { + Condition_Signal( &ReportCond ); +- thread_rest(); ++ Condition_Wait( &ReportDoneCond ); + index = agent->reporterindex; + } + +@@ -553,6 +554,7 @@ void reporter_spawn( thread_Settings *th + } + Condition_Unlock ( ReportCond ); + ++again: + if ( ReportRoot != NULL ) { + ReportHeader *temp = ReportRoot; + //Condition_Unlock ( ReportCond ); +@@ -575,9 +577,12 @@ void reporter_spawn( thread_Settings *th + // finished with report so free it + free( temp ); + Condition_Unlock ( ReportCond ); ++ Condition_Signal( &ReportDoneCond ); ++ if (ReportRoot) ++ goto again; + } +- // yield control of CPU is another thread is waiting +- thread_rest(); ++ Condition_Signal( &ReportDoneCond ); ++ usleep(10000); + } else { + //Condition_Unlock ( ReportCond ); + } +Index: iperf-2.0.2/src/main.cpp +=================================================================== +--- iperf-2.0.2.orig/src/main.cpp ++++ iperf-2.0.2/src/main.cpp +@@ -96,6 +96,7 @@ extern "C" { + // records being accessed in a report and also to + // serialize modification of the report list + Condition ReportCond; ++ Condition ReportDoneCond; + } + + // global variables only accessed within this file +@@ -141,6 +142,7 @@ int main( int argc, char **argv ) { + + // Initialize global mutexes and conditions + Condition_Initialize ( &ReportCond ); ++ Condition_Initialize ( &ReportDoneCond ); + Mutex_Initialize( &groupCond ); + Mutex_Initialize( &clients_mutex ); diff --git a/patches/iperf-2.0.2/generic/iperf_gnumalloc_cross_compile.diff b/patches/iperf-2.0.2/generic/iperf_gnumalloc_cross_compile.diff new file mode 100644 index 000000000..b39617a9b --- /dev/null +++ b/patches/iperf-2.0.2/generic/iperf_gnumalloc_cross_compile.diff @@ -0,0 +1,24 @@ +Subject: fix iperf malloc detection for cross compiling + +Iperf configure assumes a non gnu compatible malloc for cross compiling +Change the default to be able to cross compile. + +Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: iperf-2.0.2/configure +=================================================================== +--- iperf-2.0.2.orig/configure ++++ iperf-2.0.2/configure +@@ -9519,7 +9519,7 @@ if test "${ac_cv_func_malloc_0_nonnull+s + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test "$cross_compiling" = yes; then +- ac_cv_func_malloc_0_nonnull=no ++ ac_cv_func_malloc_0_nonnull=yes + else + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ diff --git a/patches/iperf-2.0.2/generic/series b/patches/iperf-2.0.2/generic/series new file mode 100644 index 000000000..f0bc0ca08 --- /dev/null +++ b/patches/iperf-2.0.2/generic/series @@ -0,0 +1,2 @@ +iperf_gnumalloc_cross_compile.diff +iperf_fix_locking.diff diff --git a/rules/Kconfig b/rules/Kconfig index da8787ce5..b3b83881d 100644 --- a/rules/Kconfig +++ b/rules/Kconfig @@ -233,6 +233,7 @@ endmenu menu "Test Suites " source "rules/cyclictest.in" +source "rules/iperf.in" source "rules/host-pelts.in" source "rules/pelts_tests.in" source "rules/tests.in" diff --git a/rules/iperf.in b/rules/iperf.in new file mode 100644 index 000000000..1d5ebea54 --- /dev/null +++ b/rules/iperf.in @@ -0,0 +1,8 @@ +config IPERF + bool + select GCCLIBS_CXX + prompt "iperf" + help + Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning + of various parameters and UDP characteristics. Iperf reports + bandwidth, delay jitter, datagram loss diff --git a/rules/iperf.make b/rules/iperf.make new file mode 100644 index 000000000..a37ca1f53 --- /dev/null +++ b/rules/iperf.make @@ -0,0 +1,131 @@ +# -*-makefile-*- +# $Id: template 6655 2007-01-02 12:55:21Z rsc $ +# +# Copyright (C) 2007 by Sascha Hauer +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +PACKAGES-$(PTXCONF_IPERF) += iperf + +# +# Paths and names +# +IPERF_VERSION := 2.0.2 +IPERF := iperf-$(IPERF_VERSION) +IPERF_SUFFIX := tar.gz +IPERF_URL := http://dast.nlanr.net/Projects/Iperf2.0/$(IPERF).$(IPERF_SUFFIX) +IPERF_SOURCE := $(SRCDIR)/$(IPERF).$(IPERF_SUFFIX) +IPERF_DIR := $(BUILDDIR)/$(IPERF) + +# ---------------------------------------------------------------------------- +# Get +# ---------------------------------------------------------------------------- + +iperf_get: $(STATEDIR)/iperf.get + +$(STATEDIR)/iperf.get: $(iperf_get_deps_default) + @$(call targetinfo, $@) + @$(call touch, $@) + +$(IPERF_SOURCE): + @$(call targetinfo, $@) + @$(call get, IPERF) + +# ---------------------------------------------------------------------------- +# Extract +# ---------------------------------------------------------------------------- + +iperf_extract: $(STATEDIR)/iperf.extract + +$(STATEDIR)/iperf.extract: $(iperf_extract_deps_default) + @$(call targetinfo, $@) + @$(call clean, $(IPERF_DIR)) + @$(call extract, IPERF) + @$(call patchin, IPERF) + @$(call touch, $@) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +iperf_prepare: $(STATEDIR)/iperf.prepare + +IPERF_PATH := PATH=$(CROSS_PATH) +IPERF_ENV := $(CROSS_ENV) + +# +# autoconf +# +IPERF_AUTOCONF := $(CROSS_AUTOCONF_USR) + +$(STATEDIR)/iperf.prepare: $(iperf_prepare_deps_default) + @$(call targetinfo, $@) + @$(call clean, $(IPERF_DIR)/config.cache) + cd $(IPERF_DIR) && \ + $(IPERF_PATH) $(IPERF_ENV) \ + ./configure $(IPERF_AUTOCONF) + @$(call touch, $@) + +# ---------------------------------------------------------------------------- +# Compile +# ---------------------------------------------------------------------------- + +iperf_compile: $(STATEDIR)/iperf.compile + +$(STATEDIR)/iperf.compile: $(iperf_compile_deps_default) + @$(call targetinfo, $@) + cd $(IPERF_DIR) && $(IPERF_PATH) $(MAKE) $(PARALLELMFLAGS) + @$(call touch, $@) + +# ---------------------------------------------------------------------------- +# Install +# ---------------------------------------------------------------------------- + +iperf_install: $(STATEDIR)/iperf.install + +$(STATEDIR)/iperf.install: $(iperf_install_deps_default) + @$(call targetinfo, $@) + @$(call install, IPERF) + @$(call touch, $@) + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +iperf_targetinstall: $(STATEDIR)/iperf.targetinstall + +$(STATEDIR)/iperf.targetinstall: $(iperf_targetinstall_deps_default) + @$(call targetinfo, $@) + + @$(call install_init, iperf) + @$(call install_fixup, iperf,PACKAGE,iperf) + @$(call install_fixup, iperf,PRIORITY,optional) + @$(call install_fixup, iperf,VERSION,$(IPERF_VERSION)) + @$(call install_fixup, iperf,SECTION,base) + @$(call install_fixup, iperf,AUTHOR,"Robert Schwebel <r.schwebel\@pengutronix.de>") + @$(call install_fixup, iperf,DEPENDS,) + @$(call install_fixup, iperf,DESCRIPTION,missing) + + @$(call install_copy, iperf, 0, 0, 0755, $(IPERF_DIR)/src/iperf, /usr/bin/iperf) + + @$(call install_finish, iperf) + + @$(call touch, $@) + +# ---------------------------------------------------------------------------- +# Clean +# ---------------------------------------------------------------------------- + +iperf_clean: + rm -rf $(STATEDIR)/iperf.* + rm -rf $(IMAGEDIR)/iperf_* + rm -rf $(IPERF_DIR) + +# vim: syntax=make |