From 04ad162540075eeecf920f10a8505ded0fcf3daf Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 29 Aug 2017 14:08:04 -0600 Subject: [PATCH] Networking: Clean up some naming that has bothered me for a long time... There are no interrupts and no interrupt handlers in the network. There are events and event handler (there used to to be interrupt logic in there years ago but that is long, long gone). --- net/arp/arp.h | 5 ++--- net/arp/arp_send.c | 10 ++++----- net/icmp/icmp_ping.c | 11 +++++----- net/icmpv6/icmpv6_autoconfig.c | 10 ++++----- net/icmpv6/icmpv6_neighbor.c | 10 ++++----- net/icmpv6/icmpv6_ping.c | 9 ++++---- net/ieee802154/ieee802154_recvfrom.c | 11 +++++----- net/ieee802154/ieee802154_sendto.c | 11 +++++----- net/inet/inet_close.c | 10 ++++----- net/inet/inet_recvfrom.c | 20 ++++++++--------- net/ipforward/ipforward.h | 4 ++-- net/ipforward/ipfwd_forward.c | 18 ++++++++-------- net/pkt/pkt_recvfrom.c | 10 ++++----- net/pkt/pkt_send.c | 10 ++++----- net/sixlowpan/sixlowpan_send.c | 10 ++++----- net/sixlowpan/sixlowpan_tcpsend.c | 10 ++++----- net/tcp/tcp.h | 25 ++++++++++------------ net/tcp/tcp_accept.c | 8 +++---- net/tcp/tcp_connect.c | 32 ++++++++++++++-------------- net/tcp/tcp_monitor.c | 17 ++++++++------- net/tcp/tcp_netpoll.c | 9 ++++---- net/tcp/tcp_send_buffered.c | 12 +++++------ net/tcp/tcp_send_unbuffered.c | 10 ++++----- net/tcp/tcp_sendfile.c | 16 ++++++++------ net/udp/udp_netpoll.c | 9 ++++---- net/udp/udp_psock_sendto.c | 9 ++++---- net/usrsock/usrsock_conn.c | 2 +- 27 files changed, 162 insertions(+), 156 deletions(-) diff --git a/net/arp/arp.h b/net/arp/arp.h index fcd47708c3..7c09294022 100644 --- a/net/arp/arp.h +++ b/net/arp/arp.h @@ -128,7 +128,7 @@ struct arp_iphdr_s #ifdef CONFIG_NET_ARP_SEND /* This structure holds the state of the send operation until it can be - * operated upon from the interrupt level. + * operated upon from the network driver poll. */ struct arp_send_s @@ -279,8 +279,7 @@ int arp_send(in_addr_t ipaddr); * * Assumptions: * This function is called from the MAC device driver indirectly through - * devif_poll() and devif_timer() and may be called from the timer - * interrupt/watchdog handler level. + * devif_poll() and devif_timer(). The network must be locked. * ****************************************************************************/ diff --git a/net/arp/arp_send.c b/net/arp/arp_send.c index 3e6898978b..9f3416cca3 100644 --- a/net/arp/arp_send.c +++ b/net/arp/arp_send.c @@ -94,12 +94,12 @@ static void arp_send_terminate(FAR struct arp_send_s *state, int result) } /**************************************************************************** - * Name: arp_send_interrupt + * Name: arp_send_eventhandler ****************************************************************************/ -static uint16_t arp_send_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, - FAR void *priv, uint16_t flags) +static uint16_t arp_send_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *priv, uint16_t flags) { FAR struct arp_send_s *state = (FAR struct arp_send_s *)priv; @@ -332,7 +332,7 @@ int arp_send(in_addr_t ipaddr) state.snd_result = -EBUSY; state.snd_cb->flags = (ARP_POLL | NETDEV_DOWN); state.snd_cb->priv = (FAR void *)&state; - state.snd_cb->event = arp_send_interrupt; + state.snd_cb->event = arp_send_eventhandler; /* Notify the device driver that new TX data is available. * NOTES: This is in essence what netdev_ipv4_txnotify() does, which diff --git a/net/icmp/icmp_ping.c b/net/icmp/icmp_ping.c index 45bfe9fcbb..35cae0caf5 100644 --- a/net/icmp/icmp_ping.c +++ b/net/icmp/icmp_ping.c @@ -127,7 +127,7 @@ static inline int ping_timeout(FAR struct icmp_ping_s *pstate) } /**************************************************************************** - * Name: ping_interrupt + * Name: ping_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -144,12 +144,13 @@ static inline int ping_timeout(FAR struct icmp_ping_s *pstate) * Modified value of the input flags * * Assumptions: - * Running at the interrupt level + * The network is locked. * ****************************************************************************/ -static uint16_t ping_interrupt(FAR struct net_driver_s *dev, FAR void *conn, - FAR void *pvpriv, uint16_t flags) +static uint16_t ping_eventhandler(FAR struct net_driver_s *dev, + FAR void *conn, + FAR void *pvpriv, uint16_t flags) { FAR struct icmp_ping_s *pstate = (struct icmp_ping_s *)pvpriv; FAR uint8_t *ptr; @@ -385,7 +386,7 @@ int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen, { state.png_cb->flags = (ICMP_POLL | ICMP_ECHOREPLY | NETDEV_DOWN); state.png_cb->priv = (FAR void *)&state; - state.png_cb->event = ping_interrupt; + state.png_cb->event = ping_eventhandler; state.png_result = -EINTR; /* Assume sem-wait interrupted by signal */ /* Notify the device driver of the availability of TX data */ diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c index 68e56011a5..a295d58163 100644 --- a/net/icmpv6/icmpv6_autoconfig.c +++ b/net/icmpv6/icmpv6_autoconfig.c @@ -110,12 +110,12 @@ static void icmpv6_router_terminate(FAR struct icmpv6_router_s *state, } /**************************************************************************** - * Name: icmpv6_router_interrupt + * Name: icmpv6_router_eventhandler ****************************************************************************/ -static uint16_t icmpv6_router_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, - FAR void *priv, uint16_t flags) +static uint16_t icmpv6_router_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *priv, uint16_t flags) { FAR struct icmpv6_router_s *state = (FAR struct icmpv6_router_s *)priv; @@ -240,7 +240,7 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev, bool advertise) state.snd_advertise = advertise; state.snd_cb->flags = (ICMPv6_POLL | NETDEV_DOWN); state.snd_cb->priv = (FAR void *)&state; - state.snd_cb->event = icmpv6_router_interrupt; + state.snd_cb->event = icmpv6_router_eventhandler; /* Notify the device driver that new TX data is available. */ diff --git a/net/icmpv6/icmpv6_neighbor.c b/net/icmpv6/icmpv6_neighbor.c index b6435977a9..64d8ac70bf 100644 --- a/net/icmpv6/icmpv6_neighbor.c +++ b/net/icmpv6/icmpv6_neighbor.c @@ -95,12 +95,12 @@ struct icmpv6_neighbor_s ****************************************************************************/ /**************************************************************************** - * Name: icmpv6_neighbor_interrupt + * Name: icmpv6_neighbor_eventhandler ****************************************************************************/ -static uint16_t icmpv6_neighbor_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, - FAR void *priv, uint16_t flags) +static uint16_t icmpv6_neighbor_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *priv, uint16_t flags) { FAR struct icmpv6_neighbor_s *state = (FAR struct icmpv6_neighbor_s *)priv; @@ -345,7 +345,7 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr) state.snd_sent = false; state.snd_cb->flags = ICMPv6_POLL; state.snd_cb->priv = (FAR void *)&state; - state.snd_cb->event = icmpv6_neighbor_interrupt; + state.snd_cb->event = icmpv6_neighbor_eventhandler; /* Notify the device driver that new TX data is available. */ diff --git a/net/icmpv6/icmpv6_ping.c b/net/icmpv6/icmpv6_ping.c index 60819eda79..017708fffb 100644 --- a/net/icmpv6/icmpv6_ping.c +++ b/net/icmpv6/icmpv6_ping.c @@ -229,7 +229,7 @@ static void icmpv6_echo_request(FAR struct net_driver_s *dev, } /**************************************************************************** - * Name: ping_interrupt + * Name: ping_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -250,8 +250,9 @@ static void icmpv6_echo_request(FAR struct net_driver_s *dev, * ****************************************************************************/ -static uint16_t ping_interrupt(FAR struct net_driver_s *dev, FAR void *conn, - FAR void *pvpriv, uint16_t flags) +static uint16_t ping_eventhandler(FAR struct net_driver_s *dev, + FAR void *conn, + FAR void *pvpriv, uint16_t flags) { FAR struct icmpv6_ping_s *pstate = (struct icmpv6_ping_s *)pvpriv; @@ -460,7 +461,7 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno, { state.png_cb->flags = (ICMPv6_POLL | ICMPv6_ECHOREPLY); state.png_cb->priv = (FAR void *)&state; - state.png_cb->event = ping_interrupt; + state.png_cb->event = ping_eventhandler; state.png_result = -EINTR; /* Assume sem-wait interrupted by signal */ /* Notify the device driver of the availability of TX data */ diff --git a/net/ieee802154/ieee802154_recvfrom.c b/net/ieee802154/ieee802154_recvfrom.c index fe1e557acb..3f13ab98f6 100644 --- a/net/ieee802154/ieee802154_recvfrom.c +++ b/net/ieee802154/ieee802154_recvfrom.c @@ -203,7 +203,7 @@ static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio, } /**************************************************************************** - * Name: ieee802154_recvfrom_interrupt + * Name: ieee802154_recvfrom_eventhandler * * Description: * @@ -216,9 +216,10 @@ static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio, * ****************************************************************************/ -static uint16_t ieee802154_recvfrom_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, FAR void *pvpriv, - uint16_t flags) +static uint16_t ieee802154_recvfrom_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, + uint16_t flags) { FAR struct ieee802154_recvfrom_s *pstate; FAR struct radio_driver_s *radio; @@ -393,7 +394,7 @@ ssize_t ieee802154_recvfrom(FAR struct socket *psock, FAR void *buf, { state.ir_cb->flags = (IEEE802154_NEWDATA | IEEE802154_POLL); state.ir_cb->priv = (FAR void *)&state; - state.ir_cb->event = ieee802154_recvfrom_interrupt; + state.ir_cb->event = ieee802154_recvfrom_eventhandler; /* Wait for either the receive to complete or for an error/timeout to * occur. NOTES: (1) net_lockedwait will also terminate if a signal diff --git a/net/ieee802154/ieee802154_sendto.c b/net/ieee802154/ieee802154_sendto.c index 7941df8daf..193272724b 100644 --- a/net/ieee802154/ieee802154_sendto.c +++ b/net/ieee802154/ieee802154_sendto.c @@ -283,12 +283,13 @@ void ieee802154_meta_data(FAR struct radio_driver_s *radio, } /**************************************************************************** - * Name: ieee802154_sendto_interrupt + * Name: ieee802154_sendto_eventhandler ****************************************************************************/ -static uint16_t ieee802154_sendto_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t ieee802154_sendto_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, + uint16_t flags) { FAR struct radio_driver_s *radio; FAR struct ieee802154_sendto_s *pstate; @@ -514,7 +515,7 @@ ssize_t psock_ieee802154_sendto(FAR struct socket *psock, FAR const void *buf, state.is_cb->flags = PKT_POLL; state.is_cb->priv = (FAR void *)&state; - state.is_cb->event = ieee802154_sendto_interrupt; + state.is_cb->event = ieee802154_sendto_eventhandler; /* Notify the device driver that new TX data is available. */ diff --git a/net/inet/inet_close.c b/net/inet/inet_close.c index 5c7960aa06..a9f01e4952 100644 --- a/net/inet/inet_close.c +++ b/net/inet/inet_close.c @@ -137,7 +137,7 @@ static inline int tcp_close_timeout(FAR struct tcp_close_s *pstate) #endif /* NET_TCP_HAVE_STACK && CONFIG_NET_SOLINGER */ /**************************************************************************** - * Name: tcp_close_interrupt + * Name: tcp_close_eventhandler * * Description: * Handle network callback events. @@ -154,9 +154,9 @@ static inline int tcp_close_timeout(FAR struct tcp_close_s *pstate) ****************************************************************************/ #ifdef NET_TCP_HAVE_STACK -static uint16_t tcp_close_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, FAR void *pvpriv, - uint16_t flags) +static uint16_t tcp_close_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) { #ifdef CONFIG_NET_SOLINGER FAR struct tcp_close_s *pstate = (FAR struct tcp_close_s *)pvpriv; @@ -362,7 +362,7 @@ static inline int tcp_close_disconnect(FAR struct socket *psock) /* Set up to receive TCP data event callbacks */ state.cl_cb->flags = (TCP_NEWDATA | TCP_POLL | TCP_DISCONN_EVENTS); - state.cl_cb->event = tcp_close_interrupt; + state.cl_cb->event = tcp_close_eventhandler; #ifdef CONFIG_NET_SOLINGER /* Check for a lingering close */ diff --git a/net/inet/inet_recvfrom.c b/net/inet/inet_recvfrom.c index c795c3c3d5..02dfa32842 100644 --- a/net/inet/inet_recvfrom.c +++ b/net/inet/inet_recvfrom.c @@ -609,7 +609,7 @@ static inline void inet_tcp_sender(FAR struct net_driver_s *dev, #endif /* NET_TCP_HAVE_STACK */ /**************************************************************************** - * Name: inet_tcp_interrupt + * Name: inet_tcp_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -629,9 +629,9 @@ static inline void inet_tcp_sender(FAR struct net_driver_s *dev, ****************************************************************************/ #ifdef NET_TCP_HAVE_STACK -static uint16_t inet_tcp_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, FAR void *pvpriv, - uint16_t flags) +static uint16_t inet_tcp_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) { FAR struct inet_recvfrom_s *pstate = (struct inet_recvfrom_s *)pvpriv; @@ -961,7 +961,7 @@ static void inet_udp_terminate(FAR struct inet_recvfrom_s *pstate, int result) #endif /* NET_UDP_HAVE_STACK */ /**************************************************************************** - * Name: inet_udp_interrupt + * Name: inet_udp_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -981,9 +981,9 @@ static void inet_udp_terminate(FAR struct inet_recvfrom_s *pstate, int result) ****************************************************************************/ #ifdef NET_UDP_HAVE_STACK -static uint16_t inet_udp_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, FAR void *pvpriv, - uint16_t flags) +static uint16_t inet_udp_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) { FAR struct inet_recvfrom_s *pstate = (FAR struct inet_recvfrom_s *)pvpriv; @@ -1266,7 +1266,7 @@ static ssize_t inet_udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t state.ir_cb->flags = (UDP_NEWDATA | UDP_POLL | NETDEV_DOWN); state.ir_cb->priv = (FAR void *)&state; - state.ir_cb->event = inet_udp_interrupt; + state.ir_cb->event = inet_udp_eventhandler; /* Wait for either the receive to complete or for an error/timeout * to occur. NOTES: (1) net_lockedwait will also terminate if a @@ -1443,7 +1443,7 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t { state.ir_cb->flags = (TCP_NEWDATA | TCP_POLL | TCP_DISCONN_EVENTS); state.ir_cb->priv = (FAR void *)&state; - state.ir_cb->event = inet_tcp_interrupt; + state.ir_cb->event = inet_tcp_eventhandler; /* Wait for either the receive to complete or for an error/timeout * to occur. diff --git a/net/ipforward/ipforward.h b/net/ipforward/ipforward.h index 4fee2e7be6..83f5e4c41a 100644 --- a/net/ipforward/ipforward.h +++ b/net/ipforward/ipforward.h @@ -222,8 +222,8 @@ void devif_forward(FAR struct forward_s *fwd); * network device, but must be forwarded on another network device. * * Set up to forward the packet on the specified device. This function - * will set up a send "interrupt" handler that will perform the actual - * send asynchronously and must return without waiting for the send to + * will set up a send event handler that will perform the actual send + * asynchronously and must return without waiting for the send to * complete. * * Input Parameters: diff --git a/net/ipforward/ipfwd_forward.c b/net/ipforward/ipfwd_forward.c index ad4ad9eec6..1b066ba4f1 100644 --- a/net/ipforward/ipfwd_forward.c +++ b/net/ipforward/ipfwd_forward.c @@ -186,7 +186,7 @@ static inline bool ipfwd_addrchk(FAR struct forward_s *fwd) #endif /* CONFIG_NET_ETHERNET */ /**************************************************************************** - * Name: ipfwd_interrupt + * Name: ipfwd_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -206,8 +206,8 @@ static inline bool ipfwd_addrchk(FAR struct forward_s *fwd) * ****************************************************************************/ -static uint16_t ipfwd_interrupt(FAR struct net_driver_s *dev, FAR void *conn, - FAR void *pvpriv, uint16_t flags) +static uint16_t ipfwd_eventhandler(FAR struct net_driver_s *dev, FAR void *conn, + FAR void *pvpriv, uint16_t flags) { FAR struct forward_s *fwd = (FAR struct forward_s *)pvpriv; @@ -231,9 +231,9 @@ static uint16_t ipfwd_interrupt(FAR struct net_driver_s *dev, FAR void *conn, } /* Check if the outgoing packet is available. It may have been claimed - * by a sendto interrupt serving a different thread -OR- if the output - * buffer currently contains unprocessed incoming data. In these cases - * we will just have to wait for the next polling cycle. + * by a sendto event handler serving a different thread -OR- if the + * output buffer currently contains unprocessed incoming data. In + * these cases we will just have to wait for the next polling cycle. */ else if (dev->d_sndlen > 0 || (flags & IPFWD_NEWDATA) != 0) @@ -309,8 +309,8 @@ static uint16_t ipfwd_interrupt(FAR struct net_driver_s *dev, FAR void *conn, * network device, but must be forwarded on another network device. * * Set up to forward the packet on the specified device. This function - * will set up a send "interrupt" handler that will perform the actual - * send asynchronously and must return without waiting for the send to + * will set up a send event handler that will perform the actual send + * asynchronously and must return without waiting for the send to * complete. * * Input Parameters: @@ -335,7 +335,7 @@ int ipfwd_forward(FAR struct forward_s *fwd) { fwd->f_cb->flags = (IPFWD_POLL | NETDEV_DOWN); fwd->f_cb->priv = (FAR void *)fwd; - fwd->f_cb->event = ipfwd_interrupt; + fwd->f_cb->event = ipfwd_eventhandler; /* Notify the device driver of the availability of TX data */ diff --git a/net/pkt/pkt_recvfrom.c b/net/pkt/pkt_recvfrom.c index ccda96ec5a..da23e1c70e 100644 --- a/net/pkt/pkt_recvfrom.c +++ b/net/pkt/pkt_recvfrom.c @@ -171,7 +171,7 @@ static inline void pkt_recvfrom_sender(FAR struct net_driver_s *dev, } /**************************************************************************** - * Name: pkt_recvfrom_interrupt + * Name: pkt_recvfrom_eventhandler * * Description: * @@ -183,9 +183,9 @@ static inline void pkt_recvfrom_sender(FAR struct net_driver_s *dev, * ****************************************************************************/ -static uint16_t pkt_recvfrom_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, FAR void *pvpriv, - uint16_t flags) +static uint16_t pkt_recvfrom_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, uint16_t flags) { struct pkt_recvfrom_s *pstate = (struct pkt_recvfrom_s *)pvpriv; @@ -423,7 +423,7 @@ ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, { state.pr_cb->flags = (PKT_NEWDATA | PKT_POLL); state.pr_cb->priv = (FAR void *)&state; - state.pr_cb->event = pkt_recvfrom_interrupt; + state.pr_cb->event = pkt_recvfrom_eventhandler; /* Wait for either the receive to complete or for an error/timeout to * occur. NOTES: (1) net_lockedwait will also terminate if a signal diff --git a/net/pkt/pkt_send.c b/net/pkt/pkt_send.c index 3902247fc8..d8c9bffc7b 100644 --- a/net/pkt/pkt_send.c +++ b/net/pkt/pkt_send.c @@ -86,12 +86,12 @@ struct send_s ****************************************************************************/ /**************************************************************************** - * Name: psock_send_interrupt + * Name: psock_send_eventhandler ****************************************************************************/ -static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, uint16_t flags) { FAR struct send_s *pstate = (FAR struct send_s *)pvpriv; @@ -271,7 +271,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf, state.snd_cb->flags = PKT_POLL; state.snd_cb->priv = (FAR void *)&state; - state.snd_cb->event = psock_send_interrupt; + state.snd_cb->event = psock_send_eventhandler; /* Notify the device driver that new TX data is available. */ diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c index 3f7cface20..d006ccbd55 100644 --- a/net/sixlowpan/sixlowpan_send.c +++ b/net/sixlowpan/sixlowpan_send.c @@ -135,7 +135,7 @@ static inline bool send_timeout(FAR struct sixlowpan_send_s *sinfo) } /**************************************************************************** - * Name: send_interrupt + * Name: send_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -154,9 +154,9 @@ static inline bool send_timeout(FAR struct sixlowpan_send_s *sinfo) * ****************************************************************************/ -static uint16_t send_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t send_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, uint16_t flags) { FAR struct sixlowpan_send_s *sinfo = (FAR struct sixlowpan_send_s *)pvpriv; @@ -310,7 +310,7 @@ int sixlowpan_send(FAR struct net_driver_s *dev, sinfo.s_cb->flags = (NETDEV_DOWN | WPAN_POLL); sinfo.s_cb->priv = (FAR void *)&sinfo; - sinfo.s_cb->event = send_interrupt; + sinfo.s_cb->event = send_eventhandler; /* Notify the IEEE802.15.4 MAC that we have data to send. */ diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index cbcf4c32f0..f987ccff3a 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -322,7 +322,7 @@ static inline bool send_timeout(FAR struct sixlowpan_send_s *sinfo) } /**************************************************************************** - * Name: tcp_send_interrupt + * Name: tcp_send_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -342,9 +342,9 @@ static inline bool send_timeout(FAR struct sixlowpan_send_s *sinfo) * ****************************************************************************/ -static uint16_t tcp_send_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, uint16_t flags) { FAR struct sixlowpan_send_s *sinfo = (FAR struct sixlowpan_send_s *)pvpriv; FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn; @@ -682,7 +682,7 @@ static int sixlowpan_send_packet(FAR struct socket *psock, sinfo.s_cb->flags = (NETDEV_DOWN | TCP_ACKDATA | TCP_REXMIT | TCP_DISCONN_EVENTS | WPAN_POLL); sinfo.s_cb->priv = (FAR void *)&sinfo; - sinfo.s_cb->event = tcp_send_interrupt; + sinfo.s_cb->event = tcp_send_eventhandler; /* There is no outstanding, unacknowledged data after this * initial sequence number. diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 418ba5c7cc..878cf428f3 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -523,7 +523,7 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr); * None * * Assumptions: - * Running at the interrupt level + * The network is locked * ****************************************************************************/ @@ -603,9 +603,9 @@ void tcp_close_monitor(FAR struct socket *psock); * * Description: * Called when a loss-of-connection event has been detected by network - * "interrupt" handling logic. Perform operations like tcp_stop_monitor - * but (1) explicitly amek this socket and (2) disable further callbacks - * the "interrupt handler". + * event handling logic. Perform operations like tcp_stop_monitor but + * (1) explicitly mark this socket and (2) disable further callbacks + * the event handler. * * Parameters: * psock - The TCP socket structure associated. @@ -777,7 +777,7 @@ void tcp_listen_initialize(void); * Return the connection listener for connections on this port (if any) * * Assumptions: - * Called at interrupt level + * The network is locked * ****************************************************************************/ @@ -1129,11 +1129,11 @@ int tcp_backlogadd(FAR struct tcp_conn_s *conn, * Name: tcp_backlogavailable * * Description: - * Called from poll(). Before waiting for a new connection, poll will - * call this API to see if there are pending connections in the backlog. + * Called from poll(). Before waiting for a new connection, poll will + * call this API to see if there are pending connections in the backlog. * * Assumptions: - * Called from normal user code, but with interrupts disabled, + * Thne network is locked. * ****************************************************************************/ @@ -1147,11 +1147,11 @@ bool tcp_backlogavailable(FAR struct tcp_conn_s *conn); * Name: tcp_backlogremove * * Description: - * Called from accept(). Before waiting for a new connection, accept will - * call this API to see if there are pending connections in the backlog. + * Called from accept(). Before waiting for a new connection, accept will + * call this API to see if there are pending connections in the backlog. * * Assumptions: - * Called from normal user code, but with interrupts disabled, + * The network is locked. * ****************************************************************************/ @@ -1290,9 +1290,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, * -ENOTCONN * The socket is not connected. * - * Assumptions: - * Not running at the interrupt level - * ****************************************************************************/ int psock_tcp_cansend(FAR struct socket *psock); diff --git a/net/tcp/tcp_accept.c b/net/tcp/tcp_accept.c index ce186cd386..1c8cd55125 100644 --- a/net/tcp/tcp_accept.c +++ b/net/tcp/tcp_accept.c @@ -145,7 +145,7 @@ static inline void accept_tcpsender(FAR struct socket *psock, #endif /* CONFIG_NET_TCP */ /**************************************************************************** - * Name: accept_interrupt + * Name: accept_eventhandler * * Description: * Receive interrupt level callbacks when connections occur @@ -162,8 +162,8 @@ static inline void accept_tcpsender(FAR struct socket *psock, * ****************************************************************************/ -static int accept_interrupt(FAR struct tcp_conn_s *listener, - FAR struct tcp_conn_s *conn) +static int accept_eventhandler(FAR struct tcp_conn_s *listener, + FAR struct tcp_conn_s *conn) { struct accept_s *pstate = (struct accept_s *)listener->accept_private; int ret = -EINVAL; @@ -291,7 +291,7 @@ int psock_tcp_accept(FAR struct socket *psock, FAR struct sockaddr *addr, /* Set up the callback in the connection */ conn->accept_private = (FAR void *)&state; - conn->accept = accept_interrupt; + conn->accept = accept_eventhandler; /* Wait for the send to complete or an error to occur: NOTES: (1) * net_lockedwait will also terminate if a signal is received, (2) diff --git a/net/tcp/tcp_connect.c b/net/tcp/tcp_connect.c index 62e6f4a5d7..842c4de2bd 100644 --- a/net/tcp/tcp_connect.c +++ b/net/tcp/tcp_connect.c @@ -82,9 +82,9 @@ static inline int psock_setup_callbacks(FAR struct socket *psock, FAR struct tcp_connect_s *pstate); static void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate, int status); -static uint16_t psock_connect_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, FAR void *pvpriv, - uint16_t flags); +static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, uint16_t flags); /**************************************************************************** * Private Functions @@ -118,12 +118,12 @@ static inline int psock_setup_callbacks(FAR struct socket *psock, pstate->tc_cb = tcp_callback_alloc(conn); if (pstate->tc_cb) { - /* Set up the connection "interrupt" handler */ + /* Set up the connection event handler */ pstate->tc_cb->flags = (TCP_NEWDATA | TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT | TCP_CONNECTED | NETDEV_DOWN); pstate->tc_cb->priv = (FAR void *)pstate; - pstate->tc_cb->event = psock_connect_interrupt; + pstate->tc_cb->event = psock_connect_eventhandler; ret = OK; } @@ -139,7 +139,7 @@ static void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate, { FAR struct tcp_conn_s *conn = pstate->tc_conn; - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ tcp_callback_free(conn, pstate->tc_cb); pstate->tc_cb = NULL; @@ -157,14 +157,14 @@ static void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate, } /**************************************************************************** - * Name: psock_connect_interrupt + * Name: psock_connect_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual - * connection operation via by the lower, device interfacing layer. + * This function is called to perform the actual connection operation via + * by the lower, device interfacing layer. * * Parameters: - * dev The structure of the network driver that caused the interrupt + * dev The structure of the network driver that reported the event * pvconn The connection structure associated with the socket * flags Set of events describing why the callback was invoked * @@ -172,13 +172,13 @@ static void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate, * The new flags setting * * Assumptions: - * Running at the interrupt level + * The network is locked. * ****************************************************************************/ -static uint16_t psock_connect_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, FAR void *pvpriv, - uint16_t flags) +static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, uint16_t flags) { struct tcp_connect_s *pstate = (struct tcp_connect_s *)pvpriv; @@ -324,7 +324,7 @@ static uint16_t psock_connect_interrupt(FAR struct net_driver_s *dev, * None * * Assumptions: - * Running at the interrupt level + * The network is locked * ****************************************************************************/ @@ -389,7 +389,7 @@ int psock_tcp_connect(FAR struct socket *psock, ret = state.tc_result; } - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ psock_teardown_callbacks(&state, ret); } diff --git a/net/tcp/tcp_monitor.c b/net/tcp/tcp_monitor.c index af4946bb7a..65a3b6707b 100644 --- a/net/tcp/tcp_monitor.c +++ b/net/tcp/tcp_monitor.c @@ -379,10 +379,11 @@ void tcp_close_monitor(FAR struct socket *psock) */ /* REVISIT: The following logic won't work: There is no way to compare - * psocks to check for a match. This could only be an issue if the same - * socket were being used on one thread, but then closed on another. - * Some redesign would be required to find only those event handlers that - * re waiting specifically for this socket (vs. a dup of this this socket) + * psocks to check for a match. This missing logic could only be an issue + * if the same socket were being used on one thread, but then closed on + * another. Some redesign would be required to find only those event + * handlers that are waiting specifically for this socket (vs. a dup of + * this socket) */ #if 0 @@ -401,9 +402,9 @@ void tcp_close_monitor(FAR struct socket *psock) * * Description: * Called when a loss-of-connection event has been detected by network - * "interrupt" handling logic. Perform operations like tcp_stop_monitor - * but (1) explicitly amek this socket and (2) disable further callbacks - * the "interrupt handler". + * event handling logic. Perform operations like tcp_stop_monitor but (1) + * explicitly mark this socket and (2) disable further callbacks the to the + * event handler. * * Parameters: * psock - The TCP socket structure whose connection was lost. @@ -425,7 +426,7 @@ void tcp_lost_connection(FAR struct socket *psock, DEBUGASSERT(psock != NULL && psock->s_conn != NULL); /* Nullify the callback structure so that recursive callbacks are not - * received by the "interrupt handler" due to disconnection processing. + * received by the event handler due to disconnection processing. */ cb->flags = 0; diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c index 7fc3937e2c..3c5ff4f5a5 100644 --- a/net/tcp/tcp_netpoll.c +++ b/net/tcp/tcp_netpoll.c @@ -70,7 +70,7 @@ struct tcp_poll_s ****************************************************************************/ /**************************************************************************** - * Name: tcp_poll_interrupt + * Name: tcp_poll_eventhandler * * Description: * This function is called to perform the actual TCP receive operation via @@ -89,8 +89,9 @@ struct tcp_poll_s * ****************************************************************************/ -static uint16_t tcp_poll_interrupt(FAR struct net_driver_s *dev, FAR void *conn, - FAR void *pvpriv, uint16_t flags) +static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev, + FAR void *conn, + FAR void *pvpriv, uint16_t flags) { FAR struct tcp_poll_s *info = (FAR struct tcp_poll_s *)pvpriv; @@ -216,7 +217,7 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds) cb->flags = (TCP_NEWDATA | TCP_BACKLOG | TCP_POLL | TCP_DISCONN_EVENTS); cb->priv = (FAR void *)info; - cb->event = tcp_poll_interrupt; + cb->event = tcp_poll_eventhandler; /* Save the reference in the poll info structure as fds private as well * for use during poll teardown as well. diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index 3b8f6061dd..074822e808 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -321,7 +321,7 @@ static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn) #endif /* CONFIG_NET_ETHERNET */ /**************************************************************************** - * Name: psock_send_interrupt + * Name: psock_send_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -340,9 +340,9 @@ static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn) * ****************************************************************************/ -static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, FAR void *pvpriv, - uint16_t flags) +static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) { FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn; FAR struct socket *psock = (FAR struct socket *)pvpriv; @@ -1051,7 +1051,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, psock->s_sndcb->flags = (TCP_ACKDATA | TCP_REXMIT | TCP_POLL | TCP_DISCONN_EVENTS); psock->s_sndcb->priv = (FAR void *)psock; - psock->s_sndcb->event = psock_send_interrupt; + psock->s_sndcb->event = psock_send_eventhandler; /* Initialize the write buffer */ @@ -1063,7 +1063,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, WRB_DUMP("I/O buffer chain", wrb, WRB_PKTLEN(wrb), 0); - /* psock_send_interrupt() will send data in FIFO order from the + /* psock_send_eventhandler() will send data in FIFO order from the * conn->write_q */ diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index 3313dc5c69..bd24069e85 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -272,7 +272,7 @@ static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn) #endif /* CONFIG_NET_ETHERNET */ /**************************************************************************** - * Name: tcpsend_interrupt + * Name: tcpsend_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -291,9 +291,9 @@ static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn) * ****************************************************************************/ -static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev, - FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, uint16_t flags) { FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn; FAR struct send_s *pstate = (FAR struct send_s *)pvpriv; @@ -826,7 +826,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, state.snd_cb->flags = (TCP_ACKDATA | TCP_REXMIT | TCP_POLL | TCP_DISCONN_EVENTS); state.snd_cb->priv = (FAR void *)&state; - state.snd_cb->event = tcpsend_interrupt; + state.snd_cb->event = tcpsend_eventhandler; /* Notify the device driver of the availability of TX data */ diff --git a/net/tcp/tcp_sendfile.c b/net/tcp/tcp_sendfile.c index 7da57d02e0..6cb809eb0f 100644 --- a/net/tcp/tcp_sendfile.c +++ b/net/tcp/tcp_sendfile.c @@ -154,8 +154,9 @@ static inline int sendfile_timeout(FAR struct sendfile_s *pstate) } #endif /* CONFIG_NET_SOCKOPTS */ -static uint16_t ack_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t ack_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, + FAR void *pvpriv, uint16_t flags) { FAR struct sendfile_s *pstate = (FAR struct sendfile_s *)pvpriv; @@ -307,7 +308,7 @@ static inline bool sendfile_addrcheck(FAR struct tcp_conn_s *conn) #endif /* CONFIG_NET_ETHERNET */ /**************************************************************************** - * Name: sendfile_interrupt + * Name: sendfile_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -326,8 +327,9 @@ static inline bool sendfile_addrcheck(FAR struct tcp_conn_s *conn) * ****************************************************************************/ -static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn, - FAR void *pvpriv, uint16_t flags) +static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev, + FAR void *pvconn, FAR void *pvpriv, + uint16_t flags) { FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn; FAR struct sendfile_s *pstate = (FAR struct sendfile_s *)pvpriv; @@ -667,7 +669,7 @@ ssize_t tcp_sendfile(FAR struct socket *psock, FAR struct file *infile, state.snd_ackcb->flags = (TCP_ACKDATA | TCP_REXMIT | TCP_DISCONN_EVENTS); state.snd_ackcb->priv = (FAR void *)&state; - state.snd_ackcb->event = ack_interrupt; + state.snd_ackcb->event = ack_eventhandler; /* Perform the TCP send operation */ @@ -675,7 +677,7 @@ ssize_t tcp_sendfile(FAR struct socket *psock, FAR struct file *infile, { state.snd_datacb->flags = TCP_POLL; state.snd_datacb->priv = (FAR void *)&state; - state.snd_datacb->event = sendfile_interrupt; + state.snd_datacb->event = sendfile_eventhandler; /* Notify the device driver of the availability of TX data */ diff --git a/net/udp/udp_netpoll.c b/net/udp/udp_netpoll.c index 7bc31ced64..868de13320 100644 --- a/net/udp/udp_netpoll.c +++ b/net/udp/udp_netpoll.c @@ -69,7 +69,7 @@ struct udp_poll_s ****************************************************************************/ /**************************************************************************** - * Name: udp_poll_interrupt + * Name: udp_poll_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -88,8 +88,9 @@ struct udp_poll_s * ****************************************************************************/ -static uint16_t udp_poll_interrupt(FAR struct net_driver_s *dev, FAR void *conn, - FAR void *pvpriv, uint16_t flags) +static uint16_t udp_poll_eventhandler(FAR struct net_driver_s *dev, + FAR void *conn, + FAR void *pvpriv, uint16_t flags) { FAR struct udp_poll_s *info = (FAR struct udp_poll_s *)pvpriv; @@ -221,7 +222,7 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds) cb->flags = 0; cb->priv = (FAR void *)info; - cb->event = udp_poll_interrupt; + cb->event = udp_poll_eventhandler; if ((info->fds->events & POLLOUT) != 0) { diff --git a/net/udp/udp_psock_sendto.c b/net/udp/udp_psock_sendto.c index dfc1aaa2e4..d29277c091 100644 --- a/net/udp/udp_psock_sendto.c +++ b/net/udp/udp_psock_sendto.c @@ -200,7 +200,7 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev, #endif /**************************************************************************** - * Name: sendto_interrupt + * Name: sendto_eventhandler * * Description: * This function is called from the interrupt level to perform the actual @@ -220,8 +220,9 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev, * ****************************************************************************/ -static uint16_t sendto_interrupt(FAR struct net_driver_s *dev, FAR void *conn, - FAR void *pvpriv, uint16_t flags) +static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, + FAR void *conn, FAR void *pvpriv, + uint16_t flags) { FAR struct sendto_s *pstate = (FAR struct sendto_s *)pvpriv; @@ -449,7 +450,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, { state.st_cb->flags = (UDP_POLL | NETDEV_DOWN); state.st_cb->priv = (FAR void *)&state; - state.st_cb->event = sendto_interrupt; + state.st_cb->event = sendto_eventhandler; /* Notify the device driver of the availability of TX data */ diff --git a/net/usrsock/usrsock_conn.c b/net/usrsock/usrsock_conn.c index 0b02276246..21baa26da7 100644 --- a/net/usrsock/usrsock_conn.c +++ b/net/usrsock/usrsock_conn.c @@ -264,7 +264,7 @@ int usrsock_setup_request_callback(FAR struct usrsock_conn_s *conn, pstate->cb = devif_callback_alloc(NULL, &conn->list); if (pstate->cb) { - /* Set up the connection "interrupt" handler */ + /* Set up the connection event handler */ pstate->cb->flags = flags; pstate->cb->priv = (FAR void *)pstate;