net: tcp: Do not capture tx_sem during retransmission

As the stack can safely keep allocating data during retransmission mode
there is no need to take the tx_sem during retransmission any more.

Data stored in the send_data buffer will be transmitted upon the ack of
the data for which an ack is pending. This the application being fully
stalled when the TCP connection enters retransmission mode.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
This commit is contained in:
Sjors Hettinga 2022-06-20 09:11:05 +02:00 committed by Carles Cufí
parent 17f94d3f96
commit 4243e8e99c

View file

@ -1201,8 +1201,6 @@ static void tcp_resend_data(struct k_work *work)
conn->data_mode = TCP_DATA_MODE_RESEND;
conn->unacked_len = 0;
(void)k_sem_take(&conn->tx_sem, K_NO_WAIT);
ret = tcp_send_data(conn);
conn->send_data_retries++;
if (ret == 0) {
@ -1227,10 +1225,6 @@ static void tcp_resend_data(struct k_work *work)
} else if (ret == -ENODATA) {
conn->data_mode = TCP_DATA_MODE_SEND;
if (!tcp_window_full(conn)) {
k_sem_give(&conn->tx_sem);
}
goto out;
} else if (ret == -ENOBUFS) {
NET_ERR("TCP failed to allocate buffer in retransmission");