Subject: Expected behaviour of `tc qdisc replace`?

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Wed, 04 Nov 2015 16:34:49 +0100

Hi

I recently noticed that the behaviour of `tc qdisc replace` differs
depending on whether the qdisc being replaced is of the same kind as the
replacement. I.e.:

# tc qdisc del dev eno1 root
# tc qdisc replace dev eno1 root fq_codel target 100ms interval 200ms
# tc qdisc replace dev eno1 root fq_codel target 5ms                 
# tc qdisc
qdisc fq_codel 8007: dev eno1 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 200.0ms ecn 
# tc qdisc del dev eno1 root                                         
# tc qdisc replace dev eno1 root fq_codel target 5ms
# tc qdisc                                          
qdisc fq_codel 8008: dev eno1 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms ecn 

Notice the difference in interval between the two output lines from tc.

Now, according to the tc man page, `tc qdisc replace` "Performs a nearly
atomic remove/add on an existing node id." In which case I would expect
it to *not* retain settings from the previous configuration.

So my question is: is this a bug, or is it expected behaviour? And if
the latter, what is the difference between `tc qdisc replace` and `tc
qdisc change` then supposed to be?

-Toke