From nobody Sun Aug 2 04:27:35 2026 X-Original-To: dev-commits-src-all@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 4hCRc76dXQz6n6QD for ; Sun, 02 Aug 2026 04:27:35 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hCRc74bvZz4FZc for ; Sun, 02 Aug 2026 04:27:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785644855; 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=QXdYyK0IfjMo6trSySeEU0e3+UrC4lmezl3emEfXCYg=; b=lJ7pkfhhaN+/uHX42fuIT2i0jME88gvq3aoE4bNEaiwTpvC5Is/1SV6p9tKrgtOnqczUsA QZ96itfM4eY0UxtsTfTPJpnCkx3BN8QwiqTT6YBcbYzAHHTJpgiLEyUk6FgZ5rz0DvFuQZ PJJ2mz7zwtVUkO7ekxd3D6/zC6isYCqW2oX2WQfkx3G8VN8IIsSyBuTTZo/BI9GqCdVcy5 3u/YLOwiw/jq7lz77SKNUBtLbxZ1AKhFV5DouyUJFXUu3Guaf4xcxLQcS3iYHNYqbvQgx5 NPXxawq5Sd5JyS2f9qnGDSlxHHQUVdw8kE1BZKUlimuVplwalBuYHCembB5xng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785644855; a=rsa-sha256; cv=none; b=XcaEePY/2ZtpP5V1sZESAK5NU9y2Bd3T/mpcJfkAHVKif+amx2oxT/JiLffptUwcU5kyK0 2kgIF8l3YW+EHfthLenhkcqzgYbiHNQq3zkNhZ0GGBdmM+E/lLRfbomwqczLRZZ0TZX9iq SwC3PdQrCA8EfJvF96J44OBIo7WamOTAb5dG3MQEaHkF/2tuitECYW8ipKTEUNPphxsUSV 2snwWJDnKWaGmD+9lnZruxWG1dzSiSFRgQAAL9lF/a1IDbGzwSbnUxGaE2iwZeoNWaiiAx tjfev6li3rYYcQY3hHO2rZvo94eUJtMEQ9rk6mqAJcXaPq/Aqua7FeUXtgmbnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785644855; 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=QXdYyK0IfjMo6trSySeEU0e3+UrC4lmezl3emEfXCYg=; b=CZOBXiS32HhradiVVRG8HKECmzxG4VEDGsbdvmzpeMu+0ZIE/bJGEGECawSSDsXiiNJ88a NZ1YHpVPqJulEXp+nkW/Ndtr+eu68XujPRoLlqaevOo3OObubeyFzefgz523Yo+2ja9cNF Ufn9N32FkdCHXby/Vs6Rmhgzs5dbdpy2rCtdPjuQLFsaYoOeF6ljRPtC4J4LU5+zJGFSWA Fowqn5GgatjwTO9X9xVdQ3icXQPOdfHgHjH9g5zIjF1e9UlfZsYp4QjAqcsB4EmZOV/9Zv d+lXlxpUIH/XlOzMs7kQhJYkXvspy3ZzquwrOKWUmIiYz16Uma3TYoOWraOfSw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hCRc73XFdz1D6g for ; Sun, 02 Aug 2026 04:27:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c602 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 02 Aug 2026 04:27:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: dcf605e67110 - stable/14 - e1000: count TSO wire segments in the AIM counters List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: dcf605e6711023feab55ddd6feddcbe682ad4760 Auto-Submitted: auto-generated Date: Sun, 02 Aug 2026 04:27:35 +0000 Message-Id: <6a6ec737.3c602.4d7eb7ae@gitrepo.freebsd.org> The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=dcf605e6711023feab55ddd6feddcbe682ad4760 commit dcf605e6711023feab55ddd6feddcbe682ad4760 Author: Kevin Bowling AuthorDate: 2026-07-25 12:33:38 +0000 Commit: Kevin Bowling CommitDate: 2026-08-02 04:26:00 +0000 e1000: count TSO wire segments in the AIM counters The transmit paths billed one packet of ipi_len bytes per request. For TSO that is the whole unsegmented payload, up to 64KB, so the average size the moderation calculation sees is not a size that appears on the wire. Count the segments the hardware will put on the wire and the header each of them carries. Non-TSO accounting is unchanged. (cherry picked from commit 072e0983d7bce80356740324973993393e77023a) --- sys/dev/e1000/em_txrx.c | 21 +++++++++++++++++++-- sys/dev/e1000/igb_txrx.c | 21 +++++++++++++++++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c index 889c36c3fb84..126364b00734 100644 --- a/sys/dev/e1000/em_txrx.c +++ b/sys/dev/e1000/em_txrx.c @@ -463,10 +463,27 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) first, pidx_last, i); pi->ipi_new_pidx = i; - /* Sent data accounting for AIM */ + /* + * Sent data accounting for AIM. For TSO, ipi_len is the whole + * unsegmented payload, which is not a size the moderation + * calculation can use. Count the segments the hardware will put on + * the wire and the header each of them carries, so that the average + * it sees is a wire packet. + */ + if (do_tso && pi->ipi_tso_segsz != 0) { + u32 hdrlen, segs; + + hdrlen = pi->ipi_ehdrlen + pi->ipi_ip_hlen + pi->ipi_tcp_hlen; + if (pi->ipi_len > hdrlen) { + segs = howmany(pi->ipi_len - hdrlen, pi->ipi_tso_segsz); + txr->tx_bytes += pi->ipi_len + (segs - 1) * hdrlen; + txr->tx_packets += segs; + return (0); + } + } + txr->tx_bytes += pi->ipi_len; ++txr->tx_packets; - return (0); } diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 62cafff4010a..c34bf3874e02 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -291,10 +291,27 @@ igb_isc_txd_encap(void *arg, if_pkt_info_t pi) txd->read.cmd_type_len |= htole32(E1000_TXD_CMD_EOP | txd_flags); pi->ipi_new_pidx = i; - /* Sent data accounting for AIM */ + /* + * Sent data accounting for AIM. For TSO, ipi_len is the whole + * unsegmented payload, which is not a size the moderation calculation + * can use. Count the segments the hardware will put on the wire and + * the header each of them carries, so that the average it sees is a + * wire packet. + */ + if ((pi->ipi_csum_flags & CSUM_TSO) && pi->ipi_tso_segsz != 0) { + u32 hdrlen, segs; + + hdrlen = pi->ipi_ehdrlen + pi->ipi_ip_hlen + pi->ipi_tcp_hlen; + if (pi->ipi_len > hdrlen) { + segs = howmany(pi->ipi_len - hdrlen, pi->ipi_tso_segsz); + txr->tx_bytes += pi->ipi_len + (segs - 1) * hdrlen; + txr->tx_packets += segs; + return (0); + } + } + txr->tx_bytes += pi->ipi_len; ++txr->tx_packets; - return (0); }