Re: [PATCH v3 7/8] thunderbolt: Decouple the waiting time of TB_PORT_UNPLUGGED and TB_PORT_UP

From: Chunfeng Yun (云春峰)

Date: Thu Nov 26 2026 - 03:49:11 EST


On 二, 2026-11-24 at 17:00 +0100, Mika Westerberg wrote:
> On Mon, Nov 23, 2026 at 07:36:54PM +0800, Chunfeng Yun wrote:
> > When USB4 is woke up by device disconnect, no need wait for 2s,
> > usually the phase2~4 takes at most about 200ms, and enters to
>
> usually phases 2-4 take at most..
>
> The 200ms is not from the spec though? It's empirical right on your
> hardhware?

Yes, you are right. The ~200ms is empirical based on testing on our
hardware with various USB4 docks and devices, rather than a hard limit
from the spec.

In the USB4 spec, the lane adapter stays in CLd (TB_PORT_UNPLUGGED)
throughout Phases 2-4 until it sends LT_Resume at the end of Phase 4 to
enter Training (TB_PORT_CONNECTING), and the spec does not define an
overall maximum timeout for Phases 2-4. At the protocol level, Phase 2
(tConnectRx), Phase 3 (AT transactions), and Phase 4 (tLTPhase4 and
Broadcast RT transactions) only take tens of milliseconds; in practice,
the ~100-200ms delay mainly comes from partner router wake-up, re-timer
initialization, etc.

So I doubled that empirical ~200ms to 400ms as a safety margin.

I will clarify in the commit message that this is an empirical value in
v4. Do you think 400ms is fine here, or would you prefer 500ms to leave
a bit more margin for active cables and older Thunderbolt switches?

Thanks

>
> > TB_PORT_CONNECTING, if it is still in TB_PORT_UNPLUGGED after
> > 400ms,
> > treat it as disconnected.
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@xxxxxxxxxxxx>