Commit b4ba6633 authored by Jubin John's avatar Jubin John Committed by Doug Ledford

IB/hfi1: Fix credit return threshold adjustment

The credit return threshold adjustment on mtu change algorithm does not
take into account all the kernel send contexts that are assigned per VL.
Use the pio send context map to adjust the credit return thresholds for
all the allocated and assigned kernel send contexts based on the MTU
adjustment per VL.

The pio send context map can be changed dynamically based on the actual
number of operational vls which is set by the fabric manager. When this
happens update the credit return threshold values for all the remapped
kernel send contexts.
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: default avatarJianxin Xiong <jianxin.xiong@intel.com>
Signed-off-by: default avatarJubin John <jubin.john@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 61c78eea
...@@ -9777,7 +9777,7 @@ static void set_send_length(struct hfi1_pportdata *ppd) ...@@ -9777,7 +9777,7 @@ static void set_send_length(struct hfi1_pportdata *ppd)
u64 len1 = 0, len2 = (((dd->vld[15].mtu + max_hb) >> 2) u64 len1 = 0, len2 = (((dd->vld[15].mtu + max_hb) >> 2)
& SEND_LEN_CHECK1_LEN_VL15_MASK) << & SEND_LEN_CHECK1_LEN_VL15_MASK) <<
SEND_LEN_CHECK1_LEN_VL15_SHIFT; SEND_LEN_CHECK1_LEN_VL15_SHIFT;
int i; int i, j;
u32 thres; u32 thres;
for (i = 0; i < ppd->vls_supported; i++) { for (i = 0; i < ppd->vls_supported; i++) {
...@@ -9801,7 +9801,10 @@ static void set_send_length(struct hfi1_pportdata *ppd) ...@@ -9801,7 +9801,10 @@ static void set_send_length(struct hfi1_pportdata *ppd)
sc_mtu_to_threshold(dd->vld[i].sc, sc_mtu_to_threshold(dd->vld[i].sc,
dd->vld[i].mtu, dd->vld[i].mtu,
dd->rcd[0]->rcvhdrqentsize)); dd->rcd[0]->rcvhdrqentsize));
sc_set_cr_threshold(dd->vld[i].sc, thres); for (j = 0; j < INIT_SC_PER_VL; j++)
sc_set_cr_threshold(
pio_select_send_context_vl(dd, j, i),
thres);
} }
thres = min(sc_percent_to_threshold(dd->vld[15].sc, 50), thres = min(sc_percent_to_threshold(dd->vld[15].sc, 50),
sc_mtu_to_threshold(dd->vld[15].sc, sc_mtu_to_threshold(dd->vld[15].sc,
......
...@@ -1797,6 +1797,21 @@ static void pio_map_rcu_callback(struct rcu_head *list) ...@@ -1797,6 +1797,21 @@ static void pio_map_rcu_callback(struct rcu_head *list)
pio_map_free(m); pio_map_free(m);
} }
/*
* Set credit return threshold for the kernel send context
*/
static void set_threshold(struct hfi1_devdata *dd, int scontext, int i)
{
u32 thres;
thres = min(sc_percent_to_threshold(dd->kernel_send_context[scontext],
50),
sc_mtu_to_threshold(dd->kernel_send_context[scontext],
dd->vld[i].mtu,
dd->rcd[0]->rcvhdrqentsize));
sc_set_cr_threshold(dd->kernel_send_context[scontext], thres);
}
/* /*
* pio_map_init - called when #vls change * pio_map_init - called when #vls change
* @dd: hfi1_devdata * @dd: hfi1_devdata
...@@ -1872,11 +1887,16 @@ int pio_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, u8 *vl_scontexts) ...@@ -1872,11 +1887,16 @@ int pio_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, u8 *vl_scontexts)
if (!newmap->map[i]) if (!newmap->map[i])
goto bail; goto bail;
newmap->map[i]->mask = (1 << ilog2(sz)) - 1; newmap->map[i]->mask = (1 << ilog2(sz)) - 1;
/* assign send contexts */ /*
* assign send contexts and
* adjust credit return threshold
*/
for (j = 0; j < sz; j++) { for (j = 0; j < sz; j++) {
if (dd->kernel_send_context[scontext]) if (dd->kernel_send_context[scontext]) {
newmap->map[i]->ksc[j] = newmap->map[i]->ksc[j] =
dd->kernel_send_context[scontext]; dd->kernel_send_context[scontext];
set_threshold(dd, scontext, i);
}
if (++scontext >= first_scontext + if (++scontext >= first_scontext +
vl_scontexts[i]) vl_scontexts[i])
/* wrap back to first send context */ /* wrap back to first send context */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment