[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230111143427.1127174-2-jgh@redhat.com>
Date: Wed, 11 Jan 2023 14:34:21 +0000
From: jgh@...hat.com
To: netdev@...r.kernel.org
Cc: Jeremy Harris <jgh@...hat.com>
Subject: [RFC PATCH 1/7] net: NIC driver Rx ring ECN: skbuff and tcp support
From: Jeremy Harris <jgh@...hat.com>
This is the infrastructure and the primary information-consumer
for the facility.
Signed-off-by: Jeremy Harris <jgh@...hat.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
Powered by blists - more mailing lists