tcp: misc changes
Subsystems (3)
v2 cover tcp: misc changes
Minor changes, following recent changes in TCP stack.
v2: typo for SKB_DROP_REASON_TCP_LISTEN_OVERFLOW kdoc (Jakub)
Eric Dumazet (6):
tcp: add a drop_reason pointer to tcp_check_req()
tcp: add four drop reasons to tcp_check_req()
tcp: convert to dev_net_rcu()
net: gro: convert four dev_net() calls
tcp: remove READ_ONCE(req->ts_recent)
tcp: tcp_set_window_clamp() cleanup
include/net/dropreason-core.h | 9 +++++++++ include/net/inet6_hashtables.h | 2 +- include/net/inet_hashtables.h | 2 +- include/net/tcp.h | 2 +- net/ipv4/tcp.c | 36 +++++++++++++++++----------------- net/ipv4/tcp_input.c | 5 ++--- net/ipv4/tcp_ipv4.c | 17 ++++++++-------- net/ipv4/tcp_metrics.c | 6 +++--- net/ipv4/tcp_minisocks.c | 17 +++++++++++----- net/ipv4/tcp_offload.c | 2 +- net/ipv4/tcp_output.c | 2 +- net/ipv4/udp_offload.c | 2 +- net/ipv6/tcp_ipv6.c | 27 +++++++++++++------------ net/ipv6/tcpv6_offload.c | 2 +- net/ipv6/udp_offload.c | 2 +- 15 files changed, 75 insertions(+), 58 deletions(-)
Signature · 1 line
2.48.1.711.g2feabab25a-goog
PATCH v2 1/6 tcp: add a drop_reason pointer to tcp_check_req()
We want to add new drop reasons for packets dropped in 3WHS in the following patches.
tcp_rcv_state_process() has to set reason to TCP_FASTOPEN, because tcp_check_req() will conditionally overwrite the drop_reason.
--- include/net/tcp.h | 2 +- net/ipv4/tcp_input.c | 5 ++--- net/ipv4/tcp_ipv4.c | 3 ++- net/ipv4/tcp_minisocks.c | 3 ++- net/ipv6/tcp_ipv6.c | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-)
include/net/tcp.h +1 -1
@@ -392,7 +392,7 @@ enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, u32 *tw_isn);struct sock *tcp_check_req (struct sock *sk,struct sk_buff *skb,struct request_sock *req,bool fastopen, -bool *lost_race); +bool *lost_race,enum skb_drop_reason *drop_reason);enum skb_drop_reason tcp_child_process (struct sock *parent,struct sock *child,struct sk_buff *skb);void tcp_enter_loss (struct sock *sk);
net/ipv4/tcp_input.c +2 -3
@@ -6812,10 +6812,9 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)WARN_ON_ONCE (sk->sk_state !=TCP_SYN_RECV && sk->sk_state !=TCP_FIN_WAIT1 ); -if (!tcp_check_req (sk, skb, req, true, &req_stolen)) { -SKB_DR_SET (reason,TCP_FASTOPEN ); +SKB_DR_SET (reason,TCP_FASTOPEN ); +if (!tcp_check_req (sk, skb, req, true, &req_stolen, &reason)) goto discard; - } }if (!th->ack && !th->rst && !th->syn) {
net/ipv4/tcp_ipv4.c +2 -1
@@ -2265,7 +2265,8 @@ int tcp_v4_rcv(struct sk_buff *skb) th = (const struct tcphdr *)skb->data; iph =ip_hdr (skb);tcp_v4_fill_cb (skb, iph, th); - nsk =tcp_check_req (sk, skb, req, false, &req_stolen); + nsk =tcp_check_req (sk, skb, req, false, &req_stolen, + &drop_reason); }else { drop_reason =SKB_DROP_REASON_SOCKET_FILTER ; }
net/ipv4/tcp_minisocks.c +2 -1
@@ -657,7 +657,8 @@ EXPORT_SYMBOL(tcp_create_openreq_child);struct sock *tcp_check_req (struct sock *sk,struct sk_buff *skb,struct request_sock *req, -bool fastopen,bool *req_stolen) +bool fastopen,bool *req_stolen, +enum skb_drop_reason *drop_reason) {struct tcp_options_received tmp_opt;struct sock *child;
net/ipv6/tcp_ipv6.c +2 -1
@@ -1828,7 +1828,8 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) th = (const struct tcphdr *)skb->data; hdr =ipv6_hdr (skb);tcp_v6_fill_cb (skb, hdr, th); - nsk =tcp_check_req (sk, skb, req, false, &req_stolen); + nsk =tcp_check_req (sk, skb, req, false, &req_stolen, + &drop_reason); }else { drop_reason =SKB_DROP_REASON_SOCKET_FILTER ; }
Signature · 1 line
2.48.1.711.g2feabab25a-goog
Re: [PATCH v2 net-next 1/6] tcp: add a drop_reason pointer to tcp_check_req()
Quoted 8 lines · Eric Dumazet
We want to add new drop reasons for packets dropped in 3WHS in the following patches.
tcp_rcv_state_process()has to set reason toTCP_FASTOPEN, becausetcp_check_req()will conditionally overwrite thedrop_reason.Signed-off-by Eric Dumazet <[email protected]>
Re: [PATCH v2 net-next 1/6] tcp: add a drop_reason pointer to tcp_check_req()
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
Date: Sat, 1 Mar 2025 20:14:19 +0000
Quoted 7 lines
We want to add new drop reasons for packets dropped in 3WHS in the following patches.
tcp_rcv_state_process()has to set reason toTCP_FASTOPEN, becausetcp_check_req()will conditionally overwrite thedrop_reason.Signed-off-by Eric Dumazet <[email protected]>
PATCH v2 2/6 tcp: add four drop reasons to tcp_check_req()
In reply to Eric DumazetUse two existing drop reasons in tcp_check_req():
- TCP_RFC7323_PAWS
- TCP_OVERWINDOW
Add two new ones:
- TCP_RFC7323_TSECR (corresponds to LINUX_MIB_TSECRREJECTED)
- TCP_LISTEN_OVERFLOW (when a listener accept queue is full)
--- include/net/dropreason-core.h | 9 +++++++++ net/ipv4/tcp_minisocks.c | 10 ++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
include/net/dropreason-core.h +9 -0
@@ -40,6 +40,8 @@ FN(TCP_OFOMERGE) \ FN(TCP_RFC7323_PAWS) \ FN(TCP_RFC7323_PAWS_ACK) \ + FN(TCP_RFC7323_TSECR) \ + FN(TCP_LISTEN_OVERFLOW) \ FN(TCP_OLD_SEQUENCE) \ FN(TCP_INVALID_SEQUENCE) \ FN(TCP_INVALID_ACK_SEQUENCE) \
@@ -281,6 +283,13 @@ enum skb_drop_reason {* Corresponds to LINUX_MIB_PAWS_OLD_ACK. */ SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK , +/** +* @SKB_DROP_REASON_TCP_RFC7323_TSECR: PAWS check, invalid TSEcr. +* Corresponds to LINUX_MIB_TSECRREJECTED. +*/ +SKB_DROP_REASON_TCP_RFC7323_TSECR , +/** @SKB_DROP_REASON_TCP_LISTEN_OVERFLOW: listener queue full. */ +SKB_DROP_REASON_TCP_LISTEN_OVERFLOW ,/** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */ SKB_DROP_REASON_TCP_OLD_SEQUENCE,/** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */
net/ipv4/tcp_minisocks.c +8 -2
@@ -809,10 +809,15 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, LINUX_MIB_TCPACKSKIPPEDSYNRECV, &tcp_rsk(req)->last_oow_ack_time)) req->rsk_ops->send_ack (sk, skb, req); -if (paws_reject) +if (paws_reject) { +SKB_DR_SET (*drop_reason,TCP_RFC7323_PAWS );NET_INC_STATS (sock_net (sk),LINUX_MIB_PAWSESTABREJECTED ); -else if (tsecr_reject) + }else if (tsecr_reject) { +SKB_DR_SET (*drop_reason,TCP_RFC7323_TSECR );NET_INC_STATS (sock_net (sk),LINUX_MIB_TSECRREJECTED ); + }else { +SKB_DR_SET (*drop_reason,TCP_OVERWINDOW ); + }return NULL ; }
@@ -882,6 +887,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,return inet_csk_complete_hashdance (sk, child, req, own_req); listen_overflow: +SKB_DR_SET (*drop_reason,TCP_LISTEN_OVERFLOW );if (sk != req->rsk_listener)__NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPMIGRATEREQFAILURE );
Signature · 1 line
2.48.1.711.g2feabab25a-goog
Re: [PATCH v2 net-next 2/6] tcp: add four drop reasons to tcp_check_req()
Quoted 7 lines · Eric Dumazet
Use two existing drop reasons in
tcp_check_req():-
TCP_RFC7323_PAWS-
TCP_OVERWINDOW
Quoted 7 lines
Add two new ones:
-
TCP_RFC7323_TSECR(corresponds toLINUX_MIB_TSECRREJECTED)-
TCP_LISTEN_OVERFLOW(when a listener accept queue is full)Signed-off-by Eric Dumazet <[email protected]>
Re: [PATCH v2 net-next 2/6] tcp: add four drop reasons to tcp_check_req()
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
Date: Sat, 1 Mar 2025 20:14:20 +0000
Quoted 6 lines
Use two existing drop reasons in
tcp_check_req():-
TCP_RFC7323_PAWS-
TCP_OVERWINDOW
Quoted 7 lines
Add two new ones:
-
TCP_RFC7323_TSECR(corresponds toLINUX_MIB_TSECRREJECTED)-
TCP_LISTEN_OVERFLOW(when a listener accept queue is full)Signed-off-by Eric Dumazet <[email protected]>
PATCH v2 3/6 tcp: convert to dev_net_rcu()
In reply to Eric DumazetTCP uses of dev_net() are under RCU protection, change them to dev_net_rcu() to get LOCKDEP support.
--- include/net/inet6_hashtables.h | 2 +- include/net/inet_hashtables.h | 2 +- net/ipv4/tcp_ipv4.c | 12 ++++++------ net/ipv4/tcp_metrics.c | 6 +++--- net/ipv6/tcp_ipv6.c | 22 +++++++++++----------- 5 files changed, 22 insertions(+), 22 deletions(-)
include/net/inet6_hashtables.h +1 -1
@@ -150,7 +150,7 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, int iif, int sdif, bool *refcounted) { - struct net *net = dev_net(skb_dst(skb)->dev); + struct net *net = dev_net_rcu(skb_dst(skb)->dev);const struct ipv6hdr *ip6h =ipv6_hdr (skb);struct sock *sk;
include/net/inet_hashtables.h +1 -1
@@ -492,7 +492,7 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,const int sdif, bool *refcounted) { - struct net *net = dev_net(skb_dst(skb)->dev); + struct net *net = dev_net_rcu(skb_dst(skb)->dev);const struct iphdr *iph =ip_hdr (skb);struct sock *sk;
net/ipv4/tcp_ipv4.c +6 -6
@@ -494,14 +494,14 @@ int tcp_v4_err(struct sk_buff *skb, u32 info) {const struct iphdr *iph = (const struct iphdr *)skb->data;struct tcphdr *th = (struct tcphdr *)(skb->data + (iph->ihl <<2 )); -struct tcp_sock *tp; +struct net *net =dev_net_rcu (skb->dev);const int type =icmp_hdr (skb)->type;const int code =icmp_hdr (skb)->code; -struct sock *sk;struct request_sock *fastopen; +struct tcp_sock *tp;u32 seq, snd_una; +struct sock *sk;int err; -struct net *net =dev_net (skb->dev); sk = __inet_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, iph->daddr, th->dest, iph->saddr,
@@ -786,7 +786,7 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb, arg.iov[0 ].iov_base = (unsigned char *)&rep; arg.iov[0 ].iov_len =sizeof (rep.th); - net = sk ?sock_net (sk) :dev_net (skb_dst (skb)->dev); + net = sk ?sock_net (sk) :dev_net_rcu (skb_dst (skb)->dev);/* Invalid TCP option size or twice included auth */ if (tcp_parse_auth_options (tcp_hdr (skb), &md5_hash_location, &aoh))
@@ -1961,7 +1961,7 @@ EXPORT_SYMBOL(tcp_v4_do_rcv);int tcp_v4_early_demux (struct sk_buff *skb) { -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);const struct iphdr *iph;const struct tcphdr *th;struct sock *sk;
@@ -2172,7 +2172,7 @@ static void tcp_v4_fill_cb(struct sk_buff *skb, const struct iphdr *iph,int tcp_v4_rcv (struct sk_buff *skb) { -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);enum skb_drop_reason drop_reason;int sdif =inet_sdif (skb);int dif =inet_iif (skb);
net/ipv4/tcp_metrics.c +3 -3
@@ -170,7 +170,7 @@ static struct tcp_metrics_block *tcpm_new(struct dst_entry *dst,bool reclaim = false;spin_lock_bh (&tcp_metrics_lock); - net =dev_net (dst->dev); + net =dev_net_rcu (dst->dev);/* While waiting for the spin-lock the cache might have been populated * with this entry and so we have to check again.
@@ -273,7 +273,7 @@ static struct tcp_metrics_block *__tcp_get_metrics_req(struct request_sock *req,return NULL ; } - net =dev_net (dst->dev); + net =dev_net_rcu (dst->dev); hash ^=net_hash_mix (net); hash =hash_32 (hash, tcp_metrics_hash_log);
@@ -318,7 +318,7 @@ static struct tcp_metrics_block *tcp_get_metrics(struct sock *sk,else return NULL ; - net =dev_net (dst->dev); + net =dev_net_rcu (dst->dev); hash ^=net_hash_mix (net); hash =hash_32 (hash, tcp_metrics_hash_log);
net/ipv6/tcp_ipv6.c +11 -11
@@ -376,7 +376,7 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, {const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data;const struct tcphdr *th = (struct tcphdr *)(skb->data+offset); -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);struct request_sock *fastopen;struct ipv6_pinfo *np;struct tcp_sock *tp;
@@ -866,16 +866,16 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 int oif, int rst, u8 tclass, __be32 label, u32 priority, u32 txhash, struct tcp_key *key) { - const struct tcphdr *th = tcp_hdr(skb); -struct tcphdr *t1; -struct sk_buff *buff; -struct flowi6 fl6; -struct net *net = sk ?sock_net (sk) :dev_net (skb_dst (skb)->dev); -struct sock *ctl_sk = net->ipv6.tcp_sk; + struct net *net = sk ? sock_net(sk) : dev_net_rcu(skb_dst(skb)->dev);unsigned int tot_len =sizeof (struct tcphdr ); +struct sock *ctl_sk = net->ipv6.tcp_sk; +const struct tcphdr *th =tcp_hdr (skb);__be32 mrst =0 , *topt;struct dst_entry *dst; -__u32 mark =0 ; +struct sk_buff *buff; +struct tcphdr *t1; +struct flowi6 fl6; +u32 mark =0 ;if (tsecr) tot_len +=TCPOLEN_TSTAMP_ALIGNED ;
@@ -1041,7 +1041,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb,if (!sk && !ipv6_unicast_destination (skb))return ; - net = sk ?sock_net (sk) :dev_net (skb_dst (skb)->dev); + net = sk ?sock_net (sk) :dev_net_rcu (skb_dst (skb)->dev);/* Invalid TCP option size or twice included auth */ if (tcp_parse_auth_options (th, &md5_hash_location, &aoh))return ;
@@ -1740,6 +1740,7 @@ static void tcp_v6_fill_cb(struct sk_buff *skb, const struct ipv6hdr *hdr, INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) { +struct net *net =dev_net_rcu (skb->dev);enum skb_drop_reason drop_reason;int sdif =inet6_sdif (skb);int dif =inet6_iif (skb);
@@ -1749,7 +1750,6 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)bool refcounted;int ret;u32 isn; -struct net *net =dev_net (skb->dev); drop_reason =SKB_DROP_REASON_NOT_SPECIFIED ;if (skb->pkt_type !=PACKET_HOST )
@@ -2001,7 +2001,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)void tcp_v6_early_demux (struct sk_buff *skb) { -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);const struct ipv6hdr *hdr;const struct tcphdr *th;struct sock *sk;
Signature · 1 line
2.48.1.711.g2feabab25a-goog
PATCH v2 4/6 net: gro: convert four dev_net() calls
In reply to Eric Dumazettcp4_check_fraglist_gro(), tcp6_check_fraglist_gro(), udp4_gro_lookup_skb() and udp6_gro_lookup_skb()
assume RCU is held so that the net structure does not disappear.
Use dev_net_rcu() instead of dev_net() to get LOCKDEP support.
--- net/ipv4/tcp_offload.c | 2 +- net/ipv4/udp_offload.c | 2 +- net/ipv6/tcpv6_offload.c | 2 +- net/ipv6/udp_offload.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/tcp_offload.c +1 -1
@@ -425,7 +425,7 @@ static void tcp4_check_fraglist_gro(struct list_head *head, struct sk_buff *skb,inet_get_iif_sdif (skb, &iif, &sdif); iph =skb_gro_network_header (skb); - net =dev_net (skb->dev); + net =dev_net_rcu (skb->dev); sk = __inet_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, iph->saddr, th->source, iph->daddr, ntohs(th->dest),
net/ipv4/udp_offload.c +1 -1
@@ -630,7 +630,7 @@ static struct sock *udp4_gro_lookup_skb(struct sk_buff *skb, __be16 sport, __be16 dport) {const struct iphdr *iph =skb_gro_network_header (skb); -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);int iif, sdif;inet_get_iif_sdif (skb, &iif, &sdif);
net/ipv6/tcpv6_offload.c +1 -1
@@ -35,7 +35,7 @@ static void tcp6_check_fraglist_gro(struct list_head *head, struct sk_buff *skb,inet6_get_iif_sdif (skb, &iif, &sdif); hdr =skb_gro_network_header (skb); - net =dev_net (skb->dev); + net =dev_net_rcu (skb->dev); sk = __inet6_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, &hdr->saddr, th->source, &hdr->daddr, ntohs(th->dest),
net/ipv6/udp_offload.c +1 -1
@@ -117,7 +117,7 @@ static struct sock *udp6_gro_lookup_skb(struct sk_buff *skb, __be16 sport, __be16 dport) {const struct ipv6hdr *iph =skb_gro_network_header (skb); -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);int iif, sdif;inet6_get_iif_sdif (skb, &iif, &sdif);
Signature · 1 line
2.48.1.711.g2feabab25a-goog
PATCH v2 5/6 tcp: remove READ_ONCE(req->ts_recent)
In reply to Eric DumazetAfter commit 8d52da23b6c6 ("tcp: Defer ts_recent changes until req is owned"), req->ts_recent is not changed anymore.
It is set once in tcp_openreq_init(), bpf_sk_assign_tcp_reqsk() or cookie_tcp_reqsk_alloc() before the req can be seen by other cpus/threads.
This completes the revert of eba20811f326 ("tcp: annotate data-races around tcp_rsk(req)->ts_recent").
--- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/tcp_minisocks.c | 4 ++-- net/ipv4/tcp_output.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
net/ipv4/tcp_ipv4.c +1 -1
@@ -1155,7 +1155,7 @@ static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,tcp_rsk (req)->rcv_nxt,tcp_synack_window (req) >>inet_rsk (req)->rcv_wscale,tcp_rsk_tsval (tcp_rsk (req)), -READ_ONCE (req->ts_recent), + req->ts_recent,0 , &key,inet_rsk (req)->no_srccheck ?IP_REPLY_ARG_NOSRCCHECK :0 , ip_hdr(skb)->tos,
net/ipv4/tcp_minisocks.c +2 -2
@@ -585,7 +585,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,if (newtp->rx_opt.tstamp_ok) { newtp->tcp_usec_ts = treq->req_usec_ts; - newtp->rx_opt.ts_recent =READ_ONCE (req->ts_recent); + newtp->rx_opt.ts_recent = req->ts_recent; newtp->rx_opt.ts_recent_stamp =ktime_get_seconds (); newtp->tcp_header_len =sizeof (struct tcphdr ) +TCPOLEN_TSTAMP_ALIGNED ; }else {
@@ -673,7 +673,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,tcp_parse_options (sock_net (sk), skb, &tmp_opt,0 ,NULL );if (tmp_opt.saw_tstamp) { - tmp_opt.ts_recent =READ_ONCE (req->ts_recent); + tmp_opt.ts_recent = req->ts_recent;if (tmp_opt.rcv_tsecr) {if (inet_rsk (req)->tstamp_ok && !fastopen) tsecr_reject = !between(tmp_opt.rcv_tsecr,
net/ipv4/tcp_output.c +1 -1
@@ -949,7 +949,7 @@ static unsigned int tcp_synack_options(const struct sock *sk,tcp_rsk (req)->snt_tsval_first = opts->tsval; }WRITE_ONCE (tcp_rsk (req)->snt_tsval_last, opts->tsval); - opts->tsecr =READ_ONCE (req->ts_recent); + opts->tsecr = req->ts_recent; remaining -=TCPOLEN_TSTAMP_ALIGNED ; }if (likely (ireq->sack_ok)) {
net/ipv6/tcp_ipv6.c +1 -1
@@ -1279,7 +1279,7 @@ static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,tcp_rsk (req)->rcv_nxt,tcp_synack_window (req) >>inet_rsk (req)->rcv_wscale,tcp_rsk_tsval (tcp_rsk (req)), -READ_ONCE (req->ts_recent), sk->sk_bound_dev_if, + req->ts_recent, sk->sk_bound_dev_if, &key,ipv6_get_dsfield (ipv6_hdr (skb)),0 ,READ_ONCE (sk->sk_priority), READ_ONCE(tcp_rsk(req)->txhash));
Signature · 1 line
2.48.1.711.g2feabab25a-goog
Re: [PATCH v2 net-next 5/6] tcp: remove READ_ONCE(req->ts_recent)
Quoted 8 lines · Eric Dumazet
After commit
8d52da23b6c6("tcp: Deferts_recentchanges until req is owned"),req->ts_recentis not changed anymore.It is set once in
tcp_openreq_init(),bpf_sk_assign_tcp_reqsk()orcookie_tcp_reqsk_alloc()before the req can be seen by other cpus/threads.
Quoted 5 lines
This completes the revert of
eba20811f326("tcp: annotate data-races around tcp_rsk(req)->ts_recent").Signed-off-by Eric Dumazet <[email protected]>Cc Wang Hai <[email protected]>
Re: [PATCH v2 net-next 5/6] tcp: remove READ_ONCE(req->ts_recent)
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
Date: Sat, 1 Mar 2025 20:14:23 +0000
Quoted 11 lines
After commit
8d52da23b6c6("tcp: Deferts_recentchanges until req is owned"),req->ts_recentis not changed anymore.It is set once in
tcp_openreq_init(),bpf_sk_assign_tcp_reqsk()orcookie_tcp_reqsk_alloc()before the req can be seen by other cpus/threads.This completes the revert of
eba20811f326("tcp: annotate data-races around tcp_rsk(req)->ts_recent").Signed-off-by Eric Dumazet <[email protected]>
PATCH v2 6/6 tcp: tcp_set_window_clamp() cleanup
In reply to Eric DumazetRemove one indentation level.
Use max_t() and clamp() macros.
--- net/ipv4/tcp.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
net/ipv4/tcp.c +18 -18
@@ -3693,33 +3693,33 @@ EXPORT_SYMBOL(tcp_sock_set_keepcnt);int tcp_set_window_clamp (struct sock *sk,int val) { +u32 old_window_clamp, new_window_clamp;struct tcp_sock *tp =tcp_sk (sk);if (!val) {if (sk->sk_state !=TCP_CLOSE )return -EINVAL ;WRITE_ONCE (tp->window_clamp,0 ); - }else { -u32 new_rcv_ssthresh, old_window_clamp = tp->window_clamp; -u32 new_window_clamp = val <SOCK_MIN_RCVBUF /2 ? -SOCK_MIN_RCVBUF /2 : val; +return 0 ; + } -if (new_window_clamp == old_window_clamp) -return 0 ; + old_window_clamp = tp->window_clamp; + new_window_clamp =max_t (int,SOCK_MIN_RCVBUF /2 , val); -WRITE_ONCE (tp->window_clamp, new_window_clamp); -if (new_window_clamp < old_window_clamp) { -/* need to apply the reserved mem provisioning only -* when shrinking the window clamp -*/ -__tcp_adjust_rcv_ssthresh (sk, tp->window_clamp); +if (new_window_clamp == old_window_clamp) +return 0 ; - }else { - new_rcv_ssthresh =min (tp->rcv_wnd, tp->window_clamp); - tp->rcv_ssthresh =max (new_rcv_ssthresh, - tp->rcv_ssthresh); - } - } +WRITE_ONCE (tp->window_clamp, new_window_clamp); + +/* Need to apply the reserved mem provisioning only +* when shrinking the window clamp. +*/ +if (new_window_clamp < old_window_clamp) +__tcp_adjust_rcv_ssthresh (sk, new_window_clamp); +else + tp->rcv_ssthresh =clamp (new_window_clamp, + tp->rcv_ssthresh, + tp->rcv_wnd);return 0 ; }
Signature · 1 line
2.48.1.711.g2feabab25a-goog
Re: [PATCH v2 net-next 6/6] tcp: tcp_set_window_clamp() cleanup
Quoted 6 lines · Eric Dumazet
Remove one indentation level.
Use
max_t()andclamp()macros.Signed-off-by Eric Dumazet <[email protected]>
Re: [PATCH v2 net-next 6/6] tcp: tcp_set_window_clamp() cleanup
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
Date: Sat, 1 Mar 2025 20:14:24 +0000
Quoted 5 lines
Remove one indentation level.
Use
max_t()andclamp()macros.Signed-off-by Eric Dumazet <[email protected]>
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 12 lines · On Sat, 1 Mar 2025 20:14:18 +0000 you wrote:
Minor changes, following recent changes in TCP stack.
v2: typo for
SKB_DROP_REASON_TCP_LISTEN_OVERFLOWkdoc (Jakub)Eric Dumazet (6):
tcp: add adrop_reasonpointer totcp_check_req()
tcp: add four drop reasons totcp_check_req()
tcp: convert todev_net_rcu()
net: gro: convert fourdev_net()calls
tcp: removeREAD_ONCE(req->ts_recent)
tcp:tcp_set_window_clamp()cleanup
Quoted 1 line
[...]
Here is the summary with links:
- [v2,net-next,1/6] tcp: add a drop_reason pointer to tcp_check_req()
https://git.kernel.org/netdev/net-next/c/e34100c2ecbb - [v2,net-next,2/6] tcp: add four drop reasons to tcp_check_req() https://git.kernel.org/netdev/net-next/c/a11a791ca81e - [v2,net-next,3/6] tcp: convert to dev_net_rcu() https://git.kernel.org/netdev/net-next/c/e7b9ecce562c - [v2,net-next,4/6] net: gro: convert four dev_net() calls https://git.kernel.org/netdev/net-next/c/9b49f57ccd3a - [v2,net-next,5/6] tcp: remove READ_ONCE(req->ts_recent) https://git.kernel.org/netdev/net-next/c/5282de17621f - [v2,net-next,6/6] tcp: tcp_set_window_clamp() cleanup https://git.kernel.org/netdev/net-next/c/863a952eb79a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html