From nobody Thu Nov 28 13:47:09 2024 Received: from us-smtp-delivery-162.mimecast.com (us-smtp-delivery-162.mimecast.com [170.10.133.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41D3F1CC15E for ; Tue, 1 Oct 2024 17:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.162 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727803930; cv=none; b=OXymNP7tOzEGDTQ6Vq018toX8DK7yrbGsZKc5vWGiRFUELZQRZw28BRLBhJkKvSH/0l2zKm01wz67iBcgyyGYj5YJ9BlVkcZE8D8LTvxqSxLyawSCbTdSB8YImgq9Vz0w7p0jjRppA+/mrdPSE2TG5Qrz68aV0o5/KIunS5Nwjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727803930; c=relaxed/simple; bh=95uHAVLhn3dwbvkj1bSKFguBoCiULtcN730jVEMT60M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Z8p6P6lZsehtSHmxc/8EBALa3EgJF/z0Ve3dN8/EWb0MD3+LCAHAsMePN8ATY30atbnvYKpto6VOJE2vMB1CYRR7iynH7EhiqKahecOZMXXxfAdkuYOSuQ18HymVnj/ZDKxbDUlAga+Ew7TEQcM6uBKMs3UL5/LWOjLCaTtX15k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=hp.com; spf=pass smtp.mailfrom=hp.com; dkim=pass (1024-bit key) header.d=hp.com header.i=@hp.com header.b=jrZI2jzU; arc=none smtp.client-ip=170.10.133.162 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=hp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hp.com header.i=@hp.com header.b="jrZI2jzU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hp.com; s=mimecast20180716; t=1727803927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9FDkauejoxz2XTpH28ePbl2EFJ+/zapfPnhifYMCH08=; b=jrZI2jzUa5XKqQamxTArYVngKqkz6Ox0p3xKKo1zY2to8zUeda07S0NuFVOEkis+5U41QH iZs+zygvFNMIf+8CcNerteNQ49HnKQBFBALqisDfmmo3Q3LvnwWvBOO4IwMOwAD6XIn1pU /dsCfWVKygrbFlki7lGx65+IRvMR2WE= Received: from g7t16451g.inc.hp.com (hpi-bastion.austin1.mail.core.hp.com [15.73.128.137]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-400-ohbBEXR0ML-V0qPm_19wDw-1; Tue, 01 Oct 2024 13:32:06 -0400 X-MC-Unique: ohbBEXR0ML-V0qPm_19wDw-1 Received: from g7t14407g.inc.hpicorp.net (g7t14407g.inc.hpicorp.net [15.63.19.131]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by g7t16451g.inc.hp.com (Postfix) with ESMTPS id 30CFD6000E52; Tue, 1 Oct 2024 17:32:05 +0000 (UTC) Received: from localhost.localdomain (unknown [15.53.255.151]) by g7t14407g.inc.hpicorp.net (Postfix) with ESMTP id C8BD118; Tue, 1 Oct 2024 17:32:03 +0000 (UTC) From: Alexandru Gagniuc To: gregkh@linuxfoundation.org, stable@vger.kernel.org Cc: qin.wan@hp.com, andreas.noever@gmail.com, michael.jamet@intel.com, mika.westerberg@linux.intel.com, YehezkelShB@gmail.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandru Gagniuc Subject: [PATCH 6.6 02/14] thunderbolt: Use tb_tunnel_dbg() where possible to make logging more consistent Date: Tue, 1 Oct 2024 17:30:57 +0000 Message-Id: <20241001173109.1513-3-alexandru.gagniuc@hp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241001173109.1513-1-alexandru.gagniuc@hp.com> References: <20241001173109.1513-1-alexandru.gagniuc@hp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: hp.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" From: Mika Westerberg [ Upstream commit fe8a0293c922ee8bc1ff0cf9048075afb264004a ] This makes it easier to find out the tunnel in question. Also drop a couple of lines that generate duplicate information. Signed-off-by: Mika Westerberg Signed-off-by: Qin Wan Signed-off-by: Alexandru Gagniuc --- drivers/thunderbolt/tunnel.c | 65 +++++++++++++++++------------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c index a6810fb36860..c0a8142f73f4 100644 --- a/drivers/thunderbolt/tunnel.c +++ b/drivers/thunderbolt/tunnel.c @@ -614,8 +614,9 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel) =20 in_rate =3D tb_dp_cap_get_rate(in_dp_cap); in_lanes =3D tb_dp_cap_get_lanes(in_dp_cap); - tb_port_dbg(in, "maximum supported bandwidth %u Mb/s x%u =3D %u Mb/s\n", - in_rate, in_lanes, tb_dp_bandwidth(in_rate, in_lanes)); + tb_tunnel_dbg(tunnel, + "DP IN maximum supported bandwidth %u Mb/s x%u =3D %u Mb/s\n", + in_rate, in_lanes, tb_dp_bandwidth(in_rate, in_lanes)); =20 /* * If the tunnel bandwidth is limited (max_bw is set) then see @@ -624,8 +625,9 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel) out_rate =3D tb_dp_cap_get_rate(out_dp_cap); out_lanes =3D tb_dp_cap_get_lanes(out_dp_cap); bw =3D tb_dp_bandwidth(out_rate, out_lanes); - tb_port_dbg(out, "maximum supported bandwidth %u Mb/s x%u =3D %u Mb/s\n", - out_rate, out_lanes, bw); + tb_tunnel_dbg(tunnel, + "DP OUT maximum supported bandwidth %u Mb/s x%u =3D %u Mb/s\n", + out_rate, out_lanes, bw); =20 if (in->sw->config.depth < out->sw->config.depth) max_bw =3D tunnel->max_down; @@ -639,13 +641,14 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel) out_rate, out_lanes, &new_rate, &new_lanes); if (ret) { - tb_port_info(out, "not enough bandwidth for DP tunnel\n"); + tb_tunnel_info(tunnel, "not enough bandwidth\n"); return ret; } =20 new_bw =3D tb_dp_bandwidth(new_rate, new_lanes); - tb_port_dbg(out, "bandwidth reduced to %u Mb/s x%u =3D %u Mb/s\n", - new_rate, new_lanes, new_bw); + tb_tunnel_dbg(tunnel, + "bandwidth reduced to %u Mb/s x%u =3D %u Mb/s\n", + new_rate, new_lanes, new_bw); =20 /* * Set new rate and number of lanes before writing it to @@ -662,7 +665,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel) */ if (tb_route(out->sw) && tb_switch_is_titan_ridge(out->sw)) { out_dp_cap |=3D DP_COMMON_CAP_LTTPR_NS; - tb_port_dbg(out, "disabling LTTPR\n"); + tb_tunnel_dbg(tunnel, "disabling LTTPR\n"); } =20 return tb_port_write(in, &out_dp_cap, TB_CFG_PORT, @@ -712,8 +715,8 @@ static int tb_dp_bandwidth_alloc_mode_enable(struct tb_= tunnel *tunnel) lanes =3D min(in_lanes, out_lanes); tmp =3D tb_dp_bandwidth(rate, lanes); =20 - tb_port_dbg(in, "non-reduced bandwidth %u Mb/s x%u =3D %u Mb/s\n", rate, - lanes, tmp); + tb_tunnel_dbg(tunnel, "non-reduced bandwidth %u Mb/s x%u =3D %u Mb/s\n", + rate, lanes, tmp); =20 ret =3D usb4_dp_port_set_nrd(in, rate, lanes); if (ret) @@ -728,15 +731,15 @@ static int tb_dp_bandwidth_alloc_mode_enable(struct t= b_tunnel *tunnel) rate =3D min(in_rate, out_rate); tmp =3D tb_dp_bandwidth(rate, lanes); =20 - tb_port_dbg(in, - "maximum bandwidth through allocation mode %u Mb/s x%u =3D %u Mb/s\n= ", - rate, lanes, tmp); + tb_tunnel_dbg(tunnel, + "maximum bandwidth through allocation mode %u Mb/s x%u =3D %u Mb/s= \n", + rate, lanes, tmp); =20 for (granularity =3D 250; tmp / granularity > 255 && granularity <=3D 100= 0; granularity *=3D 2) ; =20 - tb_port_dbg(in, "granularity %d Mb/s\n", granularity); + tb_tunnel_dbg(tunnel, "granularity %d Mb/s\n", granularity); =20 /* * Returns -EINVAL if granularity above is outside of the @@ -756,7 +759,7 @@ static int tb_dp_bandwidth_alloc_mode_enable(struct tb_= tunnel *tunnel) else estimated_bw =3D tunnel->max_up; =20 - tb_port_dbg(in, "estimated bandwidth %d Mb/s\n", estimated_bw); + tb_tunnel_dbg(tunnel, "estimated bandwidth %d Mb/s\n", estimated_bw); =20 ret =3D usb4_dp_port_set_estimated_bandwidth(in, estimated_bw); if (ret) @@ -767,7 +770,7 @@ static int tb_dp_bandwidth_alloc_mode_enable(struct tb_= tunnel *tunnel) if (ret) return ret; =20 - tb_port_dbg(in, "bandwidth allocation mode enabled\n"); + tb_tunnel_dbg(tunnel, "bandwidth allocation mode enabled\n"); return 0; } =20 @@ -788,7 +791,7 @@ static int tb_dp_init(struct tb_tunnel *tunnel) if (!usb4_dp_port_bandwidth_mode_supported(in)) return 0; =20 - tb_port_dbg(in, "bandwidth allocation mode supported\n"); + tb_tunnel_dbg(tunnel, "bandwidth allocation mode supported\n"); =20 ret =3D usb4_dp_port_set_cm_id(in, tb->index); if (ret) @@ -805,7 +808,7 @@ static void tb_dp_deinit(struct tb_tunnel *tunnel) return; if (usb4_dp_port_bandwidth_mode_enabled(in)) { usb4_dp_port_set_cm_bandwidth_mode_supported(in, false); - tb_port_dbg(in, "bandwidth allocation mode disabled\n"); + tb_tunnel_dbg(tunnel, "bandwidth allocation mode disabled\n"); } } =20 @@ -921,9 +924,6 @@ static int tb_dp_bandwidth_mode_consumed_bandwidth(stru= ct tb_tunnel *tunnel, if (allocated_bw =3D=3D max_bw) allocated_bw =3D ret; =20 - tb_port_dbg(in, "consumed bandwidth through allocation mode %d Mb/s\n", - allocated_bw); - if (in->sw->config.depth < out->sw->config.depth) { *consumed_up =3D 0; *consumed_down =3D allocated_bw; @@ -1006,9 +1006,6 @@ static int tb_dp_alloc_bandwidth(struct tb_tunnel *tu= nnel, int *alloc_up, /* Now we can use BW mode registers to figure out the bandwidth */ /* TODO: need to handle discovery too */ tunnel->bw_mode =3D true; - - tb_port_dbg(in, "allocated bandwidth through allocation mode %d Mb/s\n", - tmp); return 0; } =20 @@ -1035,8 +1032,7 @@ static int tb_dp_read_dprx(struct tb_tunnel *tunnel, = u32 *rate, u32 *lanes, *rate =3D tb_dp_cap_get_rate(val); *lanes =3D tb_dp_cap_get_lanes(val); =20 - tb_port_dbg(in, "consumed bandwidth through DPRX %d Mb/s\n", - tb_dp_bandwidth(*rate, *lanes)); + tb_tunnel_dbg(tunnel, "DPRX read done\n"); return 0; } usleep_range(100, 150); @@ -1073,9 +1069,6 @@ static int tb_dp_read_cap(struct tb_tunnel *tunnel, u= nsigned int cap, u32 *rate, =20 *rate =3D tb_dp_cap_get_rate(val); *lanes =3D tb_dp_cap_get_lanes(val); - - tb_port_dbg(in, "bandwidth from %#x capability %d Mb/s\n", cap, - tb_dp_bandwidth(*rate, *lanes)); return 0; } =20 @@ -1253,8 +1246,9 @@ static void tb_dp_dump(struct tb_tunnel *tunnel) rate =3D tb_dp_cap_get_rate(dp_cap); lanes =3D tb_dp_cap_get_lanes(dp_cap); =20 - tb_port_dbg(in, "maximum supported bandwidth %u Mb/s x%u =3D %u Mb/s\n", - rate, lanes, tb_dp_bandwidth(rate, lanes)); + tb_tunnel_dbg(tunnel, + "DP IN maximum supported bandwidth %u Mb/s x%u =3D %u Mb/s\n", + rate, lanes, tb_dp_bandwidth(rate, lanes)); =20 out =3D tunnel->dst_port; =20 @@ -1265,8 +1259,9 @@ static void tb_dp_dump(struct tb_tunnel *tunnel) rate =3D tb_dp_cap_get_rate(dp_cap); lanes =3D tb_dp_cap_get_lanes(dp_cap); =20 - tb_port_dbg(out, "maximum supported bandwidth %u Mb/s x%u =3D %u Mb/s\n", - rate, lanes, tb_dp_bandwidth(rate, lanes)); + tb_tunnel_dbg(tunnel, + "DP OUT maximum supported bandwidth %u Mb/s x%u =3D %u Mb/s\n", + rate, lanes, tb_dp_bandwidth(rate, lanes)); =20 if (tb_port_read(in, &dp_cap, TB_CFG_PORT, in->cap_adap + DP_REMOTE_CAP, 1)) @@ -1275,8 +1270,8 @@ static void tb_dp_dump(struct tb_tunnel *tunnel) rate =3D tb_dp_cap_get_rate(dp_cap); lanes =3D tb_dp_cap_get_lanes(dp_cap); =20 - tb_port_dbg(in, "reduced bandwidth %u Mb/s x%u =3D %u Mb/s\n", - rate, lanes, tb_dp_bandwidth(rate, lanes)); + tb_tunnel_dbg(tunnel, "reduced bandwidth %u Mb/s x%u =3D %u Mb/s\n", + rate, lanes, tb_dp_bandwidth(rate, lanes)); } =20 /** --=20 2.45.1