summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHanhui <sylixos@gmail.com>2019-09-02 12:35:01 (GMT)
committer Gavin.Bai <gavin_8724@163.com>2019-08-27 06:29:18 (GMT)
commit48608cc9f85a46301056753dc5d25efad58469f1 (patch)
tree733ad37b8a6a4ea014588d9448d37ce3730922ca
parent5cd8dcdcea02fa5a97e22704139ccfac3d070dd7 (diff)
downloadAIC-OS-48608cc9f85a46301056753dc5d25efad58469f1.zip
Fixed thread affinity setting error.
-rw-r--r--SylixOS/kernel/core/_KernelHighLevelInit.c4
-rw-r--r--SylixOS/kernel/core/_ThreadAffinity.c14
-rw-r--r--SylixOS/kernel/include/k_kernel.h2
-rw-r--r--SylixOS/kernel/interface/ThreadAffinity.c40
-rw-r--r--SylixOS/loader/src/loader_vpdebug.c14
-rw-r--r--SylixOS/loader/src/loader_vpthread.c25
-rw-r--r--SylixOS/net/lwip/bonding/netbonding.c158
-rw-r--r--SylixOS/net/lwip/bridge/netbridge.c6
-rw-r--r--SylixOS/system/ioLib/ioLockF.c6
9 files changed, 194 insertions, 75 deletions
diff --git a/SylixOS/kernel/core/_KernelHighLevelInit.c b/SylixOS/kernel/core/_KernelHighLevelInit.c
index 656af00..f11c378 100644
--- a/SylixOS/kernel/core/_KernelHighLevelInit.c
+++ b/SylixOS/kernel/core/_KernelHighLevelInit.c
@@ -83,8 +83,8 @@ static VOID _CreateIdleThread (VOID)
LW_CPU_SET(i, &cpuset); /* 锁定到指定 CPU */
_ThreadSetAffinity(_K_ptcbIdle[i], sizeof(LW_CLASS_CPUSET), &cpuset);
- LW_CPU_CLR(i, &cpuset);
-
+ LW_CPU_CLR(i, &cpuset); /* 绑核操作确保目标线程未就绪 */
+ /* 不需要使用 stop 操作 */
API_ThreadStart(_K_ulIdleId[i]);
}
diff --git a/SylixOS/kernel/core/_ThreadAffinity.c b/SylixOS/kernel/core/_ThreadAffinity.c
index 4b80fbb..7015535 100644
--- a/SylixOS/kernel/core/_ThreadAffinity.c
+++ b/SylixOS/kernel/core/_ThreadAffinity.c
@@ -36,13 +36,13 @@
** 全局变量:
** 调用模块:
** 注 意 : LW_CPU_ZERO(pcpuset) 可以解除 CPU 锁定.
+** 如果是设置其他 ptcb 则外层必须保证目标线程没有就绪或运行.
*********************************************************************************************************/
ULONG _ThreadSetAffinity (PLW_CLASS_TCB ptcb, size_t stSize, const PLW_CLASS_CPUSET pcpuset)
{
INTREG iregInterLevel;
ULONG i;
ULONG ulNumChk;
- ULONG ulError;
PLW_CLASS_TCB ptcbCur;
PLW_CLASS_PCB ppcb;
@@ -85,11 +85,6 @@ ULONG _ThreadSetAffinity (PLW_CLASS_TCB ptcb, size_t stSize, const PLW_CLASS_
}
} else {
- ulError = _ThreadStop(ptcb);
- if (ulError) {
- return (ulError);
- }
-
if (i >= ulNumChk) {
ptcb->TCB_bCPULock = LW_FALSE; /* 关闭 CPU 锁定 */
@@ -97,8 +92,6 @@ ULONG _ThreadSetAffinity (PLW_CLASS_TCB ptcb, size_t stSize, const PLW_CLASS_
ptcb->TCB_ulCPULock = i;
ptcb->TCB_bCPULock = LW_TRUE; /* 锁定执行 CPU */
}
-
- _ThreadContinue(ptcb, LW_FALSE); /* 唤醒目标 */
}
return (ERROR_NONE);
@@ -115,11 +108,10 @@ ULONG _ThreadSetAffinity (PLW_CLASS_TCB ptcb, size_t stSize, const PLW_CLASS_
*********************************************************************************************************/
VOID _ThreadGetAffinity (PLW_CLASS_TCB ptcb, size_t stSize, PLW_CLASS_CPUSET pcpuset)
{
+ lib_bzero(pcpuset, stSize); /* 没有亲和度设置 */
+
if (ptcb->TCB_bCPULock) {
LW_CPU_SET(ptcb->TCB_ulCPULock, pcpuset);
-
- } else {
- lib_bzero(pcpuset, stSize); /* 没有亲和度设置 */
}
}
/*********************************************************************************************************
diff --git a/SylixOS/kernel/include/k_kernel.h b/SylixOS/kernel/include/k_kernel.h
index 846c71f..b16a6f6 100644
--- a/SylixOS/kernel/include/k_kernel.h
+++ b/SylixOS/kernel/include/k_kernel.h
@@ -51,7 +51,7 @@
#define __SYLIXOS_MAJOR_VER 1
#define __SYLIXOS_MINOR_VER 10
-#define __SYLIXOS_PATCH_VER 6
+#define __SYLIXOS_PATCH_VER 7
#define __SYLIXOS_PATCH_PAD 0
/*********************************************************************************************************
diff --git a/SylixOS/kernel/interface/ThreadAffinity.c b/SylixOS/kernel/interface/ThreadAffinity.c
index 4088f9b..f985818 100644
--- a/SylixOS/kernel/interface/ThreadAffinity.c
+++ b/SylixOS/kernel/interface/ThreadAffinity.c
@@ -43,7 +43,7 @@ ULONG API_ThreadSetAffinity (LW_OBJECT_HANDLE ulId, size_t stSize, const PLW_
REGISTER UINT16 usIndex;
REGISTER PLW_CLASS_TCB ptcb;
PLW_CLASS_TCB ptcbCur;
- ULONG ulMaxLock;
+ ULONG ulError;
usIndex = _ObjectGetIndex(ulId);
@@ -82,14 +82,40 @@ ULONG API_ThreadSetAffinity (LW_OBJECT_HANDLE ulId, size_t stSize, const PLW_
}
LW_TCB_GET_CUR(ptcbCur);
- ulMaxLock = (ptcb == ptcbCur) ? 1 : 0;
- if (__THREAD_LOCK_GET(ptcb) > ulMaxLock) { /* 任务被锁定 */
+ if (ptcb == ptcbCur) {
+ if (__THREAD_LOCK_GET(ptcb) > 1) { /* 任务被锁定 */
+ __KERNEL_EXIT(); /* 退出内核 */
+ _ErrorHandle(EBUSY);
+ return (EBUSY);
+ }
+ _ThreadSetAffinity(ptcb, stSize, pcpuset); /* 设置 */
+
+ } else {
+ if (__THREAD_LOCK_GET(ptcb)) { /* 任务被锁定 */
+ __KERNEL_EXIT(); /* 退出内核 */
+ _ErrorHandle(EBUSY);
+ return (EBUSY);
+ }
+
+ ulError = _ThreadStop(ptcb);
__KERNEL_EXIT(); /* 退出内核 */
- _ErrorHandle(EBUSY);
- return (EBUSY);
+ if (ulError) {
+ return (ulError);
+ }
+
+#if LW_CFG_SMP_EN > 0
+ if (ptcbCur->TCB_uiStatusChangeReq) {
+ ptcbCur->TCB_uiStatusChangeReq = 0;
+ _ErrorHandle(ERROR_THREAD_NULL);
+ return (ERROR_THREAD_NULL);
+ }
+#endif /* LW_CFG_SMP_EN */
+
+ __KERNEL_ENTER(); /* 进入内核 */
+ _ThreadSetAffinity(ptcb, stSize, pcpuset); /* 设置 */
+ _ThreadContinue(ptcb, LW_FALSE); /* 唤醒目标 */
}
-
- _ThreadSetAffinity(ptcb, stSize, pcpuset); /* 设置 */
+
__KERNEL_EXIT(); /* 退出内核 */
return (ERROR_NONE);
diff --git a/SylixOS/loader/src/loader_vpdebug.c b/SylixOS/loader/src/loader_vpdebug.c
index 12489a3..443cf3a 100644
--- a/SylixOS/loader/src/loader_vpdebug.c
+++ b/SylixOS/loader/src/loader_vpdebug.c
@@ -92,9 +92,6 @@ VOID vprocDebugStop (PVOID pvVProc, PLW_CLASS_TCB ptcbExcp)
plineTemp = _list_line_get_next(plineTemp)) {
ptcb = _LIST_ENTRY(plineTemp, LW_CLASS_TCB, TCB_lineProcess);
- if (ptcb->TCB_iDeleteProcStatus) {
- continue; /* 已经在删除过程中 */
- }
if (ptcb == ptcbExcp) {
continue; /* 不停止此任务 */
}
@@ -132,15 +129,14 @@ VOID vprocDebugContinue (PVOID pvVProc, PLW_CLASS_TCB ptcbExcp)
plineTemp = _list_line_get_next(plineTemp)) {
ptcb = _LIST_ENTRY(plineTemp, LW_CLASS_TCB, TCB_lineProcess);
- if (ptcb->TCB_iDeleteProcStatus) {
- continue; /* 已经在删除过程中 */
- }
if (ptcb == ptcbExcp) {
continue; /* 不启动此任务 */
}
- __KERNEL_ENTER(); /* 进入内核 */
- _ThreadContinue(ptcb, LW_FALSE);
- __KERNEL_EXIT(); /* 退出内核 */
+ if (ptcb->TCB_iDeleteProcStatus == LW_TCB_DELETE_PROC_NONE) {
+ __KERNEL_ENTER(); /* 进入内核 */
+ _ThreadContinue(ptcb, LW_FALSE);
+ __KERNEL_EXIT(); /* 退出内核 */
+ }
}
LW_VP_UNLOCK(pvproc); /* 解锁当前进程 */
}
diff --git a/SylixOS/loader/src/loader_vpthread.c b/SylixOS/loader/src/loader_vpthread.c
index 4ae0b61..0d49f51 100644
--- a/SylixOS/loader/src/loader_vpthread.c
+++ b/SylixOS/loader/src/loader_vpthread.c
@@ -248,29 +248,40 @@ INT vprocThreadAffinity (PVOID pvVProc, size_t stSize, const PLW_CLASS_CPUSET
{
LW_LD_VPROC *pvproc = (LW_LD_VPROC *)pvVProc;
PLW_LIST_LINE plineTemp;
- PLW_CLASS_TCB ptcb;
+ PLW_CLASS_TCB ptcb, ptcbCur;
if (!pvproc) {
_ErrorHandle(ESRCH);
return (PX_ERROR);
}
+ LW_TCB_GET_CUR_SAFE(ptcbCur);
+
LW_VP_LOCK(pvproc); /* 锁定当前进程 */
for (plineTemp = pvproc->VP_plineThread;
plineTemp != LW_NULL;
plineTemp = _list_line_get_next(plineTemp)) {
ptcb = _LIST_ENTRY(plineTemp, LW_CLASS_TCB, TCB_lineProcess);
- if (ptcb->TCB_iDeleteProcStatus) {
- continue; /* 已经在删除过程中 */
- }
if (__THREAD_LOCK_GET(ptcb)) { /* 外部没有锁定此任务 */
continue; /* 线程被锁定 */
}
- __KERNEL_ENTER(); /* 进入内核 */
- _ThreadSetAffinity(ptcb, stSize, pcpuset);
- __KERNEL_EXIT(); /* 退出内核 */
+ if (ptcb == ptcbCur) {
+ __KERNEL_ENTER(); /* 进入内核 */
+ _ThreadSetAffinity(ptcb, stSize, pcpuset);
+ __KERNEL_EXIT(); /* 退出内核 */
+
+ } else if (ptcb->TCB_iDeleteProcStatus == LW_TCB_DELETE_PROC_NONE) {
+ __KERNEL_ENTER(); /* 进入内核 */
+ _ThreadStop(ptcb);
+ __KERNEL_EXIT(); /* 退出内核 (可能产生调度) */
+
+ __KERNEL_ENTER(); /* 进入内核 */
+ _ThreadSetAffinity(ptcb, stSize, pcpuset);
+ _ThreadContinue(ptcb, LW_FALSE);
+ __KERNEL_EXIT(); /* 退出内核 */
+ }
}
LW_VP_UNLOCK(pvproc); /* 解锁当前进程 */
diff --git a/SylixOS/net/lwip/bonding/netbonding.c b/SylixOS/net/lwip/bonding/netbonding.c
index 84175cd..6903f12 100644
--- a/SylixOS/net/lwip/bonding/netbonding.c
+++ b/SylixOS/net/lwip/bonding/netbonding.c
@@ -106,6 +106,7 @@ typedef struct netbd {
sys_mutex_t lock; /* net bonding lock */
netdev_t netdev_bd; /* net bonding net device */
netbd_eth_t *master; /* master device */
+ netbd_eth_t *working; /* current device */
LW_LIST_RING_HEADER eth_ring; /* sub ethernet device ring */
LW_LIST_LINE_HEADER arp_list; /* arp detect list */
@@ -124,6 +125,34 @@ static sys_mutex_t netdb_list_lock;
#define NETBD_LIST_LOCK() sys_mutex_lock(&netdb_list_lock)
#define NETBD_LIST_UNLOCK() sys_mutex_unlock(&netdb_list_lock)
+/* net bonding select device */
+static void netbd_select_working (netbd_t *netbd)
+{
+ int i, ok = 0;
+ netbd_eth_t *netbd_eth;
+
+ if (netbd->master) {
+ netbd_eth = netbd->master; /* first check master device */
+ if (netbd_eth->alive && (netbd_eth->netdev->if_flags & IFF_RUNNING)) { /* is alive and linkup ? */
+ netbd->working = netbd_eth;
+ ok = 1;
+ }
+ }
+
+ if (!ok) {
+ for (i = 0; i < netbd->eth_cnt; i++) {
+ netbd_eth = (netbd_eth_t *)netbd->eth_ring;
+ if (netbd->master != netbd_eth) { /* not master */
+ if (netbd_eth->alive && (netbd_eth->netdev->if_flags & IFF_RUNNING)) { /* is alive and linkup ? */
+ netbd->working = netbd_eth;
+ break;
+ }
+ }
+ netbd->eth_ring = _list_ring_get_next(&netbd_eth->ring); /* next sub net device (Rotation) */
+ }
+ }
+}
+
/* net bonding traffic detect */
static void netbd_traffic_detect (netbd_t *netbd)
{
@@ -135,8 +164,12 @@ static void netbd_traffic_detect (netbd_t *netbd)
for (i = 0; i < netbd->eth_cnt; i++) {
if (netbd_eth->alive > NETBONDING_POLL_INTERVAL) {
netbd_eth->alive -= NETBONDING_POLL_INTERVAL;
- } else {
+
+ } else if (netbd_eth->alive) {
netbd_eth->alive = 0; /* dead! not use this device transmit */
+ if (netbd->working == netbd_eth) {
+ netbd_select_working(netbd);
+ }
}
netbd_eth = (netbd_eth_t *)_list_ring_get_next(&netbd_eth->ring);
}
@@ -158,8 +191,27 @@ static void netbd_arp_detect (netbd_t *netbd)
return;
}
- netbd_traffic_detect(netbd); /* process time alive */
-
+ NETBD_LOCK(netbd);
+ netbd_eth = (netbd_eth_t *)netbd->eth_ring;
+ for (i = 0; i < netbd->eth_cnt; i++) {
+ if (netbd->working == netbd_eth) {
+ if (netbd_eth->alive > NETBONDING_POLL_INTERVAL) {
+ netbd_eth->alive -= NETBONDING_POLL_INTERVAL;
+ } else {
+ netbd_eth->alive = 0; /* dead! not use this device transmit */
+ }
+
+ } else {
+ if (netbd_eth->netdev->if_flags & IFF_RUNNING) {
+ netbd_eth->alive = netbd->alive; /* not current, if linkup we think it is a valid */
+ } else {
+ netbd_eth->alive = 0;
+ }
+ }
+ netbd_eth = (netbd_eth_t *)_list_ring_get_next(&netbd_eth->ring);
+ }
+ NETBD_UNLOCK(netbd);
+
if (netbd->timer > NETBONDING_POLL_INTERVAL) {
netbd->timer -= NETBONDING_POLL_INTERVAL;
@@ -172,17 +224,17 @@ static void netbd_arp_detect (netbd_t *netbd)
NETBD_LOCK(netbd);
netdbif = (struct netif *)(netbd->netdev_bd.sys);
MEMCPY(&macsrc.addr, netdbif->hwaddr, ETH_ALEN);
+
+ if (!netbd->working->alive || !(netbd->working->netdev->if_flags & IFF_RUNNING)) {
+ netbd_select_working(netbd);
+ }
- for (pline = netbd->arp_list; pline != NULL; pline = _list_line_get_next(pline)) {
- netbd_arp = (netbd_arp_t *)pline;
- netbd_eth = (netbd_eth_t *)netbd->eth_ring;
- for (i = 0; i < netbd->eth_cnt; i++) {
- if (netbd_eth->netdev->if_flags & IFF_RUNNING) { /* is linkup ? */
- sendif = (struct netif *)(netbd_eth->netdev->sys);
- etharp_raw(sendif, &macsrc, &ethbroadcast, &macsrc, netif_ip4_addr(netdbif),
- &ethzero, &netbd_arp->ipaddr, ARP_REQUEST); /* send ARP request */
- }
- netbd_eth = (netbd_eth_t *)_list_ring_get_next(&netbd_eth->ring);
+ if (netbd->working->netdev->if_flags & IFF_RUNNING) {
+ for (pline = netbd->arp_list; pline != NULL; pline = _list_line_get_next(pline)) {
+ netbd_arp = (netbd_arp_t *)pline;
+ sendif = (struct netif *)(netbd->working->netdev->sys);
+ etharp_raw(sendif, &macsrc, &ethbroadcast, &macsrc, netif_ip4_addr(netdbif),
+ &ethzero, &netbd_arp->ipaddr, ARP_REQUEST); /* send ARP request */
}
}
NETBD_UNLOCK(netbd);
@@ -214,6 +266,9 @@ static void netbd_arp_process (netbd_t *netbd, netbd_eth_t *netbd_eth, struct et
for (pline = netbd->arp_list; pline != NULL; pline = _list_line_get_next(pline)) {
netbd_arp = (netbd_arp_t *)pline;
if (ip4_addr_cmp(&netbd_arp->ipaddr, &srcip)) {
+ if (!netbd->working->alive) {
+ netbd->working = netbd_eth; /* use this net device as working */
+ }
netbd_eth->alive = netbd->alive; /* refresh time alive counter */
break;
}
@@ -230,6 +285,12 @@ static int netbd_transmit (struct netdev *netdev, struct pbuf *p)
netbd_eth_t *netbd_eth;
struct ethhdr *eh = (struct ethhdr *)p->payload;
+ if (!netbd->eth_cnt) { /* no sub device */
+ netdev_linkinfo_err_inc(netdev);
+ netdev_statinfo_errors_inc(netdev, LINK_OUTPUT);
+ return (-1);
+ }
+
NETBD_LOCK(netbd);
if (netbd->mode == NETBD_MODE_BALANCE_RR) { /* 'balance-rr' */
for (i = 0; i < netbd->eth_cnt; i++) {
@@ -243,26 +304,34 @@ static int netbd_transmit (struct netdev *netdev, struct pbuf *p)
}
} else if (netbd->mode == NETBD_MODE_ACTIVE_BACKUP) { /* 'active-backup' */
- if (netbd->master) {
- netbd_eth = netbd->master; /* first check master device */
- if (netbd_eth->alive && (netbd_eth->netdev->if_flags & IFF_RUNNING)) { /* is alive and linkup ? */
- netbd_eth->netdev->drv->transmit(netbd_eth->netdev, p); /* transmit */
- ok = 1;
+ if (!netbd->working->alive || !(netbd->working->netdev->if_flags & IFF_RUNNING)) { /* working dead ? */
+ if (netbd->master) {
+ netbd_eth = netbd->master; /* first check master device */
+ if (netbd_eth->alive && (netbd_eth->netdev->if_flags & IFF_RUNNING)) { /* is alive and linkup ? */
+ netbd->working = netbd_eth;
+ netbd_eth->netdev->drv->transmit(netbd_eth->netdev, p); /* transmit */
+ ok = 1;
+ }
}
- }
-
- if (!ok) {
- for (i = 0; i < netbd->eth_cnt; i++) {
- netbd_eth = (netbd_eth_t *)netbd->eth_ring;
- if (netbd->master != netbd_eth) { /* not master */
- if (netbd_eth->alive && (netbd_eth->netdev->if_flags & IFF_RUNNING)) { /* is alive and linkup ? */
- netbd_eth->netdev->drv->transmit(netbd_eth->netdev, p); /* transmit */
- ok = 1;
- break;
+
+ if (!ok) {
+ for (i = 0; i < netbd->eth_cnt; i++) {
+ netbd_eth = (netbd_eth_t *)netbd->eth_ring;
+ if (netbd->master != netbd_eth) { /* not master */
+ if (netbd_eth->alive && (netbd_eth->netdev->if_flags & IFF_RUNNING)) { /* is alive and linkup ? */
+ netbd->working = netbd_eth;
+ netbd_eth->netdev->drv->transmit(netbd_eth->netdev, p); /* transmit */
+ ok = 1;
+ break;
+ }
}
+ netbd->eth_ring = _list_ring_get_next(&netbd_eth->ring); /* next sub net device (Rotation) */
}
- netbd->eth_ring = _list_ring_get_next(&netbd_eth->ring); /* next sub net device (Rotation) */
}
+
+ } else { /* use working transmit */
+ netbd->working->netdev->drv->transmit(netbd->working->netdev, p); /* transmit */
+ ok = 1;
}
} else { /* broadcast */
@@ -389,6 +458,9 @@ to_bd:
if (netbd->mode == NETBD_MODE_ACTIVE_BACKUP) { /* active backup */
if (netbd->mon_mode == NETBD_MON_MODE_TRAFFIC) {
+ if (!netbd->working->alive) {
+ netbd->working = netbd_eth; /* use this net device as working */
+ }
netbd_eth->alive = netbd->alive; /* refresh time alive counter */
} else { /* NETBD_MON_MODE_ARP */
@@ -416,6 +488,13 @@ to_bd:
}
input: /* TODO: this function may be parallelization, and statistical variables should be locked */
+ if (netbd->mode == NETBD_MODE_ACTIVE_BACKUP) {
+ if (netbd->working != netbd_eth) {
+ pbuf_free(p);
+ return (ERR_OK); /* not working net device */
+ }
+ }
+
if (netif_bd->input(p, netif_bd)) { /* send to our tcpip stack */
netdev_linkinfo_drop_inc(netdev_bd);
netdev_statinfo_discards_inc(netdev_bd, LINK_INPUT);
@@ -547,6 +626,8 @@ int netbd_add_dev (const char *bddev, int bdindex, const char *sub, int sub_is_
MEMCPY(netdev_bd->hwaddr, netdev->hwaddr, ETH_ALEN); /* use first port mac address */
MEMCPY(netif_bd->hwaddr, netdev->hwaddr, ETH_ALEN);
+
+ netbd->working = netbd_eth; /* first working net device */
}
MEMCPY(netbd_eth->old_hwaddr, netdev->hwaddr, ETH_ALEN); /* save old hwaddr */
@@ -705,6 +786,9 @@ int netbd_delete_dev (const char *bddev, int bdindex, const char *sub, int sub_
}
}
+ netif->input = netbd_eth->input; /* restore old input function */
+ netif->ext_ctl = netif->ext_eth = NULL;
+
NETBD_LOCK(netbd);
if (netbd->master == netbd_eth) {
netbd->master = NULL;
@@ -712,11 +796,15 @@ int netbd_delete_dev (const char *bddev, int bdindex, const char *sub, int sub_
netif->vlanid = netbd_eth->old_vlanid;
_List_Ring_Del(&netbd_eth->ring, &netbd->eth_ring);
netbd->eth_cnt--;
+ if (netbd->working == netbd_eth) {
+ if (netbd->eth_cnt) {
+ netbd_select_working(netbd);
+ } else {
+ netbd->working = NULL;
+ }
+ }
NETBD_UNLOCK(netbd);
- netif->input = netbd_eth->input; /* restore old input function */
- netif->ext_ctl = netif->ext_eth = NULL;
-
mem_free(netbd_eth);
if (!(netdev->init_flags & NETDEV_INIT_TIGHT)) {
@@ -1280,6 +1368,12 @@ int netbd_show_dev (const char *bddev, int bdindex, int fd)
fdprintf(fd, "Moniting : %s\n", (netbd->mon_mode == NETBD_MON_MODE_TRAFFIC) ? "Traffic" : "ARP Detect");
fdprintf(fd, "Timeout : %d (milliseconds)\n", netbd->alive);
+ if (netbd->working) {
+ netdev = netbd->working->netdev;
+ netif = (struct netif *)netdev->sys;
+ fdprintf(fd, "Working : Dev: %s Prev-Ifname: %s\n", netdev->dev_name, netif_get_name(netif, ifname));
+ }
+
if (netbd->mon_mode == NETBD_MON_MODE_ARP) {
fdprintf(fd, "ARP Interval: %d (milliseconds)\n", netbd->interval);
fdprintf(fd, "\nNet bonding ARP target list >>\n\n");
diff --git a/SylixOS/net/lwip/bridge/netbridge.c b/SylixOS/net/lwip/bridge/netbridge.c
index 5420675..3bbc1db 100644
--- a/SylixOS/net/lwip/bridge/netbridge.c
+++ b/SylixOS/net/lwip/bridge/netbridge.c
@@ -555,13 +555,13 @@ int netbr_delete_dev (const char *brdev, int brindex, const char *sub, int sub_
}
}
+ netif->input = netbr_eth->input; /* restore old input function */
+ netif->ext_ctl = netif->ext_eth = NULL;
+
NETBR_LOCK(netbr);
_List_Line_Del(&netbr_eth->list, &netbr->eth_list);
NETBR_UNLOCK(netbr);
- netif->input = netbr_eth->input; /* restore old input function */
- netif->ext_ctl = netif->ext_eth = NULL;
-
mem_free(netbr_eth);
if (!(netdev->init_flags & NETDEV_INIT_TIGHT)) {
diff --git a/SylixOS/system/ioLib/ioLockF.c b/SylixOS/system/ioLib/ioLockF.c
index b434068..aeb8c53 100644
--- a/SylixOS/system/ioLib/ioLockF.c
+++ b/SylixOS/system/ioLib/ioLockF.c
@@ -1156,7 +1156,7 @@ INT _FdLockfIoctl (PLW_FD_ENTRY pfdentry, INT iCmd, struct flock *pfl)
}
pfdnode = (PLW_FD_NODE)pfdentry->FDENTRY_lValue;
- if (pfdnode == LW_NULL) {
+ if ((pfdnode == LW_NULL) || (pfdnode == (PLW_FD_NODE)PX_ERROR)) {
_ErrorHandle(ERROR_IOS_DRIVER_NOT_SUP);
return (PX_ERROR);
}
@@ -1216,7 +1216,7 @@ INT _FdLockfProc (PLW_FD_ENTRY pfdentry, INT iType, pid_t pid)
}
pfdnode = (PLW_FD_NODE)pfdentry->FDENTRY_lValue;
- if (pfdnode == LW_NULL) {
+ if ((pfdnode == LW_NULL) || (pfdnode == (PLW_FD_NODE)PX_ERROR)) {
_ErrorHandle(ERROR_IOS_DRIVER_NOT_SUP);
return (PX_ERROR);
}
@@ -1286,7 +1286,7 @@ INT _FdLockfClearFdEntry (PLW_FD_ENTRY pfdentry, pid_t pid)
}
pfdnode = (PLW_FD_NODE)pfdentry->FDENTRY_lValue;
- if (pfdnode == LW_NULL) {
+ if ((pfdnode == LW_NULL) || (pfdnode == (PLW_FD_NODE)PX_ERROR)) {
_ErrorHandle(ERROR_IOS_DRIVER_NOT_SUP);
return (PX_ERROR);
}