diff --git a/net/arp/arp_notify.c b/net/arp/arp_notify.c index 855aa58bff2..d735386540c 100644 --- a/net/arp/arp_notify.c +++ b/net/arp/arp_notify.c @@ -113,7 +113,7 @@ void arp_wait_setup(in_addr_t ipaddr, FAR struct arp_notify_s *notify) * is called (arp_wait() will automatically cancel the wait). * * Assumptions: - * This function may execute in the interrupt context when called from + * This function may execute with interrupts disabled when called from * arp_wait(). * ****************************************************************************/ diff --git a/net/arp/arp_send.c b/net/arp/arp_send.c index e66b0e39eb0..38bb23bf0fc 100644 --- a/net/arp/arp_send.c +++ b/net/arp/arp_send.c @@ -117,9 +117,9 @@ static uint16_t arp_send_eventhandler(FAR struct net_driver_s *dev, } /* Check if the outgoing packet is available. It may have been claimed - * by a send 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 send 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. */ if (dev->d_sndlen > 0 || (flags & PKT_NEWDATA) != 0) @@ -292,10 +292,6 @@ int arp_send(in_addr_t ipaddr) goto errout_with_lock; } - /* Initialize the state structure. This is done with interrupts - * disabled - */ - /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ @@ -310,7 +306,8 @@ int arp_send(in_addr_t ipaddr) strncpy((FAR char *)state.snd_ifname, (FAR const char *)dev->d_ifname, IFNAMSIZ); - /* Now loop, testing if the address mapping is in the ARP table and re-sending the ARP request if it is not. + /* Now loop, testing if the address mapping is in the ARP table and re- + * sending the ARP request if it is not. */ ret = -ETIMEDOUT; /* Assume a timeout failure */ @@ -355,10 +352,8 @@ int arp_send(in_addr_t ipaddr) dev->d_txavail(dev); } - /* Wait for the send to complete or an error to occur: NOTES: (1) - * net_lockedwait will also terminate if a signal is received, (2) - * interrupts may be disabled! They will be re-enabled while the - * task sleeps and automatically re-enabled when the task restarts. + /* Wait for the send to complete or an error to occur. + * net_lockedwait will also terminate if a signal is received. */ do diff --git a/net/arp/arp_table.c b/net/arp/arp_table.c index d8818ddf396..1bba33797ca 100644 --- a/net/arp/arp_table.c +++ b/net/arp/arp_table.c @@ -258,9 +258,8 @@ void arp_hdr_update(FAR uint16_t *pipaddr, FAR uint8_t *ethaddr) * Input Parameters: * ipaddr - Refers to an IP address in network order * - * Assumptions - * Interrupts are disabled; Returned value will become unstable when - * interrupts are re-enabled or if any other network APIs are called. + * Assumptions: + * The network is locked. * ****************************************************************************/ diff --git a/net/bluetooth/bluetooth_sendto.c b/net/bluetooth/bluetooth_sendto.c index e2e098fbf71..a411457f6f7 100644 --- a/net/bluetooth/bluetooth_sendto.c +++ b/net/bluetooth/bluetooth_sendto.c @@ -286,9 +286,8 @@ ssize_t psock_bluetooth_sendto(FAR struct socket *psock, FAR const void *buf, /* Perform the send operation */ - /* Initialize the state structure. This is done with interrupts - * disabled because we don't want anything to happen until we - * are ready. + /* Initialize the state structure. This is done with the network locked + * because we don't want anything to happen until we are ready. */ net_lock(); @@ -328,15 +327,13 @@ ssize_t psock_bluetooth_sendto(FAR struct socket *psock, FAR const void *buf, netdev_txnotify_dev(&radio->r_dev); - /* Wait for the send to complete or an error to occur: NOTES: (1) - * net_lockedwait will also terminate if a signal is received, (2) - * interrupts may be disabled! They will be re-enabled while the - * task sleeps and automatically re-enabled when the task restarts. + /* Wait for the send to complete or an error to occur. + * net_lockedwait will also terminate if a signal is received. */ ret = net_lockedwait(&state.is_sem); - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ bluetooth_callback_free(&radio->r_dev, conn, state.is_cb); } diff --git a/net/devif/devif_callback.c b/net/devif/devif_callback.c index e2261b750fe..5d4a57d6270 100644 --- a/net/devif/devif_callback.c +++ b/net/devif/devif_callback.c @@ -213,7 +213,8 @@ static bool devif_event_trigger(uint16_t events, uint16_t triggers) * Configure the pre-allocated callback structures into a free list. * * Assumptions: - * This function is called with interrupts disabled. + * Called early in the initialization sequence so that no special + * protection is required. * ****************************************************************************/ diff --git a/net/devif/devif_initialize.c b/net/devif/devif_initialize.c index e2bca63e18f..c345877b1b4 100644 --- a/net/devif/devif_initialize.c +++ b/net/devif/devif_initialize.c @@ -88,6 +88,10 @@ uint8_t g_reassembly_timer; * Returned Value: * None * + * Assumptions: + * Called early in the initialization sequence so that no special + * protection is required. + * ****************************************************************************/ void devif_initialize(void) diff --git a/net/icmp/icmp_recvfrom.c b/net/icmp/icmp_recvfrom.c index a0f01593bd6..0bd4c487a0d 100644 --- a/net/icmp/icmp_recvfrom.c +++ b/net/icmp/icmp_recvfrom.c @@ -497,10 +497,7 @@ ssize_t icmp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, state.recv_result = -EINTR; /* Assume sem-wait interrupted by signal */ /* Wait for either the response to be received or for timeout to - * occur. (1) net_lockedwait will also terminate if a signal is - * received, (2) interrupts may be disabled! They will be re-enabled - * while the task sleeps and automatically re-enabled when the task - * restarts. + * occur. net_lockedwait will also terminate if a signal is received. */ ninfo("Start time: 0x%08x\n", state.recv_time); diff --git a/net/icmp/icmp_sendto.c b/net/icmp/icmp_sendto.c index dcb16022f40..cdff2851ed5 100644 --- a/net/icmp/icmp_sendto.c +++ b/net/icmp/icmp_sendto.c @@ -477,10 +477,8 @@ ssize_t icmp_sendto(FAR struct socket *psock, FAR const void *buf, size_t len, netdev_txnotify_dev(dev); - /* Wait for either the send to complete or for timeout to occur. (1) - * net_lockedwait will also terminate if a signal is received, (2) - * interrupts may be disabled! They will be re-enabled while the - * task sleeps and automatically re-enabled when the task restarts. + /* Wait for either the send to complete or for timeout to occur. + * net_lockedwait will also terminate if a signal is received. */ ninfo("Start time: 0x%08x\n", state.snd_time); diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c index 5ca429b8cc9..4f5121fc6a1 100644 --- a/net/icmpv6/icmpv6_autoconfig.c +++ b/net/icmpv6/icmpv6_autoconfig.c @@ -133,7 +133,7 @@ static uint16_t icmpv6_router_eventhandler(FAR struct net_driver_s *dev, } /* Check if the outgoing packet is available. It may have been claimed - * by a send interrupt serving a different thread -OR- if the output + * by a send 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. */ @@ -204,11 +204,10 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev, bool advertise) struct icmpv6_router_s state; int ret; - /* Initialize the state structure. This is done with interrupts - * disabled - */ - - /* This semaphore is used for signaling and, hence, should not have + /* Initialize the state structure with the network locked. + * + * + * This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ @@ -246,10 +245,8 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev, bool advertise) dev->d_txavail(dev); - /* Wait for the send to complete or an error to occur: NOTES: (1) - * net_lockedwait will also terminate if a signal is received, (2) - * interrupts may be disabled! They will be re-enabled while the - * task sleeps and automatically re-enabled when the task restarts. + /* Wait for the send to complete or an error to occur + * net_lockedwait will also terminate if a signal is received. */ do diff --git a/net/icmpv6/icmpv6_neighbor.c b/net/icmpv6/icmpv6_neighbor.c index 9365ec19f36..fab84ed7c2b 100644 --- a/net/icmpv6/icmpv6_neighbor.c +++ b/net/icmpv6/icmpv6_neighbor.c @@ -119,7 +119,7 @@ static uint16_t icmpv6_neighbor_eventhandler(FAR struct net_driver_s *dev, } /* Check if the outgoing packet is available. It may have been claimed - * by a send interrupt serving a different thread -OR- if the output + * by a send 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. */ @@ -292,11 +292,9 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr) goto errout_with_lock; } - /* Initialize the state structure. This is done with interrupts - * disabled - */ - - /* This semaphore is used for signaling and, hence, should not have + /* Initialize the state structure with the network locked. + * + * This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ @@ -351,10 +349,8 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr) dev->d_txavail(dev); - /* Wait for the send to complete or an error to occur: NOTES: (1) - * net_lockedwait will also terminate if a signal is received, (2) - * interrupts may be disabled! They will be re-enabled while the - * task sleeps and automatically re-enabled when the task restarts. + /* Wait for the send to complete or an error to occur. + * net_lockedwait will also terminate if a signal is received. */ do diff --git a/net/ieee802154/ieee802154_sendto.c b/net/ieee802154/ieee802154_sendto.c index d412bf9c5d9..64a6c77e089 100644 --- a/net/ieee802154/ieee802154_sendto.c +++ b/net/ieee802154/ieee802154_sendto.c @@ -521,7 +521,7 @@ ssize_t psock_ieee802154_sendto(FAR struct socket *psock, FAR const void *buf, ret = net_lockedwait(&state.is_sem); - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ ieee802154_callback_free(&radio->r_dev, conn, state.is_cb); } diff --git a/net/pkt/pkt_recvfrom.c b/net/pkt/pkt_recvfrom.c index d3936aeb60f..a859083e23f 100644 --- a/net/pkt/pkt_recvfrom.c +++ b/net/pkt/pkt_recvfrom.c @@ -296,7 +296,7 @@ static void pkt_recvfrom_initialize(FAR struct socket *psock, FAR void *buf, static ssize_t pkt_recvfrom_result(int result, struct pkt_recvfrom_s *pstate) { - /* Check for a error/timeout detected by the interrupt handler. Errors are + /* Check for a error/timeout detected by the event handler. Errors are * signaled by negative errno values for the rcv length */ diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c index d69e007a1f5..e9c0e5196a3 100644 --- a/net/sixlowpan/sixlowpan_framelist.c +++ b/net/sixlowpan/sixlowpan_framelist.c @@ -341,7 +341,7 @@ static int sixlowpan_pktradio_metadata(FAR struct radio_driver_s *radio, * * Description: * Process an outgoing UDP, TCP, or ICMPv6 packet. This function is - * called from send interrupt logic when a TX poll is received. It + * called from send event handler when a TX poll is received. It * formats the list of frames to be sent by the IEEE802.15.4 MAC driver. * * The payload data is in the caller 'buf' and is of length 'buflen'. diff --git a/net/sixlowpan/sixlowpan_internal.h b/net/sixlowpan/sixlowpan_internal.h index e07e4015490..ccb11a2d6ed 100644 --- a/net/sixlowpan/sixlowpan_internal.h +++ b/net/sixlowpan/sixlowpan_internal.h @@ -260,7 +260,7 @@ struct iob_s; /* Forward reference */ * * Input Parameters: * dev - The IEEE802.15.4 MAC network driver interface. - * list - Head of callback list for send interrupt + * list - Head of callback list for send event handler * ipv6hdr - IPv6 header followed by UDP or ICMPv6 header. * buf - Data to send * len - Length of data to send @@ -360,7 +360,7 @@ int sixlowpan_frame_submit(FAR struct radio_driver_s *radio, * * Description: * Process an outgoing UDP or TCP packet. This function is called from - * send interrupt logic when a TX poll is received. It formates the + * the send event handler when a TX poll is received. It formates the * list of frames to be sent by the IEEE802.15.4 MAC driver. * * The payload data is in the caller 'buf' and is of length 'buflen'. diff --git a/net/socket/setsockopt.c b/net/socket/setsockopt.c index 063939832c1..6b86f303b79 100644 --- a/net/socket/setsockopt.c +++ b/net/socket/setsockopt.c @@ -154,8 +154,8 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option, setting = *(FAR int *)value; - /* Disable interrupts so that there is no conflict with interrupt - * level access to options. + /* Lock the network so that we have exclusive access to the socket + * options. */ net_lock(); @@ -251,11 +251,11 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option, setting = (FAR struct linger *)value; - /* Disable interrupts so that there is no conflict with interrupt - * level access to options. + /* Lock the network so that we have exclusive access to the socket + * options. */ - net_lock(); + net_lock(); /* Set or clear the linger option bit and linger time (in deciseconds) */