Page MenuHomeFreeBSD

vtnet: fix computation of sysctl variables
ClosedPublic

Authored by tuexen on Aug 18 2025, 12:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 8, 1:40 AM
Unknown Object (File)
Sat, Nov 8, 1:09 AM
Unknown Object (File)
Thu, Nov 6, 3:09 PM
Unknown Object (File)
Wed, Nov 5, 11:23 AM
Unknown Object (File)
Tue, Nov 4, 7:34 AM
Unknown Object (File)
Mon, Oct 27, 11:27 PM
Unknown Object (File)
Sat, Oct 25, 1:39 AM
Unknown Object (File)
Wed, Oct 22, 8:08 AM

Details

Summary

Fix the aggregation of the interface level counters dev.vtnet.X.tx_task_rescheduled, dev.vtnet.X.tx_tso_offloaded, dev.vtnet.X.tx_csum_offloaded, dev.vtnet.X.rx_task_rescheduled, dev.vtnet.X.rx_csum_offloaded, and dev.vtnet.X.rx_csum_failed. Also ensure that dev.vtnet.X.tx_defrag_failed only counts the number of times m_defrag() fails.
While there, mark sysctl-variables used for exporting statistics as such (CTLFLAG_STATS).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Mark statistic related sysctl-variables as such.

tuexen edited the summary of this revision. (Show Details)

Mark the rest of the statistical sysctl-variable as such.

I tested this patch with D51686 applied by looking at the csum counters per queue and the general rx_csum_offloaded counter with sysctl dev.vtnet. With nc, I sent TCP packets from a Linux host to a FreeBSD VM that uses virtio with multiple queues.

Without this patch, only csum queue counters increase. The rx_csum_offloaded counter remains 0. With this patch, the rx_csum_offloaded counter is the sum of all csum queue counters as it should be.

I recommend to remove the statistic variables of accumulated values, such as rx_csum_offloaded. The functions like vtnet_sysctl_rx_csum_offloaded can calculate the value with a local variable instead. But it is probably better to do that in another review.

This revision is now accepted and ready to land.Aug 28 2025, 9:02 AM
This revision was automatically updated to reflect the committed changes.

I recommend to remove the statistic variables of accumulated values, such as rx_csum_offloaded. The functions like vtnet_sysctl_rx_csum_offloaded can calculate the value with a local variable instead. But it is probably better to do that in another review.

I agree. That is something for a cleanup patch, which does not change the functionality.