Commit 45a041cc authored by Kamenee Arumugam's avatar Kamenee Arumugam Committed by Doug Ledford

IB/hfi1: Don't modify num_user_contexts module parameter

The driver parameter num_user_contexts controls global behavior and
should not be modified by the driver.
This patch eliminates modification of num_user_contexts by using a
local variable to keep track of the value.
Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: default avatarKamenee Arumugam <kamenee.arumugam@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 2d9544aa
...@@ -13406,6 +13406,7 @@ static int set_up_context_variables(struct hfi1_devdata *dd) ...@@ -13406,6 +13406,7 @@ static int set_up_context_variables(struct hfi1_devdata *dd)
unsigned ngroups; unsigned ngroups;
int qos_rmt_count; int qos_rmt_count;
int user_rmt_reduced; int user_rmt_reduced;
u32 n_usr_ctxts;
/* /*
* Kernel receive contexts: * Kernel receive contexts:
...@@ -13448,42 +13449,42 @@ static int set_up_context_variables(struct hfi1_devdata *dd) ...@@ -13448,42 +13449,42 @@ static int set_up_context_variables(struct hfi1_devdata *dd)
* num_user_contexts is negative * num_user_contexts is negative
*/ */
if (num_user_contexts < 0) if (num_user_contexts < 0)
num_user_contexts = n_usr_ctxts = cpumask_weight(&node_affinity.real_cpu_mask);
cpumask_weight(&node_affinity.real_cpu_mask); else
n_usr_ctxts = num_user_contexts;
/* /*
* Adjust the counts given a global max. * Adjust the counts given a global max.
*/ */
if (total_contexts + num_user_contexts > dd->chip_rcv_contexts) { if (total_contexts + n_usr_ctxts > dd->chip_rcv_contexts) {
dd_dev_err(dd, dd_dev_err(dd,
"Reducing # user receive contexts to: %d, from %d\n", "Reducing # user receive contexts to: %d, from %u\n",
(int)(dd->chip_rcv_contexts - total_contexts), (int)(dd->chip_rcv_contexts - total_contexts),
(int)num_user_contexts); n_usr_ctxts);
/* recalculate */ /* recalculate */
num_user_contexts = dd->chip_rcv_contexts - total_contexts; n_usr_ctxts = dd->chip_rcv_contexts - total_contexts;
} }
/* each user context requires an entry in the RMT */ /* each user context requires an entry in the RMT */
qos_rmt_count = qos_rmt_entries(dd, NULL, NULL); qos_rmt_count = qos_rmt_entries(dd, NULL, NULL);
if (qos_rmt_count + num_user_contexts > NUM_MAP_ENTRIES) { if (qos_rmt_count + n_usr_ctxts > NUM_MAP_ENTRIES) {
user_rmt_reduced = NUM_MAP_ENTRIES - qos_rmt_count; user_rmt_reduced = NUM_MAP_ENTRIES - qos_rmt_count;
dd_dev_err(dd, dd_dev_err(dd,
"RMT size is reducing the number of user receive contexts from %d to %d\n", "RMT size is reducing the number of user receive contexts from %u to %d\n",
(int)num_user_contexts, n_usr_ctxts,
user_rmt_reduced); user_rmt_reduced);
/* recalculate */ /* recalculate */
num_user_contexts = user_rmt_reduced; n_usr_ctxts = user_rmt_reduced;
} }
total_contexts += num_user_contexts; total_contexts += n_usr_ctxts;
/* the first N are kernel contexts, the rest are user/vnic contexts */ /* the first N are kernel contexts, the rest are user/vnic contexts */
dd->num_rcv_contexts = total_contexts; dd->num_rcv_contexts = total_contexts;
dd->n_krcv_queues = num_kernel_contexts; dd->n_krcv_queues = num_kernel_contexts;
dd->first_dyn_alloc_ctxt = num_kernel_contexts; dd->first_dyn_alloc_ctxt = num_kernel_contexts;
dd->num_vnic_contexts = num_vnic_contexts; dd->num_vnic_contexts = num_vnic_contexts;
dd->num_user_contexts = num_user_contexts; dd->num_user_contexts = n_usr_ctxts;
dd->freectxts = num_user_contexts; dd->freectxts = n_usr_ctxts;
dd_dev_info(dd, dd_dev_info(dd,
"rcv contexts: chip %d, used %d (kernel %d, vnic %u, user %u)\n", "rcv contexts: chip %d, used %d (kernel %d, vnic %u, user %u)\n",
(int)dd->chip_rcv_contexts, (int)dd->chip_rcv_contexts,
......
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