This is an automated email from the ASF dual-hosted git repository.
archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e404fe4b8d1 rndis.c: move ifup in setconfig to the work queue
e404fe4b8d1 is described below
commit e404fe4b8d11db438dd412db60668d02daed7cce
Author: zhanghongyu <[email protected]>
AuthorDate: Tue Feb 24 16:12:05 2026 +0800
rndis.c: move ifup in setconfig to the work queue
Move network interface up operation (ifup) to work queue in RNDIS USB
device driver to avoid calling netdev_carrier_on API in interrupt context.
Signed-off-by: zhanghongyu <[email protected]>
---
drivers/usbdev/rndis.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c
index 4b20e5a3855..efefb8fb787 100644
--- a/drivers/usbdev/rndis.c
+++ b/drivers/usbdev/rndis.c
@@ -2752,6 +2752,22 @@ static void usbclass_resetconfig(FAR struct rndis_dev_s
*priv)
}
}
+/****************************************************************************
+ * Name: rndis_carrier_on_work
+ *
+ * Description:
+ * Schedule to work queue because netdev_carrier_on API can't be used in
+ * interrupt context
+ *
+ ****************************************************************************/
+
+static void rndis_carrier_on_work(FAR void *arg)
+{
+ FAR struct rndis_dev_s *priv = arg;
+
+ netdev_carrier_on(&priv->netdev);
+}
+
/****************************************************************************
* Name: usbclass_setconfig
*
@@ -2860,10 +2876,16 @@ static int usbclass_setconfig(FAR struct rndis_dev_s
*priv, uint8_t config)
/* We are successfully configured */
priv->config = config;
- if (priv->netdev.d_ifup(&priv->netdev) == OK)
- {
- priv->netdev.d_flags |= IFF_UP;
- }
+
+ priv->netdev.d_flags |= IFF_UP;
+
+ /* Schedule to work queue because netdev_carrier_on API can't be used in
+ * interrupt context. Since the current network card is not yet RUNNING,
+ * it will not be selected to trigger rndis_txavail, so pollwork can be
+ * reused.
+ */
+
+ work_queue(LPWORK, &priv->pollwork, rndis_carrier_on_work, priv, 0);
return OK;