This is an automated email from the ASF dual-hosted git repository.

acassis 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 2e9a43571a8 arch/imx9/ethernet: Add a configuration option to use 
HPWORK queue
2e9a43571a8 is described below

commit 2e9a43571a87aab4af1d71661e70c6733c1707a3
Author: Jukka Laitinen <[email protected]>
AuthorDate: Fri Nov 28 16:14:51 2025 +0200

    arch/imx9/ethernet: Add a configuration option to use HPWORK queue
    
    Add an option to use HPWORK queue for ethernet driver, to reduce
    delays if more time critical messaging via ethernet is wanted.
    
    Signed-off-by: Jukka Laitinen <[email protected]>
---
 arch/arm64/src/imx9/Kconfig     |  9 +++++++++
 arch/arm64/src/imx9/imx9_enet.c | 28 +++++++++++++++++++---------
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/src/imx9/Kconfig b/arch/arm64/src/imx9/Kconfig
index 5e0a37e5d9e..72420e59126 100644
--- a/arch/arm64/src/imx9/Kconfig
+++ b/arch/arm64/src/imx9/Kconfig
@@ -1013,6 +1013,15 @@ config IMX9_ENET_USE_OTP_MAC
        default n
        depends on IMX9_ENET
 
+config IMX9_ENET_HPWORK
+       bool "Use high priority work queue for ethernet"
+       depends on IMX9_ENET
+       depends on SCHED_HPWORK
+       default n
+       ---help---
+               Use high-priority work-queue for ethernet packet handling.
+               Enable if low-latency ethernet packet handling is required.
+
 config IMX9_ENET1_OTP_MAC_ADDR
        hex "MAC address offset in OCOTP"
        default 0x4ec
diff --git a/arch/arm64/src/imx9/imx9_enet.c b/arch/arm64/src/imx9/imx9_enet.c
index fd301dfcdb6..48bed4f266d 100644
--- a/arch/arm64/src/imx9/imx9_enet.c
+++ b/arch/arm64/src/imx9/imx9_enet.c
@@ -74,15 +74,22 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-/* If processing is not done at the interrupt level, then work queue support
- * is required.
- */
+/* Select work queue for normal operation */
 
-#if !defined(CONFIG_SCHED_LPWORK)
-#  error LPWORK queue support is required
-#endif
+#  if defined(CONFIG_IMX9_ENET_HPWORK)
+#    define ETHWORK HPWORK
+#  else
+#    define ETHWORK LPWORK
+#  endif
 
-#define ETHWORK LPWORK
+/* LPWORK support is always required. Even if HPWORK were used for normal
+ * operation, timeouts are only handled in LPWORK since phy communication
+ * might cause delays due to polling
+ */
+
+#  if !defined(CONFIG_SCHED_LPWORK)
+#    error LPWORK queue support is required
+#  endif
 
 /* We need at least two TX buffers for reliable operation */
 
@@ -1282,10 +1289,13 @@ static void imx9_txtimeout_expiry(wdparm_t arg)
   priv->ints = 0;
 
   /* Schedule to perform the TX timeout processing on the worker thread,
-   * canceling any pending interrupt work.
+   * canceling any pending interrupt work. Note: this runs always in the
+   * low-priority queue instead of ETHWORK. It is too intrusive for the
+   * high-priority queue, running ifdown / ifup sequence and communicating
+   * with PHY.
    */
 
-  work_queue(ETHWORK, &priv->irqwork, imx9_txtimeout_work, priv, 0);
+  work_queue(LPWORK, &priv->irqwork, imx9_txtimeout_work, priv, 0);
 }
 
 /****************************************************************************

Reply via email to