【修复】部分设备网卡设置 down/up 时导致 check_link 线程重复创建问题
Signed-off-by: chenyong <1521761801@qq.com>
This commit is contained in:
parent
ce5bfc9d6c
commit
d8f2d02f22
|
@ -436,11 +436,14 @@ static int ec20_netdev_check_link_status(struct netdev *netdev)
|
||||||
#define EC20_LINK_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX - 2)
|
#define EC20_LINK_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX - 2)
|
||||||
|
|
||||||
rt_thread_t tid;
|
rt_thread_t tid;
|
||||||
|
char tname[RT_NAME_MAX] = {0};
|
||||||
|
|
||||||
RT_ASSERT(netdev);
|
RT_ASSERT(netdev);
|
||||||
|
|
||||||
|
rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name);
|
||||||
|
|
||||||
/* create ec20 link status polling thread */
|
/* create ec20 link status polling thread */
|
||||||
tid = rt_thread_create("ec20_link", ec20_check_link_status_entry, (void *)netdev,
|
tid = rt_thread_create(tname, ec20_check_link_status_entry, (void *)netdev,
|
||||||
EC20_LINK_THREAD_STACK_SIZE, EC20_LINK_THREAD_PRIORITY, EC20_LINK_THREAD_TICK);
|
EC20_LINK_THREAD_STACK_SIZE, EC20_LINK_THREAD_PRIORITY, EC20_LINK_THREAD_TICK);
|
||||||
if (tid != RT_NULL)
|
if (tid != RT_NULL)
|
||||||
{
|
{
|
||||||
|
@ -886,7 +889,11 @@ static void ec20_init_thread_entry(void *parameter)
|
||||||
{
|
{
|
||||||
/* set network interface device status and address information */
|
/* set network interface device status and address information */
|
||||||
ec20_netdev_set_info(device->netdev);
|
ec20_netdev_set_info(device->netdev);
|
||||||
|
/* check and create link staus sync thread */
|
||||||
|
if (rt_thread_find(device->netdev->name) == RT_NULL)
|
||||||
|
{
|
||||||
ec20_netdev_check_link_status(device->netdev);
|
ec20_netdev_check_link_status(device->netdev);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_I("%s device network initialize success.", device->name);
|
LOG_I("%s device network initialize success.", device->name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ static int m26_netdev_check_link_status(struct netdev *netdev)
|
||||||
|
|
||||||
RT_ASSERT(netdev);
|
RT_ASSERT(netdev);
|
||||||
|
|
||||||
rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name);
|
rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name);
|
||||||
|
|
||||||
tid = rt_thread_create(tname, check_link_status_entry, (void *)netdev,
|
tid = rt_thread_create(tname, check_link_status_entry, (void *)netdev,
|
||||||
M26_LINK_THREAD_STACK_SIZE, M26_LINK_THREAD_PRIORITY, M26_LINK_THREAD_TICK);
|
M26_LINK_THREAD_STACK_SIZE, M26_LINK_THREAD_PRIORITY, M26_LINK_THREAD_TICK);
|
||||||
|
@ -707,7 +707,11 @@ static void m26_init_thread_entry(void *parameter)
|
||||||
if (result == RT_EOK)
|
if (result == RT_EOK)
|
||||||
{
|
{
|
||||||
m26_netdev_set_info(device->netdev);
|
m26_netdev_set_info(device->netdev);
|
||||||
|
/* check and create link staus sync thread */
|
||||||
|
if (rt_thread_find(device->netdev->name) == RT_NULL)
|
||||||
|
{
|
||||||
m26_netdev_check_link_status(device->netdev);
|
m26_netdev_check_link_status(device->netdev);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_I("%s device network initialize success.", device->name);
|
LOG_I("%s device network initialize success.", device->name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ static int sim76xx_netdev_check_link_status(struct netdev *netdev)
|
||||||
|
|
||||||
RT_ASSERT(netdev);
|
RT_ASSERT(netdev);
|
||||||
|
|
||||||
rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name);
|
rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name);
|
||||||
|
|
||||||
tid = rt_thread_create(tname, check_link_status_entry, (void *)netdev,
|
tid = rt_thread_create(tname, check_link_status_entry, (void *)netdev,
|
||||||
SIM76XX_LINK_THREAD_STACK_SIZE, SIM76XX_LINK_THREAD_PRIORITY, SIM76XX_LINK_THREAD_TICK);
|
SIM76XX_LINK_THREAD_STACK_SIZE, SIM76XX_LINK_THREAD_PRIORITY, SIM76XX_LINK_THREAD_TICK);
|
||||||
|
@ -704,7 +704,11 @@ static void sim76xx_init_thread_entry(void *parameter)
|
||||||
{
|
{
|
||||||
/* set network interface device status and address information */
|
/* set network interface device status and address information */
|
||||||
sim76xx_netdev_set_info(device->netdev);
|
sim76xx_netdev_set_info(device->netdev);
|
||||||
|
/* check and create link staus sync thread */
|
||||||
|
if (rt_thread_find(device->netdev->name) == RT_NULL)
|
||||||
|
{
|
||||||
sim76xx_netdev_check_link_status(device->netdev);
|
sim76xx_netdev_check_link_status(device->netdev);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_I("%s device network initialize success!", device->name);
|
LOG_I("%s device network initialize success!", device->name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ static int sim800c_netdev_check_link_status(struct netdev *netdev)
|
||||||
|
|
||||||
RT_ASSERT(netdev);
|
RT_ASSERT(netdev);
|
||||||
|
|
||||||
rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name);
|
rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name);
|
||||||
|
|
||||||
tid = rt_thread_create(tname, check_link_status_entry, (void *) netdev,
|
tid = rt_thread_create(tname, check_link_status_entry, (void *) netdev,
|
||||||
SIM800C_LINK_THREAD_STACK_SIZE, SIM800C_LINK_THREAD_PRIORITY, SIM800C_LINK_THREAD_TICK);
|
SIM800C_LINK_THREAD_STACK_SIZE, SIM800C_LINK_THREAD_PRIORITY, SIM800C_LINK_THREAD_TICK);
|
||||||
|
@ -796,7 +796,11 @@ static void sim800c_init_thread_entry(void *parameter)
|
||||||
{
|
{
|
||||||
/* set network interface device status and address information */
|
/* set network interface device status and address information */
|
||||||
sim800c_netdev_set_info(device->netdev);
|
sim800c_netdev_set_info(device->netdev);
|
||||||
|
/* check and create link staus sync thread */
|
||||||
|
if (rt_thread_find(device->netdev->name) == RT_NULL)
|
||||||
|
{
|
||||||
sim800c_netdev_check_link_status(device->netdev);
|
sim800c_netdev_check_link_status(device->netdev);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_I("%s device network initialize success!", device->name);
|
LOG_I("%s device network initialize success!", device->name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue