Skip to content

Commit c237566

Browse files
Chunfeng Yungregkh
authored andcommitted
usb: xhci-mtk: fix fs isoc's transfer error
Due to the scheduler allocates the optimal bandwidth for FS ISOC endpoints, this may be not enough actually and causes data transfer error, so come up with an estimate that is no less than the worst case bandwidth used for any one mframe, but may be an over-estimate. Fixes: 451d391 ("usb: xhci-mtk: update fs bus bandwidth by bw_budget_table") Cc: [email protected] Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5f0b5f4 commit c237566

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

drivers/usb/host/xhci-mtk-sch.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
464464
*/
465465
for (j = 0; j < sch_ep->num_budget_microframes; j++) {
466466
k = XHCI_MTK_BW_INDEX(base + j);
467-
tmp = tt->fs_bus_bw[k] + sch_ep->bw_budget_table[j];
467+
tmp = tt->fs_bus_bw[k] + sch_ep->bw_cost_per_microframe;
468468
if (tmp > FS_PAYLOAD_MAX)
469469
return -ESCH_BW_OVERFLOW;
470470
}
@@ -538,19 +538,17 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
538538
static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used)
539539
{
540540
struct mu3h_sch_tt *tt = sch_ep->sch_tt;
541+
int bw_updated;
541542
u32 base;
542-
int i, j, k;
543+
int i, j;
544+
545+
bw_updated = sch_ep->bw_cost_per_microframe * (used ? 1 : -1);
543546

544547
for (i = 0; i < sch_ep->num_esit; i++) {
545548
base = sch_ep->offset + i * sch_ep->esit;
546549

547-
for (j = 0; j < sch_ep->num_budget_microframes; j++) {
548-
k = XHCI_MTK_BW_INDEX(base + j);
549-
if (used)
550-
tt->fs_bus_bw[k] += sch_ep->bw_budget_table[j];
551-
else
552-
tt->fs_bus_bw[k] -= sch_ep->bw_budget_table[j];
553-
}
550+
for (j = 0; j < sch_ep->num_budget_microframes; j++)
551+
tt->fs_bus_bw[XHCI_MTK_BW_INDEX(base + j)] += bw_updated;
554552
}
555553

556554
if (used)

0 commit comments

Comments
 (0)