Linux compile:
Get the source code
Apt-get update
Apt-get install linux-source edit the config file: root@pc:~/kernel_src/linux-2.6.34# make menuconfig
Processor type and features --->
[ ] Tickless System (Dynamic Ticks)
[*] High Resolution Timer Support
Processor family (Opteron/Athlon64/Hammer/K8) --->
Preemption Model (Preemptible Kernel (Low-Latency Desktop)) --->
Timer frequency (2000 HZ) --->
Power management and ACPI options --->
CPU Frequency scaling --->[ ] CPU Frequency scaling
Kernel hacking --->[ ] Kernel debugging make oldconfig
Then, start to compile: root@pc:~/kernel_src/linux-2.6.34# make -j9
Start compiling to kernel modules:
root@pc:~/kernel_src/linux-2.6.34# make -j9 modules
Install kernel modules (become a root user, use su command): root@pc:~/kernel_src/linux-2.6.34# make -j9 modules_install
Install kernel root@pc:~/kernel_src/linux-2.6.34# make -j9 install
Create an initrd image
# cd /boot !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! root@pc:/boot# mkinitramfs -o initrd.img-2.6.34-2kHZ 2.6.34-2kHZ
## the last name 2.6.34-2kHZ locates in /lib/modules/2.6.34-2kHZ update grub2: root@pc:/boot# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.34-2kHZ
Found initrd image: /boot/initrd.img-2.6.34-2kHZ
Found linux image: /boot/vmlinuz-2.6.32.15+drm33.5-base
Found initrd image: /boot/initrd.img-2.6.32.15+drm33.5-base
Found linux image: /boot/vmlinuz-2.6.32-21-server
Found initrd image: /boot/initrd.img-2.6.32-21-server
Found memtest86+ image: /memtest86+.bin done patch kernel: http://www.cyberciti.biz/tips/how-to-patch-running-linux-kernel.html
Rebuilding a single kernel module in Ubuntu
In the Ubuntu source directory,
Make M=/path/to/module make M=~/linux-2.6.39.3/net/sched/
And then do: rmmod module, and modprobe module, insmod?
For Linux Queue, need to change the parameters for RED, CHOKE…
Parameter “max” is not working in int_32, so change it to int_64 root@router1:/usr/src/linux-2.6.39.3# grep -r "linxue" .
./net/sched/sch_choke.c: //linxue
./net/sched/sch_choke.c: //printk(KERN_DEBUG "\n linxue");
./net/sched/sch_choke.c.bak: //linxue
./include/linux/pkt_sched.h://linxue
./include/linux/pkt_sched.h://linxue
./include/net/red.h://linxue
./include/net/red.h://linxue
Sender receiver parameters: sysctl –w net.ipv4.tcp_sack=1 sysctl –w net.ipv4.tcp_dsack=0 sysctl –w net.ipv4.tcp_fack=0 sysctl -w net.core.rmem_max=800000000 sysctl -w net.core.wmem_max=800000000
sysctl -w net.ipv4.tcp_rmem=”4096 400000000 800000000”
sysctl -w net.ipv4.tcp_wmem=”4096 400000000 800000000” sysctl -w net.core.netdev_max_backlog=300000 sysctl -w net.ipv4.tcp_timestamps=1 sysctl -w net.ipv4.tcp_mem=”4096 400000000 800000000” sysctl -w net.core.optmem_max=800000000
Dummynet parameter: sysctl hw.intr_storm_threshold=100000
sysctl kern.polling.idle_poll=1
user space change in tc, iproute package
./include/linux/pkt_sched.h
From 32 bit to 64 bit for red
./tc/q_red.c
Before compile user space tc, install bison and libdb-dev
Get the flow sequence in the queue using tcpdump to get the packets in the interface. Then use grep to get the tcp ports.
Get raw data to avoid kernel drop packets: tcpdump -i eth6 -t -w 1_flow_seq_log read from raw date tcpdump -r 1_flow_seq_log > 1_flowseq.log grep the tcp ports: grep -P "([\d]{5}) >" 1_flowseq.log > 1_flowseq_result get the exact 5 digits: grep -o -P "([\d]{5})" 1_flowseq_result > 1_flowseq_result_final
TCP supported by Linux 3.1.4
*
* TCP: advanced congestion control
*
TCP: advanced congestion control (TCP_CONG_ADVANCED) [Y/n/?] y
Binary Increase Congestion (BIC) control (TCP_CONG_BIC) [Y/n/m/?] y
CUBIC TCP (TCP_CONG_CUBIC) [Y/n/m/?] y
TCP Westwood+ (TCP_CONG_WESTWOOD) [Y/n/m/?] y
H-TCP (TCP_CONG_HTCP) [Y/n/m/?] y
High Speed TCP (TCP_CONG_HSTCP) [Y/n/m/?] y
TCP-Hybla congestion control algorithm (TCP_CONG_HYBLA) [Y/n/m/?] y
TCP Vegas (TCP_CONG_VEGAS) [Y/?] y
Scalable TCP (TCP_CONG_SCALABLE) [Y/n/m/?] y
TCP Low Priority (TCP_CONG_LP) [Y/n/m/?] y
TCP Veno (TCP_CONG_VENO) [Y/n/m/?] y
YeAH TCP (TCP_CONG_YEAH) [Y/n/m/?] y
TCP Illinois (TCP_CONG_ILLINOIS) [Y/n/m/?] y
Default TCP congestion control
1. Bic (DEFAULT_BIC)
> 2. Cubic (DEFAULT_CUBIC)
3. Htcp (DEFAULT_HTCP)
4. Hybla (DEFAULT_HYBLA) (NEW)
5. Vegas (DEFAULT_VEGAS)
6. Veno (DEFAULT_VENO) (NEW)
7. Westwood (DEFAULT_WESTWOOD)
8. Reno (DEFAULT_RENO)
Queue Schemes supported by Linux 3.1.4
*
* Queueing/Scheduling
*
Class Based Queueing (CBQ) (NET_SCH_CBQ) [M/n/y/?] m
Hierarchical Token Bucket (HTB) (NET_SCH_HTB) [M/n/y/?] m
Hierarchical Fair Service Curve (HFSC) (NET_SCH_HFSC) [M/n/y/?] m
ATM Virtual Circuits (ATM) (NET_SCH_ATM) [M/n/?] m
Multi Band Priority Queueing (PRIO) (NET_SCH_PRIO) [M/n/y/?] m
Hardware Multiqueue-aware Multi Band Queuing (MULTIQ) (NET_SCH_MULTIQ) [M/n/y/?] m
Random Early Detection (RED) (NET_SCH_RED) [M/n/y/?] m
Stochastic Fair Blue (SFB) (NET_SCH_SFB) [N/m/y/?] (NEW) m
Stochastic Fairness Queueing (SFQ) (NET_SCH_SFQ) [M/n/y/?] m
True Link Equalizer (TEQL) (NET_SCH_TEQL) [M/n/y/?] m
Token Bucket Filter (TBF) (NET_SCH_TBF) [M/n/y/?] m
Generic Random Early Detection (GRED) (NET_SCH_GRED) [M/n/y/?] m
Differentiated Services marker (DSMARK) (NET_SCH_DSMARK) [M/n/y/?] m
Network emulator (NETEM) (NET_SCH_NETEM) [M/n/y/?] m
Deficit Round Robin scheduler (DRR) (NET_SCH_DRR) [M/n/y/?] m
Multi-queue priority scheduler (MQPRIO) (NET_SCH_MQPRIO) [N/m/y/?] (NEW) m
CHOose and Keep responsive flow scheduler (CHOKE) (NET_SCH_CHOKE) [N/m/y/?] (NEW) m
Quick Fair Queueing scheduler (QFQ) (NET_SCH_QFQ) [N/m/y/?] (NEW) m
Ingress Qdisc (NET_SCH_INGRESS) [M/n/y/?] m