You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/04/05 11:16:56 UTC
[incubator-nuttx] branch master updated: tcp_netpoll.c: Fix a
performance issue with CONFIG_NET_TCP_WRITE_BUFFERS
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new acc3596 tcp_netpoll.c: Fix a performance issue with CONFIG_NET_TCP_WRITE_BUFFERS
acc3596 is described below
commit acc3596adc919ec63a443e4a37133ef51bed68e4
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Mon Apr 5 16:21:17 2021 +0900
tcp_netpoll.c: Fix a performance issue with CONFIG_NET_TCP_WRITE_BUFFERS
Tested with a modified version of webclient, which uses non-blocking i/o.
The packet dumps look more reasonable with this change.
---
net/tcp/tcp_netpoll.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c
index 505eef8..03ffe0f 100644
--- a/net/tcp/tcp_netpoll.c
+++ b/net/tcp/tcp_netpoll.c
@@ -97,7 +97,18 @@ static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev,
/* A poll is a sign that we are free to send data. */
- else if (psock_tcp_cansend(info->psock) >= 0)
+ /* Wake up poll() speculatively on TCP_ACKDATA.
+ * Note: our event handler is usually executed before
+ * psock_send_eventhandler, which might free IOBs/WRBs on TCP_ACKDATA.
+ * Revisit: consider some kind of priority for devif callback to allow
+ * this callback to be inserted after psock_send_eventhandler.
+ */
+
+ else if (psock_tcp_cansend(info->psock) >= 0
+#if defined(CONFIG_NET_TCP_WRITE_BUFFERS)
+ || (flags & TCP_ACKDATA) != 0
+#endif
+ )
{
eventset |= (POLLOUT & info->fds->events);
}
@@ -198,7 +209,11 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
if ((fds->events & POLLOUT) != 0)
{
- cb->flags |= TCP_POLL;
+ cb->flags |= TCP_POLL
+#if defined(CONFIG_NET_TCP_WRITE_BUFFERS)
+ | TCP_ACKDATA
+#endif
+ ;
}
if ((fds->events & POLLIN) != 0)