netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcp: tcp_mark_head_lost is only valid for sack-tcp
@ 2020-05-07  3:08 zhang kai
  2020-05-07 13:58 ` Neal Cardwell
  2020-05-08  0:58 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: zhang kai @ 2020-05-07  3:08 UTC (permalink / raw)
  To: ycheng, edumazet, ncardwell, davem, kuznet, yoshfuji, kuba, netdev

so tcp_is_sack/reno checks are removed from tcp_mark_head_lost.

Signed-off-by: zhang kai <zhangkaiheb@126.com>
---
 net/ipv4/tcp_input.c | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index b996dc106..c306becf6 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2183,8 +2183,7 @@ static bool tcp_time_to_recover(struct sock *sk, int flag)
 }
 
 /* Detect loss in event "A" above by marking head of queue up as lost.
- * For non-SACK(Reno) senders, the first "packets" number of segments
- * are considered lost. For RFC3517 SACK, a segment is considered lost if it
+ * For RFC3517 SACK, a segment is considered lost if it
  * has at least tp->reordering SACKed seqments above it; "packets" refers to
  * the maximum SACKed segments to pass before reaching this limit.
  */
@@ -2192,10 +2191,9 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int mark_head)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct sk_buff *skb;
-	int cnt, oldcnt, lost;
-	unsigned int mss;
+	int cnt;
 	/* Use SACK to deduce losses of new sequences sent during recovery */
-	const u32 loss_high = tcp_is_sack(tp) ?  tp->snd_nxt : tp->high_seq;
+	const u32 loss_high = tp->snd_nxt;
 
 	WARN_ON(packets > tp->packets_out);
 	skb = tp->lost_skb_hint;
@@ -2218,26 +2216,11 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int mark_head)
 		if (after(TCP_SKB_CB(skb)->end_seq, loss_high))
 			break;
 
-		oldcnt = cnt;
-		if (tcp_is_reno(tp) ||
-		    (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
+		if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)
 			cnt += tcp_skb_pcount(skb);
 
-		if (cnt > packets) {
-			if (tcp_is_sack(tp) ||
-			    (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) ||
-			    (oldcnt >= packets))
-				break;
-
-			mss = tcp_skb_mss(skb);
-			/* If needed, chop off the prefix to mark as lost. */
-			lost = (packets - oldcnt) * mss;
-			if (lost < skb->len &&
-			    tcp_fragment(sk, TCP_FRAG_IN_RTX_QUEUE, skb,
-					 lost, mss, GFP_ATOMIC) < 0)
-				break;
-			cnt = packets;
-		}
+		if (cnt > packets)
+			break;
 
 		tcp_skb_mark_lost(tp, skb);
 
@@ -2849,8 +2832,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una,
 			if (tcp_try_undo_partial(sk, prior_snd_una))
 				return;
 			/* Partial ACK arrived. Force fast retransmit. */
-			do_lost = tcp_is_reno(tp) ||
-				  tcp_force_fast_retransmit(sk);
+			do_lost = tcp_force_fast_retransmit(sk);
 		}
 		if (tcp_try_undo_dsack(sk)) {
 			tcp_try_keep_open(sk);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tcp: tcp_mark_head_lost is only valid for sack-tcp
  2020-05-07  3:08 [PATCH] tcp: tcp_mark_head_lost is only valid for sack-tcp zhang kai
@ 2020-05-07 13:58 ` Neal Cardwell
  2020-05-07 14:14   ` Eric Dumazet
  2020-05-08  0:58 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Neal Cardwell @ 2020-05-07 13:58 UTC (permalink / raw)
  To: zhang kai
  Cc: Yuchung Cheng, Eric Dumazet, David Miller, Alexey Kuznetsov,
	Hideaki YOSHIFUJI, Jakub Kicinski, Netdev

On Wed, May 6, 2020 at 11:09 PM zhang kai <zhangkaiheb@126.com> wrote:
>
> so tcp_is_sack/reno checks are removed from tcp_mark_head_lost.
>
> Signed-off-by: zhang kai <zhangkaiheb@126.com>
> ---

Nice clean-up, thanks.

Acked-by: Neal Cardwell <ncardwell@google.com>

As Eric noted in previous threads, this clean-up is now possible after:

6ac06ecd3a5d1dd1aaea5c2a8f6d6e4c81d5de6a ("tcp: simpler NewReno implementation")

As Yuchung noted, the tcp_mark_head_lost() function is not used today
when RACK is enabled (which is by
default).

neal

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tcp: tcp_mark_head_lost is only valid for sack-tcp
  2020-05-07 13:58 ` Neal Cardwell
@ 2020-05-07 14:14   ` Eric Dumazet
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2020-05-07 14:14 UTC (permalink / raw)
  To: Neal Cardwell
  Cc: zhang kai, Yuchung Cheng, David Miller, Alexey Kuznetsov,
	Hideaki YOSHIFUJI, Jakub Kicinski, Netdev

On Thu, May 7, 2020 at 6:58 AM Neal Cardwell <ncardwell@google.com> wrote:
>
> On Wed, May 6, 2020 at 11:09 PM zhang kai <zhangkaiheb@126.com> wrote:
> >
> > so tcp_is_sack/reno checks are removed from tcp_mark_head_lost.
> >
> > Signed-off-by: zhang kai <zhangkaiheb@126.com>
> > ---
>
> Nice clean-up, thanks.
>
> Acked-by: Neal Cardwell <ncardwell@google.com>
>
> As Eric noted in previous threads, this clean-up is now possible after:
>
> 6ac06ecd3a5d1dd1aaea5c2a8f6d6e4c81d5de6a ("tcp: simpler NewReno implementation")
>
> As Yuchung noted, the tcp_mark_head_lost() function is not used today
> when RACK is enabled (which is by
> default).
>
> neal

Yes, I was hoping for a bit more detailed changelog, it always helps
for future reference.

Thank you

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tcp: tcp_mark_head_lost is only valid for sack-tcp
  2020-05-07  3:08 [PATCH] tcp: tcp_mark_head_lost is only valid for sack-tcp zhang kai
  2020-05-07 13:58 ` Neal Cardwell
@ 2020-05-08  0:58 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2020-05-08  0:58 UTC (permalink / raw)
  To: zhangkaiheb; +Cc: ycheng, edumazet, ncardwell, kuznet, yoshfuji, kuba, netdev

From: zhang kai <zhangkaiheb@126.com>
Date: Thu, 7 May 2020 11:08:30 +0800

> so tcp_is_sack/reno checks are removed from tcp_mark_head_lost.
> 
> Signed-off-by: zhang kai <zhangkaiheb@126.com>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-08  0:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07  3:08 [PATCH] tcp: tcp_mark_head_lost is only valid for sack-tcp zhang kai
2020-05-07 13:58 ` Neal Cardwell
2020-05-07 14:14   ` Eric Dumazet
2020-05-08  0:58 ` David Miller

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).