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)
Sun, Aug 23, 11:33 PM
Unknown Object (File)
Sat, Aug 22, 11:05 AM
Unknown Object (File)
Fri, Aug 21, 4:07 PM
Unknown Object (File)
Fri, Aug 21, 2:19 PM
Unknown Object (File)
Thu, Aug 13, 2:52 PM
Unknown Object (File)
Mon, Aug 10, 12:37 AM
Unknown Object (File)
Sun, Aug 9, 10:59 PM
Unknown Object (File)
Sun, Aug 9, 3:36 AM
Subscribers

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 Skipped
Unit
Tests Skipped

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.