From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: Michael Jamet <michael.jamet@intel.com>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
Andreas Noever <andreas.noever@gmail.com>,
Isaac Hazan <isaac.hazan@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Lukas Wunner <lukas@wunner.de>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Subject: [PATCH 05/18] thunderbolt: Add more logging to XDomain connections
Date: Thu, 4 Mar 2021 15:31:12 +0300 [thread overview]
Message-ID: <20210304123125.43630-6-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20210304123125.43630-1-mika.westerberg@linux.intel.com>
Currently the driver is pretty quiet when another host is connected
which makes debugging possible issues harder. For this reason add more
logging on debug level that can be turned on as needed.
While there log the host-to-host connection on info level analogous to
routers and retimers.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/thunderbolt/xdomain.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
index 7cf8b9c85ab7..584bb5ec06f8 100644
--- a/drivers/thunderbolt/xdomain.c
+++ b/drivers/thunderbolt/xdomain.c
@@ -591,6 +591,8 @@ static void tb_xdp_handle_request(struct work_struct *work)
finalize_property_block();
+ tb_dbg(tb, "%llx: received XDomain request %#x\n", route, pkg->type);
+
switch (pkg->type) {
case PROPERTIES_REQUEST:
ret = tb_xdp_properties_response(tb, ctl, route, sequence, uuid,
@@ -1002,9 +1004,12 @@ static void tb_xdomain_get_uuid(struct work_struct *work)
uuid_t uuid;
int ret;
+ dev_dbg(&xd->dev, "requesting remote UUID\n");
+
ret = tb_xdp_uuid_request(tb->ctl, xd->route, xd->uuid_retries, &uuid);
if (ret < 0) {
if (xd->uuid_retries-- > 0) {
+ dev_dbg(&xd->dev, "failed to request UUID, retrying\n");
queue_delayed_work(xd->tb->wq, &xd->get_uuid_work,
msecs_to_jiffies(100));
} else {
@@ -1013,6 +1018,8 @@ static void tb_xdomain_get_uuid(struct work_struct *work)
return;
}
+ dev_dbg(&xd->dev, "got remote UUID %pUb\n", &uuid);
+
if (uuid_equal(&uuid, xd->local_uuid))
dev_dbg(&xd->dev, "intra-domain loop detected\n");
@@ -1052,11 +1059,15 @@ static void tb_xdomain_get_properties(struct work_struct *work)
u32 gen = 0;
int ret;
+ dev_dbg(&xd->dev, "requesting remote properties\n");
+
ret = tb_xdp_properties_request(tb->ctl, xd->route, xd->local_uuid,
xd->remote_uuid, xd->properties_retries,
&block, &gen);
if (ret < 0) {
if (xd->properties_retries-- > 0) {
+ dev_dbg(&xd->dev,
+ "failed to request remote properties, retrying\n");
queue_delayed_work(xd->tb->wq, &xd->get_properties_work,
msecs_to_jiffies(1000));
} else {
@@ -1123,6 +1134,11 @@ static void tb_xdomain_get_properties(struct work_struct *work)
dev_err(&xd->dev, "failed to add XDomain device\n");
return;
}
+ dev_info(&xd->dev, "new host found, vendor=%#x device=%#x\n",
+ xd->vendor, xd->device);
+ if (xd->vendor_name && xd->device_name)
+ dev_info(&xd->dev, "%s %s\n", xd->vendor_name,
+ xd->device_name);
} else {
kobject_uevent(&xd->dev.kobj, KOBJ_CHANGE);
}
@@ -1143,13 +1159,19 @@ static void tb_xdomain_properties_changed(struct work_struct *work)
properties_changed_work.work);
int ret;
+ dev_dbg(&xd->dev, "sending properties changed notification\n");
+
ret = tb_xdp_properties_changed_request(xd->tb->ctl, xd->route,
xd->properties_changed_retries, xd->local_uuid);
if (ret) {
- if (xd->properties_changed_retries-- > 0)
+ if (xd->properties_changed_retries-- > 0) {
+ dev_dbg(&xd->dev,
+ "failed to send properties changed notification, retrying\n");
queue_delayed_work(xd->tb->wq,
&xd->properties_changed_work,
msecs_to_jiffies(1000));
+ }
+ dev_err(&xd->dev, "failed to send properties changed notification\n");
return;
}
@@ -1390,6 +1412,10 @@ struct tb_xdomain *tb_xdomain_alloc(struct tb *tb, struct device *parent,
xd->dev.groups = xdomain_attr_groups;
dev_set_name(&xd->dev, "%u-%llx", tb->index, route);
+ dev_dbg(&xd->dev, "local UUID %pUb\n", local_uuid);
+ if (remote_uuid)
+ dev_dbg(&xd->dev, "remote UUID %pUb\n", remote_uuid);
+
/*
* This keeps the DMA powered on as long as we have active
* connection to another host.
@@ -1452,10 +1478,12 @@ void tb_xdomain_remove(struct tb_xdomain *xd)
pm_runtime_put_noidle(&xd->dev);
pm_runtime_set_suspended(&xd->dev);
- if (!device_is_registered(&xd->dev))
+ if (!device_is_registered(&xd->dev)) {
put_device(&xd->dev);
- else
+ } else {
+ dev_info(&xd->dev, "host disconnected\n");
device_unregister(&xd->dev);
+ }
}
/**
--
2.30.1
next prev parent reply other threads:[~2021-03-04 12:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 12:31 [PATCH 00/18] thunderbolt: Align with USB4 inter-domain and DROM specs Mika Westerberg
2021-03-04 12:31 ` [PATCH 01/18] thunderbolt: Disable retry logic for intra-domain control packets Mika Westerberg
2021-03-04 12:31 ` [PATCH 02/18] thunderbolt: Do not pass timeout for tb_cfg_reset() Mika Westerberg
2021-03-04 12:31 ` [PATCH 03/18] thunderbolt: Decrease control channel timeout for software connection manager Mika Westerberg
2021-03-04 12:31 ` [PATCH 04/18] Documentation / thunderbolt: Drop speed/lanes entries for XDomain Mika Westerberg
2021-03-04 12:31 ` Mika Westerberg [this message]
2021-03-04 12:31 ` [PATCH 06/18] thunderbolt: Do not re-establish XDomain DMA paths automatically Mika Westerberg
2021-03-04 12:31 ` [PATCH 07/18] thunderbolt: Use pseudo-random number as initial property block generation Mika Westerberg
2021-03-04 12:31 ` [PATCH 08/18] thunderbolt: Align XDomain protocol timeouts with the spec Mika Westerberg
2021-03-04 12:31 ` [PATCH 09/18] thunderbolt: Add tb_property_copy_dir() Mika Westerberg
2021-03-04 12:31 ` [PATCH 10/18] thunderbolt: Add support for maxhopid XDomain property Mika Westerberg
2021-03-04 12:31 ` [PATCH 11/18] thunderbolt: Use dedicated flow control for DMA tunnels Mika Westerberg
2021-03-04 12:31 ` [PATCH 12/18] thunderbolt: Drop unused tb_port_set_initial_credits() Mika Westerberg
2021-03-04 12:31 ` [PATCH 13/18] thunderbolt: Allow multiple DMA tunnels over a single XDomain connection Mika Westerberg
2021-03-04 12:31 ` [PATCH 14/18] net: thunderbolt: Align the driver to the USB4 networking spec Mika Westerberg
2021-03-04 12:31 ` [PATCH 15/18] thunderbolt: Add KUnit tests for XDomain properties Mika Westerberg
2021-03-04 12:31 ` [PATCH 16/18] thunderbolt: Add KUnit tests for DMA tunnels Mika Westerberg
2021-03-04 12:31 ` [PATCH 17/18] thunderbolt: Check quirks in tb_switch_add() Mika Westerberg
2021-03-04 12:31 ` [PATCH 18/18] thunderbolt: Add support for USB4 DROM Mika Westerberg
2021-03-18 15:30 ` [PATCH 00/18] thunderbolt: Align with USB4 inter-domain and DROM specs Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210304123125.43630-6-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=davem@davemloft.net \
--cc=isaac.hazan@intel.com \
--cc=kuba@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=michael.jamet@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).