mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 02:36:11 +08:00
driver/net: replace net_lock with netdev_lock
modify the code of the adapted protocol stack to avoid deadlocks and the logic that cannot be protected by locks after modification. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
@@ -530,7 +530,7 @@ static void cdcecm_interrupt_work(FAR void *arg)
|
||||
* thread has been configured.
|
||||
*/
|
||||
|
||||
net_lock();
|
||||
netdev_lock(&self->dev);
|
||||
|
||||
/* Check if we received an incoming packet, if so, call cdcecm_receive() */
|
||||
|
||||
@@ -558,7 +558,7 @@ static void cdcecm_interrupt_work(FAR void *arg)
|
||||
cdcecm_txdone(self);
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
netdev_unlock(&self->dev);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -666,7 +666,7 @@ static void cdcecm_txavail_work(FAR void *arg)
|
||||
* thread has been configured.
|
||||
*/
|
||||
|
||||
net_lock();
|
||||
netdev_lock(&self->dev);
|
||||
|
||||
/* Ignore the notification if the interface is not yet up */
|
||||
|
||||
@@ -675,7 +675,7 @@ static void cdcecm_txavail_work(FAR void *arg)
|
||||
devif_poll(&self->dev, cdcecm_txpoll);
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
netdev_unlock(&self->dev);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -1022,7 +1022,7 @@ static void rndis_rxdispatch(FAR void *arg)
|
||||
FAR struct eth_hdr_s *hdr;
|
||||
irqstate_t flags;
|
||||
|
||||
net_lock();
|
||||
netdev_lock(&priv->netdev);
|
||||
flags = enter_critical_section();
|
||||
rndis_giverxreq(priv);
|
||||
priv->netdev.d_len = priv->current_rx_datagram_size;
|
||||
@@ -1099,7 +1099,7 @@ static void rndis_rxdispatch(FAR void *arg)
|
||||
rndis_freenetreq(priv);
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
netdev_unlock(&priv->netdev);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -1192,7 +1192,7 @@ static void rndis_txavail_work(FAR void *arg)
|
||||
{
|
||||
FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)arg;
|
||||
|
||||
net_lock();
|
||||
netdev_lock(&priv->netdev);
|
||||
|
||||
if (rndis_allocnetreq(priv))
|
||||
{
|
||||
@@ -1203,7 +1203,7 @@ static void rndis_txavail_work(FAR void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
netdev_unlock(&priv->netdev);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user