On Thursday 09 August 2012 14:15:24 Edo Monticelli wrote:
The bandwith meter module is a simple, kernel-space replacement for bandwith measurements tool like iperf and netper. It is intended to approximate TCP behaviour.
It is invoked through ``batctl bw": the protocol is connection oriented, with cumulative acknowledgment and sliding window. Sender keeps a timeout, which is checked by a worker function regoularly invoked through the workqueue mechanism. If the timeout is expired at the time worker is executed, the whole window is re-transmitted.
Struct bw_vars, one for each connection, are collected into a linked list. Thus access to them is protected with a spinlock.
Another spinlock prevents more than one instance of multiple_send to run concurrently. Ack code is mutually exclusive (two ack handler cannot run at the same time for differnent acks), but they are not mutually exclusive with send_remaining_window, that is to say the ack handler shifts the window ``while" send_remaining_window is running. Maybe some atomic variable (window_first) is needed to avoid problems.
When the test is over, the results are returned to batctl through a call to the function batadv_socket_receive_packet(), before freeing struct batadv_bw_vars.
The function only accepts struct batadv_icmp_packet_rr, so that structure is used and a cast is done to struct batadv_bw_result.
The test interruptable with CTRL-C. A receiver side timeout avoids unlimited waitings for sender packets: after one second of inactivity, the receiver abort the ongoing test.
Signed-off-by: Edo Monticelli montik@autistici.org
Makefile | 2 +- Makefile.kbuild | 1 + bw_meter.c | 513 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ bw_meter.h | 7 + icmp_socket.c | 18 ++ main.c | 2 + packet.h | 22 ++- routing.c | 15 ++- soft-interface.c | 5 + types.h | 36 ++++ 10 files changed, 614 insertions(+), 7 deletions(-) create mode 100644 bw_meter.c create mode 100644 bw_meter.h
diff --git a/Makefile b/Makefile index bd8d30c..12aebe5 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@
# changing the CONFIG_* line to 'y' enables the related feature # B.A.T.M.A.N. debugging: -export CONFIG_BATMAN_ADV_DEBUG=n +export CONFIG_BATMAN_ADV_DEBUG=y # B.A.T.M.A.N. bridge loop avoidance: export CONFIG_BATMAN_ADV_BLA=y
Sry, disapproved.
Kind regards, Sven