Skip to content

Commit 9c0c11b

Browse files
matnymangregkh
authored andcommitted
xhci: support setting interrupt moderation IMOD for secondary interrupters
Allow creators of seconday interrupters to specify the interrupt moderation interval value in nanoseconds when creating the interrupter. If not sure what value to use then use the xhci driver default xhci->imod_interval Suggested-by: Wesley Cheng <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f81dfa3 commit 9c0c11b

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

drivers/usb/host/xhci-mem.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2332,7 +2332,8 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir,
23322332
}
23332333

23342334
struct xhci_interrupter *
2335-
xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs)
2335+
xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs,
2336+
u32 imod_interval)
23362337
{
23372338
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
23382339
struct xhci_interrupter *ir;
@@ -2365,6 +2366,11 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs)
23652366
return NULL;
23662367
}
23672368

2369+
err = xhci_set_interrupter_moderation(ir, imod_interval);
2370+
if (err)
2371+
xhci_warn(xhci, "Failed to set interrupter %d moderation to %uns\n",
2372+
i, imod_interval);
2373+
23682374
xhci_dbg(xhci, "Add secondary interrupter %d, max interrupters %d\n",
23692375
i, xhci->max_interrupters);
23702376

drivers/usb/host/xhci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ static int xhci_disable_interrupter(struct xhci_interrupter *ir)
347347
}
348348

349349
/* interrupt moderation interval imod_interval in nanoseconds */
350-
static int xhci_set_interrupter_moderation(struct xhci_interrupter *ir,
351-
u32 imod_interval)
350+
int xhci_set_interrupter_moderation(struct xhci_interrupter *ir,
351+
u32 imod_interval)
352352
{
353353
u32 imod;
354354

drivers/usb/host/xhci.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,8 @@ struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci,
18261826
void xhci_free_container_ctx(struct xhci_hcd *xhci,
18271827
struct xhci_container_ctx *ctx);
18281828
struct xhci_interrupter *
1829-
xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs);
1829+
xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs,
1830+
u32 imod_interval);
18301831
void xhci_remove_secondary_interrupter(struct usb_hcd
18311832
*hcd, struct xhci_interrupter *ir);
18321833

@@ -1866,6 +1867,8 @@ int xhci_alloc_tt_info(struct xhci_hcd *xhci,
18661867
struct xhci_virt_device *virt_dev,
18671868
struct usb_device *hdev,
18681869
struct usb_tt *tt, gfp_t mem_flags);
1870+
int xhci_set_interrupter_moderation(struct xhci_interrupter *ir,
1871+
u32 imod_interval);
18691872

18701873
/* xHCI ring, segment, TRB, and TD functions */
18711874
dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, union xhci_trb *trb);

0 commit comments

Comments
 (0)