mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
Networking: Fixes another CONFIG_NET_NOINTS issues. When called sem_timedwait() with the network locked, the network stays logcked while we wait which is not what we want (without CONFIG_NET_NOINTS, interrupts are re-enabled while we wait and all is well).
This commit is contained in:
+3
-3
@@ -345,8 +345,8 @@ int arp_wait_cancel(FAR struct arp_notify_s *notify);
|
|||||||
* timeout occurs.
|
* timeout occurs.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function is called from ARP send and executes in the normal
|
* This function is called from ARP send and mut execute with the network
|
||||||
* tasking environment.
|
* un-locked.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ int arp_wait(FAR struct arp_notify_s *notify, FAR struct timespec *timeout);
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function is called from the MAC device driver indirectly through
|
* This function is called from the MAC device driver indirectly through
|
||||||
* arp_arpin() and may be execute from the interrupt level.
|
* arp_arpin() and will execute with the network locked.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ int arp_wait_cancel(FAR struct arp_notify_s *notify)
|
|||||||
* timeout occurs.
|
* timeout occurs.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function is called from ARP send and executes in the normal
|
* This function is called from ARP send must execute with the network
|
||||||
* tasking environment.
|
* un-locked (interrupts may be disabled to keep the things stable).
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ int arp_wait(FAR struct arp_notify_s *notify, FAR struct timespec *timeout)
|
|||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function is called from the MAC device driver indirectly through
|
* This function is called from the MAC device driver indirectly through
|
||||||
* arp_arpin() and may be execute from the interrupt level.
|
* arp_arpin() will execute with the network locked.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -190,6 +190,9 @@ int arp_send(in_addr_t ipaddr)
|
|||||||
struct arp_notify_s notify;
|
struct arp_notify_s notify;
|
||||||
struct timespec delay;
|
struct timespec delay;
|
||||||
struct arp_send_s state;
|
struct arp_send_s state;
|
||||||
|
#ifdef CONFIG_NET_NOINTS
|
||||||
|
irqstate_t flags;
|
||||||
|
#endif
|
||||||
net_lock_t save;
|
net_lock_t save;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -358,12 +361,21 @@ int arp_send(in_addr_t ipaddr)
|
|||||||
|
|
||||||
/* Now wait for response to the ARP response to be received. The
|
/* Now wait for response to the ARP response to be received. The
|
||||||
* optimal delay would be the work case round trip time.
|
* optimal delay would be the work case round trip time.
|
||||||
|
* NOTE: The network is locked.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
delay.tv_sec = CONFIG_ARP_SEND_DELAYSEC;
|
delay.tv_sec = CONFIG_ARP_SEND_DELAYSEC;
|
||||||
delay.tv_nsec = CONFIG_ARP_SEND_DELAYNSEC;
|
delay.tv_nsec = CONFIG_ARP_SEND_DELAYNSEC;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_NOINTS
|
||||||
|
flags = irqsave(); /* Keep things stable */
|
||||||
|
net_unlock(save); /* Unlock the network with interrupts disabled */
|
||||||
|
#endif
|
||||||
ret = arp_wait(¬ify, &delay);
|
ret = arp_wait(¬ify, &delay);
|
||||||
|
#ifdef CONFIG_NET_NOINTS
|
||||||
|
save = net_lock(); /* Re-lock the network with interrupts disabled */
|
||||||
|
irqrestore(flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* arp_wait will return OK if and only if the matching ARP response
|
/* arp_wait will return OK if and only if the matching ARP response
|
||||||
* is received. Otherwise, it will return -ETIMEDOUT.
|
* is received. Otherwise, it will return -ETIMEDOUT.
|
||||||
|
|||||||
Reference in New Issue
Block a user