From owner-svn-src-stable@FreeBSD.ORG Sun Jan 12 21:21:20 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AC7F187; Sun, 12 Jan 2014 21:21:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6BD37123D; Sun, 12 Jan 2014 21:21:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CLLK3K017926; Sun, 12 Jan 2014 21:21:20 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CLLJWc017922; Sun, 12 Jan 2014 21:21:19 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401122121.s0CLLJWc017922@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 12 Jan 2014 21:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r260575 - in stable/9/sys/dev/usb: . storage wlan X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 21:21:20 -0000 Author: hselasky Date: Sun Jan 12 21:21:19 2014 New Revision: 260575 URL: http://svnweb.freebsd.org/changeset/base/260575 Log: MFC r244607 and r244650: Fix regression issues after r244503. PR: usb/185628 Modified: stable/9/sys/dev/usb/storage/ustorage_fs.c stable/9/sys/dev/usb/usb_msctest.c stable/9/sys/dev/usb/wlan/if_urtw.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- stable/9/sys/dev/usb/storage/ustorage_fs.c Sun Jan 12 21:19:49 2014 (r260574) +++ stable/9/sys/dev/usb/storage/ustorage_fs.c Sun Jan 12 21:21:19 2014 (r260575) @@ -603,6 +603,8 @@ tr_setup: usbd_xfer_set_stall(xfer); DPRINTF("stall pipe\n"); } + usbd_xfer_set_frame_len(xfer, 0, + sizeof(ustorage_fs_bbb_cbw_t)); usbd_transfer_submit(xfer); break; @@ -827,6 +829,8 @@ tr_setup: sc->sc_transfer.data_error = 0; usbd_xfer_set_stall(xfer); } + usbd_xfer_set_frame_len(xfer, 0, + sizeof(ustorage_fs_bbb_csw_t)); usbd_transfer_submit(xfer); break; Modified: stable/9/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/9/sys/dev/usb/usb_msctest.c Sun Jan 12 21:19:49 2014 (r260574) +++ stable/9/sys/dev/usb/usb_msctest.c Sun Jan 12 21:21:19 2014 (r260575) @@ -83,7 +83,7 @@ enum { DIR_NONE, }; -#define SCSI_MAX_LEN 0x100 +#define SCSI_MAX_LEN MAX(0x100, BULK_SIZE) #define SCSI_INQ_LEN 0x24 #define SCSI_SENSE_LEN 0xFF @@ -150,6 +150,7 @@ struct bbb_transfer { usb_size_t data_rem; /* bytes */ usb_timeout_t data_timeout; /* ms */ usb_frlength_t actlen; /* bytes */ + usb_frlength_t buffer_size; /* bytes */ uint8_t cmd_len; /* bytes */ uint8_t dir; @@ -192,7 +193,7 @@ static const struct usb_config bbb_confi .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .bufsize = MAX(SCSI_MAX_LEN, BULK_SIZE), + .bufsize = SCSI_MAX_LEN, .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, .callback = &bbb_data_read_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ @@ -211,7 +212,7 @@ static const struct usb_config bbb_confi .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = BULK_SIZE, + .bufsize = SCSI_MAX_LEN, .flags = {.ext_buffer = 1,.proxy_buffer = 1,}, .callback = &bbb_data_write_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ @@ -299,6 +300,8 @@ bbb_command_callback(struct usb_xfer *xf sc->cbw->bCDBLength = sizeof(sc->cbw->CBWCDB); DPRINTFN(0, "Truncating long command\n"); } + usbd_xfer_set_frame_len(xfer, 0, + sizeof(struct bbb_cbw)); usbd_transfer_submit(xfer); break; @@ -385,7 +388,7 @@ bbb_data_write_callback(struct usb_xfer if (sc->data_rem == 0) { bbb_transfer_start(sc, ST_STATUS); - return; + break; } if (max_bulk > sc->data_rem) { max_bulk = sc->data_rem; @@ -393,7 +396,7 @@ bbb_data_write_callback(struct usb_xfer usbd_xfer_set_timeout(xfer, sc->data_timeout); usbd_xfer_set_frame_data(xfer, 0, sc->data_ptr, max_bulk); usbd_transfer_submit(xfer); - return; + break; default: /* Error */ if (error == USB_ERR_CANCELLED) { @@ -401,8 +404,7 @@ bbb_data_write_callback(struct usb_xfer } else { bbb_transfer_start(sc, ST_DATA_WR_CS); } - return; - + break; } } @@ -437,6 +439,8 @@ bbb_status_callback(struct usb_xfer *xfe break; case USB_ST_SETUP: + usbd_xfer_set_frame_len(xfer, 0, + sizeof(struct bbb_csw)); usbd_transfer_submit(xfer); break; @@ -548,6 +552,8 @@ bbb_attach(struct usb_device *udev, uint /* store pointer to DMA buffers */ sc->buffer = usbd_xfer_get_frame_buffer( sc->xfer[ST_DATA_RD], 0); + sc->buffer_size = + usbd_xfer_max_len(sc->xfer[ST_DATA_RD]); sc->cbw = usbd_xfer_get_frame_buffer( sc->xfer[ST_COMMAND], 0); sc->csw = usbd_xfer_get_frame_buffer( @@ -828,8 +834,8 @@ usb_msc_eject(struct usb_device *udev, u * TCTMobile needs DIR_IN flag. To get it, we * supply a dummy data with the command. */ - err = bbb_command_start(sc, DIR_IN, 0, &sc->buffer, - sizeof(sc->buffer), &scsi_tct_eject, + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + sc->buffer_size, &scsi_tct_eject, sizeof(scsi_tct_eject), USB_MS_HZ); break; default: Modified: stable/9/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_urtw.c Sun Jan 12 21:19:49 2014 (r260574) +++ stable/9/sys/dev/usb/wlan/if_urtw.c Sun Jan 12 21:21:19 2014 (r260575) @@ -4179,6 +4179,7 @@ urtw_bulk_tx_status_callback(struct usb_ case USB_ST_SETUP: setup: memcpy(dma_buf, &sc->sc_txstatus, sizeof(uint64_t)); + usbd_xfer_set_frame_len(xfer, 0, sizeof(uint64_t)); usbd_transfer_submit(xfer); break; default: