From patchwork Thu Jun 1 01:51:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1788722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=n9UhSoSR; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QWpz0180Tz20QJ for ; Thu, 1 Jun 2023 11:51:56 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1q4XTe-0001I2-RK; Thu, 01 Jun 2023 01:51:46 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1q4XTd-0001Hq-BA for kernel-team@lists.ubuntu.com; Thu, 01 Jun 2023 01:51:45 +0000 Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 198E141281 for ; Thu, 1 Jun 2023 01:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1685584305; bh=H1stV6TenPS5Fkvtu4JZnqoqIb2syUwUU4UwA5X2dq8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n9UhSoSR8QFUTMFXt6cTh5ofEryGG+yjtMqeS7FFMrcV8wOhB7+MDwB4oMQ7Dw9jK w4l8SNT/z85jx/Qc9GQmFpRAZR4bwmQAJqnZDozJU5jlV5+9EEp/wW8+bxHoDMpUvG Z95Gr5R2B2eJDOxnPVGcCFHn0Ac9ALLrybh2HtXXJAp4sg912zL+U4VYZ7qk2SNYej DirEMUZ4P7B5cPoPv/s84Apv4bjKZOwNCPt9cRfrH75BoaT3pOMz07PIAwh6SDXNNV EITw1U1EfP7aWKUQUsidrPvAMu+xUxT2tx2q2HpMoyclXE6PCMYCsLOfckxuLJaj8l /X/z/oskzUHYg== Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-64d5ce33a36so414333b3a.0 for ; Wed, 31 May 2023 18:51:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685584303; x=1688176303; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H1stV6TenPS5Fkvtu4JZnqoqIb2syUwUU4UwA5X2dq8=; b=RV9hC0nFdllNmIp2pwNgkhocnUnqjnbWXAuBBIQDtyHjWQ0pNTH3z2c2493HEcnxDL lQ4P+7OHQtfPQfVLRB1pE1y8YFvrMsWuiReXbFJaEHH5QlbkqaPlDbzHVUOv4K564QLG 5rTGNYKII9OBS+Ry3jlSxswCry/hmzVKQU7ko/z/mjTU1gaNSj4B9IbsqCwe6TkkRr1r fh5oTQqQ1nMoPu0melFHtJNiDi22+kIpw/aSlNF3Y6OIC+Rg8LkBdrsf4H/SHghpGyxp 0utKaakcR7Avv5GV9YMVJ/VFpIgghgG5JORC4V9ZZt+gskeD1tr1U+gUIk6PeWPXV32f BdZg== X-Gm-Message-State: AC+VfDydEZAOjyXz/2nBECv0FTnkFjZDWsXhRat14Eb8xrWQvChHgi+Z wNOtGnUCzb0tujL7eNiq60EbZpacsaNfTbaN9lTjyv6n8VNUZcxVMWTjA/F1RvseD7ytmAWchwj 4PV9o3qS/vRwT3xU00zNbQplS1dffRHh7EpWbkpxlmcIeeyw0xQ== X-Received: by 2002:a05:6a00:2e9e:b0:64f:52c9:ddd5 with SMTP id fd30-20020a056a002e9e00b0064f52c9ddd5mr9358580pfb.34.1685584302715; Wed, 31 May 2023 18:51:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5AEF+2SQGZne8wiyojXGFkzsY0Xt+96QV99s2nTvEdWhM9O2jaZxOQSPXVZGJtrvH4PShTvQ== X-Received: by 2002:a05:6a00:2e9e:b0:64f:52c9:ddd5 with SMTP id fd30-20020a056a002e9e00b0064f52c9ddd5mr9358565pfb.34.1685584302352; Wed, 31 May 2023 18:51:42 -0700 (PDT) Received: from canonical.com (211-75-139-218.hinet-ip.hinet.net. [211.75.139.218]) by smtp.gmail.com with ESMTPSA id j22-20020aa78016000000b006414b2c9efasm3923879pfi.123.2023.05.31.18.51.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 18:51:41 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/4][SRU][L/K] thunderbolt: Increase timeout of DP OUT adapter handshake Date: Thu, 1 Jun 2023 09:51:25 +0800 Message-Id: <20230601015128.246426-2-koba.ko@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230601015128.246426-1-koba.ko@canonical.com> References: <20230601015128.246426-1-koba.ko@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mika Westerberg BugLink: https://bugs.launchpad.net/bugs/2021949 Sometimes the current timeout is not enough so increase it to 1500 ms and while there make the loop use ktime instead. Signed-off-by: Mika Westerberg (cherry picked from commit fe1a1cf7c97028570127ac8d222c2b451ba04278) Signed-off-by: Koba Ko --- drivers/thunderbolt/tunnel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c index 1fc3c29b24f83..45109c8c660b1 100644 --- a/drivers/thunderbolt/tunnel.c +++ b/drivers/thunderbolt/tunnel.c @@ -339,9 +339,10 @@ static bool tb_dp_is_usb4(const struct tb_switch *sw) return tb_switch_is_usb4(sw) || tb_switch_is_titan_ridge(sw); } -static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out) +static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out, + int timeout_msec) { - int timeout = 10; + ktime_t timeout = ktime_add_ms(ktime_get(), timeout_msec); u32 val; int ret; @@ -368,8 +369,8 @@ static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out) return ret; if (!(val & DP_STATUS_CTRL_CMHS)) return 0; - usleep_range(10, 100); - } while (timeout--); + usleep_range(100, 150); + } while (ktime_before(ktime_get(), timeout)); return -ETIMEDOUT; } @@ -519,7 +520,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel) * Perform connection manager handshake between IN and OUT ports * before capabilities exchange can take place. */ - ret = tb_dp_cm_handshake(in, out); + ret = tb_dp_cm_handshake(in, out, 1500); if (ret) return ret;