From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: linux-media@vger.kernel.org, gregkh@linuxfoundation.org,
laurent.pinchart@ideasonboard.com, hdegoede@redhat.com,
Thinh.Nguyen@synopsys.com,
"Amardeep Rai" <amardeep.rai@intel.com>,
"Kannappan R" <r.kannappan@intel.com>,
"Mathias Nyman" <mathias.nyman@linux.intel.com>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Michał Pecio" <michal.pecio@gmail.com>
Subject: [PATCH v5 8/9] usb: core: support eUSB2 double bandwidth large isoc URB frames
Date: Wed, 20 Aug 2025 17:38:23 +0300 [thread overview]
Message-ID: <20250820143824.551777-9-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20250820143824.551777-1-sakari.ailus@linux.intel.com>
From: "Rai, Amardeep" <amardeep.rai@intel.com>
eUSB2 double isochronous in bandwidth devices support up to 6 transactions
per microframe, and thus doubles the total bytes possible to receive per
microframe.
Support larger URB isoc frame sizes for eUSB2 double isoc in endpoints.
Also usb_endpoint_maxp() returns a natural number so there's no need to
assume it could be < 0.
Signed-off-by: Rai, Amardeep <amardeep.rai@intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Co-developed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
drivers/usb/core/urb.c | 14 ++++++++++----
drivers/usb/core/usb.c | 2 ++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 7a76d5a62db1..ff8df16cca35 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -372,6 +372,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
struct usb_host_endpoint *ep;
int is_out;
unsigned int allowed;
+ bool is_eusb2_isoch_double;
if (!urb || !urb->complete)
return -EINVAL;
@@ -434,7 +435,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
return -ENODEV;
max = usb_endpoint_maxp(&ep->desc);
- if (max <= 0) {
+ is_eusb2_isoch_double = usb_endpoint_is_hs_isoc_double(dev, ep);
+ if (!max && !is_eusb2_isoch_double) {
dev_dbg(&dev->dev,
"bogus endpoint ep%d%s in %s (bad maxpacket %d)\n",
usb_endpoint_num(&ep->desc), is_out ? "out" : "in",
@@ -467,9 +469,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
max = le32_to_cpu(isoc_ep_comp->dwBytesPerInterval);
}
- /* "high bandwidth" mode, 1-3 packets/uframe? */
- if (dev->speed == USB_SPEED_HIGH)
- max *= usb_endpoint_maxp_mult(&ep->desc);
+ /* High speed, 1-3 packets/uframe, max 6 for eUSB2 double bw */
+ if (dev->speed == USB_SPEED_HIGH) {
+ if (is_eusb2_isoch_double)
+ max = le32_to_cpu(ep->eusb2_isoc_ep_comp.dwBytesPerInterval);
+ else
+ max *= usb_endpoint_maxp_mult(&ep->desc);
+ }
if (urb->number_of_packets <= 0)
return -EINVAL;
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 939dc4aafb89..b88b6271cb30 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1134,6 +1134,8 @@ u32 usb_endpoint_max_periodic_payload(struct usb_device *udev,
case USB_SPEED_SUPER:
return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval);
default:
+ if (usb_endpoint_is_hs_isoc_double(udev, ep))
+ return le32_to_cpu(ep->eusb2_isoc_ep_comp.dwBytesPerInterval);
return usb_endpoint_maxp(&ep->desc) * usb_endpoint_maxp_mult(&ep->desc);
}
}
--
2.47.2
next prev parent reply other threads:[~2025-08-20 14:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 14:38 [PATCH v5 0/9] eUSB2 Double Isochronous IN Bandwidth support Sakari Ailus
2025-08-20 14:38 ` [PATCH v5 1/9] usb: core: Use le16_to_cpu() to read __le16 value in usb_parse_endpoint() Sakari Ailus
2025-08-26 12:50 ` Mathias Nyman
2025-08-20 14:38 ` [PATCH v5 2/9] usb: core: Parse eUSB2 companion descriptors for high speed devices only Sakari Ailus
2025-08-26 12:50 ` Mathias Nyman
2025-08-20 14:38 ` [PATCH v5 3/9] usb: core: eUSB2 companion descriptor is for isoc IN endpoints only Sakari Ailus
2025-08-26 12:52 ` Mathias Nyman
2025-08-20 14:38 ` [PATCH v5 4/9] usb: core: Add a function to get USB version independent periodic payload Sakari Ailus
2025-08-20 14:38 ` [PATCH v5 5/9] usb: xhci: Use usb_endpoint_max_periodic_payload() Sakari Ailus
2025-08-21 8:22 ` Mathias Nyman
2025-08-20 14:38 ` [PATCH v5 6/9] usb: core: Introduce usb_endpoint_is_hs_isoc_double() Sakari Ailus
2025-08-26 12:53 ` Mathias Nyman
2025-08-20 14:38 ` [PATCH v5 7/9] usb: xhci: Add host support for eUSB2 double isochronous bandwidth devices Sakari Ailus
2025-08-20 14:38 ` Sakari Ailus [this message]
2025-08-20 14:38 ` [PATCH v5 9/9] media: uvcvideo: eUSB2 double isochronous bandwidth support Sakari Ailus
2025-08-20 15:21 ` Ricardo Ribalda
2025-08-21 9:51 ` Sakari Ailus
2025-08-26 13:28 ` [PATCH v5 0/9] eUSB2 Double Isochronous IN Bandwidth support Mathias Nyman
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=20250820143824.551777-9-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=amardeep.rai@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=michal.pecio@gmail.com \
--cc=r.kannappan@intel.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;
as well as URLs for NNTP newsgroup(s).