aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/hfi1/pio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/hfi1/pio.c')
-rw-r--r--drivers/infiniband/hw/hfi1/pio.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/hfi1/pio.c b/drivers/infiniband/hw/hfi1/pio.c
index d5edb1afbb8f..d4022450b73f 100644
--- a/drivers/infiniband/hw/hfi1/pio.c
+++ b/drivers/infiniband/hw/hfi1/pio.c
@@ -995,7 +995,7 @@ static void sc_wait_for_packet_egress(struct send_context *sc, int pause)
995 /* counter is reset if occupancy count changes */ 995 /* counter is reset if occupancy count changes */
996 if (reg != reg_prev) 996 if (reg != reg_prev)
997 loop = 0; 997 loop = 0;
998 if (loop > 500) { 998 if (loop > 50000) {
999 /* timed out - bounce the link */ 999 /* timed out - bounce the link */
1000 dd_dev_err(dd, 1000 dd_dev_err(dd,
1001 "%s: context %u(%u) timeout waiting for packets to egress, remaining count %u, bouncing link\n", 1001 "%s: context %u(%u) timeout waiting for packets to egress, remaining count %u, bouncing link\n",
@@ -1798,6 +1798,21 @@ static void pio_map_rcu_callback(struct rcu_head *list)
1798} 1798}
1799 1799
1800/* 1800/*
1801 * Set credit return threshold for the kernel send context
1802 */
1803static void set_threshold(struct hfi1_devdata *dd, int scontext, int i)
1804{
1805 u32 thres;
1806
1807 thres = min(sc_percent_to_threshold(dd->kernel_send_context[scontext],
1808 50),
1809 sc_mtu_to_threshold(dd->kernel_send_context[scontext],
1810 dd->vld[i].mtu,
1811 dd->rcd[0]->rcvhdrqentsize));
1812 sc_set_cr_threshold(dd->kernel_send_context[scontext], thres);
1813}
1814
1815/*
1801 * pio_map_init - called when #vls change 1816 * pio_map_init - called when #vls change
1802 * @dd: hfi1_devdata 1817 * @dd: hfi1_devdata
1803 * @port: port number 1818 * @port: port number
@@ -1872,11 +1887,16 @@ int pio_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, u8 *vl_scontexts)
1872 if (!newmap->map[i]) 1887 if (!newmap->map[i])
1873 goto bail; 1888 goto bail;
1874 newmap->map[i]->mask = (1 << ilog2(sz)) - 1; 1889 newmap->map[i]->mask = (1 << ilog2(sz)) - 1;
1875 /* assign send contexts */ 1890 /*
1891 * assign send contexts and
1892 * adjust credit return threshold
1893 */
1876 for (j = 0; j < sz; j++) { 1894 for (j = 0; j < sz; j++) {
1877 if (dd->kernel_send_context[scontext]) 1895 if (dd->kernel_send_context[scontext]) {
1878 newmap->map[i]->ksc[j] = 1896 newmap->map[i]->ksc[j] =
1879 dd->kernel_send_context[scontext]; 1897 dd->kernel_send_context[scontext];
1898 set_threshold(dd, scontext, i);
1899 }
1880 if (++scontext >= first_scontext + 1900 if (++scontext >= first_scontext +
1881 vl_scontexts[i]) 1901 vl_scontexts[i])
1882 /* wrap back to first send context */ 1902 /* wrap back to first send context */