NETEM - fq_codel and pfifo_fast change/add tc rule

HI,
I am trying to understand netem operation over Linux

when I issued tc show command i see as follows:

ing:~ tc qdisc show dev en1
qdisc mq 0: root
qdisc fq_codel 0: parent :18 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 32Mb ecn
qdisc fq_codel 0: parent :17 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 32Mb ecn
qdisc fq_codel 0: parent :16 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 32Mb ecn
ing:~

Now when i try to add/change tc qdisc with a loss of 0.5% I see following error:

ing:~ tc qdisc change dev en1 root netem loss 0.5%
Error: Qdisc not found. To create specify NLM_F_CREATE flag.
ing:~ tc qdisc add dev en1 root netem loss 0.5%
Error: Specified qdisc not found.
ing:~


How to fix it ??
Also i tried setting back to pfifo_fast (default netem rule) and then tried to add loss of 0.5% i see following issue

ing:~ tc qdisc add dev en1 root pfifo_fast
ing:~ tc qdisc show dev en1
qdisc pfifo_fast 8004: root refcnt 92 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
ing:~ tc qdisc add dev en1 root netem loss 0.5%
Error: Exclusivity flag on, cannot modify.
ing:~

Here again I tried deleting pfifo_fast tc rule but fq_codel got set back and where i was unable to set loss 0.5%

As as recall, the netem package has issues related to granularity; and when I did a quick look, I found this in the man page:

This could be way off base, but perhaps using a 0.5% loss parameter is too granular for Linux?

Did you experiment using a larger parameter, such as 5% or even 2% first, to test?

Sorry if this is not helpful or I'm way off the mark.

EDIT: Yes, I am way off the mark... I just read this in the docs on Packet Loss:

Ref: networking:netem [Wiki]

Packet loss
 
Random packet loss is specified in the 'tc' command in percent. The smallest possible non-zero value is:

232 = 0.0000000232%

 # tc qdisc change dev eth0 root netem loss 0.1%
This causes 1/10th of a percent (i.e 1 out of 1000) packets to be randomly dropped.

An optional correlation may also be added. This causes the random number generator to be less random and can be used to emulate packet burst losses.

 # tc qdisc change dev eth0 root netem loss 0.3% 25%
This will cause 0.3% of packets to be lost, and each successive probability depends by a quarter on the last one.

Probn = .25 * Probn-1 + .75 * Random

I'm really interested in this topic, so looking forward to any updates. What version of Linux are you using? I may install netem on Ubuntu and check it out.

Thanks.

Thank you Neo :slight_smile: But still same issue even if i use 5% loss
I am using Rhel8.1

What happens if you run this?

modinfo sch_netem

On one of my Ubuntu servers, the results:

ubuntu:/tmp# modinfo sch_netem
filename:       /lib/modules/4.15.0-33-generic/kernel/net/sched/sch_netem.ko
license:        GPL
srcversion:     97B479D10ADED0DD99F6AEC
depends:        
retpoline:      Y
intree:         Y
name:           sch_netem
vermagic:       4.15.0-33-generic SMP mod_unload 
signat:         PKCS#7
signer:         
sig_key:        
sig_hashalgo:   md4

On a different Ubuntu server I get:

root@localhost:~# modinfo sch_netem
filename:       /lib/modules/4.15.0-32-generic/kernel/net/sched/sch_netem.ko
license:        GPL
srcversion:     97B479D10ADED0DD99F6AEC
depends:        
retpoline:      Y
intree:         Y
name:           sch_netem
vermagic:       4.15.0-32-generic SMP mod_unload 
signat:         PKCS#7
signer:         
sig_key:        
sig_hashalgo:   md4
ing:~ modinfo sch_netem
modinfo: ERROR: Module sch_netem not found.
ing:~

Actually kernel-modules-extra, iproute-tc packages are installed.. I guess this sch_netem is for ubuntu..
I am waiting :frowning: