Skip to contentSkip to conversation

net: wwan: mhi_wwan_ctrl: say the DTR drop flush is best effort

PATCH Applied Peter Hunt 3 participants 3 messages Nov 12 – Nov 19

Subsystems (3)
lore
Share & tools
lore

Peter Hunt

author
#0 lore raw

PATCH v2 1/1 net: wwan: mhi_wwan_ctrl: say the DTR drop flush is best effort

Four comments around the DTR/RTS work don't match the code since commit 10f51f4fb99d ("net: wwan: mhi_wwan_ctrl: send a DTR drop before it can be coalesced"):

- the ->dtr_rts() comment says the drop is sent now, but a drop that hits a full UL ring or a failed allocation is retried with whatever state is latest by then,
- the stop() comment says pending state is sent before the channel stops, but the flush there makes one attempt as well, and a retry goes out from dtr_work after the channel has stopped,
- the dtr_mdmbits comment only describes coalescing,
- the remove() comment says the removal drop gets one attempt, but the drop and stop() paths now flush the work as well.

Update them. No functional change.

---
Changes in v2:
- Also update the stop() comment, its flush makes one attempt too.
- Name a failed allocation as well as a full UL ring as a retry cause.
- v1: https://lore.kernel.org/all/[email protected]/

 drivers/net/wwan/mhi_wwan_ctrl.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/wwan/mhi_wwan_ctrl.c +10 -4
index 772319927867..387ab1bb0c41 100644
@@ -68,7 +68,8 @@ struct mhi_wwan_dev {
 	unsigned int rx_budget;
 
 	/* Latest DTR/RTS state for the modem, sent from dtr_work so a burst of
-	 * changes is coalesced and only the final state has to get through
+	 * changes is coalesced and only the final state has to get through.
+	 * A DTR drop is flushed out on its own, see mhi_wwan_ctrl_dtr_rts().
 	 */
 	unsigned int dtr_mdmbits;
 	struct delayed_work dtr_work;
@@ -216,7 +217,9 @@ static void mhi_wwan_ctrl_dtr_rts(struct wwan_port *port, unsigned int mdmbits)
 	schedule_delayed_work(&mhiwwan->dtr_work, 0);
 
 	/* A DTR drop matters on its own, e.g. to hang up a modem set to AT&D2,
-	 * so send it now rather than let a following raise coalesce it away
+	 * so try to send it now rather than let a following raise coalesce it
+	 * away. This is best effort, a drop that hits a full UL ring or a failed
+	 * allocation is retried with whatever state is latest by then.
 	 */
 	if (drop)
 		flush_delayed_work(&mhiwwan->dtr_work);
@@ -254,7 +257,10 @@ static void mhi_wwan_ctrl_stop(struct wwan_port *port)
 
 	cancel_work_sync(&mhiwwan->rx_refill);
 
-	/* Send any pending DTR/RTS state before the channel stops */
+	/* Try to send any pending DTR/RTS state before the channel stops. This
+	 * is best effort too, a send that has to be retried goes out from
+	 * dtr_work after the channel has stopped.
+	 */
 	flush_delayed_work(&mhiwwan->dtr_work);
 
 	mhi_unprepare_from_transfer(mhiwwan->mhi_dev);
@@ -376,7 +382,7 @@ static void mhi_wwan_ctrl_remove(struct mhi_device *mhi_dev)
 	struct mhi_wwan_dev *mhiwwan = dev_get_drvdata(&mhi_dev->dev);
 
 	wwan_remove_port(mhiwwan->wwan_port);
-	/* Give the DTR/RTS drop from removal one attempt, then stop the work */
+	/* Give any pending DTR/RTS state a last attempt, then stop the work */
 	flush_delayed_work(&mhiwwan->dtr_work);
 	disable_delayed_work_sync(&mhiwwan->dtr_work);
 	kfree(mhiwwan);
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 15 lines · Peter Hunt

Four comments around the DTR/RTS work don't match the code since commit 10f51f4fb99d ("net: wwan: mhi_wwan_ctrl: send a DTR drop before it can be coalesced"):

- the ->dtr_rts() comment says the drop is sent now, but a drop that hits a full UL ring or a failed allocation is retried with whatever state is latest by then,
- the stop() comment says pending state is sent before the channel stops, but the flush there makes one attempt as well, and a retry goes out from dtr_work after the channel has stopped,
- the dtr_mdmbits comment only describes coalescing,
- the remove() comment says the removal drop gets one attempt, but the drop and stop() paths now flush the work as well.

Quoted 4 lines

Update them. No functional change.

Quoted 58 lines

---
Changes in v2:
- Also update the stop() comment, its flush makes one attempt too.
- Name a failed allocation as well as a full UL ring as a retry cause.
- v1: https://lore.kernel.org/all/[email protected]/

 drivers/net/wwan/mhi_wwan_ctrl.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/wwan/mhi_wwan_ctrl.c +10 -5
index 772319927867..387ab1bb0c41 100644
@@ -68,7 +68,8 @@ struct mhi_wwan_dev {
        unsigned int rx_budget;
 
        /* Latest DTR/RTS state for the modem, sent from dtr_work so a burst of
-        * changes is coalesced and only the final state has to get through
+        * changes is coalesced and only the final state has to get through.
+        * A DTR drop is flushed out on its own, see mhi_wwan_ctrl_dtr_rts().
         */
        unsigned int dtr_mdmbits;
        struct delayed_work dtr_work;
@@ -216,7 +217,9 @@ static void mhi_wwan_ctrl_dtr_rts(struct wwan_port *port, unsigned int mdmbits)
        schedule_delayed_work(&mhiwwan->dtr_work, 0);
 
        /* A DTR drop matters on its own, e.g. to hang up a modem set to AT&D2,
-        * so send it now rather than let a following raise coalesce it away
+        * so try to send it now rather than let a following raise coalesce it
+        * away. This is best effort, a drop that hits a full UL ring or a failed
+        * allocation is retried with whatever state is latest by then.
         */
        if (drop)
                flush_delayed_work(&mhiwwan->dtr_work);
@@ -254,7 +257,10 @@ static void mhi_wwan_ctrl_stop(struct wwan_port *port)
 
        cancel_work_sync(&mhiwwan->rx_refill);
 
-       /* Send any pending DTR/RTS state before the channel stops */
+       /* Try to send any pending DTR/RTS state before the channel stops. This
+        * is best effort too, a send that has to be retried goes out from
+        * dtr_work after the channel has stopped.
+        */
        flush_delayed_work(&mhiwwan->dtr_work);
 
        mhi_unprepare_from_transfer(mhiwwan->mhi_dev);
@@ -376,7 +382,7 @@ static void mhi_wwan_ctrl_remove(struct mhi_device *mhi_dev)
        struct mhi_wwan_dev *mhiwwan = dev_get_drvdata(&mhi_dev->dev);
 
        wwan_remove_port(mhiwwan->wwan_port);
-       /* Give the DTR/RTS drop from removal one attempt, then stop the work */
+       /* Give any pending DTR/RTS state a last attempt, then stop the work */
        flush_delayed_work(&mhiwwan->dtr_work);
        disable_delayed_work_sync(&mhiwwan->dtr_work);
        kfree(mhiwwan);
--

2.43.0

#2 lore raw
In reply to Peter Hunt
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 14 lines · On Thu, 12 Nov 2026 10:22:16 -0700 you wrote:

Four comments around the DTR/RTS work don't match the code since commit 10f51f4fb99d ("net: wwan: mhi_wwan_ctrl: send a DTR drop before it can be coalesced"):

- the ->dtr_rts() comment says the drop is sent now, but a drop that hits a full UL ring or a failed allocation is retried with whatever state is latest by then,
- the stop() comment says pending state is sent before the channel stops, but the flush there makes one attempt as well, and a retry goes out from dtr_work after the channel has stopped,
- the dtr_mdmbits comment only describes coalescing,
- the remove() comment says the removal drop gets one attempt, but the drop and stop() paths now flush the work as well.

Quoted 1 line

[...]

Here is the summary with links:
- [net-next,v2] net: wwan: mhi_wwan_ctrl: say the DTR drop flush is best effort

    https://git.kernel.org/netdev/net-next/c/84a828d40fae

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html