summaryrefslogtreecommitdiff
path: root/components/net/sal_socket/src
diff options
context:
space:
mode:
authortangyuxin <[email protected]>2019-08-09 14:23:31 +0800
committertyx <[email protected]>2019-08-11 11:53:28 +0800
commit16304f14a804d6862b3bc69063428a40e119ff7d (patch)
tree63823d404cb9d355dc87fc922f4babc6bf55d9eb /components/net/sal_socket/src
parent532ad16b7bd5ba5201f42d26da80121a6ccd0d89 (diff)
[components][net] 1.网卡可卸载 2.dhcpd 服务可停止
Diffstat (limited to 'components/net/sal_socket/src')
-rw-r--r--components/net/sal_socket/src/sal_socket.c31
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