Skip to contentSkip to conversation

net: tcp: add correct check for tcp_retransmit_skb()

PATCH In review Sharath Chandra Vurukala 3 participants 3 messages Dec 1, 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.

---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +1 -1
index 091c5392..c19f371 100644
@@ -511,7 +511,7 @@ void tcp_retransmit_timer(struct sock *sk)
 
 	tcp_enter_loss(sk);
 
-	if (tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1) > 0) {
+	if (tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1) != 0) {
 		/* Retransmission failed because of local congestion,
 		 * do not backoff.
 		 */
Signature · 1 line
1.9.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.

This looks wrong.

Yuchung has cooked a patch series to really address issues, please wait for it

We are waiting for David Miller to merge a prior patch series into net tree, then in net-next.

Thanks.

#2 lore raw
In reply to Sharath Chandra Vurukala
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.

Perhaps my previous comment was not clear: your bug-fix patch is incorrect.

On local congestion, tcp_retransmit_skb returns positive values *only*. negative values do not indicate local congestion.

Quoted 20 lines
---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +1 -2
index 091c5392..c19f371 100644
@@ -511,7 +511,7 @@ void tcp_retransmit_timer(struct sock *sk)
 
        tcp_enter_loss(sk);
 
-       if (tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1) > 0) {
+       if (tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1) != 0) {
                /* Retransmission failed because of local congestion,
                 * do not backoff.
                 */
--

1.9.1