mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kean Ren <rh_king@163.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mathias Nyman <mathias.nyman@intel.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	Griffin Kroah-Hartman <griffin@kroah.com>,
	Kuen-Han Tsai <khtsai@google.com>, Kees Cook <kees@kernel.org>,
	Nikhil Solanke <nikhilsolanke5@gmail.com>,
	Thorsten Blum <blum@kernel.org>, Kean Ren <rh_king@163.com>
Subject: [PATCH 1/2] usb: core: hub: recognise two-lane SuperSpeed sublinks as Gen 1x2
Date: Sun, 20 Sep 2026 10:52:42 +0800	[thread overview]
Message-ID: <20260920025308.2358862-2-rh_king@163.com> (raw)
In-Reply-To: <20260920025308.2358862-1-rh_king@163.com>

get_port_ssp_rate() rejects every matching sublink speed attribute whose
link protocol (LP) is not SuperSpeedPlus by jumping to the "unknown"
exit before it looks at the number of active lanes.

USB 3.2 Gen 1x2 runs two SuperSpeed (Gen 1) lanes, so the matching
sublink entry advertises LP = SuperSpeed while two lanes are in use.
The current code therefore returns USB_SSP_GEN_UNKNOWN for such a link
and the USB core falls back to USB_SPEED_SUPER, reporting 5000 Mbps.

Handle the two-lane cases before rejecting non-SuperSpeedPlus entries:

  >= 10 Gbps per lane and 2 lanes -> USB_SSP_GEN_2x2
  >=  5 Gbps per lane and 2 lanes -> USB_SSP_GEN_1x2

so that a genuine Gen 1x2 link is reported as 10000 Mbps instead of
5000 Mbps.

Signed-off-by: Kean Ren <rh_king@163.com>
---
 drivers/usb/core/hub.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 3345b3298daf..50f14dd6a41f 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2866,10 +2866,6 @@ static enum usb_ssp_rate get_port_ssp_rate(struct usb_device *hdev,
 			    type == USB_SSP_SUBLINK_SPEED_ST_ASYM_TX)
 				goto out;
 
-			if (FIELD_GET(USB_SSP_SUBLINK_SPEED_LP, attr) !=
-			    USB_SSP_SUBLINK_SPEED_LP_SSP)
-				goto out;
-
 			lse = FIELD_GET(USB_SSP_SUBLINK_SPEED_LSE, attr);
 			mantissa = FIELD_GET(USB_SSP_SUBLINK_SPEED_LSM, attr);
 
@@ -2877,14 +2873,28 @@ static enum usb_ssp_rate get_port_ssp_rate(struct usb_device *hdev,
 			for (; lse < USB_SSP_SUBLINK_SPEED_LSE_GBPS; lse++)
 				mantissa /= 1000;
 
-			if (mantissa >= 10 && lanes == 1)
-				return USB_SSP_GEN_2x1;
+			/*
+			 * Two active lanes mean USB 3.2 dual-lane operation.
+			 * A Gen 1x2 link uses SuperSpeed (Gen 1) signalling on
+			 * both lanes, so its sublink entry advertises the
+			 * SuperSpeed link protocol rather than SuperSpeedPlus.
+			 * Handle the two-lane cases before rejecting entries
+			 * that do not advertise SuperSpeedPlus.
+			 */
+			if (lanes == 2) {
+				if (mantissa >= 10)
+					return USB_SSP_GEN_2x2;
+				if (mantissa >= 5)
+					return USB_SSP_GEN_1x2;
+				goto out;
+			}
 
-			if (mantissa >= 10 && lanes == 2)
-				return USB_SSP_GEN_2x2;
+			if (FIELD_GET(USB_SSP_SUBLINK_SPEED_LP, attr) !=
+			    USB_SSP_SUBLINK_SPEED_LP_SSP)
+				goto out;
 
-			if (mantissa >= 5 && lanes == 2)
-				return USB_SSP_GEN_1x2;
+			if (mantissa >= 10)
+				return USB_SSP_GEN_2x1;
 
 			goto out;
 		}


  reply	other threads:[~2026-09-20  2:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  2:52 [PATCH 0/2] usb: fix ASM3242 reporting SuperSpeed for a Gen 2x2 link Kean Ren
2026-09-20  2:52 ` Kean Ren [this message]
2026-09-20  2:52 ` [PATCH 2/2] xhci: fix ASM3242 port speed report for Gen 2x2 links after cold boot Kean Ren

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=20260920025308.2358862-2-rh_king@163.com \
    --to=rh_king@163.com \
    --cc=blum@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=griffin@kroah.com \
    --cc=kees@kernel.org \
    --cc=khtsai@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=nikhilsolanke5@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®