diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-01-19 15:51:40 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-01-19 15:51:40 -0600 |
commit | 1217b534991006a9b3b43063f9d48de7c522a41e (patch) | |
tree | 7cd2f7f00165db100387f5eb493f22513ae2475e /nuttx | |
parent | 4025277f60a71c772167307266b3cc6ebb233eea (diff) | |
download | px4-nuttx-1217b534991006a9b3b43063f9d48de7c522a41e.tar.gz px4-nuttx-1217b534991006a9b3b43063f9d48de7c522a41e.tar.bz2 px4-nuttx-1217b534991006a9b3b43063f9d48de7c522a41e.zip |
Networking: Hook in ICMPv6 polling operations into periodic network logic
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/net/devif/devif_poll.c | 55 | ||||
-rw-r--r-- | nuttx/net/icmpv6/icmpv6_ping.c | 2 |
2 files changed, 47 insertions, 10 deletions
diff --git a/nuttx/net/devif/devif_poll.c b/nuttx/net/devif/devif_poll.c index 4d365a2da..e0fd5df2b 100644 --- a/nuttx/net/devif/devif_poll.c +++ b/nuttx/net/devif/devif_poll.c @@ -51,6 +51,7 @@ #include "udp/udp.h" #include "pkt/pkt.h" #include "icmp/icmp.h" +#include "icmpv6/icmpv6.h" #include "igmp/igmp.h" /**************************************************************************** @@ -101,11 +102,7 @@ static int devif_poll_pkt_connections(FAR struct net_driver_s *dev, * Function: devif_poll_icmp * * Description: - * Poll all UDP connections for available packets to send. - * - * Assumptions: - * This function is called from the MAC device driver and may be called from - * the timer interrupt/watchdog handle level. + * Poll all of the connections waiting to send an ICMP ECHO request * ****************************************************************************/ @@ -113,7 +110,7 @@ static int devif_poll_pkt_connections(FAR struct net_driver_s *dev, static inline int devif_poll_icmp(FAR struct net_driver_s *dev, devif_poll_callback_t callback) { - /* Perform the UDP TX poll */ + /* Perform the ICMP poll */ icmp_poll(dev); @@ -124,6 +121,28 @@ static inline int devif_poll_icmp(FAR struct net_driver_s *dev, #endif /* CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING */ /**************************************************************************** + * Function: devif_poll_icmpv6 + * + * Description: + * Poll all of the connections waiting to send an ICMPv6 ECHO request + * + ****************************************************************************/ + +#if defined(CONFIG_NET_ICMPv6) && defined(CONFIG_NET_ICMPv6_PING) +static inline int devif_poll_icmpv6(FAR struct net_driver_s *dev, + devif_poll_callback_t callback) +{ + /* Perform the ICMPv6 poll */ + + icmpv6_poll(dev); + + /* Call back into the driver */ + + return callback(dev); +} +#endif /* CONFIG_NET_ICMPv6 && CONFIG_NET_ICMPv6_PING */ + +/**************************************************************************** * Function: devif_poll_igmp * * Description: @@ -271,7 +290,7 @@ static inline int devif_poll_tcp_timer(FAR struct net_driver_s *dev, * * Description: * This function will traverse each active uIP connection structure and - * will perform TCP and UDP polling operations. devif_poll() may be called + * will perform network polling operations. devif_poll() may be called * asynchronously with the network driver can accept another outgoing * packet. * @@ -354,6 +373,15 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback) if (!bstop) #endif +#if defined(CONFIG_NET_ICMPv6) && defined(CONFIG_NET_ICMPv6_PING) + { + /* Traverse all of the tasks waiting to send an ICMPv6 ECHO request. */ + + bstop = devif_poll_icmpv6(dev, callback); + } + + if (!bstop) +#endif { /* Nothing more to do */ } @@ -366,8 +394,8 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback) * * Description: * These function will traverse each active uIP connection structure and - * perform TCP timer operations (and UDP polling operations). The Ethernet - * driver MUST implement logic to periodically call devif_timer(). + * perform network timer operations. The Ethernet driver MUST implement + * logic to periodically call devif_timer(). * * This function will call the provided callback function for every active * connection. Polling will continue until all connections have been polled @@ -459,6 +487,15 @@ int devif_timer(FAR struct net_driver_s *dev, devif_poll_callback_t callback, if (!bstop) #endif +#if defined(CONFIG_NET_ICMP6) && defined(CONFIG_NET_ICMPv6_PING) + { + /* Traverse all of the tasks waiting to send an ICMP ECHO request. */ + + bstop = devif_poll_icmp6(dev, callback); + } + + if (!bstop) +#endif { /* Nothing to do */ } diff --git a/nuttx/net/icmpv6/icmpv6_ping.c b/nuttx/net/icmpv6/icmpv6_ping.c index 9de346703..bedc11567 100644 --- a/nuttx/net/icmpv6/icmpv6_ping.c +++ b/nuttx/net/icmpv6/icmpv6_ping.c @@ -297,7 +297,7 @@ end_wait: ****************************************************************************/ /**************************************************************************** - * Name: imcp_ping + * Name: imcpv6_ping * * Description: * Send a ECHO request and wait for the ECHO response |