Lines Matching refs:credits
91 int credits, usb3, pcie, spare; in tb_available_credits() local
105 credits = tb_usable_credits(port); in tb_available_credits()
112 ndp = (credits - (usb3 + pcie + spare)) / in tb_available_credits()
119 credits -= ndp * (sw->min_dp_aux_credits + sw->min_dp_main_credits); in tb_available_credits()
120 credits -= usb3; in tb_available_credits()
125 return credits > 0 ? credits : 0; in tb_available_credits()
169 unsigned int credits; in tb_pci_init_credits() local
175 credits = min(sw->max_pcie_credits, available); in tb_pci_init_credits()
177 if (credits < TB_MIN_PCIE_CREDITS) in tb_pci_init_credits()
180 credits = max(TB_MIN_PCIE_CREDITS, credits); in tb_pci_init_credits()
183 credits = port->bonded ? 32 : 16; in tb_pci_init_credits()
185 credits = 7; in tb_pci_init_credits()
188 hop->initial_credits = credits; in tb_pci_init_credits()
1299 int credits; in tb_dma_available_credits() local
1301 credits = tb_available_credits(port, NULL); in tb_dma_available_credits()
1303 credits -= sw->max_pcie_credits; in tb_dma_available_credits()
1304 credits -= port->dma_credits; in tb_dma_available_credits()
1306 return credits > 0 ? credits : 0; in tb_dma_available_credits()
1309 static int tb_dma_reserve_credits(struct tb_path_hop *hop, unsigned int credits) in tb_dma_reserve_credits() argument
1323 while (credits > available) in tb_dma_reserve_credits()
1324 credits--; in tb_dma_reserve_credits()
1327 credits); in tb_dma_reserve_credits()
1329 port->dma_credits += credits; in tb_dma_reserve_credits()
1332 credits = port->bonded ? 14 : 6; in tb_dma_reserve_credits()
1334 credits = min(port->total_credits, credits); in tb_dma_reserve_credits()
1337 hop->initial_credits = credits; in tb_dma_reserve_credits()
1342 static int tb_dma_init_rx_path(struct tb_path *path, unsigned int credits) in tb_dma_init_rx_path() argument
1361 tmp = min(tb_usable_credits(hop->in_port), credits); in tb_dma_init_rx_path()
1368 ret = tb_dma_reserve_credits(&path->hops[i], credits); in tb_dma_init_rx_path()
1377 static int tb_dma_init_tx_path(struct tb_path *path, unsigned int credits) in tb_dma_init_tx_path() argument
1392 ret = tb_dma_reserve_credits(hop, credits); in tb_dma_init_tx_path()
1453 int credits; in tb_tunnel_alloc_dma() local
1471 credits = min_not_zero(TB_DMA_CREDITS, nhi->sw->max_dma_credits); in tb_tunnel_alloc_dma()
1479 if (tb_dma_init_rx_path(path, credits)) { in tb_tunnel_alloc_dma()
1491 if (tb_dma_init_tx_path(path, credits)) { in tb_tunnel_alloc_dma()
1699 unsigned int credits; in tb_usb3_init_credits() local
1702 credits = sw->max_usb3_credits; in tb_usb3_init_credits()
1705 credits = port->bonded ? 32 : 16; in tb_usb3_init_credits()
1707 credits = 7; in tb_usb3_init_credits()
1710 hop->initial_credits = credits; in tb_usb3_init_credits()