CAKE w/ DSCPs - cake-qos-simple

Inspired by @shm0 in this thread here, I have incorporated the facility in cake-qos-simple to overwrite the ECN bits on upload and/or download packets before the cake instances see them, e.g. to prevent the cake instances from marking any packets.

It seems there are situations in which it is desirable to prevent cake from marking rather than dropping packets.

Firstly, see discussion from around here:

Secondly, whenever an ISP bleaches ECN bits (which is common for mobile operators), the bleaching occurs prior to cake on download, but after cake on upload - thus cake is blind to the bleaching in the upload direction, and this means that by default cake will mark packets on upload in response to saturation, which is futile because the ISP ultimately bleaches those markings anyway. So in this situation it strikes me as better to proactively scrub the ECN bits on upload before cake sees the packets to prevent cake form ineffectively marking the ECN bits.

@dave14305, @dlakelan and @moeller0 does this approach seem reasonable to you:

https://github.com/lynxthecat/cake-qos-simple/compare/master...overwrite-ecn-bits

Here is a brief summary of my implementation.

For download, to overwrite the ECN bits the following tc arguments are added:

pipe pedit ex munge ip dsfield set ${overwrite_ecn_val_dl} retain 0x3

See here:

https://man7.org/linux/man-pages/man8/tc-pedit.8.html#EXAMPLES

For upload, the situation is more complicated.

Taking inspiration from:

https://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.qdisc.filters.html

I have implemented the following:

# create egress handle using prio qdisc
tc qdisc add dev "${ul_if}" handle 1: root prio
# filter the flow using pedit and send the filtered flow to band 1:1
tc filter add dev "${ul_if}" parent 1: protocol ip matchall action pedit ex munge ip dsfield set "${overwrite_ecn_val_ul}" retain 0x3 flowid 1:1
# then apply cake on band 1:1
tc qdisc add dev "${ul_if}" parent 1:1 cake bandwidth "${cake_ul_rate_Mbps}Mbit" ${cake_ul_options}

I tested this on upload and it works - ECN bits are overwritten before cake sees them and cake does not mark any packets on upload. I cannot test download because my ISP bleaches the ECN bits.

Any thoughts?

1 Like