From aabdc00e8cfbbd99afe1bdce5e9bf4daaf693b28 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 23 Jun 2018 14:09:06 -0600 Subject: [PATCH] net/: Fix some incorrect comments that go back for years (but have also been cloned in newer files). The network was once interrupt driver, but now runs on the work queue with a semaphore to enforce mutual exclusion. --- net/bluetooth/bluetooth_callback.c | 2 +- net/bluetooth/bluetooth_conn.c | 8 ++--- net/bluetooth/bluetooth_sendto.c | 2 +- net/devif/devif_iobsend.c | 3 +- net/devif/devif_pktsend.c | 3 +- net/icmp/icmp_conn.c | 8 ++--- net/icmp/icmp_recvfrom.c | 9 +++--- net/icmp/icmp_sendto.c | 11 +++---- net/icmpv6/icmpv6_autoconfig.c | 2 +- net/icmpv6/icmpv6_conn.c | 8 ++--- net/icmpv6/icmpv6_neighbor.c | 2 +- net/icmpv6/icmpv6_recvfrom.c | 9 +++--- net/icmpv6/icmpv6_sendto.c | 17 +++++------ net/ieee802154/ieee802154_callback.c | 2 +- net/ieee802154/ieee802154_conn.c | 8 ++--- net/ieee802154/ieee802154_sendto.c | 14 ++++----- net/inet/inet_recvfrom.c | 44 ++++++++++++---------------- net/ipforward/ipfwd_forward.c | 9 +++--- net/pkt/pkt_callback.c | 2 +- net/pkt/pkt_conn.c | 8 ++--- net/pkt/pkt_send.c | 21 ++++++------- net/sixlowpan/sixlowpan_send.c | 18 +++++------- net/sixlowpan/sixlowpan_tcpsend.c | 18 +++++------- net/usrsock/usrsock_conn.c | 8 ++--- 24 files changed, 98 insertions(+), 138 deletions(-) diff --git a/net/bluetooth/bluetooth_callback.c b/net/bluetooth/bluetooth_callback.c index a2bfc97e1e9..1855ff4203c 100644 --- a/net/bluetooth/bluetooth_callback.c +++ b/net/bluetooth/bluetooth_callback.c @@ -63,7 +63,7 @@ * OK if packet has been processed, otherwise ERROR. * * Assumptions: - * This function is called at the interrupt level with interrupts disabled. + * This function is called at the with the network disabled. * ****************************************************************************/ diff --git a/net/bluetooth/bluetooth_conn.c b/net/bluetooth/bluetooth_conn.c index ec6c9fbbc4e..501f9916f30 100644 --- a/net/bluetooth/bluetooth_conn.c +++ b/net/bluetooth/bluetooth_conn.c @@ -128,9 +128,7 @@ FAR struct bluetooth_conn_s *bluetooth_conn_alloc(void) { FAR struct bluetooth_conn_s *conn; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by the network lock */ net_lock(); conn = (FAR struct bluetooth_conn_s *) @@ -162,9 +160,7 @@ void bluetooth_conn_free(FAR struct bluetooth_conn_s *conn) FAR struct bluetooth_container_s *container; FAR struct bluetooth_container_s *next; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by the network lock. */ DEBUGASSERT(conn->bc_crefs == 0); diff --git a/net/bluetooth/bluetooth_sendto.c b/net/bluetooth/bluetooth_sendto.c index 32242aee9e5..e2e098fbf71 100644 --- a/net/bluetooth/bluetooth_sendto.c +++ b/net/bluetooth/bluetooth_sendto.c @@ -73,7 +73,7 @@ ****************************************************************************/ /* This structure holds the state of the send operation until it can be - * operated upon from the interrupt level. + * operated upon from the event handler. */ struct bluetooth_sendto_s diff --git a/net/devif/devif_iobsend.c b/net/devif/devif_iobsend.c index 7b44a2068cc..055f049a800 100644 --- a/net/devif/devif_iobsend.c +++ b/net/devif/devif_iobsend.c @@ -63,8 +63,7 @@ * in an I/O buffer chain, rather than a flat buffer. * * Assumptions: - * Called from the interrupt level or, at a minimum, with interrupts - * disabled. + * Called with the network locked. * ****************************************************************************/ diff --git a/net/devif/devif_pktsend.c b/net/devif/devif_pktsend.c index a2b7f07c50e..9f844a860b2 100644 --- a/net/devif/devif_pktsend.c +++ b/net/devif/devif_pktsend.c @@ -91,8 +91,7 @@ * no header on the data. * * Assumptions: - * Called from the interrupt level or, at a minimum, with interrupts - * disabled. + * Called with the network locked. * ****************************************************************************/ diff --git a/net/icmp/icmp_conn.c b/net/icmp/icmp_conn.c index a6726180b39..8c9073c5fbe 100644 --- a/net/icmp/icmp_conn.c +++ b/net/icmp/icmp_conn.c @@ -118,9 +118,7 @@ FAR struct icmp_conn_s *icmp_alloc(void) FAR struct icmp_conn_s *conn = NULL; int ret; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by a semaphore (that behaves like a mutex). */ ret = net_lockedwait(&g_free_sem); if (ret >= 0) @@ -156,9 +154,7 @@ void icmp_free(FAR struct icmp_conn_s *conn) { int ret; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by a semaphore (that behaves like a mutex). */ DEBUGASSERT(conn->crefs == 0); diff --git a/net/icmp/icmp_recvfrom.c b/net/icmp/icmp_recvfrom.c index 870f15f2713..a0f01593bd6 100644 --- a/net/icmp/icmp_recvfrom.c +++ b/net/icmp/icmp_recvfrom.c @@ -127,13 +127,14 @@ static inline int recvfrom_timeout(FAR struct icmp_recvfrom_s *pstate) * Name: recvfrom_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * ECHO request and/or ECHO reply actions when polled by the lower, device * interfacing layer. * * Input Parameters: - * dev The structure of the network driver that caused the interrupt - * conn The received packet, cast to void * + * dev The structure of the network driver that generated the + * event. + * conn The received packet, cast to (void *) * pvpriv An instance of struct icmp_recvfrom_s cast to void* * flags Set of events describing why the callback was invoked * @@ -274,7 +275,7 @@ end_wait: * Input Parameters: * conn - IPPROTO_ICMP socket connection structure containing the read- * ahead data. - * dev The structure of the network driver that caused the interrupt + * dev The structure of the network driver that generated the event. * pstate recvfrom state structure * * Returned Value: diff --git a/net/icmp/icmp_sendto.c b/net/icmp/icmp_sendto.c index e4fbe0d156f..dcb16022f40 100644 --- a/net/icmp/icmp_sendto.c +++ b/net/icmp/icmp_sendto.c @@ -226,14 +226,15 @@ static void sendto_request(FAR struct net_driver_s *dev, * Name: sendto_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * ECHO request and/or ECHO reply actions when polled by the lower, device * interfacing layer. * * Input Parameters: - * dev The structure of the network driver that caused the interrupt - * conn The received packet, cast to void * - * pvpriv An instance of struct icmp_sendto_s cast to void* + * dev The structure of the network driver that generated the + * event. + * conn The received packet, cast to (void *) + * pvpriv An instance of struct icmp_sendto_s cast to (void *) * flags Set of events describing why the callback was invoked * * Returned Value: @@ -265,7 +266,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, /* Check: * If the outgoing packet is available (it may have been claimed - * by a sendto interrupt serving a different thread) + * by a sendto event handler serving a different thread) * -OR- * If the output buffer currently contains unprocessed incoming * data. diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c index b5074b77e42..5ca429b8cc9 100644 --- a/net/icmpv6/icmpv6_autoconfig.c +++ b/net/icmpv6/icmpv6_autoconfig.c @@ -72,7 +72,7 @@ ****************************************************************************/ /* This structure holds the state of the send operation until it can be - * operated upon from the interrupt level. + * operated upon by the event handler. */ struct icmpv6_router_s diff --git a/net/icmpv6/icmpv6_conn.c b/net/icmpv6/icmpv6_conn.c index 22ad2b688fd..4bcf06e5796 100644 --- a/net/icmpv6/icmpv6_conn.c +++ b/net/icmpv6/icmpv6_conn.c @@ -118,9 +118,7 @@ FAR struct icmpv6_conn_s *icmpv6_alloc(void) FAR struct icmpv6_conn_s *conn = NULL; int ret; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by a semaphore (that behaves like a mutex). */ ret = net_lockedwait(&g_free_sem); if (ret >= 0) @@ -156,9 +154,7 @@ void icmpv6_free(FAR struct icmpv6_conn_s *conn) { int ret; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by a semaphore (that behaves like a mutex). */ DEBUGASSERT(conn->crefs == 0); diff --git a/net/icmpv6/icmpv6_neighbor.c b/net/icmpv6/icmpv6_neighbor.c index f73d702e88d..9365ec19f36 100644 --- a/net/icmpv6/icmpv6_neighbor.c +++ b/net/icmpv6/icmpv6_neighbor.c @@ -77,7 +77,7 @@ ****************************************************************************/ /* This structure holds the state of the send operation until it can be - * operated upon from the interrupt level. + * operated upon from the event handler. */ struct icmpv6_neighbor_s diff --git a/net/icmpv6/icmpv6_recvfrom.c b/net/icmpv6/icmpv6_recvfrom.c index 11c90dea7be..bf943a4f27c 100644 --- a/net/icmpv6/icmpv6_recvfrom.c +++ b/net/icmpv6/icmpv6_recvfrom.c @@ -130,13 +130,14 @@ static inline int recvfrom_timeout(FAR struct icmpv6_recvfrom_s *pstate) * Name: recvfrom_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * ECHO request and/or ECHO reply actions when polled by the lower, device * interfacing layer. * * Input Parameters: - * dev The structure of the network driver that caused the interrupt - * conn The received packet, cast to void * + * dev The structure of the network driver that generated the + * event + * conn The received packet, cast to (void *) * pvpriv An instance of struct icmpv6_recvfrom_s cast to void* * flags Set of events describing why the callback was invoked * @@ -277,7 +278,7 @@ end_wait: * Input Parameters: * conn - IPPROTO_ICMP6 socket connection structure containing the read- * ahead data. - * dev The structure of the network driver that caused the interrupt + * dev The structure of the network driver that generated the event. * pstate recvfrom state structure * * Returned Value: diff --git a/net/icmpv6/icmpv6_sendto.c b/net/icmpv6/icmpv6_sendto.c index 8e5ad48837b..4d522851ca5 100644 --- a/net/icmpv6/icmpv6_sendto.c +++ b/net/icmpv6/icmpv6_sendto.c @@ -217,14 +217,15 @@ static void sendto_request(FAR struct net_driver_s *dev, * Name: sendto_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * ECHO request and/or ECHO reply actions when polled by the lower, device * interfacing layer. * * Input Parameters: - * dev The structure of the network driver that caused the interrupt - * pvconn The received packet, cast to void * - * pvpriv An instance of struct icmpv6_sendto_s cast to void* + * dev The structure of the network driver that generated the + * event + * pvconn The received packet, cast to (void *) + * pvpriv An instance of struct icmpv6_sendto_s cast to (void *) * flags Set of events describing why the callback was invoked * * Returned Value: @@ -256,7 +257,7 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, /* Check: * If the outgoing packet is available (it may have been claimed - * by a sendto interrupt serving a different thread) + * by a sendto event handler serving a different thread) * -OR- * If the output buffer currently contains unprocessed incoming * data. @@ -471,10 +472,8 @@ ssize_t icmpv6_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/ieee802154/ieee802154_callback.c b/net/ieee802154/ieee802154_callback.c index 48eefd4580c..e9fca09b09e 100644 --- a/net/ieee802154/ieee802154_callback.c +++ b/net/ieee802154/ieee802154_callback.c @@ -63,7 +63,7 @@ * OK if packet has been processed, otherwise ERROR. * * Assumptions: - * This function is called at the interrupt level with interrupts disabled. + * This function is called with the network locked. * ****************************************************************************/ diff --git a/net/ieee802154/ieee802154_conn.c b/net/ieee802154/ieee802154_conn.c index 830d93969fb..7a3d9bc92f4 100644 --- a/net/ieee802154/ieee802154_conn.c +++ b/net/ieee802154/ieee802154_conn.c @@ -122,9 +122,7 @@ FAR struct ieee802154_conn_s *ieee802154_conn_alloc(void) { FAR struct ieee802154_conn_s *conn; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by the network lock. */ net_lock(); conn = (FAR struct ieee802154_conn_s *) @@ -156,9 +154,7 @@ void ieee802154_conn_free(FAR struct ieee802154_conn_s *conn) FAR struct ieee802154_container_s *container; FAR struct ieee802154_container_s *next; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by the network lock. */ DEBUGASSERT(conn->crefs == 0); diff --git a/net/ieee802154/ieee802154_sendto.c b/net/ieee802154/ieee802154_sendto.c index 7027fef4595..d412bf9c5d9 100644 --- a/net/ieee802154/ieee802154_sendto.c +++ b/net/ieee802154/ieee802154_sendto.c @@ -69,7 +69,7 @@ ****************************************************************************/ /* This structure holds the state of the send operation until it can be - * operated upon from the interrupt level. + * operated upon by the event handler. */ struct ieee802154_sendto_s @@ -473,9 +473,9 @@ ssize_t psock_ieee802154_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(); @@ -515,10 +515,8 @@ ssize_t psock_ieee802154_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); diff --git a/net/inet/inet_recvfrom.c b/net/inet/inet_recvfrom.c index d9233c5203f..a62a4e85dc3 100644 --- a/net/inet/inet_recvfrom.c +++ b/net/inet/inet_recvfrom.c @@ -150,7 +150,7 @@ static inline void inet_update_recvlen(FAR struct inet_recvfrom_s *pstate, * Copy the read data from the packet * * Input Parameters: - * dev The structure of the network driver that caused the interrupt + * dev The structure of the network driver that generated the event. * pstate recvfrom state structure * * Returned Value: @@ -198,7 +198,7 @@ static size_t inet_recvfrom_newdata(FAR struct net_driver_s *dev, * Copy the read data from the packet * * Input Parameters: - * dev The structure of the network driver that caused the interrupt + * dev The structure of the network driver that generated the event * pstate recvfrom state structure * * Returned Value: @@ -270,7 +270,7 @@ static inline void inet_tcp_newdata(FAR struct net_driver_s *dev, * Copy the read data from the packet * * Input Parameters: - * dev The sructure of the network driver that caused the interrupt + * dev The sructure of the network driver that generated the event * pstate recvfrom state structure * * Returned Value: @@ -611,11 +611,11 @@ static inline void inet_tcp_sender(FAR struct net_driver_s *dev, * Name: inet_tcp_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * TCP receive operation via by the lower, device interfacing layer. * * Input Parameters: - * dev The structure of the network driver that caused the interrupt + * dev The structure of the network driver that generated the event. * pvconn The connection structure associated with the socket * flags Set of events describing why the callback was invoked * @@ -974,11 +974,11 @@ static void inet_udp_terminate(FAR struct inet_recvfrom_s *pstate, int result) * Name: inet_udp_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * UDP receive operation via by the lower, device interfacing layer. * * Input Parameters: - * dev The structure of the network driver that caused the interrupt + * dev The structure of the network driver that generated the event. * pvconn The connection structure associated with the socket * flags Set of events describing why the callback was invoked * @@ -1141,7 +1141,7 @@ static void inet_recvfrom_initialize(FAR struct socket *psock, FAR void *buf, #if defined(NET_UDP_HAVE_STACK) || defined(NET_TCP_HAVE_STACK) static ssize_t inet_recvfrom_result(int result, struct inet_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 */ @@ -1198,9 +1198,8 @@ static ssize_t inet_udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t /* Perform the UDP recvfrom() 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(); @@ -1273,15 +1272,13 @@ static ssize_t inet_udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t 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 - * signal is received, (2) interrupts are disabled! They will be - * re-enabled while the task sleeps and automatically re-enabled - * when the task restarts. + * to occur. net_lockedwait will also terminate if a signal is + * received. */ ret = net_lockedwait(&state. ir_sem); - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ udp_callback_free(dev, conn, state.ir_cb); ret = inet_recvfrom_result(ret, &state); @@ -1325,9 +1322,8 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t struct inet_recvfrom_s state; int ret; - /* 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(); @@ -1449,17 +1445,13 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t state.ir_cb->event = inet_tcp_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 is - * received, (2) interrupts may be disabled! They will be re- - * enabled while the task sleeps and automatically re-enabled when - * the task restarts. + * to occur. net_lockedwait will also terminate if a signal isi + * received. */ ret = net_lockedwait(&state.ir_sem); - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ tcp_callback_free(conn, state.ir_cb); ret = inet_recvfrom_result(ret, &state); diff --git a/net/ipforward/ipfwd_forward.c b/net/ipforward/ipfwd_forward.c index 613b3aee557..d85942a50f6 100644 --- a/net/ipforward/ipfwd_forward.c +++ b/net/ipforward/ipfwd_forward.c @@ -189,13 +189,14 @@ static inline bool ipfwd_addrchk(FAR struct forward_s *fwd) * Name: ipfwd_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * send operation when polled by the lower, device interfacing layer. * * Input Parameters: - * dev The structure of the network driver that caused the interrupt - * conn An instance of the forwarding structure cast to void * - * pvpriv An instance of struct forward_s cast to void* + * dev The structure of the network driver that generated the + * event + * conn An instance of the forwarding structure cast to (void *) + * pvpriv An instance of struct forward_s cast to (void *) * flags Set of events describing why the callback was invoked * * Returned Value: diff --git a/net/pkt/pkt_callback.c b/net/pkt/pkt_callback.c index 13437962561..6b715e93996 100644 --- a/net/pkt/pkt_callback.c +++ b/net/pkt/pkt_callback.c @@ -63,7 +63,7 @@ * OK if packet has been processed, otherwise ERROR. * * Assumptions: - * This function is called at the interrupt level with interrupts disabled. + * This function is called with the network locked. * ****************************************************************************/ diff --git a/net/pkt/pkt_conn.c b/net/pkt/pkt_conn.c index 701b69bbc39..ffa67a37e67 100644 --- a/net/pkt/pkt_conn.c +++ b/net/pkt/pkt_conn.c @@ -152,9 +152,7 @@ FAR struct pkt_conn_s *pkt_alloc(void) { FAR struct pkt_conn_s *conn; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by a semaphore (that behaves like a mutex). */ _pkt_semtake(&g_free_sem); conn = (FAR struct pkt_conn_s *)dq_remfirst(&g_free_pkt_connections); @@ -184,9 +182,7 @@ FAR struct pkt_conn_s *pkt_alloc(void) void pkt_free(FAR struct pkt_conn_s *conn) { - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by a semaphore (that behaves like a mutex). */ DEBUGASSERT(conn->crefs == 0); diff --git a/net/pkt/pkt_send.c b/net/pkt/pkt_send.c index 0f31d15e533..cd0ec8e7253 100644 --- a/net/pkt/pkt_send.c +++ b/net/pkt/pkt_send.c @@ -67,7 +67,7 @@ ****************************************************************************/ /* This structure holds the state of the send operation until it can be - * operated upon from the interrupt level. + * operated upon by the event handler. */ struct send_s @@ -99,9 +99,9 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev, if (pstate) { /* 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) @@ -197,9 +197,8 @@ ssize_t psock_pkt_send(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(); @@ -235,15 +234,13 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf, netdev_txnotify_dev(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.snd_sem); - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ pkt_callback_free(dev, conn, state.snd_cb); } diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c index 92706a98c89..94bf97aeb43 100644 --- a/net/sixlowpan/sixlowpan_send.c +++ b/net/sixlowpan/sixlowpan_send.c @@ -71,7 +71,7 @@ * Private Types ****************************************************************************/ -/* This is the state data provided to the send interrupt logic. No actions +/* This is the state data provided to the send event handler. No actions * can be taken until the until we receive the TX poll, then we can call * sixlowpan_queue_frames() with this data strurcture. */ @@ -138,11 +138,11 @@ static inline bool send_timeout(FAR struct sixlowpan_send_s *sinfo) * Name: send_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * send operation when polled by the lower, device interfacing layer. * * Input Parameters: - * dev - The structure of the network driver that caused the interrupt + * dev - The structure of the network driver that generated the event. * conn - The connection structure associated with the socket * flags - Set of events describing why the callback was invoked * @@ -251,7 +251,7 @@ end_wait: * * 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 events * ipv6hdr - IPv6 header followed by UDP or ICMPv6 header. * buf - Data to send * len - Length of data to send @@ -316,10 +316,8 @@ int sixlowpan_send(FAR struct net_driver_s *dev, netdev_txnotify_dev(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. */ ninfo("Wait for send complete\n"); @@ -330,9 +328,9 @@ int sixlowpan_send(FAR struct net_driver_s *dev, sinfo.s_result = ret; } - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ - devif_conn_callback_free(dev, sinfo.s_cb, list); + devif_conn_callback_free(dev, sinfo.s_cb, list); } } diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index 66ce10eb357..c7d60d4e931 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -83,7 +83,7 @@ * Private Types ****************************************************************************/ -/* This is the state data provided to the send interrupt logic. No actions +/* This is the state data provided to the send event handler. No actions * can be taken until the until we receive the TX poll, then we can call * sixlowpan_queue_frames() with this data strurcture. */ @@ -325,13 +325,13 @@ static inline bool send_timeout(FAR struct sixlowpan_send_s *sinfo) * Name: tcp_send_eventhandler * * Description: - * This function is called from the interrupt level to perform the actual + * This function is called with the network locked to perform the actual * TCP send operation when polled by the lower, device interfacing layer. * * Input Parameters: - * dev - The structure of the network driver that caused the interrupt + * dev - The structure of the network driver that generated the event. * pvconn - The connection structure associated with the socket - * pvpriv - The interrupt handler's private data argument + * pvpriv - The event handler's private data argument * flags - Set of events describing why the callback was invoked * * Returned Value: @@ -463,7 +463,7 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev, } /* Check if the outgoing packet is available (it may have been claimed - * by a sendto interrupt serving a different thread). + * by a sendto event handler serving a different thread). */ #if 0 /* We can't really support multiple senders on the same TCP socket */ @@ -708,10 +708,8 @@ static int sixlowpan_send_packet(FAR struct socket *psock, netdev_txnotify_dev(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. */ ninfo("Wait for send complete\n"); @@ -722,7 +720,7 @@ static int sixlowpan_send_packet(FAR struct socket *psock, sinfo.s_result = ret; } - /* Make sure that no further interrupts are processed */ + /* Make sure that no further events are processed */ tcp_callback_free(conn, sinfo.s_cb); } diff --git a/net/usrsock/usrsock_conn.c b/net/usrsock/usrsock_conn.c index 665733d36b4..9d1b04c2fbb 100644 --- a/net/usrsock/usrsock_conn.c +++ b/net/usrsock/usrsock_conn.c @@ -121,9 +121,7 @@ FAR struct usrsock_conn_s *usrsock_alloc(void) { FAR struct usrsock_conn_s *conn; - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by a semaphore (that behaves like a mutex). */ _usrsock_semtake(&g_free_sem); conn = (FAR struct usrsock_conn_s *)dq_remfirst(&g_free_usrsock_connections); @@ -158,9 +156,7 @@ FAR struct usrsock_conn_s *usrsock_alloc(void) void usrsock_free(FAR struct usrsock_conn_s *conn) { - /* The free list is only accessed from user, non-interrupt level and - * is protected by a semaphore (that behaves like a mutex). - */ + /* The free list is protected by a semaphore (that behaves like a mutex). */ DEBUGASSERT(conn->crefs == 0);