net/tcp: rename the winszie to snd_wnd to make the semantics more accurate

Change-Id: I8fdc7cf78a7f2cd53a30ef1de702b1a697c43238
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2020-12-07 13:51:08 +08:00
committed by Masayuki Ishikawa
parent 375211f5a1
commit 794a6ec23d
6 changed files with 13 additions and 12 deletions
+3 -3
View File
@@ -446,14 +446,14 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
sndlen = conn->mss; sndlen = conn->mss;
} }
winleft = conn->winsize - sinfo->s_sent + sinfo->s_acked; winleft = conn->snd_wnd - sinfo->s_sent + sinfo->s_acked;
if (sndlen > winleft) if (sndlen > winleft)
{ {
sndlen = winleft; sndlen = winleft;
} }
ninfo("s_buflen=%zu s_sent=%zu mss=%u winsize=%u sndlen=%d\n", ninfo("s_buflen=%zu s_sent=%zu mss=%u snd_wnd=%u sndlen=%d\n",
sinfo->s_buflen, sinfo->s_sent, conn->mss, conn->winsize, sinfo->s_buflen, sinfo->s_sent, conn->mss, conn->snd_wnd,
sndlen); sndlen);
if (sndlen > 0) if (sndlen > 0)
+2 -1
View File
@@ -192,7 +192,8 @@ struct tcp_conn_s
uint16_t rport; /* The remoteTCP port, in network byte order */ uint16_t rport; /* The remoteTCP port, in network byte order */
uint16_t mss; /* Current maximum segment size for the uint16_t mss; /* Current maximum segment size for the
* connection */ * connection */
uint16_t winsize; /* Current window size of the connection */ uint16_t snd_wnd; /* Sequence and acknowledgement numbers of last
* window update */
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS #ifdef CONFIG_NET_TCP_WRITE_BUFFERS
uint32_t tx_unacked; /* Number bytes sent but not yet ACKed */ uint32_t tx_unacked; /* Number bytes sent but not yet ACKed */
#else #else
+1 -1
View File
@@ -326,7 +326,7 @@ found:
/* Update the connection's window size */ /* Update the connection's window size */
conn->winsize = ((uint16_t)tcp->wnd[0] << 8) + (uint16_t)tcp->wnd[1]; conn->snd_wnd = ((uint16_t)tcp->wnd[0] << 8) + (uint16_t)tcp->wnd[1];
flags = 0; flags = 0;
+5 -5
View File
@@ -734,7 +734,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
if ((conn->tcpstateflags & TCP_ESTABLISHED) && if ((conn->tcpstateflags & TCP_ESTABLISHED) &&
(flags & (TCP_POLL | TCP_REXMIT)) && (flags & (TCP_POLL | TCP_REXMIT)) &&
!(sq_empty(&conn->write_q)) && !(sq_empty(&conn->write_q)) &&
conn->winsize > 0) conn->snd_wnd > 0)
{ {
FAR struct tcp_wrbuffer_s *wrb; FAR struct tcp_wrbuffer_s *wrb;
uint32_t predicted_seqno; uint32_t predicted_seqno;
@@ -760,15 +760,15 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
sndlen = conn->mss; sndlen = conn->mss;
} }
if (sndlen > conn->winsize) if (sndlen > conn->snd_wnd)
{ {
sndlen = conn->winsize; sndlen = conn->snd_wnd;
} }
ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%zu mss=%u " ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%zu mss=%u "
"winsize=%u\n", "snd_wnd=%u\n",
wrb, TCP_WBPKTLEN(wrb), TCP_WBSENT(wrb), sndlen, conn->mss, wrb, TCP_WBPKTLEN(wrb), TCP_WBSENT(wrb), sndlen, conn->mss,
conn->winsize); conn->snd_wnd);
/* Set the sequence number for this segment. If we are /* Set the sequence number for this segment. If we are
* retransmitting, then the sequence number will already * retransmitting, then the sequence number will already
+1 -1
View File
@@ -417,7 +417,7 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
/* Check if we have "space" in the window */ /* Check if we have "space" in the window */
if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->winsize) if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->snd_wnd)
{ {
/* Set the sequence number for this packet. NOTE: The network /* Set the sequence number for this packet. NOTE: The network
* updates sndseq on receipt of ACK *before* this function is * updates sndseq on receipt of ACK *before* this function is
+1 -1
View File
@@ -299,7 +299,7 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
/* Check if we have "space" in the window */ /* Check if we have "space" in the window */
if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->winsize) if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->snd_wnd)
{ {
uint32_t seqno; uint32_t seqno;