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

View file

@ -446,14 +446,14 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
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)
{
sndlen = winleft;
}
ninfo("s_buflen=%zu s_sent=%zu mss=%u winsize=%u sndlen=%d\n",
sinfo->s_buflen, sinfo->s_sent, conn->mss, conn->winsize,
ninfo("s_buflen=%zu s_sent=%zu mss=%u snd_wnd=%u sndlen=%d\n",
sinfo->s_buflen, sinfo->s_sent, conn->mss, conn->snd_wnd,
sndlen);
if (sndlen > 0)

View file

@ -192,7 +192,8 @@ struct tcp_conn_s
uint16_t rport; /* The remoteTCP port, in network byte order */
uint16_t mss; /* Current maximum segment size for the
* 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
uint32_t tx_unacked; /* Number bytes sent but not yet ACKed */
#else

View file

@ -326,7 +326,7 @@ found:
/* 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;

View file

@ -734,7 +734,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
if ((conn->tcpstateflags & TCP_ESTABLISHED) &&
(flags & (TCP_POLL | TCP_REXMIT)) &&
!(sq_empty(&conn->write_q)) &&
conn->winsize > 0)
conn->snd_wnd > 0)
{
FAR struct tcp_wrbuffer_s *wrb;
uint32_t predicted_seqno;
@ -760,15 +760,15 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
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 "
"winsize=%u\n",
"snd_wnd=%u\n",
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
* retransmitting, then the sequence number will already

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 */
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
* updates sndseq on receipt of ACK *before* this function is

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 */
if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->winsize)
if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->snd_wnd)
{
uint32_t seqno;