Skip to contentSkip to conversation

net: tcp: add correct check for tcp_retransmit_skb()

PATCH In review Sharath Chandra Vurukala 4 participants 4 messages Nov 26, 2018 – Nov 28, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: tcp: add correct check for tcp_retransmit_skb()

when the tcp_retranmission_timer expires and tcp_retranmsit_skb is called if the retranmsission fails due to local congestion, backoff should not incremented.

tcp_retransmit_skb() returns non-zero negative value in some cases of failure but the caller tcp_retransmission_timer() has a check for failure which checks if the return value is greater than zero. The check is corrected to check for non-zero value.

Change-Id I494fed73b2e385216402c91e9558d5c2884add5b
---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +1 -1
index 4be66e4..a70b4a9 100644
@@ -536,7 +536,7 @@ void tcp_retransmit_timer(struct sock *sk)
 
 	tcp_enter_loss(sk);
 
-	if (tcp_retransmit_skb(sk, tcp_write_queue_head(sk), 1) > 0) {
+	if (tcp_retransmit_skb(sk, tcp_write_queue_head(sk), 1) != 0) {
 		/* Retransmission failed because of local congestion,
 		 * do not backoff.
 		 */
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Sharath Chandra Vurukala

when the tcp_retranmission_timer expires and tcp_retranmsit_skb is called if the retranmsission fails due to local congestion, backoff should not incremented.

tcp_retransmit_skb() returns non-zero negative value in some cases of failure but the caller tcp_retransmission_timer() has a check for failure which checks if the return value is greater than zero. The check is corrected to check for non-zero value.

Change-Id I494fed73b2e385216402c91e9558d5c2884add5b

You are right, tcp_retransmit_skb() calls int err = __tcp_retransmit_skb() which returns non-zero on error.

Signature · 2 lines
Cheers,
Joey Pabalinas
maintainer
#2 lore raw
In reply to Sharath Chandra Vurukala

From: Sharath Chandra Vurukala <[email protected]>
Date: Mon, 26 Nov 2018 15:05:50 +0530

Quoted 10 lines

when the tcp_retranmission_timer expires and tcp_retranmsit_skb is called if the retranmsission fails due to local congestion, backoff should not incremented.

tcp_retransmit_skb() returns non-zero negative value in some cases of failure but the caller tcp_retransmission_timer() has a check for failure which checks if the return value is greater than zero. The check is corrected to check for non-zero value.

Change-Id: I494fed73b2e385216402c91e9558d5c2884add5b

No changeids please.

Quoted 1 line

This patch doesn't apply cleanly to my net tree.

#3 lore raw
In reply to Sharath Chandra Vurukala
Quoted 8 lines · Sharath Chandra Vurukala

when the tcp_retranmission_timer expires and tcp_retranmsit_skb is called if the retranmsission fails due to local congestion, backoff should not incremented.

tcp_retransmit_skb() returns non-zero negative value in some cases of failure but the caller tcp_retransmission_timer() has a check for failure which checks if the return value is greater than zero. The check is corrected to check for non-zero value.

Not sure about this fix. The specific check is to handle local congestion which is only indicated by positive return values.

Quoted 23 lines
Change-Id I494fed73b2e385216402c91e9558d5c2884add5b
---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +1 -2
index 4be66e4..a70b4a9 100644
@@ -536,7 +536,7 @@ void tcp_retransmit_timer(struct sock *sk)
 
        tcp_enter_loss(sk);
 
-       if (tcp_retransmit_skb(sk, tcp_write_queue_head(sk), 1) > 0) {
+       if (tcp_retransmit_skb(sk, tcp_write_queue_head(sk), 1) != 0) {
                /* Retransmission failed because of local congestion,
                 * do not backoff.
                 */
--

1.9.1