03/04/2020 11:45, Morten Brørup: > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Ivan Dyukov > > Sent: Friday, April 3, 2020 10:06 AM > > > > 02.04.2020 23:58, Thomas Monjalon пишет: > > > 02/04/2020 22:41, Ivan Dyukov: > > >> 02.04.2020 16:50, Morten Brørup пишет: > > >>>>>> Yes, if speed is unknown, it should be reported as 0. > > >>> Could the DPDK vNIC PMDs be updated accordingly? At least the > > virtio driver... > > >> Current version of dpdk code on master always returns 10G speed for > > >> virtio device and many application rely on it. e.g. pktgen. If we'll > > >> change it, we break the apps. > > > I am OK with breaking such strange assumption. > > > I can understand the need for specifying the underlying hardware > > speed > > > through virtio driver. But hardcoded 10G... no! > > > > > > > > > > > OK. I'll redefine it to 0xffffffff, like in kernel virtio. > > > > Thomas, you were opposed to using 1 as the special value for "unknown", as it > is likely interpreted as 1 Mbps instead, and I agree with your reasoning on > that. > > Since using an extremely large value is as close to infinity we can get, > Ivan's suggested value makes sense to me instead: > > +#define ETH_SPEED_NUM_UNKNOWN 0xffffffff /**< Unknown */ > > In theory, it also addresses Stephen's concern about breaking the ABI for > existing applications that look at speed. They will get a non-zero speed, > which is not a randomly chosen fake 10G speed; so I consider it an > improvement. > Although in reality, such applications may still break if they are unable to > handle the extreme speed of 4.3 Pbps. > > I considered "Unlimited" instead of "Unknown", but Unlimited is not really > correct, so I settled with Unknown.
Yes it makes sense. The only drawback is that the information "speed is accurate" will be checked against two constants: ETH_SPEED_NUM_NONE or ETH_SPEED_NUM_UNKNOWN It can be mitigated with a function though.