Lines Matching refs:credits
39 /* Minimum number of credits needed for PCIe path */
42 * Number of credits we try to allocate for each DMA path if not limited
46 /* Minimum number of credits for DMA path */
51 MODULE_PARM_DESC(dma_credits, "specify custom credits for DMA tunnels (default: "
88 * tb_available_credits() - Available credits for PCIe and DMA
97 int credits, usb3, pcie, spare;
105 /* Add some credits for potential second DMA tunnel */
111 credits = tb_usable_credits(port);
118 ndp = (credits - (usb3 + pcie + spare)) /
125 credits -= ndp * (sw->min_dp_aux_credits + sw->min_dp_main_credits);
126 credits -= usb3;
131 return credits > 0 ? credits : 0;
206 unsigned int credits;
212 credits = min(sw->max_pcie_credits, available);
214 if (credits < TB_MIN_PCIE_CREDITS)
217 credits = max(TB_MIN_PCIE_CREDITS, credits);
220 credits = port->bonded ? 32 : 16;
222 credits = 7;
225 hop->initial_credits = credits;
1201 * Read the number of currently allocated NFC credits
1448 int credits;
1450 credits = tb_available_credits(port, NULL);
1452 credits -= sw->max_pcie_credits;
1453 credits -= port->dma_credits;
1455 return credits > 0 ? credits : 0;
1458 static int tb_dma_reserve_credits(struct tb_path_hop *hop, unsigned int credits)
1472 while (credits > available)
1473 credits--;
1475 tb_port_dbg(port, "reserving %u credits for DMA path\n",
1476 credits);
1478 port->dma_credits += credits;
1481 credits = port->bonded ? 14 : 6;
1483 credits = min(port->total_credits, credits);
1486 hop->initial_credits = credits;
1491 static int tb_dma_init_rx_path(struct tb_path *path, unsigned int credits)
1507 * the credits (except the ones reserved for control traffic).
1510 tmp = min(tb_usable_credits(hop->in_port), credits);
1517 ret = tb_dma_reserve_credits(&path->hops[i], credits);
1526 static int tb_dma_init_tx_path(struct tb_path *path, unsigned int credits)
1541 ret = tb_dma_reserve_credits(hop, credits);
1556 tb_port_dbg(port, "released %u DMA path credits\n",
1602 int credits;
1624 credits = min_not_zero(dma_credits, nhi->sw->max_dma_credits);
1632 if (tb_dma_init_rx_path(path, credits)) {
1644 if (tb_dma_init_tx_path(path, credits)) {
1852 unsigned int credits;
1855 credits = sw->max_usb3_credits;
1858 credits = port->bonded ? 32 : 16;
1860 credits = 7;
1863 hop->initial_credits = credits;