From nobody Thu Feb 03 15:54:34 2022 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 E51B8198A3A8; Thu, 3 Feb 2022 15:54:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JqNXB6B7Nz4VZH; Thu, 3 Feb 2022 15:54:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643903674; 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=wOqZ0pBlyeZ+DmAJpYywdU+l9rMJyYFJQSUs8UcmiV4=; b=nfpepJOKQ8IR5bXB3zTgJe8lTmlpP9AVV/jAGTHKQPGLXQUb7EO6MfUKvZWGJNJpNCZ2o8 50Gnv51Uw/dTf0ISLHFKGcSgHWCoJnsVqa7G7lIP/HAPu0iuF9BdH3ce77A05OuKkKzNiT Ntvu/MFfzsY2r7a1qIlXLPk6cPxYV3Q764ZlbrvEEJxuPeIPMAqLctT/sbAecA134txL41 ZZ1oEJeHMOKkQQOEHhXI4HWKTZ/3WUYEzjC2MRjKnBWWKq8SooFr8x2c00lFDislXg8fzn BU7i8S5kMIxZqRXy6srDyk9/C+K75hLq138lPYaPOnBz/Y5wtZ/mA+cjJHfYVQ== 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 A5F221A6EB; Thu, 3 Feb 2022 15:54:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 213FsYav044160; Thu, 3 Feb 2022 15:54:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 213FsYFh044159; Thu, 3 Feb 2022 15:54:34 GMT (envelope-from git) Date: Thu, 3 Feb 2022 15:54:34 GMT Message-Id: <202202031554.213FsYFh044159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: f026275e26d0 - main - tcp: set IP ECN header codepoint properly 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f026275e26d0071ac3dee98526e8b9bcad58f0fa Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643903674; 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=wOqZ0pBlyeZ+DmAJpYywdU+l9rMJyYFJQSUs8UcmiV4=; b=SFvYny6Bt9ZBA86nmeRjtJIQXnbV4TvmaE7DY1vLNGQQZJPYYV7imCnXytlz4e/BqjHWVF zQIidLRQWzzcpjlKsJgx5Z05JHrEe/tiKxaRHGW8MAfyQ4Q97Iz/HlO9tT/Og8/jX57Rxj ySmt7utEIr53grIk1HU2UP7DrroZMQwezjX2UG5oEtf3iswY4jAJQzuA17yTUoOHz2Nhqf 0I6BZWn5VoDLNkXJeNVWUDXmmS05GaxhDzFmhWurqDsB69mSBrCko3rPMEwr3im3fSWp11 83u1p8KDSy4XQZVEbst0xDz2UcPKnhhvasw7jcu2r4fQ6xETSDJyvItMDpNSkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643903674; a=rsa-sha256; cv=none; b=A+xNO3TfZ5jAMPyigozaEPJzc1SDHANJNjPhQOQjjJMCp39vEGwYQO7LHf26GEqcXPU3PJ rch2LHQbMEw/l1xPvn4mBTHnw1jy7CeyTauGC8b9s7KaL54Wc1FKfJ/4DUjGIRyQaIkWoF 31MU+ZFCX5SUl+GJSHyYJmN1BAInb2H1ATNV98s+ZNRA/QAANAPzy8JBVnNAr0dJKFT6oi 8r9YkLh25QVg9QBpJgYZeMuSkV73naS+OGrVwUQFcxfAYU6/Ft/pvyCXynkzIWtTSw7bdJ hwUMupLO4vfaK9TNgDULbp0MzDNO/5YaOSvZ0bRZDJGAP5elDJmpSSbCHkHkGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=f026275e26d0071ac3dee98526e8b9bcad58f0fa commit f026275e26d0071ac3dee98526e8b9bcad58f0fa Author: Richard Scheffenegger AuthorDate: 2022-02-03 15:47:50 +0000 Commit: Richard Scheffenegger CommitDate: 2022-02-03 15:53:41 +0000 tcp: set IP ECN header codepoint properly TCP RACK can cache the IP header while preparing a new TCP packet for transmission. Thus all the IP ECN codepoint bits need to be assigned, without assuming a clear field beforehand. Reviewed By: tuexen, kbowling, #transport MFC after: 3 days Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D34148 --- sys/netinet/tcp_output.c | 7 ++++++- sys/netinet/tcp_stacks/rack.c | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index dc512c8aad39..ce6d9b86e73f 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1223,11 +1223,16 @@ send: !((tp->t_flags & TF_FORCEDATA) && len == 1 && SEQ_LT(tp->snd_una, tp->snd_max))) { #ifdef INET6 - if (isipv6) + if (isipv6) { + ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); + } else #endif + { + ip->ip_tos &= ~IPTOS_ECN_MASK; ip->ip_tos |= IPTOS_ECN_ECT0; + } TCPSTAT_INC(tcps_ecn_ect0); /* * Reply with proper ECN notifications. diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 7983c18620e2..22164c0d5cf4 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -16537,11 +16537,16 @@ again: */ if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max)) { #ifdef INET6 - if (rack->r_is_v6) + if (rack->r_is_v6) { + ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); + } else #endif + { + ip->ip_tos &= ~IPTOS_ECN_MASK; ip->ip_tos |= IPTOS_ECN_ECT0; + } KMOD_TCPSTAT_INC(tcps_ecn_ect0); /* * Reply with proper ECN notifications. @@ -18614,11 +18619,16 @@ send: if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && (sack_rxmit == 0)) { #ifdef INET6 - if (isipv6) + if (isipv6) { + ip6->ip6_flow &= ~htonl(IPTOS_ECN_MASK << 20); ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); + } else #endif + { + ip->ip_tos &= IPTOS_ECN_MASK; ip->ip_tos |= IPTOS_ECN_ECT0; + } KMOD_TCPSTAT_INC(tcps_ecn_ect0); /* * Reply with proper ECN notifications.