From nobody Sun Nov 24 03:22:51 2024 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 4XwvKl2rj3z5dLdS; Sun, 24 Nov 2024 03:22:51 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XwvKl1X3Wz4JPy; Sun, 24 Nov 2024 03:22:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732418571; 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=PlPTpHY9LhZzHCZKa5I4/Jp0JoCCnD+zgg6dO6M1KE0=; b=uX+GNaJ0VfhURdAf42RKrxCN3xfrO/MkJqGrxgZdnPhqWw9HF+9l1TgYzRhKXfMtg8rVb0 BFoVr7E0VBearxLdt+cJsmSpr9W1jJiMk8jOxOjqRzdwjSL0dt/tRwOizEvq4BlpZVxO+Q rHl/N8pubN1sTUexWFieNkWV3nugWB3u3k1eyIM6IixYRXQcHceXq4D5E99rd7v9AU4GZH ftSRr7EYI/MbfcFVk2RqrTZAIeACl7TigP7ZekpundekOlIHkFnAPG3ZHDzN+F89cplbSO Nv/j3jYUW2rfZcO3bKo3OnSipLsM0Z5sO/7UysrYhqptLavOCrZDl0MDBEJfOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732418571; 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=PlPTpHY9LhZzHCZKa5I4/Jp0JoCCnD+zgg6dO6M1KE0=; b=n24K91pm8y+5KHihz0OpTJ5A7esKI+8o3QXL21S8rcr3ESJTmt9dFzbLpmKQyKezg9ZfMD 3NddOx3QQ09vuzlpN8q1LYCJsGOq9MJD/mDqIk9c0S258dI+BKCXjS4ZbkqhjiW5+fmPIM TrdHdlusLiz8quZ24p77C/1vUG0caoRLvwYdsCiayhrf+KOWYX9forSLm5CkJ+3diqpWK4 R63Os7ANiQKzr3iM3JpGrI9ZJSjna3YEF+cRiLV420FhjFq86KPMl0swtXog22lEFE2NV8 1vRthpilJ/93yfRPrvXknj/y0O6lMcR6sb85wXPZwQ7oUOd3D+Oml7O9D+zKqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732418571; a=rsa-sha256; cv=none; b=GngRch0S7R5ssqy/RuarmwuE9GdyED9nQPGkfXHS7DIuRiCve7E8+SPDgZLjMABlxWKg7T Vm8WrNqkHEucUEsxLPa49xiUxos5otF9Risy+9YbOlu1hbwux3FyjKSLM4m0S+F+5+BBpW DfmEmr5diJxBzDrNCaW7XHFr+CxcMav0wWzz1B0r3vMPUotsf7imbAaRgo2ympPZe+z5sD Ca34l4XSKVZUFnCJGH80Cfl/wSYfwTo59oUOP/SV7xfQsTacZOhdpmEFFaXVx7BhNm+oXP 5zbCz1rak9lpWTR7KqlVn1VF2dGiX2sLiTm+1ncn9F9ahfTIsz3woNWgLpvpeQ== 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 4XwvKl17m8zdJJ; Sun, 24 Nov 2024 03:22:51 +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 4AO3MpdO041457; Sun, 24 Nov 2024 03:22:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AO3MpjJ041454; Sun, 24 Nov 2024 03:22:51 GMT (envelope-from git) Date: Sun, 24 Nov 2024 03:22:51 GMT Message-Id: <202411240322.4AO3MpjJ041454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 27f62dfa4447 - stable/13 - igc: sysctl for TCP flag handling during TSO 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 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/13 X-Git-Reftype: branch X-Git-Commit: 27f62dfa4447442c97c776c2267d6ec677a30f23 Auto-Submitted: auto-generated The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=27f62dfa4447442c97c776c2267d6ec677a30f23 commit 27f62dfa4447442c97c776c2267d6ec677a30f23 Author: Kevin Bowling AuthorDate: 2024-11-21 02:38:01 +0000 Commit: Kevin Bowling CommitDate: 2024-11-24 03:22:39 +0000 igc: sysctl for TCP flag handling during TSO Add tso_tcp_flags_mask_first_segment, tso_tcp_flags_mask_middle_segment, and tso_tcp_flags_mask_last_segment sysctl-variables to control the handling of TCP flags during TSO. This allows to change the masks appropriate for classical ECN and to configure appropriate masks for accurate ECN. Sponsored by: Netflix (cherry picked from commit ab540d44ba3201ff8313b90ba0096004603b2e34) --- sys/dev/igc/if_igc.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/igc/igc_regs.h | 2 ++ 2 files changed, 61 insertions(+) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index 5851b715b932..9ecb1d3fc44d 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -127,6 +127,7 @@ static void igc_print_debug_info(struct igc_softc *); static int igc_is_valid_ether_addr(u8 *); static void igc_neweitr(struct igc_softc *, struct igc_rx_queue *, struct tx_ring *, struct rx_ring *); +static int igc_sysctl_tso_tcp_flags_mask(SYSCTL_HANDLER_ARGS); /* Management and WOL Support */ static void igc_get_hw_control(struct igc_softc *); static void igc_release_hw_control(struct igc_softc *); @@ -498,6 +499,27 @@ igc_if_attach_pre(if_ctx_t ctx) CTLTYPE_INT | CTLFLAG_RW, sc, 0, igc_sysctl_dmac, "I", "DMA Coalesce"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "tso_tcp_flags_mask_first_segment", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + sc, 0, igc_sysctl_tso_tcp_flags_mask, "IU", + "TSO TCP flags mask for first segment"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "tso_tcp_flags_mask_middle_segment", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + sc, 1, igc_sysctl_tso_tcp_flags_mask, "IU", + "TSO TCP flags mask for middle segment"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "tso_tcp_flags_mask_last_segment", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + sc, 2, igc_sysctl_tso_tcp_flags_mask, "IU", + "TSO TCP flags mask for last segment"); + /* Determine hardware and mac info */ igc_identify_hardware(ctx); @@ -3014,6 +3036,43 @@ igc_print_nvm_info(struct igc_softc *sc) printf("\n"); } +static int +igc_sysctl_tso_tcp_flags_mask(SYSCTL_HANDLER_ARGS) +{ + struct igc_softc *sc; + u32 reg, val, shift; + int error, mask; + + sc = oidp->oid_arg1; + switch (oidp->oid_arg2) { + case 0: + reg = IGC_DTXTCPFLGL; + shift = 0; + break; + case 1: + reg = IGC_DTXTCPFLGL; + shift = 16; + break; + case 2: + reg = IGC_DTXTCPFLGH; + shift = 0; + break; + default: + return (EINVAL); + break; + } + val = IGC_READ_REG(&sc->hw, reg); + mask = (val >> shift) & 0xfff; + error = sysctl_handle_int(oidp, &mask, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (mask < 0 || mask > 0xfff) + return (EINVAL); + val = (val & ~(0xfff << shift)) | (mask << shift); + IGC_WRITE_REG(&sc->hw, reg, val); + return (0); +} + /* * Set flow control using sysctl: * Flow control values: diff --git a/sys/dev/igc/igc_regs.h b/sys/dev/igc/igc_regs.h index 26614dc33df6..17fa89e492e8 100644 --- a/sys/dev/igc/igc_regs.h +++ b/sys/dev/igc/igc_regs.h @@ -145,6 +145,8 @@ #define IGC_FFVT_REG(_i) (0x09800 + ((_i) * 8)) #define IGC_FFLT_REG(_i) (0x05F00 + ((_i) * 8)) #define IGC_TXPBS 0x03404 /* Tx Packet Buffer Size - RW */ +#define IGC_DTXTCPFLGL 0x0359C /* DMA Tx Control flag low - RW */ +#define IGC_DTXTCPFLGH 0x035A0 /* DMA Tx Control flag high - RW */ /* Statistics Register Descriptions */ #define IGC_CRCERRS 0x04000 /* CRC Error Count - R/clr */ #define IGC_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */