Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
486314ad
Commit
486314ad
authored
11 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Add configuration support for TCP Write Buffering
parent
f47b3d04
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/nuttx/net/uip/uipopt.h
+19
-1
19 additions, 1 deletion
include/nuttx/net/uip/uipopt.h
net/Kconfig
+43
-5
43 additions, 5 deletions
net/Kconfig
net/uip/uip_tcpreadahead.c
+22
-9
22 additions, 9 deletions
net/uip/uip_tcpreadahead.c
with
84 additions
and
15 deletions
include/nuttx/net/uip/uipopt.h
+
19
−
1
View file @
486314ad
...
...
@@ -294,7 +294,7 @@
# define CONFIG_NET_NTCP_READAHEAD_BUFFERS 4
# endif
/* The size of
th
e TCP read buffer
size
*/
/* The size of
on
e TCP read buffer */
# ifndef CONFIG_NET_TCP_READAHEAD_BUFSIZE
# define CONFIG_NET_TCP_READAHEAD_BUFSIZE UIP_TCP_MSS
...
...
@@ -305,6 +305,24 @@
# undef CONFIG_NET_NTCP_READAHEAD_BUFFERS
#endif
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
/* Number of TCP write buffers */
# ifndef CONFIG_NET_NTCP_WRITE_BUFFERS
# define CONFIG_NET_NTCP_WRITE_BUFFERS 1
# endif
/* The size of one TCP write buffer */
# ifndef CONFIG_NET_TCP_WRITE_BUFSIZE
# define CONFIG_NET_TCP_WRITE_BUFSIZE UIP_TCP_MSS
# endif
#else
# undef CONFIG_NET_TCP_WRITE_BUFSIZE
# undef CONFIG_NET_NTCP_WRITE_BUFFERS
#endif
/* Delay after receive to catch a following packet. No delay should be
* required if TCP/IP read-ahead buffering is enabled.
*/
...
...
This diff is collapsed.
Click to expand it.
net/Kconfig
+
43
−
5
View file @
486314ad
...
...
@@ -103,6 +103,7 @@ config NET_TCP
TCP support on or off
if NET_TCP
config NET_TCP_CONNS
int "Number of TCP/IP connections"
default 8
...
...
@@ -118,6 +119,14 @@ config NET_MAX_LISTENPORTS
config NET_TCP_READAHEAD
bool "Enabled TCP/IP read-ahead buffering"
default y
---help---
Read-ahead buffers allows buffering of TCP/IP packets when there is no
receive in place to catch the TCP packet. In that case, the packet
will be retained in the NuttX read-ahead buffers.
You might want to disable TCP/IP read-ahead buffering on a highly
memory constrained system that does not have any TCP/IP packet rate
issues.
if NET_TCP_READAHEAD
...
...
@@ -140,14 +149,43 @@ config NET_NTCP_READAHEAD_BUFFERS
receive in place to catch the TCP packet. In that case, the packet
will be retained in the NuttX read-ahead buffers.
This setting specifies the number of TCP/IP read-ahead buffers This
value can be set to zero to disable all TCP/IP read-ahead buffering.
You might want to disable TCP/IP read-ahead buffering on a highly
memory constained system that does not have any TCP/IP packet rate
issues.
This setting specifies the number of TCP/IP read-ahead buffers.
endif # NET_TCP_READAHEAD
config NET_TCP_WRITE_BUFFERS
bool "Enabled TCP/IP write buffering"
default n
---help---
Write buffers allows buffering of ongoing TCP/IP packets, providing
for higher performance, streamed output.
You might want to disable TCP/IP write buffering on a highly memory
memory constrained system where there are no performance issues.
if NET_TCP_WRITE_BUFFERS
config NET_TCP_WRITE_BUFSIZE
int "TCP/IP write buffer size"
default 562
---help---
Write buffers allows buffering of ongoing TCP/IP packets, providing
for higher performance, streamed output.
This setting specifies the size of one TCP/IP write buffer. This
should best be a equal to the maximum packet size (NET_BUFSIZE).
config NET_NTCP_WRITE_BUFFERS
int "Number of TCP/IP write buffers"
default 8
---help---
Write buffers allows buffering of ongoing TCP/IP packets, providing
for higher performance, streamed output.
This setting specifies the number of TCP/IP write buffers.
endif # NET_TCP_WRITE_BUFFERS
config NET_TCP_RECVDELAY
int "TCP Rx delay"
default 0
...
...
This diff is collapsed.
Click to expand it.
net/uip/uip_tcpreadahead.c
+
22
−
9
View file @
486314ad
...
...
@@ -48,16 +48,29 @@
#include
"uip_internal.h"
/****************************************************************************
* Private
Data
* Private
Types
****************************************************************************/
/* These are the pre-allocated read-ahead buffers */
/* Package all globals used by this logic into a structure */
struct
readahead_s
{
/* This is the list of available write buffers */
sq_queue_t
freebuffers
;
/* These are the pre-allocated write buffers */
static
struct
uip_readahead_s
g_buffers
[
CONFIG_NET_NTCP_READAHEAD_BUFFERS
];
struct
uip_readahead_s
buffers
[
CONFIG_NET_NTCP_READAHEAD_BUFFERS
];
};
/****************************************************************************
* Private Data
****************************************************************************/
/* This is the
list of available
read-ahead
buffers
*/
/* This is the
state of the global
read-ahead
resource
*/
static
s
q_queue_t
g_
f
re
ebuffers
;
static
s
truct
readahead_s
g_re
adahead
;
/****************************************************************************
* Private Functions
...
...
@@ -82,10 +95,10 @@ void uip_tcpreadaheadinit(void)
{
int
i
;
sq_init
(
&
g_freebuffers
);
sq_init
(
&
g_
readahead
.
freebuffers
);
for
(
i
=
0
;
i
<
CONFIG_NET_NTCP_READAHEAD_BUFFERS
;
i
++
)
{
sq_addfirst
(
&
g_buffers
[
i
].
rh_node
,
&
g_freebuffers
);
sq_addfirst
(
&
g_
readahead
.
buffers
[
i
].
rh_node
,
&
g_
readahead
.
freebuffers
);
}
}
...
...
@@ -106,7 +119,7 @@ void uip_tcpreadaheadinit(void)
struct
uip_readahead_s
*
uip_tcpreadaheadalloc
(
void
)
{
return
(
struct
uip_readahead_s
*
)
sq_remfirst
(
&
g_freebuffers
);
return
(
struct
uip_readahead_s
*
)
sq_remfirst
(
&
g_
readahead
.
freebuffers
);
}
/****************************************************************************
...
...
@@ -124,7 +137,7 @@ struct uip_readahead_s *uip_tcpreadaheadalloc(void)
void
uip_tcpreadaheadrelease
(
struct
uip_readahead_s
*
buf
)
{
sq_addfirst
(
&
buf
->
rh_node
,
&
g_freebuffers
);
sq_addfirst
(
&
buf
->
rh_node
,
&
g_
readahead
.
freebuffers
);
}
#endif
/* CONFIG_NET && CONFIG_NET_TCP && CONFIG_NET_TCP_READAHEAD */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment