Lines Matching refs:credits
100 int credits, usb3, pcie, spare; in tb_available_credits() local
114 credits = tb_usable_credits(port); in tb_available_credits()
121 ndp = (credits - (usb3 + pcie + spare)) / in tb_available_credits()
128 credits -= ndp * (sw->min_dp_aux_credits + sw->min_dp_main_credits); in tb_available_credits()
129 credits -= usb3; in tb_available_credits()
134 return credits > 0 ? credits : 0; in tb_available_credits()
238 unsigned int credits; in tb_pci_init_credits() local
244 credits = min(sw->max_pcie_credits, available); in tb_pci_init_credits()
246 if (credits < TB_MIN_PCIE_CREDITS) in tb_pci_init_credits()
249 credits = max(TB_MIN_PCIE_CREDITS, credits); in tb_pci_init_credits()
252 credits = port->bonded ? 32 : 16; in tb_pci_init_credits()
254 credits = 7; in tb_pci_init_credits()
257 hop->initial_credits = credits; in tb_pci_init_credits()
1510 int credits; in tb_dma_available_credits() local
1512 credits = tb_available_credits(port, NULL); in tb_dma_available_credits()
1514 credits -= sw->max_pcie_credits; in tb_dma_available_credits()
1515 credits -= port->dma_credits; in tb_dma_available_credits()
1517 return credits > 0 ? credits : 0; in tb_dma_available_credits()
1520 static int tb_dma_reserve_credits(struct tb_path_hop *hop, unsigned int credits) in tb_dma_reserve_credits() argument
1534 while (credits > available) in tb_dma_reserve_credits()
1535 credits--; in tb_dma_reserve_credits()
1538 credits); in tb_dma_reserve_credits()
1540 port->dma_credits += credits; in tb_dma_reserve_credits()
1543 credits = port->bonded ? 14 : 6; in tb_dma_reserve_credits()
1545 credits = min(port->total_credits, credits); in tb_dma_reserve_credits()
1548 hop->initial_credits = credits; in tb_dma_reserve_credits()
1553 static int tb_dma_init_rx_path(struct tb_path *path, unsigned int credits) in tb_dma_init_rx_path() argument
1572 tmp = min(tb_usable_credits(hop->in_port), credits); in tb_dma_init_rx_path()
1579 ret = tb_dma_reserve_credits(&path->hops[i], credits); in tb_dma_init_rx_path()
1588 static int tb_dma_init_tx_path(struct tb_path *path, unsigned int credits) in tb_dma_init_tx_path() argument
1603 ret = tb_dma_reserve_credits(hop, credits); in tb_dma_init_tx_path()
1664 int credits; in tb_tunnel_alloc_dma() local
1686 credits = min_not_zero(dma_credits, nhi->sw->max_dma_credits); in tb_tunnel_alloc_dma()
1694 if (tb_dma_init_rx_path(path, credits)) { in tb_tunnel_alloc_dma()
1706 if (tb_dma_init_tx_path(path, credits)) { in tb_tunnel_alloc_dma()
1916 unsigned int credits; in tb_usb3_init_credits() local
1919 credits = sw->max_usb3_credits; in tb_usb3_init_credits()
1922 credits = port->bonded ? 32 : 16; in tb_usb3_init_credits()
1924 credits = 7; in tb_usb3_init_credits()
1927 hop->initial_credits = credits; in tb_usb3_init_credits()