From nobody Sun Nov 24 03:21:56 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 4XwvJh6Nk4z5dL0t; Sun, 24 Nov 2024 03:21:56 +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 4XwvJh3gH7z4HJc; Sun, 24 Nov 2024 03:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732418516; 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=5FABlpGduHMsQQ+vBxeUJ0weoBVV08snuQvK3vnYAyg=; b=qu+BlWuiP/6FlrjFpYLg3DJhwWlRVhAu8bYjBhREbz4Mqjvluiq8K4aPJrsgEcH3dBNDyX B6W3r1HWxXy9MtK6cfnTVWRINUQ3ftzz4jFQD3EQGAW1aIuvzHE4r/rrSAXYif4cbNuNk7 kNjo1KBnAAwgo9qwni7Uo0gm4KsA+NAMro/H0EGWdPJrBi7LEzt79GN/NHK1bVcw+X3yeu vUWV6eFTsJjkgGznK26JYN8ifFOBQhenMtQkyT+wAnfzVZqH+eo7IP5Vj4v8kxKhR4Z/Su t2IkgTY1DYH7koJ/5XbK0+Q3V/bOpiOzeIwzf1PKMEW3aGSgCO4iKEafscsb5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732418516; 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=5FABlpGduHMsQQ+vBxeUJ0weoBVV08snuQvK3vnYAyg=; b=n6g0IWQsckhGamFDRlO/YzhctHIx10hH9YCY3ak5JMLFZ1XG24bLzDOiBytLqWZIMgtdWH cwEZl0TfhnBg4kK2wWKnENu/kbmj9qJ2EfAD2aU3Mj5CRFfkYnhJDYR27q3CJ1AkYaSg0d UV9JrjY5/ExTkvoqCaCuhhqGmwZJXAwZYWqgpPnZ/tO+LsyyJs11Z3atc9ky73CAbJW7MP kpvkPfZHb8J2bCnwbqjO+dSMsxxxm+ixc1aGsfixxxZezBoJu8Q1DfGsirRUBA+rv6diXB Nyy5l/+8oCvZRRdNMcFVEdwlkVQ+N7NdW0zPo3wBVY2oXua0FTAp2AyHXr5vNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732418516; a=rsa-sha256; cv=none; b=hKMk7j+9SC8n4MKnojsdvQXO+LVFVKCrpKB6AS0vDE+c0ZJmTmE1r1cbcqAwzYuxfz5tXu i0LmCUDKtO3FYwiTNVDPIYHLOnDI9SdyStX61xOQi/n2xbQJPxiZsToVDvbWvSCFbEcszA NAledOVz84gleTIoDWhYwCfn/ijAmmBqbnfeFnpuEF90URYxFZmOtnJtCBNuf3z7qiwzGF pOOt6q3zsWtVg4UmBCqKHeskIGsFPuVCYUejb7WT73TbbmgkvZyaK+MuMgKRzxmfDQ+SeO KlNm3fRTMPpKQACJso661SqY67Y7nOh/MHp7UVd9vYkUVOFL0sxnMzodkQmuOg== 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 4XwvJh2zsWzdHM; Sun, 24 Nov 2024 03:21:56 +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 4AO3LubJ040917; Sun, 24 Nov 2024 03:21:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AO3LuGT040914; Sun, 24 Nov 2024 03:21:56 GMT (envelope-from git) Date: Sun, 24 Nov 2024 03:21:56 GMT Message-Id: <202411240321.4AO3LuGT040914@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: 6890e1e79341 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 6890e1e79341b52665792978899b94a1bbe311dd Auto-Submitted: auto-generated The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=6890e1e79341b52665792978899b94a1bbe311dd commit 6890e1e79341b52665792978899b94a1bbe311dd Author: Kevin Bowling AuthorDate: 2024-11-21 02:38:01 +0000 Commit: Kevin Bowling CommitDate: 2024-11-24 03:21:30 +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 38fb1406b1c1..9a4d0b2dd0ac 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 *); @@ -497,6 +498,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); @@ -3013,6 +3035,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 */