Skip to content

Commit 9891ca7

Browse files
natnat
authored andcommitted
Don't generate duplicate events when sending ZLP.
Patch from sc_dying as posted to tech-kern. Addresses PR/59678. XXX pullup -11, pullup -10.
1 parent 5c7608c commit 9891ca7

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.191 2025/10/05 20:04:30 riastradh Exp $ */
1+
/* $NetBSD: xhci.c,v 1.192 2025/10/10 20:21:05 nat 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.191 2025/10/05 20:04:30 riastradh Exp $");
37+
__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.192 2025/10/10 20:21:05 nat Exp $");
3838

3939
#ifdef _KERNEL_OPT
4040
#include "opt_usb.h"
@@ -2576,6 +2576,20 @@ xhci_event_transfer(struct xhci_softc * const sc,
25762576
return;
25772577
}
25782578

2579+
/*
2580+
* If next event will be from zero-length packet,
2581+
* suppress notification of first event.
2582+
*/
2583+
if (xfertype == UE_BULK &&
2584+
err == USBD_NORMAL_COMPLETION &&
2585+
(xfer->ux_flags & USBD_FORCE_SHORT_XFER) &&
2586+
XHCI_TRB_2_REM_GET(le32toh(xr->xr_trb[idx].trb_2)) != 0) {
2587+
DPRINTFN(100, "short xfer %#jx: suppress notification status "
2588+
"%ju pipe %#jx", (uintptr_t)xfer, xfer->ux_status,
2589+
(uintptr_t)xfer->ux_pipe, 0);
2590+
return;
2591+
}
2592+
25792593
if ((trb_3 & XHCI_TRB_3_ED_BIT) == 0 ||
25802594
(trb_0 & 0x3) == 0x0) {
25812595
/*

0 commit comments

Comments
 (0)