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, Dec 6, 11:00 PM
Unknown Object (File)
Sun, Nov 23, 10:47 AM
Unknown Object (File)
Sat, Nov 22, 11:42 AM
Unknown Object (File)
Mon, Nov 17, 11:53 PM
Unknown Object (File)
Mon, Nov 17, 10:53 AM
Unknown Object (File)
Sun, Nov 16, 10:54 PM
Unknown Object (File)
Nov 8 2025, 1:40 AM
Unknown Object (File)
Nov 8 2025, 1:09 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 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.