network: simplify the timeout process logic

1.Consolidate absolute to relative timeout conversion into one place(_net_timedwait)
2.Drive the wait timeout logic by net_timedwait instead of devif_timer
This patch help us remove devif_timer(period tick) to save the power in the future.

Change-Id: I534748a5d767ca6da8a7843c3c2f993ed9ea77d4
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2020-01-04 18:37:46 +08:00
committed by patacongo
parent 346336bb9e
commit 5c5c08efcd
54 changed files with 242 additions and 1207 deletions
+1
View File
@@ -50,6 +50,7 @@
#include <stdint.h>
#include <net/ethernet.h>
#include <nuttx/clock.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
+4 -6
View File
@@ -370,7 +370,7 @@ void net_unlock(void);
*
* Input Parameters:
* sem - A reference to the semaphore to be taken.
* abstime - The absolute time to wait until a timeout is declared.
* timeout - The relative time to wait until a timeout is declared.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
@@ -378,8 +378,7 @@ void net_unlock(void);
*
****************************************************************************/
struct timespec;
int net_timedwait(sem_t *sem, FAR const struct timespec *abstime);
int net_timedwait(sem_t *sem, unsigned int timeout);
/****************************************************************************
* Name: net_lockedwait
@@ -412,7 +411,7 @@ int net_lockedwait(sem_t *sem);
*
* Input Parameters:
* sem - A reference to the semaphore to be taken.
* abstime - The absolute time to wait until a timeout is declared.
* timeout - The relative time to wait until a timeout is declared.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
@@ -420,8 +419,7 @@ int net_lockedwait(sem_t *sem);
*
****************************************************************************/
int net_timedwait_uninterruptible(sem_t *sem,
FAR const struct timespec *abstime);
int net_timedwait_uninterruptible(sem_t *sem, unsigned int timeout);
/****************************************************************************
* Name: net_lockedwait_uninterruptible