Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3017762pxu; Sat, 10 Oct 2020 16:16:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywV7eyDCLvEqWnUnUci3KT93BVEWqpWz1P/2lrNRho7rABh88L6MJIgpx4Y4wRJqHO9XwK X-Received: by 2002:aa7:d782:: with SMTP id s2mr6502056edq.111.1602371775337; Sat, 10 Oct 2020 16:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602371775; cv=none; d=google.com; s=arc-20160816; b=abSlDK0cdVGtcsofjqRZff/jQyLJH9A5eFhzJtpJmEVSEau3uZU18Q1JrS+4tUS2ED Bgq7S+eDd2oNQNnGP/leWkmTa2PKNDn/MTFsz9Bd17Vqchkbw+GQxwqsMsawRaQ6RFJQ QCxbKPZUNqjfTP4MJVTXHgQCEOtGYcPQQtKKbpJJQANfvvy8/QhkocLk6xl65zsuBdeM r1P4pVXMAH3InT8Gwhk5oB9rxf4AQLUBwLWorchAJUtqSmUH2/wgulPkxfAnQGmhx5j8 0wrjiuXdbT4e3vcMaj2KpsNip3bIH638Yhz+Oh5ii7ntvAmjYLI1Hq1gMKbrFPDJX8Hu NAbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :dkim-signature; bh=77d5X5ZtNoznypcZc20yzAR7XwV/B5sLmMBtpT0eIs0=; b=CBVoqPEWC/NzpJqWUUDX6nNq2EWdiRyFd6ib0aUdgwkRwP9oFSObWY6tj35L1aUBJ1 CBhbQs9JeX4sKVoA8ZKc0xme4OPg0ZOqSWLTM1YZQCJuU9GgcLQZEbMkBHATu7aCwmu1 QECRNrayWsMXv8oM/GZrBjG5avNjxkQAUbdV2BDqXF6oG6MZZkxRz80NJ+LKUC89N7Fz c20WcZtO5zHQg8Bwfa1zdVRdAg7Px0WJra7/3cRxI5RqiatQOpC09Kli8ZMOoTsVi98W ABsHAYeXxfyfV3dLu2Njtyfjk4ZdnuvBMyom7Mr6FzTWfJoVEwfwn24rJeO9H5/zrkty Q2Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ohpYkoyn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si9180929ejb.269.2020.10.10.16.15.52; Sat, 10 Oct 2020 16:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ohpYkoyn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388891AbgJJWyu (ORCPT + 99 others); Sat, 10 Oct 2020 18:54:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731373AbgJJTO1 (ORCPT ); Sat, 10 Oct 2020 15:14:27 -0400 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B44AC05BD2D; Sat, 10 Oct 2020 08:46:49 -0700 (PDT) Received: by mail-ot1-x331.google.com with SMTP id n61so11782298ota.10; Sat, 10 Oct 2020 08:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=77d5X5ZtNoznypcZc20yzAR7XwV/B5sLmMBtpT0eIs0=; b=ohpYkoynygMJmbx+5NSwRmH1cm6Hng5v/a9GY5se13KSOkkewhSdPXh1cGMKdDDXqB h58Wny6D7atBtEWDNCfFVtjKw9qEw2TrktCIwoUA88AVlx/cB4gD54C/xKNgJkjOFG6L 5KM9o3MfCIuGyy/ehmvTXggU9fjUzk7aoAw69kqxz/EZL0N22MRtwiAJ8UHCEXfOPK99 Q5TrmOqqI7u73oqH7EIsN0SJ2pFpp25r9fmHf7Z0EHyDr1rlq07ktHXq73297iWVjuE8 sJ4YL3cyjUTRlB0rCKtmcwS0Ai45seLP6l3/0UWyLIbqeH5ZfifBGxxBJEcmOFshaJYw DHYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=77d5X5ZtNoznypcZc20yzAR7XwV/B5sLmMBtpT0eIs0=; b=RqriGVCbVC6R29IPV3xNSFfH2OIJI1uHVELzwsC2XUdJ4Kshp44Ff62ldH8fK/TEkv 5NYJVLgHZbNIZFzMRmHcRVNYieVbW2CyNj7NX+k180162E2489/O9eYs46osIcPdW2EN ytiaJBXNy6bcah2HYv6Wfo9fEmWU8iMiPNHQ1/vt3i4Vc+WuhTZWZsaTS2TcyLuonsOq A/TjRP5WbPjWC40X8+lTh/wO7CXlFe2tiHCXY1lichE0inUkWCnF7RjREJ6ejhLXGi3Z uvKbAVpWl2nMnmcSpcIc9eD4XhfQKJWGv9T6g+1wgK/GOyQhDS6FajUGuhDg2P8Dar1v 97Yg== X-Gm-Message-State: AOAM530w6xDeOEF2YK/WElF0sE2uYJa2P1ZbOpWurqfQkhdYwCzzZOjZ 8ven5rhblNFkETIbHPEatjs= X-Received: by 2002:a9d:7993:: with SMTP id h19mr11115721otm.289.1602344808241; Sat, 10 Oct 2020 08:46:48 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 81sm7133889oti.79.2020.10.10.08.46.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Oct 2020 08:46:47 -0700 (PDT) Sender: Guenter Roeck Date: Sat, 10 Oct 2020 08:46:46 -0700 From: Guenter Roeck To: ChiYuan Huang Cc: Jun Li , Jun Li , Greg KH , Heikki Krogerus , Linux USB List , lkml , cy_huang Subject: Re: [PATCH] usb: typec: tcpm: Fix if vbus before cc, hard_reset_count not reset issue Message-ID: <20201010154646.GA248582@roeck-us.net> References: <20201002133145.GA3384841@kroah.com> <20201005110808.GA298743@kroah.com> <88586992-650f-a4a1-2fa0-8cef313380fb@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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