From nobody Sun Aug 2 04:23:00 2026 X-Original-To: dev-commits-src-branches@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 4hCRVs1rqTz6n64P for ; Sun, 02 Aug 2026 04:23:01 +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 4hCRVs0Z8cz4983 for ; Sun, 02 Aug 2026 04:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785644581; 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=l+OOSB6dQXGr8yp6wKh9locGQc6RpMRVaLa/Na9Otlg=; b=omoLWceATEyNdizUnFdxfZme1YCk0sKFfdCi1/WawJQiIijt8OuhKqnW6oLynNmnwymW0H hRVJj7MSUSWQHh2SlVS+DPRoqjEcebcH1ySn20Hptzpy18zdG4hKQnarcHTqwqm7vwBHtc NSoisRTtK3ztmyaj5kW659f+0VFQLE+vHngM9DbY6ogQBIZTr/UhAEfjvf/hzuOrl7Hln7 Kpw1xjk9vhAbpkhm07UaME39NlofVxl2HyvwkDGGuHCWnjpXYOUyvLpZwd9QJNysp8zdoU ac51FDcLjiQ07r1nG/82rsbJpRWDBqmuhDjgid5w12cA9whiFnDlk9XMG4d1Iw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785644581; a=rsa-sha256; cv=none; b=OLUGZQ3BEjlBJUvoAz1CqEJyt09xIoqEYwCFAhEEYenoXwrY/L9nEzw6NFwqFeP4C0+yaa CBGyJAhuW8lF4CJELO/QhXk03x0ieD87X/uJF4OSVDXt8Y7C6ofF420PiYbFu3oD22TlfQ 4oAucePdsqRdNob3ZN0Pjwg6rhK6Nh4n/eRTEJUCFIM3iiwj89vTWySdCaYlzIXp6/rB+2 gP4bqHGFDukbk02lXLiFdCMQojW1J12c1oK/MDLcF+gq0xDR9FFJTY1nmvu2mfJvvozLrZ 46MHmmbJfPbNtlSVf5gF3ViJwXvZu8avo0vQWfS0r+NlzRFfKLTR8nBCBp5qSw== 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=1785644581; 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=l+OOSB6dQXGr8yp6wKh9locGQc6RpMRVaLa/Na9Otlg=; b=JCaH3OKNSOcywHN3AD0jQ1dYcqGmA/hMalflG/HwJEtM7QV7PmsFyWmU50ERP7Im+OtdrI YgqVNOwt2xp5riTx1rcOexQDOXNe7xBjTjfdoyzSvTUcZ5pAwlH19AgpcD9srqSqhU3LwN 1PrGJIOIJ+apMIRCtf3JMRQ3ziL595O6oGZSVGh5FEcMCQew3IrfGB3fIAsJqaq6WrpjV4 d/HolZrcSmhu1P43fTejjOWJEZUzEDpVrPP8n/bXhJUD3o5AMgDY/7ro+VK2elDrYLrthD MhW0MoTBpat49UM8zNAqIzkkViPyrQI0BUTxNPtNQvV01JFOwm78evTUGFceJw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hCRVr66hGz1DYy for ; Sun, 02 Aug 2026 04:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b737 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 02 Aug 2026 04:23:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 38450872031c - stable/15 - e1000: count TSO wire segments in the AIM counters List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/15 X-Git-Reftype: branch X-Git-Commit: 38450872031c92b5eb8cbc0f99d1261468fe3205 Auto-Submitted: auto-generated Date: Sun, 02 Aug 2026 04:23:00 +0000 Message-Id: <6a6ec624.3b737.70c3e5b7@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=38450872031c92b5eb8cbc0f99d1261468fe3205 commit 38450872031c92b5eb8cbc0f99d1261468fe3205 Author: Kevin Bowling AuthorDate: 2026-07-25 12:33:38 +0000 Commit: Kevin Bowling CommitDate: 2026-08-02 04:20:51 +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); }