What is a separate flow in Linux fq_codel?
Asked Answered
V

2

10

I'm setting up a proof of concept to throttle ingress traffic at terminal end (client):

eth0 -> ifb0 -> htb -> filter by ip -> htb rate -> fq_codel+ecn

I have 2 source ips for specific program I want to throttle. The program in question opens a bunch of tcp connections (downloads, thus ingress throttle), and I would like to both limit total ingress bandwidth it uses (done) and have fair scheduling between connections to same ip address (this question).

In the end there's 1 bucket with rate attached and 1 fq_codel instance.

I have it working, but I have some questions:

  • surely codel has separate queue per protocol (tcp vs udp)?
  • does codel have separate queues per source ip?
  • does codel have separate queue per tcp connection?
  • do I have to manually separate/tag flows?

Per internet research flow id is "hash of 5-tuple", question is, what elements of a packet are parts of the 5-tuple? Are both source and destination ports included?

Vanhomrigh answered 26/1, 2016 at 9:37 Comment(1)
P.S. I am looking for a better / more authoritative answer than my ownVanhomrigh
V
0

Per http://mdh.diva-portal.org/smash/get/diva2:754020/FULLTEXT01.pdf (someone's PhD thesis):

The flows are separated by hashing a 5-tuple value from the packet (default is src/dest port/ip and protocol) together with a random number

Apart from default bit, it's clear.

Vanhomrigh answered 5/2, 2016 at 8:7 Comment(0)
V
1

It seems both source and destination ports are included, at least by default:

http://lxr.free-electrons.com/source/net/core/flow_dissector.c#L655

655 /**
656  * __skb_get_hash: calculate a flow hash
657  * @skb: sk_buff to calculate flow hash from
658  *
659  * This function calculates a flow hash based on src/dst addresses
660  * and src/dst port numbers.  Sets hash in skb to non-zero hash value
661  * on success, zero indicates no valid hash.  Also, sets l4_hash in skb
662  * if hash is a canonical 4-tuple hash over transport ports.
663  */
664 void __skb_get_hash(struct sk_buff *skb)
Vanhomrigh answered 27/1, 2016 at 15:36 Comment(0)
V
0

Per http://mdh.diva-portal.org/smash/get/diva2:754020/FULLTEXT01.pdf (someone's PhD thesis):

The flows are separated by hashing a 5-tuple value from the packet (default is src/dest port/ip and protocol) together with a random number

Apart from default bit, it's clear.

Vanhomrigh answered 5/2, 2016 at 8:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.