mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
net: protect the older network cards driver's tx and rx process
Add netdev_lock in xxx_input and txavail to adapt to drivers that do not use upperhalf. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/can.h>
|
||||
#include <nuttx/net/netstats.h>
|
||||
#include <nuttx/net/net.h>
|
||||
|
||||
#include "devif/devif.h"
|
||||
#include "utils/utils.h"
|
||||
@@ -289,6 +290,7 @@ int can_input(FAR struct net_driver_s *dev)
|
||||
#ifdef CONFIG_NET_STATISTICS
|
||||
g_netstats.can.recv++;
|
||||
#endif
|
||||
netdev_lock(dev);
|
||||
|
||||
if (dev->d_iob != NULL)
|
||||
{
|
||||
@@ -301,6 +303,7 @@ int can_input(FAR struct net_driver_s *dev)
|
||||
|
||||
dev->d_buf = buf;
|
||||
|
||||
netdev_unlock(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -312,6 +315,7 @@ int can_input(FAR struct net_driver_s *dev)
|
||||
#endif
|
||||
}
|
||||
|
||||
netdev_unlock(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user