Skip to content

Commit 1f3cb08

Browse files
ssharkscarlescufi
authored andcommitted
net: tcp: Remove trigger of send_data_timer when window full
Likely this trigger of the send_data_timer was an alternative for the function that has been filled in by the ZWP transmission. At the moment this timer has the potential to cause spurious retransmissions that can degrade the throughput of the network stack. Second to that it can accelerate the retransmission process, quickly running to the number of retransmissions, causing a connection failure. Signed-off-by: Sjors Hettinga <[email protected]>
1 parent a0a9539 commit 1f3cb08

File tree

1 file changed

+4
-34
lines changed

1 file changed

+4
-34
lines changed

subsys/net/ip/tcp.c

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,41 +2775,11 @@ int net_tcp_queue_data(struct net_context *context, struct net_pkt *pkt)
27752775

27762776
k_mutex_lock(&conn->lock, K_FOREVER);
27772777

2778+
/* If there is no space to transmit, try at a later time.
2779+
* The ZWP will make sure the window becomes available at
2780+
* some point in time.
2781+
*/
27782782
if (tcp_window_full(conn)) {
2779-
if (conn->send_win == 0) {
2780-
/* No point retransmiting if the current TX window size
2781-
* is 0.
2782-
*/
2783-
ret = -EAGAIN;
2784-
goto out;
2785-
}
2786-
2787-
/* Trigger resend if the timer is not active */
2788-
/* TODO: use k_work_delayable for send_data_timer so we don't
2789-
* have to directly access the internals of the legacy object.
2790-
*
2791-
* NOTE: It is not permitted to access any fields of k_work or
2792-
* k_work_delayable directly. This replacement does so, but
2793-
* only as a temporary workaround until the legacy
2794-
* k_delayed_work structure is replaced with k_work_delayable;
2795-
* at that point k_work_schedule() can be invoked to cause the
2796-
* work to be scheduled if it is not already scheduled.
2797-
*
2798-
* This solution diverges from the original, which would
2799-
* invoke the retransmit function directly here. Because that
2800-
* function is given a k_work pointer, again this cannot be
2801-
* done without accessing the internal data of the
2802-
* k_work_delayable structure.
2803-
*
2804-
* The original inline retransmission could be supported by
2805-
* refactoring the work_handler to delegate to a function that
2806-
* takes conn directly, rather than the work item in which
2807-
* conn is embedded, and calling that function directly here
2808-
* and in the work handler.
2809-
*/
2810-
(void)k_work_schedule_for_queue(&tcp_work_q,
2811-
&conn->send_data_timer,
2812-
K_NO_WAIT);
28132783
ret = -EAGAIN;
28142784
goto out;
28152785
}

0 commit comments

Comments
 (0)