Wednesday, August 8, 2018

TCP latency vs sk_pacing_shift value test

###############
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
  struct net_device *dev,
  u32 info_flags)
{
if (!IS_ERR_OR_NULL(sta)) {
struct ieee80211_fast_tx *fast_tx;

/* We need a bit of data queued to build aggregates properly, so
 * instruct the TCP stack to allow more than a single ms of data
 * to be queued in the stack. The value is a bit-shift of 1
 * second, so 8 is ~4ms of queued data. Only affects local TCP
 * sockets.
 */
sk_pacing_shift_update(skb->sk, 8);

fast_tx = rcu_dereference(sta->fast_tx);
###############

TCP latency values test: The tcp_nup test in Flent (https://flent.org)

https://flent.org/intro.html#quick-start

I used the command but test failed:

flent tcp_download -p 1 -l 60 -H 192.168.1.5 -t text-to-be-included-in-plot -o file1.png

error loading plotter: unable to find plot configuration "1"

Try something like:

flent -H 192.168.1.5 -t "sk_pacing_shift 7" tcp_nup --test-parameter upload_streams=1

you can vary the number of TCP streams by changing the upload_streams parameter.

I'm assuming you are running Flent on the device
with the kernel you are trying to test, so you want a TCP transfer going
*from* the device. If not, change "tcp_nup" to "tcp_ndown" and
"upload_streams" to "download_streams". Upload is netperf TCP_STREAM
test, and download is TCP_MAERTS.

When running the above command you'll get a summary output on the
terminal that you can paste on the list; and also a data file to plot
things form. For instance, you can do something like 'flent -p ping_cdf
*.flent.gz' to get a CDF plot of all your test results afterwards.

###############

Shift 6:
root:~/flent$ flent -H 192.168.1.7 -t "sk_pacing_shift6" tcp_nup --test-parameter upload_streams=1
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-13T110414.699512.sk_pacing_shift6.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift6' (at 2018-08-13 03:04:14.699512):

                           avg       median          # data pts
Ping (ms) ICMP :         9.91         4.99 ms              350
TCP upload avg :       242.48       262.43 Mbits/s         301
TCP upload sum :       242.48       262.43 Mbits/s         301
TCP upload::1  :       242.48       263.34 Mbits/s         271

root:~/flent$ flent -H 192.168.1.7 -t "sk_pacing_shift6" tcp_nup --test-parameter upload_streams=1
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-13T113317.074077.sk_pacing_shift6.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift6' (at 2018-08-13 03:33:17.074077):

                           avg       median          # data pts
Ping (ms) ICMP :         7.75         5.30 ms              350
TCP upload avg :       239.17       250.84 Mbits/s         301
TCP upload sum :       239.17       250.84 Mbits/s         301
TCP upload::1  :       239.17       255.03 Mbits/s         266


Shift 7:
root:~/flent$ flent -H 192.168.1.7 -t "sk_pacing_shift7" tcp_nup --test-parameter upload_streams=1
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-13T122948.020974.sk_pacing_shift7.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift7' (at 2018-08-13 04:29:48.020974):

                           avg       median          # data pts
Ping (ms) ICMP :        14.12         6.61 ms              350
TCP upload avg :       188.19       188.04 Mbits/s         301
TCP upload sum :       188.19       188.04 Mbits/s         301
TCP upload::1  :       188.19       190.88 Mbits/s         258

root:~/flent$ flent -H 192.168.1.7 -t "sk_pacing_shift7" tcp_nup --test-parameter upload_streams=1
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-13T123129.526514.sk_pacing_shift7.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift7' (at 2018-08-13 04:31:29.526514):

                           avg       median          # data pts
Ping (ms) ICMP :        10.31         6.32 ms              350
TCP upload avg :       212.70       233.69 Mbits/s         301
TCP upload sum :       212.70       233.69 Mbits/s         301
TCP upload::1  :       212.70       237.65 Mbits/s         262


Shift 8:
root:~/flent$ flent -H 192.168.1.7 -t "sk_pacing_shift8" tcp_nup --test-parameter upload_streams=1
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-13T121433.187781.sk_pacing_shift8.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift8' (at 2018-08-13 04:14:33.187781):

                           avg       median          # data pts
Ping (ms) ICMP :        17.12         7.07 ms              350
TCP upload avg :       180.05       185.82 Mbits/s         301
TCP upload sum :       180.05       185.82 Mbits/s         301
TCP upload::1  :       180.05       189.41 Mbits/s         253

root:~/flent$ flent -H 192.168.1.7 -t "sk_pacing_shift8" tcp_nup --test-parameter upload_streams=1
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-13T121602.382575.sk_pacing_shift8.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift8' (at 2018-08-13 04:16:02.382575):

                           avg       median          # data pts
Ping (ms) ICMP :        13.90         5.89 ms              350
TCP upload avg :       207.56       228.16 Mbits/s         301
TCP upload sum :       207.56       228.16 Mbits/s         301
TCP upload::1  :       207.56       228.11 Mbits/s         259

Shift 10:
root:~/flent$ flent -H 192.168.1.7 -t "sk_pacing_shift10" tcp_nup --test-parameter upload_streams=1
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-13T121844.493498.sk_pacing_shift10.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift10' (at 2018-08-13 04:18:44.493498):

                           avg       median          # data pts
Ping (ms) ICMP :        15.11         7.41 ms              350
TCP upload avg :       162.38       164.10 Mbits/s         301
TCP upload sum :       162.38       164.10 Mbits/s         301
TCP upload::1  :       162.38       165.47 Mbits/s         252
root:~/flent$ flent -H 192.168.1.7 -t "sk_pacing_shift10" tcp_nup --test-parameter upload_streams=1
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-13T122108.347163.sk_pacing_shift10.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift10' (at 2018-08-13 04:21:08.347163):

                           avg       median          # data pts
Ping (ms) ICMP :        13.69         7.48 ms              350
TCP upload avg :       171.11       170.52 Mbits/s         301
TCP upload sum :       171.11       170.52 Mbits/s         301
TCP upload::1  :       171.11       171.36 Mbits/s         258


################################
Test result with upload_streams=5:
################################

sk_pacing_shift6:
root:~/flent/5stream$ flent -H 192.168.1.7 -t "sk_pacing_shift6" tcp_nup --test-parameter upload_streams=5
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-14T105332.356811.sk_pacing_shift6.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift6' (at 2018-08-14 02:53:32.356811):

                           avg       median          # data pts
Ping (ms) ICMP :        20.46        13.85 ms              350
TCP upload avg :        66.30        68.71 Mbits/s         301
TCP upload sum :       331.49       343.55 Mbits/s         301
TCP upload::1  :        60.80        64.65 Mbits/s         202
TCP upload::2  :        77.72        82.89 Mbits/s         211
TCP upload::3  :        60.52        56.09 Mbits/s         202
TCP upload::4  :        67.39        73.56 Mbits/s         204
TCP upload::5  :        65.06        71.97 Mbits/s         201

root:~/flent/5stream$ flent -H 192.168.1.7 -t "sk_pacing_shift6" tcp_nup --test-parameter upload_streams=5
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-14T105554.583603.sk_pacing_shift6.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift6' (at 2018-08-14 02:55:54.583603):

                           avg       median          # data pts
Ping (ms) ICMP :        20.86        13.80 ms              350
TCP upload avg :        75.88        83.17 Mbits/s         301
TCP upload sum :       379.42       415.84 Mbits/s         301
TCP upload::1  :        82.07        90.73 Mbits/s         225
TCP upload::2  :        74.08        78.29 Mbits/s         204
TCP upload::3  :        70.44        75.65 Mbits/s         217
TCP upload::4  :        82.70        92.86 Mbits/s         223
TCP upload::5  :        70.13        76.87 Mbits/s         210

sk_pacing_shift7:
root:~/flent/5stream$ flent -H 192.168.1.7 -t "sk_pacing_shift7" tcp_nup --test-parameter upload_streams=5
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-14T105759.169367.sk_pacing_shift7.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift7' (at 2018-08-14 02:57:59.169367):

                           avg       median          # data pts
Ping (ms) ICMP :        24.66        15.55 ms              350
TCP upload avg :        65.33        72.83 Mbits/s         301
TCP upload sum :       326.67       363.10 Mbits/s         301
TCP upload::1  :        77.60        92.93 Mbits/s         214
TCP upload::2  :        67.22        75.95 Mbits/s         213
TCP upload::3  :        65.81        74.54 Mbits/s         205
TCP upload::4  :        63.06        70.37 Mbits/s         207
TCP upload::5  :        52.98        55.78 Mbits/s         198

root:~/flent/5stream$ flent -H 192.168.1.7 -t "sk_pacing_shift7" tcp_nup --test-parameter upload_streams=5
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-14T105923.620572.sk_pacing_shift7.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift7' (at 2018-08-14 02:59:23.620572):

                           avg       median          # data pts
Ping (ms) ICMP :        25.03        14.25 ms              350
TCP upload avg :        74.35        85.64 Mbits/s         297
TCP upload sum :       371.77       428.19 Mbits/s         297
TCP upload::1  :        74.12        82.55 Mbits/s         216
TCP upload::2  :        67.78        71.87 Mbits/s         208
TCP upload::3  :        82.40        94.72 Mbits/s         210
TCP upload::4  :        70.77        82.43 Mbits/s         206
TCP upload::5  :        76.70        88.62 Mbits/s         210

sk_pacing_shift8:
root:~/flent/5stream$ flent -H 192.168.1.7 -t "sk_pacing_shift8" tcp_nup --test-parameter upload_streams=5
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-14T110334.670845.sk_pacing_shift8.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift8' (at 2018-08-14 03:03:34.670845):

                           avg       median          # data pts
Ping (ms) ICMP :        25.03        19.50 ms              350
TCP upload avg :        58.11        59.70 Mbits/s         301
TCP upload sum :       290.53       298.51 Mbits/s         301
TCP upload::1  :        51.37        51.74 Mbits/s         197
TCP upload::2  :        42.02        43.66 Mbits/s         192
TCP upload::3  :        61.17        62.33 Mbits/s         200
TCP upload::4  :        66.11        70.31 Mbits/s         198
TCP upload::5  :        69.86        76.31 Mbits/s         202

root:~/flent/5stream$ flent -H 192.168.1.7 -t "sk_pacing_shift8" tcp_nup --test-parameter upload_streams=5
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-14T110557.587769.sk_pacing_shift8.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift8' (at 2018-08-14 03:05:57.587769):

                           avg       median          # data pts
Ping (ms) ICMP :        21.50        13.05 ms              350
TCP upload avg :        61.59        62.00 Mbits/s         301
TCP upload sum :       307.93       310.01 Mbits/s         301
TCP upload::1  :        69.70        76.22 Mbits/s         210
TCP upload::2  :        68.51        74.88 Mbits/s         207
TCP upload::3  :        71.06        77.57 Mbits/s         200
TCP upload::4  :        47.08        51.42 Mbits/s         196
TCP upload::5  :        51.58        51.98 Mbits/s         203

sk_pacing_shift10:
root:~/flent/5stream$ flent -H 192.168.1.7 -t "sk_pacing_shift10" tcp_nup --test-parameter upload_streams=5
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-14T110814.434543.sk_pacing_shift10.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift10' (at 2018-08-14 03:08:14.434543):

                           avg       median          # data pts
Ping (ms) ICMP :        31.57        19.35 ms              350
TCP upload avg :        56.61        62.61 Mbits/s         301
TCP upload sum :       283.07       313.07 Mbits/s         301
TCP upload::1  :        39.39        42.96 Mbits/s         187
TCP upload::2  :        62.20        72.39 Mbits/s         193
TCP upload::3  :        61.72        74.31 Mbits/s         191
TCP upload::4  :        61.86        73.74 Mbits/s         190
TCP upload::5  :        57.90        65.11 Mbits/s         193

root:~/flent/5stream$ flent -H 192.168.1.7 -t "sk_pacing_shift10" tcp_nup --test-parameter upload_streams=5
Started Flent 1.2.2 using Python 2.7.12.
Starting tcp_nup test. Expected run time: 70 seconds.
Data file written to ./tcp_nup-2018-08-14T110931.986159.sk_pacing_shift10.flent.gz.
Summary of tcp_nup test run 'sk_pacing_shift10' (at 2018-08-14 03:09:31.986159):

                           avg       median          # data pts
Ping (ms) ICMP :        19.23        13.20 ms              350
TCP upload avg :        76.36        81.37 Mbits/s         301
TCP upload sum :       381.80       406.85 Mbits/s         301
TCP upload::1  :        64.95        67.91 Mbits/s         212
TCP upload::2  :        82.16        92.35 Mbits/s         215
TCP upload::3  :        67.51        70.18 Mbits/s         213
TCP upload::4  :        77.42        82.11 Mbits/s         232
TCP upload::5  :        89.76        99.96 Mbits/s         226

Friday, July 27, 2018

Linux bonding example, bond multiple network interfaces into one

source: http://fibrevillage.com/sysadmin/411-linux-bonding-example-bond-multiple-network-interfaces-into-one

The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical “bonded” interface. The behavior of the bonded interfaces depends upon the mode; generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring may be performed.

peter@peter-linux-dell:~/works/src/cosmos/hostap$ modinfo bonding
filename:       /lib/modules/4.4.0-21-generic/kernel/drivers/net/bonding/bonding.ko
author:         Thomas Davis, tadavis@lbl.gov and many others
description:    Ethernet Channel Bonding Driver, v3.7.1
version:        3.7.1
license:        GPL
alias:          rtnl-link-bond
srcversion:     84775F8435FCD8AD1DB80FB
depends:     
intree:         Y
vermagic:       4.4.0-21-generic SMP mod_unload modversions

***********
example
***********



ip link add bond0 type bond mode 1 primary wlan1 miimon 100

ip link set wlan1 down
ip link set wlan1 master bond0
ip link set wlan3 down
ip link set wlan3 master bond0
ip link set bond0 up
ifconfig bond0 192.168.33.100

cat /proc/net/bonding/bond0
cat /sys/class/net/meshbond/bonding/primary
cat /sys/class/net/meshbond/bonding/slaves
cat /sys/class/net/meshbond/bonding/active_slave

* to switch primary interface
echo wlan1 > /sys/class/net/meshbond/bonding/primary
It will change active_slave too.

Thursday, June 14, 2018

backtrace in application


https://www.gnu.org/software/libc/manual/html_node/Backtraces.html
*** hostapd has good sample too

Function: int backtrace (void **buffer, int size)
Function: char ** backtrace_symbols (void *const *buffer, int size)
Function: void backtrace_symbols_fd (void *const *buffer, int size, int fd)

#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>

/* Obtain a backtrace and print it to stdout. */
void
print_trace (void)
{
void *array[10];
size_t size;
char **strings;
size_t i;
size = backtrace (array, 10);
strings = backtrace_symbols (array, size);
printf ("Obtained %zd stack frames.\n", size);
for (i = 0; i < size; i++)
printf ("%s\n", strings[i]);
free (strings);
}

/* A dummy function to make the backtrace more interesting. */
void
dummy_function (void)
{
print_trace ();
}

int
main (void)
{
dummy_function ();
return 0;

}