[components][net] 1.网卡可卸载 2.dhcpd 服务可停止

This commit is contained in:
tangyuxin
2019-08-11 11:53:28 +08:00
committed by tyx
parent 532ad16b7b
commit 16304f14a8
9 changed files with 217 additions and 14 deletions
@@ -350,6 +350,37 @@ static void sal_unlock(void)
rt_mutex_release(&sal_core_lock);
}
/**
* 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
*