mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
net: use netdev_lock to protect netdev_txnotify_dev
since the type of sconn lock is rmutex, there is no need to release sconn lock before TX Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
@@ -376,8 +376,6 @@ int psock_tcp_connect(FAR struct socket *psock,
|
||||
info.tc_conn = conn;
|
||||
info.tc_cb = &state.tc_cb;
|
||||
info.tc_sem = &state.tc_sem;
|
||||
conn_dev_unlock(&conn->sconn, conn->dev);
|
||||
tls_cleanup_push(tls_get_info(), tcp_callback_cleanup, &info);
|
||||
|
||||
/* Notify the device driver that new connection is available. */
|
||||
|
||||
@@ -389,6 +387,8 @@ int psock_tcp_connect(FAR struct socket *psock,
|
||||
* signal is received.
|
||||
*/
|
||||
|
||||
conn_dev_unlock(&conn->sconn, conn->dev);
|
||||
tls_cleanup_push(tls_get_info(), tcp_callback_cleanup, &info);
|
||||
ret = net_sem_wait(&state.tc_sem);
|
||||
|
||||
tls_cleanup_pop(tls_get_info(), 0);
|
||||
|
||||
@@ -838,7 +838,9 @@ static ssize_t tcp_recvfrom_one(FAR struct tcp_conn_s *conn, FAR void *buf,
|
||||
if (tcp_should_send_recvwindow(conn))
|
||||
{
|
||||
conn_unlock(&conn->sconn);
|
||||
netdev_lock(conn->dev);
|
||||
netdev_txnotify_dev(conn->dev);
|
||||
netdev_unlock(conn->dev);
|
||||
conn_lock(&conn->sconn);
|
||||
}
|
||||
|
||||
|
||||
@@ -1665,8 +1665,8 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
|
||||
|
||||
/* Notify the device driver of the availability of TX data */
|
||||
|
||||
conn_dev_unlock(&conn->sconn, conn->dev);
|
||||
tcp_send_txnotify(psock, conn);
|
||||
conn_dev_unlock(&conn->sconn, conn->dev);
|
||||
|
||||
if (chunk_result == 0)
|
||||
{
|
||||
|
||||
@@ -515,12 +515,12 @@ ssize_t tcp_sendfile(FAR struct socket *psock, FAR struct file *infile,
|
||||
TCP_DISCONN_EVENTS);
|
||||
state.snd_cb->priv = (FAR void *)&state;
|
||||
state.snd_cb->event = sendfile_eventhandler;
|
||||
conn_dev_unlock(&conn->sconn, conn->dev);
|
||||
|
||||
/* Notify the device driver of the availability of TX data */
|
||||
|
||||
tcp_send_txnotify(psock, conn);
|
||||
|
||||
conn_dev_unlock(&conn->sconn, conn->dev);
|
||||
for (; ; )
|
||||
{
|
||||
uint32_t acked = state.snd_acked;
|
||||
|
||||
@@ -137,9 +137,7 @@ static inline int tcp_send_fin(FAR struct socket *psock)
|
||||
|
||||
/* Notify the device driver of the availability of TX data */
|
||||
|
||||
conn_dev_unlock(&conn->sconn, conn->dev);
|
||||
tcp_send_txnotify(psock, conn);
|
||||
return ret;
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
@@ -154,7 +154,9 @@ static void tcp_timer_expiry(FAR void *arg)
|
||||
{
|
||||
tcp_conn_list_unlock();
|
||||
conn->timeout = true;
|
||||
netdev_lock(conn->dev);
|
||||
netdev_txnotify_dev(conn->dev);
|
||||
netdev_unlock(conn->dev);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user