vtnet: Prefer "hardware" accounting for the multicast and total number of octets sent

When ALTQ is enabled, this driver does "hardware" accounting and soft
accounting at the same time. Prefer the "hardware" one to make the logic
simpler.

Reviewed by:	zlei
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D44817
This commit is contained in:
Joyu Liao 2025-09-05 04:00:28 +08:00 committed by Zhenlei Huang
parent a14d561e58
commit 2a346c8993

View file

@ -3042,13 +3042,9 @@ vtnet_get_counter(if_t ifp, ift_counter cnt)
case IFCOUNTER_OPACKETS:
return (txaccum.vtxs_opackets);
case IFCOUNTER_OBYTES:
if (!VTNET_ALTQ_ENABLED)
return (txaccum.vtxs_obytes);
/* FALLTHROUGH */
return (txaccum.vtxs_obytes);
case IFCOUNTER_OMCASTS:
if (!VTNET_ALTQ_ENABLED)
return (txaccum.vtxs_omcasts);
/* FALLTHROUGH */
return (txaccum.vtxs_omcasts);
default:
return (if_get_counter_default(ifp, cnt));
}