Tuesday, February 27, 2018

update kernel defconfig



make ARCH=arm xxx_defconfig
make ARCH=arm menuconfig
make savedefconfig
cp ./defconfig ./arch/arm/configs/xxx_defconfig

Tuesday, February 13, 2018

time measurement in kernel

ktime_t start_time, end_time;
s64 delay_time;

start_time = ktime_get();
udelay(10);
end_time = ktime_get();

delay_time = ktime_to_ns(end_time) - ktime_to_ns(start_time);
printk("delay_time %lld nsec\n", delay_time);

Friday, February 2, 2018

tc - linux traffic control

sudo tc qdisc add dev eth0 root fq_codel

sudo sysctl -w net.core.default_qdisc=fq_codel

* man tc fq_codel

FQ_CoDel(8)                                                        Linux                                                   
NAME
       CoDel - Fair Queuing (FQ) with Controlled Delay (CoDel)

SYNOPSIS
       tc qdisc ... fq_codel [ limit PACKETS ] [ flows NUMBER ] [ target TIME ] [ interval TIME ] [ quantum BYTES ] [ ecn | noecn ]

qdisc fq_codel 8001: dev wlan0 root refcnt 5 limit 1024p flows 1024 quantum 300 target 5.0ms interval 100.0ms ecn

qdisc
        [ add | change | replace | link | delete ]
dev DEV

[ parent qdisc-id | root ]

qdisc name [qdisc specific parameters ]

tc change dev wifi0 root cake bandwidth 10mbit

sudo tc -s qdisc show
       -s, -stats, -statistics
              output more statistics about packet usage.

Adding this to /etc/sysctl.conf or /etc/sysctl.d/bufferbloat.conf is
generally what we do

net.core.default_qdisc=fq_codel

A lot of us are running ecn by default and put in ecn on also:

net.ipv4.tcp_ecn=1

tc qdisc add dev wlan0 root fq_codel target 50.0ms interval 1000.0ms ecn
tc -s qdisc show wlan0 ap0
tc qdisc change dev wlan0 root fq_codel target 10.0ms interval 1000.0ms noecn
tc qdisc del dev wlan0 root fq_codel