Re: [B.A.T.M.A.N.] [RFC 12/23] batman-adv: add base throughput attribute

Antonio Quartulli
2014-02-13T09:53:09Z

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]

On 13/02/14 10:36, Andrew Lunn wrote:
>>>> +/**
>>>> + * BATADV_DEFAULT_BASE_THROUGHPUT - default value used as throughput for
>>>> + * hard_ifaces for which it is not possible to measure/estimate the real one.
>>>> + * Value is expressed in Mbps/10
>>>
>>> Mbps/10 is a rather odd unit. How about just Kbps?
>>
>> This is the unit used in cfg/mac80211 because most of the rates are
>> either in the form of XX.0Mbps of XX.YMbps (so just one decimal number
>> needs to be saved).
>> Moreover I thought that having an higher precision is not very useful
>> because the routing decision cannot be taken on such a fine grained value.
>> Actually the originator table prints the metric in Mbps (XX.YMbps).
>
> It is not precision which i think is important, it is having a unit a
> user expects. Networking people work in Kbps, or MBps. If it is
> printed in the originator table as XX.YMBps, then i think this sysfs
> file also needs to be XX.YMBps. That does however make your parsing
> more complex, since it is no longer an int. I suppose there is the use
> case of an ADSL link, with bandwidth of say 2Mbps down, 256Kbps up,
> and then you do need the decimal point in XX.YMBps.

I just checked what we do in the "improved GW bandwidth advertisement"
introduced not so much time ago:

- we store the bandwidth value in Mbps/10
- we print it in the form XX.YMbps
+ but we allow the user to specify the unit when entering the value in
the sysfs interface: "xxxMbps" or "yyyKbps".

This way the user can pick the favourite unit, but of course the value
is truncated (in the case of Kbps) to fit the internal representation.

What do you think about this approach?
I also think we have to keep the two consistent with each other (it
would allow me to re-use the same parsing function).

Cheers,

--
Antonio Quartulli

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]