From nobody Thu Sep 4 20:01:42 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cHr3B4k4rz66gRW; Thu, 04 Sep 2025 20:01:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cHr3B3DtCz3YKY; Thu, 04 Sep 2025 20:01:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757016102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zl9kqc9bhKaYhJq0/SaAJZsLcfobfO/lYQoDm3ZtcCw=; b=VQ2Rm0We+PiI5HHUEozzPBpEjDiYVKAkAbBzDjp9u/sAKdDGV5wPFb1g9dmwmj5E+e+siL 616KGixcxXp2Sl6/pP+d1VzsDcN8fBQQNljqVfkO8smy/NeS5m7BY6mgFkO5H/u6cTwmWD tVYHYmadaF1912zDWgJjlFq40NsbaBCPnTVc8fNMkAFAxZrs2rvINQU/ANga4Sm57/8LSi QY4GNEhfK0Ntzf36RLLS/8xy5LdCyaqHFUvVAv7DnUHO0cV19XFJmamAm6jB2crPCHkwiP xSqxmxXbw6szLHDBjjKt71gxJst2hgmSjz8JEcCHlZYyo8YfvGWnFzX1aezFuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757016102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zl9kqc9bhKaYhJq0/SaAJZsLcfobfO/lYQoDm3ZtcCw=; b=YJHJqIXxUYGbsQLr7oa3iXtkWqFLZfPqZcK9iW2kFwK2wrtMZhb8UDWa7jx9+k9qPSQtkG paW9/A6P796+3XG76TUlwapxhAR/etDMzrjNjcSME+lpGazPC4/f0wtjUoNs/StWHSDrte YTJugLazF8E3momemx3t9D20ysXULpHFSEj2IvahiuJWO/pG3TJfUAweWB20MiT74QGRXM eKGQERWkt6nQIu6soPaq3BH/2Tn+SDFkLgP4FJlJeMUomRhm2L5Oj4c6yEUpuL7iFPm8mB lssbHq7LNGyyeuuL0bbWeO4rMAoCag7wOOninKVpDkZcLMDXwpa4/dlvyJKiYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757016102; a=rsa-sha256; cv=none; b=hnv0PxlXGGM0Bkf40yYbr4qrE9er2LxUMknVE3lyrb6QQ6K1KEEa1EliCily+xBLri9gMv MPp/ghxyFnXaOdKw/zCp2hJrR9HmWrXNQ3yR8YLa/ra38EzO4Ruw7mlBKUYdKgzCy9CBCh 9wObgbjf1oNekqdheYvQRZkFK9eDxtWA8+exWehQQhHGFCLZG2F8ZVtUKsIKZfNL4L9N/p JhDLiFEc1RSIczHEVqSBjNBC75ubBh2I1gmNGWA1Tng78qprkuPUS1z8fpFy+m3ZYVRlbn Zjqg1hRhxqhKPRVAd0cIimX0xWSO9lbYITyHU5Ju8u8x1GvuHS2y9WVKHkwBMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cHr3B2YQHz2d8; Thu, 04 Sep 2025 20:01:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 584K1g7I042030; Thu, 4 Sep 2025 20:01:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 584K1g0G042027; Thu, 4 Sep 2025 20:01:42 GMT (envelope-from git) Date: Thu, 4 Sep 2025 20:01:42 GMT Message-Id: <202509042001.584K1g0G042027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: a14d561e5852 - main - vtnet: Do "hardware" accounting for the total number of received octets List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a14d561e58529c9686a2efc47f4828ad82026e63 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=a14d561e58529c9686a2efc47f4828ad82026e63 commit a14d561e58529c9686a2efc47f4828ad82026e63 Author: Joyu Liao AuthorDate: 2025-09-04 20:00:27 +0000 Commit: Zhenlei Huang CommitDate: 2025-09-04 20:00:27 +0000 vtnet: Do "hardware" accounting for the total number of received octets While here, advertise the IFCAP_HWSTATS capability to avoid the net stack from double counting it. Co-authored-by: zlei Reviewed by: zlei MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D44816 --- sys/dev/virtio/network/if_vtnet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 4f19af6281a3..ec4282e0741a 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -1178,6 +1178,7 @@ vtnet_setup_interface(struct vtnet_softc *sc) if (sc->vtnet_max_mtu >= ETHERMTU_JUMBO) if_setcapabilitiesbit(ifp, IFCAP_JUMBO_MTU, 0); if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0); + if_setcapabilitiesbit(ifp, IFCAP_HWSTATS, 0); /* * Capabilities after here are not enabled by default. @@ -3036,6 +3037,8 @@ vtnet_get_counter(if_t ifp, ift_counter cnt) return (rxaccum.vrxs_iqdrops); case IFCOUNTER_IERRORS: return (rxaccum.vrxs_ierrors); + case IFCOUNTER_IBYTES: + return (rxaccum.vrxs_ibytes); case IFCOUNTER_OPACKETS: return (txaccum.vtxs_opackets); case IFCOUNTER_OBYTES: