netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jgh@redhat.com
To: netdev@vger.kernel.org
Cc: Jeremy Harris <jgh@redhat.com>
Subject: [RFC PATCH 1/7] net: NIC driver Rx ring ECN: skbuff and tcp support
Date: Wed, 11 Jan 2023 14:34:21 +0000	[thread overview]
Message-ID: <20230111143427.1127174-2-jgh@redhat.com> (raw)
In-Reply-To: <20230111143427.1127174-1-jgh@redhat.com>

From: Jeremy Harris <jgh@redhat.com>

This is the infrastructure and the primary information-consumer
for the facility.

Signed-off-by: Jeremy Harris <jgh@redhat.com>
---
 include/linux/skbuff.h | 2 ++
 net/core/skbuff.c      | 1 +
 net/ipv4/tcp_input.c   | 8 +++++++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4c8492401a10..8bdf0049e1a3 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -804,6 +804,7 @@ typedef unsigned char *sk_buff_data_t;
  *		the packet minus one that have been verified as
  *		CHECKSUM_UNNECESSARY (max 3)
  *	@scm_io_uring: SKB holds io_uring registered files
+ *	@congestion_experienced: data-source or channel for SKB has congestion
  *	@dst_pending_confirm: need to confirm neighbour
  *	@decrypted: Decrypted SKB
  *	@slow_gro: state present at GRO time, slower prepare step required
@@ -983,6 +984,7 @@ struct sk_buff {
 	__u8			slow_gro:1;
 	__u8			csum_not_inet:1;
 	__u8			scm_io_uring:1;
+	__u8			congestion_experienced:1;
 
 #ifdef CONFIG_NET_SCHED
 	__u16			tc_index;	/* traffic control index */
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3a10387f9434..37940dd3dbe9 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5548,6 +5548,7 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
 	to->truesize += delta;
 	to->len += len;
 	to->data_len += len;
+	to->congestion_experienced |= from->congestion_experienced;
 
 	*delta_truesize = delta;
 	return true;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index cc072d2cfcd8..217374eefe41 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -338,8 +338,14 @@ static void tcp_ecn_withdraw_cwr(struct tcp_sock *tp)
 static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
+	__u8 ecn;
 
-	switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) {
+	if (unlikely(skb->congestion_experienced))
+		ecn = INET_ECN_CE;
+	else
+		ecn = TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK;
+
+	switch (ecn) {
 	case INET_ECN_NOT_ECT:
 		/* Funny extension: if ECT is not set on a segment,
 		 * and we already seen ECT on a previous segment,
-- 
2.39.0


  reply	other threads:[~2023-01-11 14:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 14:34 [RFC PATCH net-next 0/7] NIC driver Rx ring ECN jgh
2023-01-11 14:34 ` jgh [this message]
2023-01-11 14:34 ` [RFC PATCH 2/7] net: NIC driver Rx ring ECN: stats counter jgh
2023-01-11 14:34 ` [RFC PATCH 3/7] drivers: net: xgene: NIC driver Rx ring ECN jgh
2023-01-11 14:34 ` [RFC PATCH 4/7] drivers: net: bnx2x: " jgh
2023-01-11 14:34 ` [RFC PATCH 5/7] " jgh
2023-01-11 14:34 ` [RFC PATCH 6/7] drivers: net: bnx2: " jgh
2023-01-11 14:34 ` [RFC PATCH 7/7] " jgh
2023-01-11 18:46 ` [RFC PATCH net-next 0/7] " Jakub Kicinski
2023-01-12 14:06   ` Jeremy Harris
2023-01-13  0:09     ` Jakub Kicinski
2023-01-19 17:05       ` Jeremy Harris
2023-01-19 17:20         ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230111143427.1127174-2-jgh@redhat.com \
    --to=jgh@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).