diff options
| author | Bernard Xiong <[email protected]> | 2019-08-11 14:33:47 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-08-11 14:33:47 +0800 |
| commit | b86333f5a2c8cf2653e48d1178b8664886cfbbff (patch) | |
| tree | 243245c48e6da57252e690125160c5c56b2967e3 /components/net/sal_socket | |
| parent | 882ba628bc0b43eb5ad1414180c3c4029d3f508b (diff) | |
| parent | 16304f14a804d6862b3bc69063428a40e119ff7d (diff) | |
Merge pull request #2936 from enkiller/net
[components][net] 1.网卡可卸载 2.dhcpd 服务可停止
Diffstat (limited to 'components/net/sal_socket')
| -rw-r--r-- | components/net/sal_socket/src/sal_socket.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/components/net/sal_socket/src/sal_socket.c b/components/net/sal_socket/src/sal_socket.c index be7c1984a1..44442d306f 100644 --- a/components/net/sal_socket/src/sal_socket.c +++ b/components/net/sal_socket/src/sal_socket.c @@ -351,6 +351,37 @@ static void sal_unlock(void) } /** + * This function will clean the netdev. + * + * @note please don't invoke it on ISR. + */ +int sal_netdev_cleanup(struct netdev *netdev) +{ + int idx = 0, find_dev; + + do + { + find_dev = 0; + sal_lock(); + for (idx = 0; idx < socket_table.max_socket; idx++) + { + if (socket_table.sockets[idx] && socket_table.sockets[idx]->netdev == netdev) + { + find_dev = 1; + break; + } + } + sal_unlock(); + if (find_dev) + { + rt_thread_mdelay(rt_tick_from_millisecond(100)); + } + } while (find_dev); + + return 0; +} + +/** * This function will initialize sal socket object and set socket options * * @param family protocol family |
