Skip to content

Commit 2331754

Browse files
Pull up following revision(s) (requested by nat in ticket #50):
sys/dev/usb/xhci.c: revision 1.192 Don't generate duplicate events when sending ZLP. Patch from sc_dying as posted to tech-kern. Addresses PR/59678.
1 parent 4844fe1 commit 2331754

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

sys/dev/usb/xhci.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: xhci.c,v 1.188.2.1 2025/09/12 14:48:04 snj Exp $ */
1+
/* $NetBSD: xhci.c,v 1.188.2.2 2025/10/11 10:43:25 martin Exp $ */
22

33
/*
44
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
3434
*/
3535

3636
#include <sys/cdefs.h>
37-
__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.188.2.1 2025/09/12 14:48:04 snj Exp $");
37+
__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.188.2.2 2025/10/11 10:43:25 martin Exp $");
3838

3939
#ifdef _KERNEL_OPT
4040
#include "opt_usb.h"
@@ -2561,6 +2561,20 @@ xhci_event_transfer(struct xhci_softc * const sc,
25612561
return;
25622562
}
25632563

2564+
/*
2565+
* If next event will be from zero-length packet,
2566+
* suppress notification of first event.
2567+
*/
2568+
if (xfertype == UE_BULK &&
2569+
err == USBD_NORMAL_COMPLETION &&
2570+
(xfer->ux_flags & USBD_FORCE_SHORT_XFER) &&
2571+
XHCI_TRB_2_REM_GET(le32toh(xr->xr_trb[idx].trb_2)) != 0) {
2572+
DPRINTFN(100, "short xfer %#jx: suppress notification status "
2573+
"%ju pipe %#jx", (uintptr_t)xfer, xfer->ux_status,
2574+
(uintptr_t)xfer->ux_pipe, 0);
2575+
return;
2576+
}
2577+
25642578
if ((trb_3 & XHCI_TRB_3_ED_BIT) == 0 ||
25652579
(trb_0 & 0x3) == 0x0) {
25662580
/*

0 commit comments

Comments
 (0)