mirror of
https://github.com/apache/nuttx.git
synced 2026-05-18 08:54:05 +08:00
Networking: Remove driver based backlog support. This affects the entire network, but is used by only one driver. The only supported with of supported RX backlog is via common read-ahead buffering.
This commit is contained in:
@@ -33,7 +33,6 @@ CONFIG_NET_ETH_MTU=1500
|
||||
CONFIG_NET_HOSTNAME="stntest"
|
||||
CONFIG_NET_ICMP_PING=y
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_RXAVAIL=y
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_SOLINGER=y
|
||||
CONFIG_NET_STATISTICS=y
|
||||
|
||||
@@ -295,7 +295,6 @@ menuconfig ENCX24J600
|
||||
bool "Microchip ENCX24J600 support"
|
||||
default n
|
||||
select SPI
|
||||
select NET_RXAVAIL
|
||||
select ARCH_HAVE_NETDEV_STATISTICS
|
||||
---help---
|
||||
References:
|
||||
|
||||
@@ -156,10 +156,6 @@
|
||||
|
||||
#define ENC_TXTIMEOUT (60*CLK_TCK)
|
||||
|
||||
/* RX timeout (Time packets are held in the RX queue until they are dropped) */
|
||||
|
||||
#define ENC_RXTIMEOUT MSEC2TICK(2000)
|
||||
|
||||
/* Poll timeout */
|
||||
|
||||
#define ENC_POLLTIMEOUT MSEC2TICK(50)
|
||||
@@ -228,7 +224,6 @@ struct enc_descr_s
|
||||
struct enc_descr_next *flink;
|
||||
uint16_t addr;
|
||||
uint16_t len;
|
||||
uint32_t ts; /* Timestamp of reception for timeout */
|
||||
};
|
||||
|
||||
/* The enc_driver_s encapsulates all state information for a single hardware
|
||||
@@ -360,7 +355,6 @@ static void enc_polltimer(int argc, uint32_t arg, ...);
|
||||
static int enc_ifup(struct net_driver_s *dev);
|
||||
static int enc_ifdown(struct net_driver_s *dev);
|
||||
static int enc_txavail(struct net_driver_s *dev);
|
||||
static int enc_rxavail(struct net_driver_s *dev);
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
static int enc_addmac(struct net_driver_s *dev, FAR const uint8_t *mac);
|
||||
static int enc_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac);
|
||||
@@ -1497,16 +1491,11 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
|
||||
*/
|
||||
|
||||
arp_ipin(&priv->dev);
|
||||
ret = ipv4_input(&priv->dev);
|
||||
(void)ipv4_input(&priv->dev);
|
||||
|
||||
if (ret == OK || (clock_systimer() - (systime_t)descr->ts) > ENC_RXTIMEOUT)
|
||||
{
|
||||
/* If packet has been successfully processed or has timed out,
|
||||
* free it.
|
||||
*/
|
||||
/* Free the packet */
|
||||
|
||||
enc_rxrmpkt(priv, descr);
|
||||
}
|
||||
enc_rxrmpkt(priv, descr);
|
||||
|
||||
/* If the above function invocation resulted in data that should be
|
||||
* sent out on the network, the field d_len will set to a value > 0.
|
||||
@@ -1546,14 +1535,9 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
|
||||
|
||||
ret = ipv6_input(&priv->dev);
|
||||
|
||||
if (ret == OK || (clock_systimer() - (systime_t)descr->ts) > ENC_RXTIMEOUT)
|
||||
{
|
||||
/* If packet has been successfully processed or has timed out,
|
||||
* free it.
|
||||
*/
|
||||
/* Free the packet */
|
||||
|
||||
enc_rxrmpkt(priv, descr);
|
||||
}
|
||||
enc_rxrmpkt(priv, descr);
|
||||
|
||||
/* If the above function invocation resulted in data that should be
|
||||
* sent out on the network, the field d_len will set to a value > 0.
|
||||
@@ -1692,10 +1676,6 @@ static void enc_pktif(FAR struct enc_driver_s *priv)
|
||||
|
||||
descr = enc_rxgetdescr(priv);
|
||||
|
||||
/* Set current timestamp */
|
||||
|
||||
descr->ts = (uint32_t)clock_systimer();
|
||||
|
||||
/* Store the start address of the frame without the enc's header */
|
||||
|
||||
descr->addr = curpkt + 8;
|
||||
@@ -2391,38 +2371,6 @@ static int enc_txavail(struct net_driver_s *dev)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: enc_rxavail
|
||||
*
|
||||
* Description:
|
||||
* Driver callback invoked when new TX data is available. This is a
|
||||
* stimulus perform an out-of-cycle poll and, thereby, reduce the TX
|
||||
* latency.
|
||||
*
|
||||
* Parameters:
|
||||
* dev - Reference to the NuttX driver state structure
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Called in normal user mode
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int enc_rxavail(struct net_driver_s *dev)
|
||||
{
|
||||
FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)dev->d_private;
|
||||
|
||||
if (!sq_empty(&priv->rxqueue))
|
||||
{
|
||||
ninfo("RX queue not empty, trying to dispatch\n");
|
||||
enc_rxdispatch(priv);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: enc_addmac
|
||||
*
|
||||
@@ -2858,7 +2806,6 @@ int enc_initialize(FAR struct spi_dev_s *spi,
|
||||
priv->dev.d_ifup = enc_ifup; /* I/F up (new IP address) callback */
|
||||
priv->dev.d_ifdown = enc_ifdown; /* I/F down callback */
|
||||
priv->dev.d_txavail = enc_txavail; /* New TX data callback */
|
||||
priv->dev.d_rxavail = enc_rxavail; /* RX wating callback */
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
priv->dev.d_addmac = enc_addmac; /* Add multicast MAC address */
|
||||
priv->dev.d_rmmac = enc_rmmac; /* Remove multicast MAC address */
|
||||
|
||||
@@ -368,9 +368,6 @@ struct net_driver_s
|
||||
int (*d_ifup)(FAR struct net_driver_s *dev);
|
||||
int (*d_ifdown)(FAR struct net_driver_s *dev);
|
||||
int (*d_txavail)(FAR struct net_driver_s *dev);
|
||||
#ifdef CONFIG_NET_RXAVAIL
|
||||
int (*d_rxavail)(FAR struct net_driver_s *dev);
|
||||
#endif
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
int (*d_addmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac);
|
||||
int (*d_rmmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac);
|
||||
|
||||
@@ -1165,55 +1165,6 @@ static ssize_t inet_recvfrom_result(int result, struct inet_recvfrom_s *pstate)
|
||||
}
|
||||
#endif /* NET_UDP_HAVE_STACK || NET_TCP_HAVE_STACK */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inet_udp_rxnotify
|
||||
*
|
||||
* Description:
|
||||
* Notify the appropriate device driver that we are ready to receive a
|
||||
* packet (UDP)
|
||||
*
|
||||
* Parameters:
|
||||
* psock - Socket state structure
|
||||
* conn - The UDP connection structure
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NET_UDP_HAVE_STACK
|
||||
static inline void inet_udp_rxnotify(FAR struct socket *psock,
|
||||
FAR struct udp_conn_s *conn)
|
||||
{
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
/* If both IPv4 and IPv6 support are enabled, then we will need to select
|
||||
* the device driver using the appropriate IP domain.
|
||||
*/
|
||||
|
||||
if (psock->s_domain == PF_INET)
|
||||
#endif
|
||||
{
|
||||
/* Notify the device driver of the receive ready */
|
||||
|
||||
netdev_ipv4_rxnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv4 */
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
else /* if (psock->s_domain == PF_INET6) */
|
||||
#endif /* CONFIG_NET_IPv4 */
|
||||
{
|
||||
/* Notify the device driver of the receive ready */
|
||||
|
||||
DEBUGASSERT(psock->s_domain == PF_INET6);
|
||||
netdev_ipv6_rxnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
}
|
||||
#endif /* NET_UDP_HAVE_STACK */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inet_udp_recvfrom
|
||||
*
|
||||
@@ -1323,10 +1274,6 @@ static ssize_t inet_udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
state.ir_cb->priv = (FAR void *)&state;
|
||||
state.ir_cb->event = inet_udp_interrupt;
|
||||
|
||||
/* Notify the device driver of the receive call */
|
||||
|
||||
inet_udp_rxnotify(psock, conn);
|
||||
|
||||
/* Wait for either the receive to complete or for an error/timeout
|
||||
* to occur. NOTES: (1) net_lockedwait will also terminate if a
|
||||
* signal is received, (2) interrupts are disabled! They will be
|
||||
|
||||
@@ -41,10 +41,6 @@ NETDEV_CSRCS += netdev_count.c netdev_foreach.c netdev_unregister.c
|
||||
NETDEV_CSRCS += netdev_carrier.c netdev_default.c netdev_verify.c
|
||||
NETDEV_CSRCS += netdev_lladdrsize.c
|
||||
|
||||
ifeq ($(CONFIG_NET_RXAVAIL),y)
|
||||
NETDEV_CSRCS += netdev_rxnotify.c
|
||||
endif
|
||||
|
||||
# Include netdev build support
|
||||
|
||||
DEPPATH += --dep-path netdev
|
||||
|
||||
@@ -323,65 +323,6 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t lipaddr,
|
||||
|
||||
void netdev_txnotify_dev(FAR struct net_driver_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_ipv4_rxnotify
|
||||
*
|
||||
* Description:
|
||||
* Notify the device driver that forwards the IPv4 address that the
|
||||
* application waits for RX data.
|
||||
*
|
||||
* Parameters:
|
||||
* lipaddr - The local board IPv6 address of the socket
|
||||
* ripaddr - The remote IPv4 address to send the data
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Called from normal user mode
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET_RXAVAIL)
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
void netdev_ipv4_rxnotify(in_addr_t lipaddr, in_addr_t ripaddr);
|
||||
#endif /* CONFIG_NET_IPv4 */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_ipv6_rxnotify
|
||||
*
|
||||
* Description:
|
||||
* Notify the device driver that forwards the IPv6 address that the
|
||||
* application waits for RX data.
|
||||
*
|
||||
* Parameters:
|
||||
* lipaddr - The local board IPv6 address of the socket
|
||||
* ripaddr - The remote IPv6 address to send the data
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Called from normal user mode
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t lipaddr,
|
||||
FAR const net_ipv6addr_t ripaddr);
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
#else
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
# define netdev_ipv4_rxnotify(lipaddr,ripaddr)
|
||||
#endif /* CONFIG_NET_IPv4 */
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
# define netdev_ipv6_rxnotify(lipaddr,ripaddr)
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_count
|
||||
*
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/****************************************************************************
|
||||
* net/netdev/netdev_rxnotify.c
|
||||
*
|
||||
* Copyright (C) 2013-2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET_RXAVAIL)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/ip.h>
|
||||
|
||||
#include "netdev/netdev.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_ipv4_rxnotify
|
||||
*
|
||||
* Description:
|
||||
* Notify the device driver that forwards the IPv4 address that the
|
||||
* application waits for RX data.
|
||||
*
|
||||
* Parameters:
|
||||
* lipaddr - The local board IPv6 address of the socket
|
||||
* ripaddr - The remote IPv4 address to send the data
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Called from normal user mode
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
void netdev_ipv4_rxnotify(in_addr_t lipaddr, in_addr_t ripaddr)
|
||||
{
|
||||
FAR struct net_driver_s *dev;
|
||||
|
||||
/* Find the device driver that serves the subnet of the remote address */
|
||||
|
||||
dev = netdev_findby_ipv4addr(lipaddr, ripaddr);
|
||||
if (dev && dev->d_rxavail)
|
||||
{
|
||||
/* Notify the device driver that new RX data is available. */
|
||||
|
||||
(void)dev->d_rxavail(dev);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv4 */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_ipv6_rxnotify
|
||||
*
|
||||
* Description:
|
||||
* Notify the device driver that forwards the IPv6 address that the
|
||||
* application waits for RX data.
|
||||
*
|
||||
* Parameters:
|
||||
* lipaddr - The local board IPv6 address of the socket
|
||||
* ripaddr - The remote IPv6 address to send the data
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Called from normal user mode
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t lipaddr,
|
||||
FAR const net_ipv6addr_t ripaddr)
|
||||
{
|
||||
FAR struct net_driver_s *dev;
|
||||
|
||||
/* Find the device driver that serves the subnet of the remote address */
|
||||
|
||||
dev = netdev_findby_ipv6addr(lipaddr, ripaddr);
|
||||
if (dev && dev->d_rxavail)
|
||||
{
|
||||
/* Notify the device driver that new RX data is available. */
|
||||
|
||||
(void)dev->d_rxavail(dev);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS && CONFIG_NET_RXAVAIL */
|
||||
@@ -323,28 +323,6 @@ static ssize_t pkt_recvfrom_result(int result, struct pkt_recvfrom_s *pstate)
|
||||
return pstate->pr_recvlen;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pkt_recvfrom_rxnotify
|
||||
*
|
||||
* Description:
|
||||
* Notify the appropriate device driver that we are ready to receive a
|
||||
* packet (PKT)
|
||||
*
|
||||
* Parameters:
|
||||
* conn - The PKT connection structure
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if 0 /* Not implemented */
|
||||
static void pkt_recvfrom_rxnotify(FAR struct pkt_conn_s *conn)
|
||||
{
|
||||
# warning Missing logic
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -447,12 +425,6 @@ ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
|
||||
state.pr_cb->priv = (FAR void *)&state;
|
||||
state.pr_cb->event = pkt_recvfrom_interrupt;
|
||||
|
||||
/* Notify the device driver of the receive call */
|
||||
|
||||
#if 0 /* Not implemented */
|
||||
pkt_recvfrom_rxnotify(conn);
|
||||
#endif
|
||||
|
||||
/* Wait for either the receive to complete or for an error/timeout to
|
||||
* occur. NOTES: (1) net_lockedwait will also terminate if a signal
|
||||
* is received, (2) the network is locked! It will be un-locked while
|
||||
|
||||
@@ -41,22 +41,6 @@ config NET_BROADCAST
|
||||
---help---
|
||||
Incoming UDP broadcast support
|
||||
|
||||
config NET_RXAVAIL
|
||||
bool "Driver-based UDP backlog"
|
||||
default n
|
||||
---help---
|
||||
One problem with UDP communications is that, unlike TCP/IP, there is
|
||||
no backlog of UDP packets. So if you are listening at the precise
|
||||
moment that the UDP packet is sent, it will not be received. This
|
||||
is not incompatible with the properties of UDP, but can result in
|
||||
bad performance if packets are missed, time out, and are resent.
|
||||
|
||||
Some Ethernet controllers have built-in RAM and the drivers can
|
||||
support retention of UDP packets in that RAM. If the drivers
|
||||
supports such a capability, this option may be enabled to use it.
|
||||
NOTE: If this option is enabled, the driver must support the
|
||||
rxavail() method in the net_driver_s structure.
|
||||
|
||||
config NET_UDP_READAHEAD
|
||||
bool "Enable UDP/IP read-ahead buffering"
|
||||
default y
|
||||
|
||||
Reference in New Issue
Block a user