You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2020/12/10 03:25:52 UTC
[incubator-nuttx] 01/03: net/tcp: rename the winszie to snd_wnd to
make the semantics more accurate
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 794a6ec23d640d5a421dabe7921afa8631bb703b
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Dec 7 13:51:08 2020 +0800
net/tcp: rename the winszie to snd_wnd to make the semantics more accurate
Change-Id: I8fdc7cf78a7f2cd53a30ef1de702b1a697c43238
Signed-off-by: chao.an <an...@xiaomi.com>
---
net/sixlowpan/sixlowpan_tcpsend.c | 6 +++---
net/tcp/tcp.h | 3 ++-
net/tcp/tcp_input.c | 2 +-
net/tcp/tcp_send_buffered.c | 10 +++++-----
net/tcp/tcp_send_unbuffered.c | 2 +-
net/tcp/tcp_sendfile.c | 2 +-
6 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c
index ddc34da..b0b0277 100644
--- a/net/sixlowpan/sixlowpan_tcpsend.c
+++ b/net/sixlowpan/sixlowpan_tcpsend.c
@@ -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)
diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h
index 9dd9f0c..fc67f45 100644
--- a/net/tcp/tcp.h
+++ b/net/tcp/tcp.h
@@ -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
diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c
index bd6455a..c7055a3 100644
--- a/net/tcp/tcp_input.c
+++ b/net/tcp/tcp_input.c
@@ -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;
diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c
index 981b2f8..51c36a6 100644
--- a/net/tcp/tcp_send_buffered.c
+++ b/net/tcp/tcp_send_buffered.c
@@ -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
diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c
index abdd11d..387f3c7 100644
--- a/net/tcp/tcp_send_unbuffered.c
+++ b/net/tcp/tcp_send_unbuffered.c
@@ -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
diff --git a/net/tcp/tcp_sendfile.c b/net/tcp/tcp_sendfile.c
index 8c84334..6792e9c 100644
--- a/net/tcp/tcp_sendfile.c
+++ b/net/tcp/tcp_sendfile.c
@@ -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;