From nobody Thu Nov 21 02:38:50 2024 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 4Xv2VL44WJz5f5Rt; Thu, 21 Nov 2024 02:38:50 +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 4Xv2VL3VJ6z4W9Y; Thu, 21 Nov 2024 02:38:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732156730; 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=tR5Kh1IvoJFc4A69yZfEmr0ySCS9oQyBO1ues6RW7kk=; b=JnfDM8QsuJwZIvbxqCxmnQwbFJrZWH3CudCJ3FoDGQvSlXn1op5nolYdaPWFQXXf1C+ivS xRKBPQIkqyvDEINUho3Anbi6LnVtbJj8VEUP2KBO66bboAcljjfzlE7pTQeJUjB0SozTHn Bt5fOsApf6Rp8vqT42cFcltIKPGgHiD/pwD8vufsqPOVydG0IJdjSuUAfR7NGFyXzTxq8y 6YsYaJ8CDf/QrfAwo0Pd2oEvz95xiZJh6qaGtNo0MTrbB+TDub+UNqTytj3X1umvcMvv2U GKDfMZrjfoVwlvkWzqKPDlGN53/n0JT2ghGWOtTFD/4XkySph2XFxYIDvr0Tpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732156730; 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=tR5Kh1IvoJFc4A69yZfEmr0ySCS9oQyBO1ues6RW7kk=; b=ytjyvVphLFYOCkt41IolYSheT4uRoG2l5w4kcrio6dXeNchAQmuztm2BnEtsbd2YgJzSsb /tYSN+38RmMRabPwawb8E+cxUkA9Gb+kdZ9saMpzAXkgNyOj49Iz2lY9sEzDp2SHSP9rHW s1ooWMuE5WZiU4IqvuBaOHmRLnvwmYSYObXdyABAn7uXxwLTyj81frRl2/Wxg4ko8xXuJt n6CZGm9N5wmUFUQyoVPubLogvjwMIDk7zf4EGu0TpcXf1/WFBf0DFAgbFJ4cncCPZon905 uWsTxGt6kIXrpZj51L37whX4+PF617jxYr9iCUKn5RtdUdHvbEdK7GC6WRaMPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732156730; a=rsa-sha256; cv=none; b=bE/vyXqB5nrWCujkYVY6WpeiQU7dZMPWLbKFkOFdOmGuKYh3pvf1msQBaNausJoBFt35iV U6zCLNwSFNVCEB3j7khU6OXXhu8tKI8DuampAnrctF/G8XPuk4oCHVJBFVJDspZ1YSWpha XfUw6guj4sMs4MdehCiwthbsIpakVM4i30c9K4q+kiT3S/IuTQI5oe2CzGoiNKZqEBfHim u4XO9m/6C65X49naG8a5dZiT4EAXvb4FQVTCwSoJjKUtNojYP6myBN4KFkUdJh7Urgv0kK zuc052ZXSOaQGF7kkXk76QrAe6B6ibEQtxeD3ohvYtbNildShBDx4VlfcKqJ3g== 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 4Xv2VL2XmdzLZx; Thu, 21 Nov 2024 02:38:50 +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 4AL2coSq067799; Thu, 21 Nov 2024 02:38:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AL2coM7067796; Thu, 21 Nov 2024 02:38:50 GMT (envelope-from git) Date: Thu, 21 Nov 2024 02:38:50 GMT Message-Id: <202411210238.4AL2coM7067796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: ab540d44ba32 - main - igc: sysctl for TCP flag handling during TSO 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: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab540d44ba3201ff8313b90ba0096004603b2e34 Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=ab540d44ba3201ff8313b90ba0096004603b2e34 commit ab540d44ba3201ff8313b90ba0096004603b2e34 Author: Kevin Bowling AuthorDate: 2024-11-21 02:38:01 +0000 Commit: Kevin Bowling CommitDate: 2024-11-21 02:38:01 +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. MFC after: 3 days Sponsored by: Netflix --- 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 */