Make the read ahead buffer unselectable
Here is the email loop talk about why it is better to remove the option: https://groups.google.com/forum/#!topic/nuttx/AaNkS7oU6R0 Change-Id: Ib66c037752149ad4b2787ef447f966c77aa12aad Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
b96d0bfb70
commit
346336bb9e
@ -4600,7 +4600,7 @@ This objectives of this feature are:
|
||||
<dt><code>CONFIG_IOB_NBUFFERS</code>
|
||||
<dd>Number of pre-allocated I/O buffers. Each packet is represented by a series of small I/O buffers in a chain. This setting determines the number of preallocated I/O buffers available for packet data.
|
||||
|
||||
The default value is setup for network support. The default is 8 buffers if neither TCP read-ahead or TCP write buffering is enabled (neither <code>CONFIG_NET_TCP_WRITE_BUFFERS</code> nor <code>CONFIG_NET_TCP_READAHEAD</code>), 24 if only write buffering is enabled, and 36 if both read-ahead and write buffering are enabled.
|
||||
The default value is setup for network support. The default is 8 buffers if neither TCP/UDP or write buffering is enabled (neither <code>CONFIG_NET_TCP_WRITE_BUFFERS</code> nor <code>CONFIG_NET_TCP</code>), 24 if only TCP/UDP is enabled, and 36 if both TCP/UDP and write buffering are enabled.
|
||||
|
||||
<dt><code>CONFIG_IOB_BUFSIZE</code>
|
||||
<dd>Payload size of one I/O buffer. Each packet is represented by a series of small I/O buffers in a chain. This setting determines the data payload each preallocated I/O buffer. The default value is 196 bytes.
|
||||
@ -4610,7 +4610,7 @@ This objectives of this feature are:
|
||||
|
||||
<dd>These generic I/O buffer chain containers are not currently used by any logic in NuttX. That is because their other other specialized I/O buffer chain containers that also carry a payload of usage specific information.
|
||||
|
||||
The default value is zero if nether TCP nor UDP read-ahead buffering is enabled (i.e., neither <code>CONFIG_NET_TCP_READAHEAD</code> && !<code>CONFIG_NET_UDP_READAHEAD</code> or eight if either is enabled.
|
||||
The default value is zero if nether TCP nor UDP is enabled (i.e., neither <code>CONFIG_NET_TCP</code> && !<code>CONFIG_NET_UDP</code> or eight if either is enabled.
|
||||
|
||||
<dt><code>CONFIG_IOB_THROTTLE</code>
|
||||
<dd>I/O buffer throttle value. TCP write buffering and read-ahead buffer use the same pool of free I/O buffers. In order to prevent uncontrolled incoming TCP packets from hogging all of the available, pre-allocated I/O buffers, a throttling value is required. This throttle value assures that I/O buffers will be denied to the read-ahead logic before TCP writes are halted.
|
||||
|
@ -8639,8 +8639,6 @@ interface of the same name.
|
||||
<ul>
|
||||
<li><code>CONFIG_NET</code> Defined for general network support</li>
|
||||
<li><code>CONFIG_NET_TCP</code> Defined for TCP/IP support</li>
|
||||
<li><code>CONFIG_NET_TCP_READAHEAD</code> Define to enable read-ahead buffering</li>
|
||||
<li><code>CONFIG_NET_NTCP_READAHEAD_BUFFERS</code> Defined to be greater than zero</li>
|
||||
</ul>
|
||||
<p>
|
||||
In order to for select to work with incoming connections, you must also select:
|
||||
|
@ -200,11 +200,9 @@ Networking Support
|
||||
CONFIG_NET_ARP_IPIN=y : Enable ARP address harvesting
|
||||
CONFIG_NET_ARP_SEND=y : Send ARP request before sending data
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCP_READAHEAD=y : Support TCP read-ahead
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Support TCP write-buffering
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_MAX_LISTENPORTS=20 :
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=536 Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Needed for DNS name resolution
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
|
@ -203,11 +203,9 @@ Networking Support
|
||||
CONFIG_NET_ARP_IPIN=y : Enable ARP address harvesting
|
||||
CONFIG_NET_ARP_SEND=y : Send ARP request before sending data
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCP_READAHEAD=y : Support TCP read-ahead
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Support TCP write-buffering
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_MAX_LISTENPORTS=20 :
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=536 Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Needed for DNS name resolution
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
|
@ -178,11 +178,9 @@ Networking Support
|
||||
CONFIG_NET_ARP_IPIN=y : Enable ARP address harvesting
|
||||
CONFIG_NET_ARP_SEND=y : Send ARP request before sending data
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCP_READAHEAD=y : Support TCP read-ahead
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Support TCP write-buffering
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_MAX_LISTENPORTS=20 :
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=536 Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Needed for DNS name resolution
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
|
@ -226,7 +226,6 @@ Networking Support
|
||||
CONFIG_NET_ETH_PKTSIZE=562 : Maximum packet size 1518 is more standard
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=536 Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Needed for DNS name resolution
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
|
@ -843,7 +843,6 @@ Networking
|
||||
CONFIG_NET_ETH_PKTSIZE=562 : Maximum packet size 1518 is more standard
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=562 : Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
CONFIG_NET_ICMP_SOCKET=y : Needed for NSH ping command
|
||||
|
@ -5,7 +5,6 @@
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NET_UDP_READAHEAD is not set
|
||||
# CONFIG_SAMA5_ISRAM_HEAP is not set
|
||||
# CONFIG_SAMA5_UART0 is not set
|
||||
CONFIG_ARCH="arm"
|
||||
|
@ -983,7 +983,6 @@ Networking
|
||||
CONFIG_NET_ETH_PKTSIZE=562 : Maximum packet size 1518 is more standard
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=562 : Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
CONFIG_NET_ICMP_SOCKET=y : Needed for NSH ping command
|
||||
|
@ -1344,7 +1344,6 @@ Networking
|
||||
CONFIG_NET_ARP_IPIN=y : IP address harvesting (optional)
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_TCP_READAHEAD=y : Enable TCP read-ahead buffering
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Enable TCP write buffering
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Support UDP broadcast packets
|
||||
|
@ -5,7 +5,6 @@
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NET_UDP_READAHEAD is not set
|
||||
# CONFIG_SAMA5_ISRAM_HEAP is not set
|
||||
# CONFIG_SAMA5_UART0 is not set
|
||||
CONFIG_ARCH="arm"
|
||||
|
@ -395,7 +395,6 @@ Selecting the GMAC peripheral
|
||||
CONFIG_NET_ARP_SEND=y : Use ARP to get peer address before sending
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_TCP_READAHEAD=y : Enable TCP read-ahead buffering
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Enable TCP write buffering
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Support UDP broadcast packets
|
||||
|
@ -711,7 +711,6 @@ Selecting the GMAC peripheral
|
||||
CONFIG_NET_ARP_SEND=y : Use ARP to get peer address before sending
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_TCP_READAHEAD=y : Enable TCP read-ahead buffering
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Enable TCP write buffering
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Support UDP broadcast packets
|
||||
|
@ -5,7 +5,6 @@
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NET_UDP_READAHEAD is not set
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
# CONFIG_SPI_CALLBACK is not set
|
||||
|
@ -5,7 +5,6 @@
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NET_UDP_READAHEAD is not set
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
CONFIG_ADC=y
|
||||
|
@ -374,8 +374,6 @@ ViewTool DP83848 Ethernet Module
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
|
||||
CONFIG_NET_ETH_PKTSIZE=650 : Maximum packet size
|
||||
CONFIG_NET_TCP_READAHEAD=y : Enable read-ahead buffering
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=650
|
||||
|
||||
CONFIG_NET_TCP=y : TCP support
|
||||
CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
|
||||
|
@ -232,11 +232,9 @@ Networking Support
|
||||
CONFIG_NET_ARP_IPIN=y : Enable ARP address harvesting
|
||||
CONFIG_NET_ARP_SEND=y : Send ARP request before sending data
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCP_READAHEAD=y : Support TCP read-ahead
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Support TCP write-buffering
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_MAX_LISTENPORTS=20 :
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=536 Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Needed for DNS name resolution
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
|
@ -7,7 +7,6 @@
|
||||
#
|
||||
# CONFIG_ARCH_FPU is not set
|
||||
# CONFIG_NET_IPv4 is not set
|
||||
# CONFIG_NET_UDP_READAHEAD is not set
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
CONFIG_ARCH="arm"
|
||||
|
@ -5,7 +5,6 @@
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NET_UDP_READAHEAD is not set
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
CONFIG_ARCH="arm"
|
||||
|
@ -136,13 +136,13 @@ static FAR const char *g_iob_user_names[] =
|
||||
#ifdef CONFIG_NET_BLUETOOTH
|
||||
"bluetooth_sock",
|
||||
#endif
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
#if defined(CONFIG_NET_UDP) && !defined(NET_UDP_NO_STACK)
|
||||
"udp_readahead",
|
||||
#endif
|
||||
#ifdef CONFIG_NET_UDP_WRITE_BUFFERS
|
||||
"udp_writebuffer",
|
||||
#endif
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
#if defined(CONFIG_NET_TCP) && !defined(NET_TCP_NO_STACK)
|
||||
"tcp_readahead",
|
||||
#endif
|
||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
||||
|
@ -7,7 +7,6 @@ menuconfig VNCSERVER
|
||||
bool "VNC server"
|
||||
default n
|
||||
depends on NET_TCP && !NX_LCDDRIVER
|
||||
select NET_TCP_READAHEAD
|
||||
select NX_UPDATE
|
||||
---help---
|
||||
Enable support for a VNC Remote Frame Buffer (RFB) server.
|
||||
|
@ -60,10 +60,6 @@
|
||||
|
||||
/* Configuration */
|
||||
|
||||
#ifndef CONFIG_NET_TCP_READAHEAD
|
||||
# error CONFIG_NET_TCP_READAHEAD must be set to use VNC
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NX_UPDATE
|
||||
# error CONFIG_NX_UPDATE must be set to use VNC
|
||||
#endif
|
||||
|
@ -187,13 +187,13 @@ enum iob_user_e
|
||||
#ifdef CONFIG_NET_BLUETOOTH
|
||||
IOBUSER_NET_SOCK_BLUETOOTH,
|
||||
#endif
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
#if defined(CONFIG_NET_UDP) && !defined(NET_UDP_NO_STACK)
|
||||
IOBUSER_NET_UDP_READAHEAD,
|
||||
#endif
|
||||
#ifdef CONFIG_NET_UDP_WRITE_BUFFERS
|
||||
IOBUSER_NET_UDP_WRITEBUFFER,
|
||||
#endif
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
#if defined(CONFIG_NET_TCP) && !defined(NET_TCP_NO_STACK)
|
||||
IOBUSER_NET_TCP_READAHEAD,
|
||||
#endif
|
||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
||||
|
@ -587,20 +587,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* General configuration options */
|
||||
|
||||
/* Delay after receive to catch a following packet. No delay should be
|
||||
* required if TCP/IP read-ahead buffering is enabled.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_TCP_RECVDELAY
|
||||
# ifdef CONFIG_NET_TCP_READAHEAD
|
||||
# define CONFIG_NET_TCP_RECVDELAY 0
|
||||
# else
|
||||
# define CONFIG_NET_TCP_RECVDELAY 5
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
@ -16,8 +16,8 @@ if MM_IOB
|
||||
|
||||
config IOB_NBUFFERS
|
||||
int "Number of pre-allocated I/O buffers"
|
||||
default 24 if (NET_WRITE_BUFFERS && !NET_READAHEAD) || (!NET_WRITE_BUFFERS && NET_READAHEAD)
|
||||
default 36 if NET_WRITE_BUFFERS && NET_READAHEAD
|
||||
default 36 if NET_WRITE_BUFFERS
|
||||
default 24 if !NET_WRITE_BUFFERS && NET_READAHEAD
|
||||
default 8 if !NET_WRITE_BUFFERS && !NET_READAHEAD
|
||||
---help---
|
||||
Each packet is represented by a series of small I/O buffers in a
|
||||
@ -34,8 +34,8 @@ config IOB_BUFSIZE
|
||||
|
||||
config IOB_NCHAINS
|
||||
int "Number of pre-allocated I/O buffer chain heads"
|
||||
default 0 if !NET_READAHEAD && !NET_UDP_READAHEAD
|
||||
default IOB_NBUFFERS if NET_READAHEAD || NET_UDP_READAHEAD
|
||||
default 0 if !NET_READAHEAD
|
||||
default IOB_NBUFFERS if NET_READAHEAD
|
||||
---help---
|
||||
These tiny nodes are used as "containers" to support queueing of
|
||||
I/O buffer chains. This will limit the number of I/O transactions
|
||||
|
@ -14,10 +14,12 @@ config ARCH_HAVE_PHY
|
||||
config NET_WRITE_BUFFERS
|
||||
bool
|
||||
default n
|
||||
select MM_IOB
|
||||
|
||||
config NET_READAHEAD
|
||||
bool
|
||||
default n
|
||||
select MM_IOB
|
||||
|
||||
config NET_MCASTGROUP
|
||||
bool
|
||||
|
@ -223,7 +223,6 @@ static inline void inet_tcp_newdata(FAR struct net_driver_s *dev,
|
||||
|
||||
if (recvlen < dev->d_len)
|
||||
{
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pstate->ir_sock->s_conn;
|
||||
FAR uint8_t *buffer = (FAR uint8_t *)dev->d_appdata + recvlen;
|
||||
uint16_t buflen = dev->d_len - recvlen;
|
||||
@ -251,9 +250,6 @@ static inline void inet_tcp_newdata(FAR struct net_driver_s *dev,
|
||||
{
|
||||
nerr("ERROR: packet data not saved (%d bytes)\n", buflen - nsaved);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
nerr("ERROR: packet data lost (%d bytes)\n", dev->d_len - recvlen);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -312,7 +308,7 @@ static inline void inet_udp_newdata(FAR struct net_driver_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(NET_TCP_HAVE_STACK) && defined(CONFIG_NET_TCP_READAHEAD)
|
||||
#ifdef NET_TCP_HAVE_STACK
|
||||
static inline void inet_tcp_readahead(struct inet_recvfrom_s *pstate)
|
||||
{
|
||||
FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pstate->ir_sock->s_conn;
|
||||
@ -373,9 +369,9 @@ static inline void inet_tcp_readahead(struct inet_recvfrom_s *pstate)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* NET_TCP_HAVE_STACK && CONFIG_NET_TCP_READAHEAD */
|
||||
#endif /* NET_TCP_HAVE_STACK */
|
||||
|
||||
#if defined(NET_UDP_HAVE_STACK) && defined(CONFIG_NET_UDP_READAHEAD)
|
||||
#ifdef NET_UDP_HAVE_STACK
|
||||
|
||||
static inline void inet_udp_readahead(struct inet_recvfrom_s *pstate)
|
||||
{
|
||||
@ -501,26 +497,6 @@ static int inet_recvfrom_timeout(struct inet_recvfrom_s *pstate)
|
||||
timeo = psock->s_rcvtimeo;
|
||||
}
|
||||
|
||||
/* Use a fixed, configurable delay under the following circumstances:
|
||||
*
|
||||
* 1) This delay function has been enabled with CONFIG_NET_TCP_RECVDELAY > 0
|
||||
* 2) Some data has already been received from the socket. Since this can
|
||||
* only be true for a TCP/IP socket, this logic applies only to TCP/IP
|
||||
* sockets. And either
|
||||
* 3) There is no configured receive timeout, or
|
||||
* 4) The configured receive timeout is greater than than the delay
|
||||
*/
|
||||
|
||||
#if CONFIG_NET_TCP_RECVDELAY > 0
|
||||
if ((timeo == 0 || timeo > CONFIG_NET_TCP_RECVDELAY) &&
|
||||
pstate->ir_recvlen > 0)
|
||||
{
|
||||
/* Use the configured timeout */
|
||||
|
||||
timeo = CONFIG_NET_TCP_RECVDELAY;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Is there an effective timeout? */
|
||||
|
||||
if (timeo)
|
||||
@ -675,28 +651,14 @@ static uint16_t inet_tcp_eventhandler(FAR struct net_driver_s *dev,
|
||||
|
||||
flags = (flags & ~TCP_NEWDATA) | TCP_SNDACK;
|
||||
|
||||
/* Check for transfer complete. We will consider the transfer
|
||||
* complete in own of two different ways, depending on the setting
|
||||
* of CONFIG_NET_TCP_RECVDELAY.
|
||||
*
|
||||
* 1) If CONFIG_NET_TCP_RECVDELAY == 0 then we will consider the
|
||||
* TCP/IP transfer complete as soon as any data has been received.
|
||||
* This is safe because if any additional data is received, it
|
||||
* will be retained in the TCP/IP read-ahead buffer until the
|
||||
* next receive is performed.
|
||||
* 2) CONFIG_NET_TCP_RECVDELAY > 0 may be set to wait a little
|
||||
* bit to determine if more data will be received. You might
|
||||
* do this if read-ahead buffering is disabled and we want to
|
||||
* minimize the loss of back-to-back packets. In this case,
|
||||
* the transfer is complete when either a) the entire user buffer
|
||||
* is full or 2) when the receive timeout occurs (below).
|
||||
/* Check for transfer complete. We will consider the
|
||||
* TCP/IP transfer complete as soon as any data has been received.
|
||||
* This is safe because if any additional data is received, it
|
||||
* will be retained in the TCP/IP read-ahead buffer until the
|
||||
* next receive is performed.
|
||||
*/
|
||||
|
||||
#if CONFIG_NET_TCP_RECVDELAY > 0
|
||||
if (pstate->ir_buflen == 0)
|
||||
#else
|
||||
if (pstate->ir_recvlen > 0)
|
||||
#endif
|
||||
{
|
||||
ninfo("TCP resume\n");
|
||||
|
||||
@ -765,23 +727,7 @@ static uint16_t inet_tcp_eventhandler(FAR struct net_driver_s *dev,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If no data has been received, then return ENOTCONN.
|
||||
* Otherwise, let this return success. The failure will
|
||||
* be reported the next time that recv[from]() is called.
|
||||
*/
|
||||
|
||||
#if CONFIG_NET_TCP_RECVDELAY > 0
|
||||
if (pstate->ir_recvlen > 0)
|
||||
{
|
||||
pstate->ir_result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pstate->ir_result = -ENOTCONN;
|
||||
}
|
||||
#else
|
||||
pstate->ir_result = -ENOTCONN;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Wake up the waiting thread */
|
||||
@ -806,19 +752,9 @@ static uint16_t inet_tcp_eventhandler(FAR struct net_driver_s *dev,
|
||||
pstate->ir_cb->priv = NULL;
|
||||
pstate->ir_cb->event = NULL;
|
||||
|
||||
/* Report an error only if no data has been received. (If
|
||||
* CONFIG_NET_TCP_RECVDELAY then ir_recvlen should always be
|
||||
* less than or equal to zero).
|
||||
*/
|
||||
/* Report the timeout error */
|
||||
|
||||
#if CONFIG_NET_TCP_RECVDELAY > 0
|
||||
if (pstate->ir_recvlen <= 0)
|
||||
#endif
|
||||
{
|
||||
/* Report the timeout error */
|
||||
|
||||
pstate->ir_result = -EAGAIN;
|
||||
}
|
||||
pstate->ir_result = -EAGAIN;
|
||||
|
||||
/* Wake up the waiting thread, returning either the error -EAGAIN
|
||||
* that signals the timeout event or the data received up to
|
||||
@ -1207,7 +1143,6 @@ static ssize_t inet_udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
net_lock();
|
||||
inet_recvfrom_initialize(psock, buf, len, from, fromlen, &state);
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
/* Copy the read-ahead data from the packet */
|
||||
|
||||
inet_udp_readahead(&state);
|
||||
@ -1220,15 +1155,6 @@ static ssize_t inet_udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
|
||||
ret = state.ir_recvlen;
|
||||
|
||||
#else
|
||||
/* Otherwise, the default return value of zero is used (only for the case
|
||||
* where len == state.ir_buflen is zero).
|
||||
*/
|
||||
|
||||
ret = 0;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
/* Handle non-blocking UDP sockets */
|
||||
|
||||
if (_SS_ISNONBLOCK(psock->s_flags))
|
||||
@ -1253,7 +1179,6 @@ static ssize_t inet_udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
*/
|
||||
|
||||
else if (state.ir_recvlen <= 0)
|
||||
#endif
|
||||
{
|
||||
/* Get the device that will handle the packet transfers. This may be
|
||||
* NULL if the UDP socket is bound to INADDR_ANY. In that case, no
|
||||
@ -1336,7 +1261,6 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
* socket has been disconnected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
inet_tcp_readahead(&state);
|
||||
|
||||
/* The default return value is the number of bytes that we just copied
|
||||
@ -1347,14 +1271,6 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
|
||||
ret = state.ir_recvlen;
|
||||
|
||||
#else
|
||||
/* Otherwise, the default return value of zero is used (only for the case
|
||||
* where len == state.ir_buflen is zero).
|
||||
*/
|
||||
|
||||
ret = 0;
|
||||
#endif
|
||||
|
||||
/* Verify that the SOCK_STREAM has been and still is connected */
|
||||
|
||||
if (!_SS_ISCONNECTED(psock->s_flags))
|
||||
@ -1370,11 +1286,7 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
* end-of-file indication.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
if (ret <= 0 && !_SS_ISCLOSED(psock->s_flags))
|
||||
#else
|
||||
if (!_SS_ISCLOSED(psock->s_flags))
|
||||
#endif
|
||||
{
|
||||
/* Nothing was previously received from the readahead buffers.
|
||||
* The SOCK_STREAM must be (re-)connected in order to receive any
|
||||
@ -1391,9 +1303,7 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
* if no data was obtained from the read-ahead buffers.
|
||||
*/
|
||||
|
||||
else
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
if (_SS_ISNONBLOCK(psock->s_flags))
|
||||
else if (_SS_ISNONBLOCK(psock->s_flags))
|
||||
{
|
||||
/* Return the number of bytes read from the read-ahead buffer if
|
||||
* something was received (already in 'ret'); EAGAIN if not.
|
||||
@ -1413,27 +1323,19 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
*/
|
||||
|
||||
else
|
||||
#endif
|
||||
|
||||
/* We get here when we we decide that we need to setup the wait for incoming
|
||||
* TCP/IP data. Just a few more conditions to check:
|
||||
*
|
||||
* 1) Make sure thet there is buffer space to receive additional data
|
||||
* (state.ir_buflen > 0). This could be zero, for example, if read-ahead
|
||||
* buffering was enabled and we filled the user buffer with data from
|
||||
* the read-ahead buffers. And
|
||||
* 2) if read-ahead buffering is enabled (CONFIG_NET_TCP_READAHEAD)
|
||||
* and delay logic is disabled (CONFIG_NET_TCP_RECVDELAY == 0), then we
|
||||
* not want to wait if we already obtained some data from the read-ahead
|
||||
* buffer. In that case, return now with what we have (don't want for more
|
||||
* because there may be no timeout).
|
||||
* (state.ir_buflen > 0). This could be zero, for example, we filled
|
||||
* the user buffer with data from the read-ahead buffers. And
|
||||
* 2) then we not want to wait if we already obtained some data from the
|
||||
* read-ahead buffer. In that case, return now with what we have (don't
|
||||
* want for more because there may be no timeout).
|
||||
*/
|
||||
|
||||
#if CONFIG_NET_TCP_RECVDELAY == 0 && defined(CONFIG_NET_TCP_READAHEAD)
|
||||
if (state.ir_recvlen == 0 && state.ir_buflen > 0)
|
||||
#else
|
||||
if (state.ir_buflen > 0)
|
||||
#endif
|
||||
{
|
||||
FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)psock->s_conn;
|
||||
|
||||
|
@ -287,28 +287,12 @@ static sockcaps_t inet_sockcaps(FAR struct socket *psock)
|
||||
{
|
||||
#ifdef NET_TCP_HAVE_STACK
|
||||
case SOCK_STREAM:
|
||||
/* REVISIT: Non-blocking recv() depends on CONFIG_NET_TCP_READAHEAD,
|
||||
* but non-blocking send() depends on CONFIG_NET_TCP_WRITE_BUFFERS.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
return SOCKCAP_NONBLOCKING;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NET_UDP_HAVE_STACK
|
||||
case SOCK_DGRAM:
|
||||
/* REVISIT: Non-blocking recvfrom() depends on CONFIG_NET_UDP_READAHEAD,
|
||||
* but non-blocking sendto() depends on CONFIG_NET_UDP_WRITE_BUFFERS.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
return SOCKCAP_NONBLOCKING;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
@ -8,6 +8,7 @@ menu "TCP/IP Networking"
|
||||
config NET_TCP
|
||||
bool "TCP/IP Networking"
|
||||
default n
|
||||
select NET_READAHEAD if !NET_TCP_NO_STACK
|
||||
---help---
|
||||
Enable or disable TCP networking support.
|
||||
|
||||
@ -90,30 +91,10 @@ config NET_TCP_NOTIFIER
|
||||
purpose notifier, but was developed specifically to support poll()
|
||||
logic where the poll must wait for these events.
|
||||
|
||||
config NET_TCP_READAHEAD
|
||||
bool "Enable TCP/IP read-ahead buffering"
|
||||
default y
|
||||
select NET_READAHEAD
|
||||
select MM_IOB
|
||||
---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. But, if disabled, there will probably be more packet
|
||||
retransmissions or even packet loss.
|
||||
|
||||
Make sure that you check the setting in the I/O Buffering menu.
|
||||
These settings are critical to the reasonable operation of read-
|
||||
ahead buffering.
|
||||
|
||||
config NET_TCP_WRITE_BUFFERS
|
||||
bool "Enable TCP/IP write buffering"
|
||||
default n
|
||||
select NET_WRITE_BUFFERS
|
||||
select MM_IOB
|
||||
---help---
|
||||
Write buffers allows buffering of ongoing TCP/IP packets, providing
|
||||
for higher performance, streamed output.
|
||||
@ -157,20 +138,6 @@ config NET_TCP_WRBUFFER_DUMP
|
||||
|
||||
endif # NET_TCP_WRITE_BUFFERS
|
||||
|
||||
config NET_TCP_RECVDELAY
|
||||
int "TCP Rx delay"
|
||||
default 0
|
||||
---help---
|
||||
If NET_TCP_READAHEAD_BUFFERS is undefined, then there will be no buffering
|
||||
of TCP/IP packets: Any TCP/IP packet received will be ACKed, but its contents
|
||||
will be dropped in the bit-bucket.
|
||||
|
||||
One low-performance option is delay for a short period of time after a
|
||||
TCP/IP packet is received to see if another comes right behind it. Then
|
||||
the packet data from both can be combined. This option only makes since
|
||||
if performance is not an issue and you need to handle short bursts of
|
||||
small, back-to-back packets. The delay is in units of deciseconds.
|
||||
|
||||
config NET_TCPBACKLOG
|
||||
bool "TCP/IP backlog support"
|
||||
default n
|
||||
|
@ -208,7 +208,6 @@ struct tcp_conn_s
|
||||
|
||||
FAR struct net_driver_s *dev;
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
/* Read-ahead buffering.
|
||||
*
|
||||
* readahead - A singly linked list of type struct iob_qentry_s
|
||||
@ -216,7 +215,6 @@ struct tcp_conn_s
|
||||
*/
|
||||
|
||||
struct iob_queue_s readahead; /* Read-ahead buffering */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
||||
/* Write buffering
|
||||
@ -1109,10 +1107,8 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
uint16_t tcp_datahandler(FAR struct tcp_conn_s *conn, FAR uint8_t *buffer,
|
||||
uint16_t nbytes);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tcp_backlogcreate
|
||||
@ -1708,7 +1704,7 @@ int tcp_notifier_teardown(int key);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_TCP_READAHEAD) && defined(CONFIG_NET_TCP_NOTIFIER)
|
||||
#ifdef CONFIG_NET_TCP_NOTIFIER
|
||||
void tcp_readahead_signal(FAR struct tcp_conn_s *conn);
|
||||
#endif
|
||||
|
||||
|
@ -89,22 +89,18 @@ tcp_data_event(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
||||
|
||||
if (dev->d_len > 0)
|
||||
{
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
uint8_t *buffer = dev->d_appdata;
|
||||
int buflen = dev->d_len;
|
||||
uint16_t recvlen;
|
||||
#endif
|
||||
|
||||
ninfo("No listener on connection\n");
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
/* Save as the packet data as in the read-ahead buffer. NOTE that
|
||||
* partial packets will not be buffered.
|
||||
*/
|
||||
|
||||
recvlen = tcp_datahandler(conn, buffer, buflen);
|
||||
if (recvlen < buflen)
|
||||
#endif
|
||||
{
|
||||
/* There is no handler to receive new data and there are no free
|
||||
* read-ahead buffers to retain the data -- drop the packet.
|
||||
@ -241,7 +237,6 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
uint16_t tcp_datahandler(FAR struct tcp_conn_s *conn, FAR uint8_t *buffer,
|
||||
uint16_t buflen)
|
||||
{
|
||||
@ -298,6 +293,5 @@ uint16_t tcp_datahandler(FAR struct tcp_conn_s *conn, FAR uint8_t *buffer,
|
||||
ninfo("Buffered %d bytes\n", buflen);
|
||||
return buflen;
|
||||
}
|
||||
#endif /* CONFIG_NET_TCP_READAHEAD */
|
||||
|
||||
#endif /* NET_TCP_HAVE_STACK */
|
||||
|
@ -775,11 +775,9 @@ void tcp_free(FAR struct tcp_conn_s *conn)
|
||||
dq_rem(&conn->node, &g_active_tcp_connections);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
/* Release any read-ahead buffers attached to the connection */
|
||||
|
||||
iob_free_queue(&conn->readahead, IOBUSER_NET_TCP_READAHEAD);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
||||
/* Release any write buffers attached to the connection */
|
||||
@ -1020,11 +1018,9 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev,
|
||||
|
||||
memcpy(conn->rcvseq, tcp->seqno, 4);
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
/* Initialize the list of TCP read-ahead buffers */
|
||||
|
||||
IOB_QINIT(&conn->readahead);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
||||
/* Initialize the write buffer lists */
|
||||
@ -1257,11 +1253,9 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr)
|
||||
conn->sndseq_max = 0;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
/* Initialize the list of TCP read-ahead buffers */
|
||||
|
||||
IOB_QINIT(&conn->readahead);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
||||
/* Initialize the TCP write buffer lists */
|
||||
|
@ -302,15 +302,9 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
|
||||
|
||||
fds->priv = (FAR void *)info;
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
/* Check for read data or backlogged connection availability now */
|
||||
|
||||
if (!IOB_QEMPTY(&conn->readahead) || tcp_backlogavailable(conn))
|
||||
#else
|
||||
/* Check for backlogged connection now */
|
||||
|
||||
if (tcp_backlogavailable(conn))
|
||||
#endif
|
||||
{
|
||||
/* Normal data may be read without blocking. */
|
||||
|
||||
|
@ -85,7 +85,6 @@ int tcp_readahead_notifier_setup(worker_t worker,
|
||||
FAR struct tcp_conn_s *conn,
|
||||
FAR void *arg)
|
||||
{
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
struct work_notifier_s info;
|
||||
|
||||
DEBUGASSERT(worker != NULL);
|
||||
@ -108,9 +107,6 @@ int tcp_readahead_notifier_setup(worker_t worker,
|
||||
info.worker = worker;
|
||||
|
||||
return work_notifier_setup(&info);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -269,14 +265,12 @@ int tcp_notifier_teardown(int key)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
void tcp_readahead_signal(FAR struct tcp_conn_s *conn)
|
||||
{
|
||||
/* This is just a simple wrapper around work_notifier_signal(). */
|
||||
|
||||
return work_notifier_signal(WORK_TCP_READAHEAD, conn);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tcp_writebuffer_signal
|
||||
|
@ -75,10 +75,8 @@ uint16_t tcp_get_recvwindow(FAR struct net_driver_s *dev)
|
||||
uint16_t iplen;
|
||||
uint16_t mss;
|
||||
uint16_t recvwndo;
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
int niob_avail;
|
||||
int nqentry_avail;
|
||||
#endif
|
||||
int niob_avail;
|
||||
int nqentry_avail;
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
@ -106,7 +104,6 @@ uint16_t tcp_get_recvwindow(FAR struct net_driver_s *dev)
|
||||
|
||||
mss = dev->d_pktsize - (NET_LL_HDRLEN(dev) + iplen + TCP_HDRLEN);
|
||||
|
||||
#ifdef CONFIG_NET_TCP_READAHEAD
|
||||
/* Update the TCP received window based on read-ahead I/O buffer
|
||||
* and IOB chain availability. At least one queue entry is required.
|
||||
* If one queue entry is available, then the amount of read-ahead
|
||||
@ -168,7 +165,6 @@ uint16_t tcp_get_recvwindow(FAR struct net_driver_s *dev)
|
||||
recvwndo = (uint16_t)rwnd;
|
||||
}
|
||||
else /* nqentry_avail == 0 || niob_avail == 0 */
|
||||
#endif
|
||||
{
|
||||
/* No IOB chains or noIOBs are available. The only buffering
|
||||
* available is within the packet buffer itself. We can buffer no
|
||||
|
@ -8,6 +8,7 @@ menu "UDP Networking"
|
||||
config NET_UDP
|
||||
bool "UDP Networking"
|
||||
default n
|
||||
select NET_READAHEAD if !NET_UDP_NO_STACK
|
||||
depends on NET
|
||||
---help---
|
||||
Enable or disable UDP networking support.
|
||||
@ -59,17 +60,10 @@ config NET_UDP_NPOLLWAITERS
|
||||
int "Number of UDP poll waiters"
|
||||
default 1
|
||||
|
||||
config NET_UDP_READAHEAD
|
||||
bool "Enable UDP/IP read-ahead buffering"
|
||||
default y
|
||||
select NET_READAHEAD
|
||||
select MM_IOB
|
||||
|
||||
config NET_UDP_WRITE_BUFFERS
|
||||
bool "Enable UDP/IP write buffering"
|
||||
default n
|
||||
select NET_WRITE_BUFFERS
|
||||
select MM_IOB
|
||||
---help---
|
||||
Write buffers allows buffering of ongoing UDP/IP packets, providing
|
||||
for higher performance, streamed output.
|
||||
|
@ -48,10 +48,7 @@
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/net/ip.h>
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
# include <nuttx/mm/iob.h>
|
||||
#endif
|
||||
#include <nuttx/mm/iob.h>
|
||||
|
||||
#ifdef CONFIG_NET_UDP_NOTIFIER
|
||||
# include <nuttx/wqueue.h>
|
||||
@ -143,7 +140,6 @@ struct udp_conn_s
|
||||
* Unbound: 0, Bound: 1-MAX_IFINDEX */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
/* Read-ahead buffering.
|
||||
*
|
||||
* readahead - A singly linked list of type struct iob_qentry_s
|
||||
@ -151,7 +147,6 @@ struct udp_conn_s
|
||||
*/
|
||||
|
||||
struct iob_queue_s readahead; /* Read-ahead buffering */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_UDP_WRITE_BUFFERS
|
||||
/* Write buffering
|
||||
@ -814,7 +809,7 @@ int udp_notifier_teardown(int key);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_UDP_READAHEAD) && defined(CONFIG_NET_UDP_NOTIFIER)
|
||||
#ifdef CONFIG_NET_UDP_NOTIFIER
|
||||
void udp_readahead_signal(FAR struct udp_conn_s *conn);
|
||||
#endif
|
||||
|
||||
|
@ -75,7 +75,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
static uint16_t udp_datahandler(FAR struct net_driver_s *dev,
|
||||
FAR struct udp_conn_s *conn,
|
||||
FAR uint8_t *buffer, uint16_t buflen)
|
||||
@ -245,7 +244,6 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev,
|
||||
ninfo("Buffered %d bytes\n", buflen);
|
||||
return buflen;
|
||||
}
|
||||
#endif /* CONFIG_NET_UDP_READAHEAD */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_dataevent
|
||||
@ -260,11 +258,9 @@ net_dataevent(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn,
|
||||
uint16_t flags)
|
||||
{
|
||||
uint16_t ret;
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
uint8_t *buffer = dev->d_appdata;
|
||||
int buflen = dev->d_len;
|
||||
uint16_t recvlen;
|
||||
#endif
|
||||
|
||||
ret = (flags & ~UDP_NEWDATA);
|
||||
|
||||
@ -274,14 +270,12 @@ net_dataevent(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn,
|
||||
|
||||
ninfo("No receive on connection\n");
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
/* Save as the packet data as in the read-ahead buffer. NOTE that
|
||||
* partial packets will not be buffered.
|
||||
*/
|
||||
|
||||
recvlen = udp_datahandler(dev, conn, buffer, buflen);
|
||||
if (recvlen < buflen)
|
||||
#endif
|
||||
{
|
||||
/* There is no handler to receive new data and there are no free
|
||||
* read-ahead buffers to retain the data -- drop the packet.
|
||||
|
@ -617,11 +617,9 @@ void udp_free(FAR struct udp_conn_s *conn)
|
||||
|
||||
dq_rem(&conn->node, &g_active_udp_connections);
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
/* Release any read-ahead buffers attached to the connection */
|
||||
|
||||
iob_free_queue(&conn->readahead, IOBUSER_NET_UDP_READAHEAD);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_UDP_WRITE_BUFFERS
|
||||
/* Release any write buffers attached to the connection */
|
||||
|
@ -281,7 +281,6 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
|
||||
|
||||
fds->priv = (FAR void *)info;
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
/* Check for read data availability now */
|
||||
|
||||
if (!IOB_QEMPTY(&conn->readahead))
|
||||
@ -290,7 +289,6 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
|
||||
|
||||
fds->revents |= (POLLRDNORM & fds->events);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (psock_udp_cansend(psock) >= 0)
|
||||
{
|
||||
|
@ -83,7 +83,6 @@ int udp_readahead_notifier_setup(worker_t worker,
|
||||
FAR struct udp_conn_s *conn,
|
||||
FAR void *arg)
|
||||
{
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
struct work_notifier_s info;
|
||||
|
||||
DEBUGASSERT(worker != NULL);
|
||||
@ -106,9 +105,6 @@ int udp_readahead_notifier_setup(worker_t worker,
|
||||
info.worker = worker;
|
||||
|
||||
return work_notifier_setup(&info);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -215,14 +211,12 @@ int udp_notifier_teardown(int key)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
void udp_readahead_signal(FAR struct udp_conn_s *conn)
|
||||
{
|
||||
/* This is just a simple wrapper around work_notifier_signal(). */
|
||||
|
||||
return work_notifier_signal(WORK_UDP_READAHEAD, conn);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: udp_writebuffer_signal
|
||||
|
Loading…
Reference in New Issue
Block a user