> From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Thursday, 1 August 2024 18.18 > > On Thu, 1 Aug 2024 16:03:12 +0000 > Morten Brørup <m...@smartsharesystems.com> wrote: > > > Optimized the performance of updating the virtio statistics counters > by > > reducing the number of branches. > > > > Ordered the packet size comparisons according to the probability with > > typical internet traffic mix. > > > > Signed-off-by: Morten Brørup <m...@smartsharesystems.com> > > LGTM > Acked-by: Stephen Hemminger <step...@networkplumber.org> > > I wonder if other software drivers could use similar counters?
While working on this, I noticed the netvsc driver and vhost lib also have size_bins [1], so they are likely candidates. The netvsc's hn_update_packet_stats() function [2] seems like 100 % copy-paste, and should be easy to paste over with the new implementation. The vhost lib's vhost_queue_stats_update() function [3] also looks rather similar to the original variant, and could benefit too. [1]: https://elixir.bootlin.com/dpdk/v24.07/A/ident/size_bins [2]: https://elixir.bootlin.com/dpdk/v24.07/source/drivers/net/netvsc/hn_rxtx.c#L108 [3]: https://elixir.bootlin.com/dpdk/v24.07/source/lib/vhost/virtio_net.c#L56 I'll take a look around and add similar patches for what I find. Thanks for the reminder.