mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
net/: More fixes to wrong comments from old change from the interrupt driven network to the work-queue driven network.
This commit is contained in:
@@ -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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
+7
-12
@@ -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
|
||||
|
||||
+2
-3
@@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
|
||||
@@ -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'.
|
||||
|
||||
@@ -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'.
|
||||
|
||||
@@ -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) */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user