net/devif: fix devif_poll loop logic
Previously, the devif_poll works in this flow:
devif_poll_xx -> bstop = callback -> continue if !bstop -> poll another
Now we split the polling and callback, so it should work like:
devif_poll_connections -> return true if callback need to be called
-> bstop = callback -> loop if !bstop -> poll again
Conditions:
poll_connections == 0, d_len == 0, break, return 0
poll_connections == 1, d_len == 0, break, return 1 (other stop case,
don't callback)
poll_connections == 1, d_len > 0, callback == 1, break, return 1
poll_connections == 1, d_len > 0, callback == 0, loop
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
parent
991fd3d887
commit
34ade7a0b6
1 changed files with 7 additions and 1 deletions
|
|
@ -964,8 +964,14 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Not stopped by devif_poll_callback, just stop and return bstop */
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (bstop);
|
||||
while (!bstop);
|
||||
|
||||
/* Device polling completed, release iob */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue