TX/RX statistics need to be swapped

Hi, virDomainNetTypeSharesHostView[1] contains the logic where for some interface types it swaps TX and RX values, because what TX from the inside is RX on the outside and vice versa. We observe a configuration where <interface type='ethernet' /> shows swapped values in statistics, because, apparently, the values are swapped once inside the kernel when going from the inside to the outside, but not swapped second time because of the mentioned logic. Is this a bug? Why in the virDomainNetTypeSharesHostView[1] ethernet is marked as 'non-swapped'? Maybe we need some more fine-grained way of determining whether to swap value a second time? Thanks, Oleg [1]: https://gitlab.com/libvirt/libvirt/-/blob/master/src/conf/domain_conf.c#L290...

On 11/23/22 15:12, Oleg Vasilev wrote:
Hi,
virDomainNetTypeSharesHostView[1] contains the logic where for some interface types it swaps TX and RX values, because what TX from the inside is RX on the outside and vice versa.
We observe a configuration where <interface type='ethernet' /> shows swapped values in statistics, because, apparently, the values are swapped once inside the kernel when going from the inside to the outside, but not swapped second time because of the mentioned logic.
Is this a bug? Why in the virDomainNetTypeSharesHostView[1] ethernet is marked as 'non-swapped'?
Yeah, this looks like a bug. Another scenario where this demonstrates itself is QoS. I mean, for the same <bandwidth/> setting one gets different values set for interface type network and ethernet. Let me post a patch. Michal

On 24.11.2022 14:53, Michal Prívozník wrote:
On 11/23/22 15:12, Oleg Vasilev wrote:
Hi,
virDomainNetTypeSharesHostView[1] contains the logic where for some interface types it swaps TX and RX values, because what TX from the inside is RX on the outside and vice versa.
We observe a configuration where <interface type='ethernet' /> shows swapped values in statistics, because, apparently, the values are swapped once inside the kernel when going from the inside to the outside, but not swapped second time because of the mentioned logic.
Is this a bug? Why in the virDomainNetTypeSharesHostView[1] ethernet is marked as 'non-swapped'?
Yeah, this looks like a bug. Another scenario where this demonstrates itself is QoS. I mean, for the same <bandwidth/> setting one gets different values set for interface type network and ethernet. Let me post a patch. Great, thanks! I'll try to test it on our scenario to verify.
Oleg
participants (2)
-
Michal Prívozník
-
Oleg Vasilev