net: tcp: Removed copy of conn->unacked_len

In the function tcp_send_data, the variable conn->unacked_len in copied
into a local variable pos. This value is only used in one location and
used mixed with the original conn->unacked_len.

This fix removes pos and switches to use conn->unacked_len everywhere
to reduce the chance of confusion. This does not functionally change the
code.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
This commit is contained in:
Sjors Hettinga 2022-05-19 08:05:11 +02:00 committed by Carles Cufí
commit 2d824f4811

View file

@ -1006,10 +1006,9 @@ static int tcp_unsent_len(struct tcp *conn)
static int tcp_send_data(struct tcp *conn) static int tcp_send_data(struct tcp *conn)
{ {
int ret = 0; int ret = 0;
int pos, len; int len;
struct net_pkt *pkt; struct net_pkt *pkt;
pos = conn->unacked_len;
len = MIN3(conn->send_data_total - conn->unacked_len, len = MIN3(conn->send_data_total - conn->unacked_len,
conn->send_win - conn->unacked_len, conn->send_win - conn->unacked_len,
conn_mss(conn)); conn_mss(conn));
@ -1026,7 +1025,7 @@ static int tcp_send_data(struct tcp *conn)
goto out; goto out;
} }
ret = tcp_pkt_peek(pkt, conn->send_data, pos, len); ret = tcp_pkt_peek(pkt, conn->send_data, conn->unacked_len, len);
if (ret < 0) { if (ret < 0) {
tcp_pkt_unref(pkt); tcp_pkt_unref(pkt);
ret = -ENOBUFS; ret = -ENOBUFS;