From owner-p4-projects@FreeBSD.ORG Fri May 18 20:19:55 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 417CE16A407; Fri, 18 May 2007 20:19:55 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14F1B16A402 for ; Fri, 18 May 2007 20:19:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 039CB13C457 for ; Fri, 18 May 2007 20:19:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l4IKJsFR071031 for ; Fri, 18 May 2007 20:19:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l4IKJs94071021 for perforce@freebsd.org; Fri, 18 May 2007 20:19:54 GMT (envelope-from hselasky@FreeBSD.org) Date: Fri, 18 May 2007 20:19:54 GMT Message-Id: <200705182019.l4IKJs94071021@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 120019 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2007 20:19:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=120019 Change 120019 by hselasky@hselasky_mini_itx on 2007/05/18 20:19:29 Fix isochronous support in the Linux USB compat layer. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#2 edit .. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.h#2 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#2 (text+ko) ==== @@ -64,6 +64,7 @@ static usb_complete_t usb_linux_wait_complete; +static uint16_t usb_max_isoc_frames(struct usb_device *dev); static int32_t usb_start_wait_urb(struct urb *urb, uint32_t timeout, uint32_t *p_actlen); static const struct usb_device_id * usb_linux_lookup_id(struct usb_driver *udrv, struct usb_attach_arg *uaa); static struct usb_driver * usb_linux_get_usb_driver(struct usb_linux_softc *sc); @@ -347,6 +348,14 @@ /*------------------------------------------------------------------------* * Linux emulation layer *------------------------------------------------------------------------*/ + +static uint16_t +usb_max_isoc_frames(struct usb_device *dev) +{ + return ((usbd_get_speed(dev->bsd_udev) == USB_SPEED_HIGH) ? + USB_MAX_HIGH_SPEED_ISOC_FRAMES : USB_MAX_FULL_SPEED_ISOC_FRAMES); +} + int32_t usb_submit_urb(struct urb *urb, gfp_t mem_flags) { @@ -669,6 +678,7 @@ cfg[0].direction = addr & (UE_DIR_OUT|UE_DIR_IN); cfg[0].callback = &usb_linux_isoc_callback; cfg[0].bufsize = 0; /* use wMaxPacketSize */ + cfg[0].frames = usb_max_isoc_frames(dev); bcopy(cfg + 0, cfg + 1, sizeof(*cfg)); @@ -1189,6 +1199,12 @@ TAILQ_REMOVE(&(uhe->bsd_urb_list), urb, bsd_urb_list); urb->bsd_urb_list.tqe_prev = NULL; + x = usb_max_isoc_frames(urb->dev); + if (urb->number_of_packets > x) { + /* XXX simply truncate the transfer */ + urb->number_of_packets = x; + } + } else { /* already got a transfer (should not happen) */ ==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.h#2 (text+ko) ==== @@ -49,6 +49,9 @@ typedef void (usb_complete_t)(struct urb *, struct pt_regs *); typedef uint32_t gfp_t; +#define USB_MAX_FULL_SPEED_ISOC_FRAMES (60 * 1) +#define USB_MAX_HIGH_SPEED_ISOC_FRAMES (60 * 8) + /* * Linux compatible USB device drivers put their device information * into the "usb_device_id" structure using the "USB_DEVICE()" macro.