Skip to contentSkip to conversation

thunderbolt: Fix xdomain rx_lanes_show and tx_lanes_show

PATCH New Mohammad Rahimi 2 participants 3 messages Jan 14, 2024 – Jan 22, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thunderbolt: Fix xdomain rx_lanes_show and tx_lanes_show

While reviewing the USB4 Gen4 code, I came across a section that appears to be incorrect. Despite consulting the USB4 v2 and Inter-Domain specifications, I couldn't find a justification for it. Please take a look at the patch email and let me know if there's anything I might be overlooking. Thank you.

#1 lore raw

PATCH 1/1 thunderbolt: Fix xdomain rx_lanes_show and tx_lanes_show

If the Inter-Domain link is operating in asymmetric TB_LINK_WIDTH_ASYM_TX mode, the rx_lanes_show should return 1 since there is only one receiver and tx_lanes_show should return 3 since there are 3 transmitters.

---
 drivers/thunderbolt/xdomain.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thunderbolt/xdomain.c +4 -4
index 9803f0bbf20d..3e5c8aa06bed 100644
@@ -1786,13 +1786,13 @@ static ssize_t rx_lanes_show(struct device *dev, struct device_attribute *attr,
 
 	switch (xd->link_width) {
 	case TB_LINK_WIDTH_SINGLE:
-	case TB_LINK_WIDTH_ASYM_RX:
+	case TB_LINK_WIDTH_ASYM_TX:
 		width = 1;
 		break;
 	case TB_LINK_WIDTH_DUAL:
 		width = 2;
 		break;
-	case TB_LINK_WIDTH_ASYM_TX:
+	case TB_LINK_WIDTH_ASYM_RX:
 		width = 3;
 		break;
 	default:
@@ -1812,13 +1812,13 @@ static ssize_t tx_lanes_show(struct device *dev, struct device_attribute *attr,
 
 	switch (xd->link_width) {
 	case TB_LINK_WIDTH_SINGLE:
-	case TB_LINK_WIDTH_ASYM_TX:
+	case TB_LINK_WIDTH_ASYM_RX:
 		width = 1;
 		break;
 	case TB_LINK_WIDTH_DUAL:
 		width = 2;
 		break;
-	case TB_LINK_WIDTH_ASYM_RX:
+	case TB_LINK_WIDTH_ASYM_TX:
 		width = 3;
 		break;
 	default:
Signature · 1 line
2.39.2
#2 lore raw
Quoted 5 lines · Mohammad Rahimi

If the Inter-Domain link is operating in asymmetric TB_LINK_WIDTH_ASYM_TX mode, the rx_lanes_show should return 1 since there is only one receiver and tx_lanes_show should return 3 since there are 3 transmitters.

Applied to thunderbolt.git/next, thanks!

This is kind of cosmetic thing because it is not allowed to have asymmetric link over host-to-host connection according to the spec but maybe somewhere in the future...