From owner-svn-src-stable-10@freebsd.org Sun Jun 9 08:22:39 2019 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4417115C1BC6; Sun, 9 Jun 2019 08:22:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D92EB8F46B; Sun, 9 Jun 2019 08:22:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEA3435E; Sun, 9 Jun 2019 08:22:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x598MclU010656; Sun, 9 Jun 2019 08:22:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x598Mca5010655; Sun, 9 Jun 2019 08:22:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906090822.x598Mca5010655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 9 Jun 2019 08:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r348832 - stable/10/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 348832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D92EB8F46B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2019 08:22:39 -0000 Author: hselasky Date: Sun Jun 9 08:22:38 2019 New Revision: 348832 URL: https://svnweb.freebsd.org/changeset/base/348832 Log: MFC r348603: Make sure the DMA tags get freed in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Sun Jun 9 08:19:45 2019 (r348831) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Sun Jun 9 08:22:38 2019 (r348832) @@ -772,6 +772,7 @@ mlx5e_destroy_rq(struct mlx5e_rq *rq) } free(rq->mbuf, M_MLX5EN); mlx5_wq_destroy(&rq->wq_ctrl); + bus_dma_tag_destroy(rq->dma_tag); } static int @@ -1098,6 +1099,7 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq) } if (sq->br != NULL) buf_ring_free(sq->br, M_MLX5EN); + bus_dma_tag_destroy(sq->dma_tag); } int From owner-svn-src-stable-10@freebsd.org Mon Jun 10 13:17:40 2019 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2987F15BEE8A; Mon, 10 Jun 2019 13:17:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F66172767; Mon, 10 Jun 2019 13:17:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A6B11ABC5; Mon, 10 Jun 2019 13:17:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5ADHdOD018639; Mon, 10 Jun 2019 13:17:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5ADHdrf018638; Mon, 10 Jun 2019 13:17:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906101317.x5ADHdrf018638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Jun 2019 13:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r348853 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/usb/controller X-SVN-Commit-Revision: 348853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8F66172767 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.91)[-0.909,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2019 13:17:40 -0000 Author: hselasky Date: Mon Jun 10 13:17:39 2019 New Revision: 348853 URL: https://svnweb.freebsd.org/changeset/base/348853 Log: MFC r348604: In xhci(4) there is no stream ID in the completion TRB. Instead iterate all the stream IDs in stream mode to find the matching USB transfer. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/controller/xhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Mon Jun 10 13:16:49 2019 (r348852) +++ stable/10/sys/dev/usb/controller/xhci.c Mon Jun 10 13:17:39 2019 (r348853) @@ -895,7 +895,7 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci uint64_t td_event; uint32_t temp; uint32_t remainder; - uint16_t stream_id; + uint16_t stream_id = 0; uint16_t i; uint8_t status; uint8_t halted; @@ -908,7 +908,6 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci remainder = XHCI_TRB_2_REM_GET(temp); status = XHCI_TRB_2_ERROR_GET(temp); - stream_id = XHCI_TRB_2_STREAM_GET(temp); temp = le32toh(trb->dwTrb3); epno = XHCI_TRB_3_EP_GET(temp); @@ -918,8 +917,8 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci halted = (status != XHCI_TRB_ERROR_SHORT_PKT && status != XHCI_TRB_ERROR_SUCCESS); - DPRINTF("slot=%u epno=%u stream=%u remainder=%u status=%u\n", - index, epno, stream_id, remainder, status); + DPRINTF("slot=%u epno=%u remainder=%u status=%u\n", + index, epno, remainder, status); if (index > sc->sc_noslot) { DPRINTF("Invalid slot.\n"); @@ -933,18 +932,19 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci pepext = &sc->sc_hw.devs[index].endp[epno]; - if (pepext->trb_ep_mode != USB_EP_MODE_STREAMS) { - stream_id = 0; - DPRINTF("stream_id=0\n"); - } else if (stream_id >= XHCI_MAX_STREAMS) { - DPRINTF("Invalid stream ID.\n"); - return; - } - /* try to find the USB transfer that generated the event */ - for (i = 0; i != (XHCI_MAX_TRANSFERS - 1); i++) { + for (i = 0;; i++) { struct usb_xfer *xfer; struct xhci_td *td; + + if (i == (XHCI_MAX_TRANSFERS - 1)) { + if (pepext->trb_ep_mode != USB_EP_MODE_STREAMS || + stream_id == (XHCI_MAX_STREAMS - 1)) + break; + stream_id++; + i = 0; + DPRINTFN(5, "stream_id=%u\n", stream_id); + } xfer = pepext->xfer[i + (XHCI_MAX_TRANSFERS * stream_id)]; if (xfer == NULL) From owner-svn-src-stable-10@freebsd.org Mon Jun 10 13:37:39 2019 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36A4315BF979; Mon, 10 Jun 2019 13:37:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C938D73670; Mon, 10 Jun 2019 13:37:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A51561AF1C; Mon, 10 Jun 2019 13:37:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5ADbcgO028952; Mon, 10 Jun 2019 13:37:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5ADbcmH028951; Mon, 10 Jun 2019 13:37:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906101337.x5ADbcmH028951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Jun 2019 13:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r348857 - stable/10/sys/dev/usb X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/usb X-SVN-Commit-Revision: 348857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C938D73670 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2019 13:37:39 -0000 Author: hselasky Date: Mon Jun 10 13:37:38 2019 New Revision: 348857 URL: https://svnweb.freebsd.org/changeset/base/348857 Log: MFC r348631: In usb(4) fix a lost completion event issue towards libusb(3). It may happen if a USB transfer is cancelled that we need to fake a completion event. Implement missing support in ugen_fs_copy_out() to handle this. This fixes issues with webcamd(8) and firefox. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/usb_generic.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usb_generic.c ============================================================================== --- stable/10/sys/dev/usb/usb_generic.c Mon Jun 10 13:36:53 2019 (r348856) +++ stable/10/sys/dev/usb/usb_generic.c Mon Jun 10 13:37:38 2019 (r348857) @@ -1218,6 +1218,40 @@ complete: } static int +ugen_fs_copy_out_cancelled(struct usb_fs_endpoint *fs_ep_uptr) +{ + struct usb_fs_endpoint fs_ep; + int error; + + error = copyin(fs_ep_uptr, &fs_ep, sizeof(fs_ep)); + if (error) + return (error); + + fs_ep.status = USB_ERR_CANCELLED; + fs_ep.aFrames = 0; + fs_ep.isoc_time_complete = 0; + + /* update "aFrames" */ + error = copyout(&fs_ep.aFrames, &fs_ep_uptr->aFrames, + sizeof(fs_ep.aFrames)); + if (error) + goto done; + + /* update "isoc_time_complete" */ + error = copyout(&fs_ep.isoc_time_complete, + &fs_ep_uptr->isoc_time_complete, + sizeof(fs_ep.isoc_time_complete)); + if (error) + goto done; + + /* update "status" */ + error = copyout(&fs_ep.status, &fs_ep_uptr->status, + sizeof(fs_ep.status)); +done: + return (error); +} + +static int ugen_fs_copy_out(struct usb_fifo *f, uint8_t ep_index) { struct usb_device_request *req; @@ -1242,8 +1276,13 @@ ugen_fs_copy_out(struct usb_fifo *f, uint8_t ep_index) return (EINVAL); mtx_lock(f->priv_mtx); - if (usbd_transfer_pending(xfer)) { + if (!xfer->flags_int.transferring && + !xfer->flags_int.started) { mtx_unlock(f->priv_mtx); + DPRINTF("Returning fake cancel event\n"); + return (ugen_fs_copy_out_cancelled(f->fs_ep_ptr + ep_index)); + } else if (usbd_transfer_pending(xfer)) { + mtx_unlock(f->priv_mtx); return (EBUSY); /* should not happen */ } mtx_unlock(f->priv_mtx); @@ -1363,6 +1402,7 @@ complete: sizeof(fs_ep.isoc_time_complete)); if (error) goto done; + /* update "status" */ error = copyout(&fs_ep.status, &fs_ep_uptr->status, sizeof(fs_ep.status)); @@ -1451,12 +1491,15 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, xfer = f->fs_xfer[u.pstart->ep_index]; if (usbd_transfer_pending(xfer)) { usbd_transfer_stop(xfer); + /* * Check if the USB transfer was stopped - * before it was even started. Else a cancel - * callback will be pending. + * before it was even started and fake a + * cancel event. */ - if (!xfer->flags_int.transferring) { + if (!xfer->flags_int.transferring && + !xfer->flags_int.started) { + DPRINTF("Issuing fake completion event\n"); ugen_fs_set_complete(xfer->priv_sc, USB_P2U(xfer->priv_fifo)); } From owner-svn-src-stable-10@freebsd.org Tue Jun 11 08:53:27 2019 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FA5015B3720; Tue, 11 Jun 2019 08:53:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D53678319A; Tue, 11 Jun 2019 08:53:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF82F274BC; Tue, 11 Jun 2019 08:53:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5B8rQWf041452; Tue, 11 Jun 2019 08:53:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5B8rQun041451; Tue, 11 Jun 2019 08:53:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201906110853.x5B8rQun041451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 11 Jun 2019 08:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r348895 - stable/10/lib/libusb X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/lib/libusb X-SVN-Commit-Revision: 348895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D53678319A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2019 08:53:27 -0000 Author: hselasky Date: Tue Jun 11 08:53:26 2019 New Revision: 348895 URL: https://svnweb.freebsd.org/changeset/base/348895 Log: MFC r348797: Fix for reading the configuration descriptor in libusb. Catch invalid configuration descriptor reads early on to avoid issues with devices that don't check for a valid USB configuration read request. Submitted by: takahiro.kurosawa@gmail.com PR: 238412 Modified: stable/10/lib/libusb/libusb20.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libusb/libusb20.c ============================================================================== --- stable/10/lib/libusb/libusb20.c Tue Jun 11 08:52:48 2019 (r348894) +++ stable/10/lib/libusb/libusb20.c Tue Jun 11 08:53:26 2019 (r348895) @@ -935,6 +935,14 @@ libusb20_dev_alloc_config(struct libusb20_device *pdev uint8_t do_close; int error; + /* + * Catch invalid configuration descriptor reads early on to + * avoid issues with devices that don't check for a valid USB + * configuration read request. + */ + if (configIndex >= pdev->ddesc.bNumConfigurations) + return (NULL); + if (!pdev->is_opened) { error = libusb20_dev_open(pdev, 0); if (error) {