On Sat, Oct 10, 2020 at 12:06:13AM +0800, ChiYuan Huang wrote: [ ... ] > > Like I mentioned before, whatever the condition is, hard_reset_count > must be reset to zero during tcpm_detach. > > But refer to Guenter's mail, he prefer to narrow down the condition > to reset this counter. > > I think the original thought is important why to put this line there. > > Hi, Guenter: > From the discussion, we really need to know why you put the reset > line below port attached is false and also make some judgement. > I think there may be ome condition that we don't considered. > As I am sure I have mentioned before, it was to handle misbehaving partners, to enforce that the system goes into error recovery state and (hopefully) recover the partner enough to be able to reconnect. This is the same reason why resetting the counter is commented out in SRC_SEND_CAPABILITIES and reset in SRC_READY instead. The typical sequence was that the state machine would process from SRC_UNATTACHED to some point and then stall / time out, but never be in disconnected state. Always resetting the hard reset counter in tcpm_detach() would disable error recovery in that situation, and affected partners would never recover. Effectively it would disable error recovery in any state machine cycle which involves an unattached state, which makes me really question if it is indeed mandated by the specification to reset the hard reset counter at that point. Guenter