Avnu / tsn-doc

Documentation on TSN Linux components, interfaces and usage
BSD 3-Clause "New" or "Revised" License
40 stars 20 forks source link

calc-cbs-params.py uses kbit/s and bytes inconsistently #25

Open nmuh opened 3 years ago

nmuh commented 3 years ago

Hello, I'm currently researching on CBS and my computations on the CBS parameters differed from the script provided in this project. I had a look into it and found a potential bug in lines 28-29:

https://github.com/Avnu/tsn-doc/blob/722928bbf2316b3e71f755d49a460b540b9a73b0/misc/calc-cbs-params.py#L28-L29

The variables idleslope_a, sendslope_a and linkspeed are measured in kbit/s

https://github.com/Avnu/tsn-doc/blob/722928bbf2316b3e71f755d49a460b540b9a73b0/misc/calc-cbs-params.py#L85 https://github.com/Avnu/tsn-doc/blob/722928bbf2316b3e71f755d49a460b540b9a73b0/misc/calc-cbs-params.py#L137-L138 https://github.com/Avnu/tsn-doc/blob/722928bbf2316b3e71f755d49a460b540b9a73b0/misc/calc-cbs-params.py#L150

while max_frame_size_a and frame_non_sr are in Byte (if I did not miss anything). The usage of kbit/s and byte in one equation sounds wrong to me. Also Annex L section L.2 a) shows an example, where all computations are done in bit and bit/s.

If I missed a point somewhere in the code or the specification, I'd be thankful for pointing it out.

Thanks!

edersondisouza commented 3 years ago

Hi @nmuh,

You didn't missing anything on the code or specification. Note that calc-cbs-params.py returns results to be used to set the CBS qdisc (man 8 tc-cbs), which expects hicredit and locredit to be in bytes.

So it's more of a convenience to just copy its output as input for setting up CBS qdisc - without having to convert to bytes.