lnet_del_route(LNET_NIDNET(LNET_NID_ANY), LNET_NID_ANY);
}
+int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)
+{
+ int i, rc = -ENOENT, lidx, j;
+
+ if (the_lnet.ln_rtrpools == NULL)
+ return rc;
+
+ for (i = 0; i < LNET_NRBPOOLS; i++) {
+ lnet_rtrbufpool_t *rbp;
+
+ lnet_net_lock(LNET_LOCK_EX);
+ lidx = idx;
+ cfs_percpt_for_each(rbp, j, the_lnet.ln_rtrpools) {
+ if (lidx-- == 0) {
+ rc = 0;
+ pool_cfg->pl_pools[i].pl_npages =
+ rbp[i].rbp_npages;
+ pool_cfg->pl_pools[i].pl_nbuffers =
+ rbp[i].rbp_nbuffers;
+ pool_cfg->pl_pools[i].pl_credits =
+ rbp[i].rbp_credits;
+ pool_cfg->pl_pools[i].pl_mincredits =
+ rbp[i].rbp_mincredits;
+ break;
+ }
+ }
+ lnet_net_unlock(LNET_LOCK_EX);
+ }
+
+ lnet_net_lock(LNET_LOCK_EX);
+ pool_cfg->pl_routing = the_lnet.ln_routing;
+ lnet_net_unlock(LNET_LOCK_EX);
+
+ return rc;
+}
+
int
lnet_get_route(int idx, __u32 *net, __u32 *hops,
lnet_nid_t *gateway, __u32 *alive, __u32 *priority)
*priority = route->lr_priority;
*gateway = route->lr_gateway->lp_nid;
*alive =
- route->lr_gateway->lp_alive &&
- !route->lr_downis;
+ route->lr_gateway->lp_alive &&
+ !route->lr_downis;
lnet_net_unlock(cpt);
return 0;
}
return rc;
}
-int
-lnet_rtrpools_adjust(int tiny, int small, int large)
+static int
+lnet_rtrpools_adjust_helper(int tiny, int small, int large)
{
int nrb = 0;
int rc = 0;
int i;
lnet_rtrbufpool_t *rtrp;
- /* this function doesn't revert the changes if adding new buffers
- * failed. It's up to the user space caller to revert the
- * changes. */
-
- if (!the_lnet.ln_routing)
- return 0;
-
/* If the provided values for each buffer pool are different than the
* configured values, we need to take action. */
- if (tiny >= 0 && tiny != tiny_router_buffers) {
+ if (tiny >= 0) {
tiny_router_buffers = tiny;
nrb = lnet_nrb_tiny_calculate();
cfs_percpt_for_each(rtrp, i, the_lnet.ln_rtrpools) {
return rc;
}
}
- if (small >= 0 && small != small_router_buffers) {
+ if (small >= 0) {
small_router_buffers = small;
nrb = lnet_nrb_small_calculate();
cfs_percpt_for_each(rtrp, i, the_lnet.ln_rtrpools) {
return rc;
}
}
- if (large >= 0 && large != large_router_buffers) {
+ if (large >= 0) {
large_router_buffers = large;
nrb = lnet_nrb_large_calculate();
cfs_percpt_for_each(rtrp, i, the_lnet.ln_rtrpools) {
}
int
+lnet_rtrpools_adjust(int tiny, int small, int large)
+{
+ /* this function doesn't revert the changes if adding new buffers
+ * failed. It's up to the user space caller to revert the
+ * changes. */
+
+ if (!the_lnet.ln_routing)
+ return 0;
+
+ return lnet_rtrpools_adjust_helper(tiny, small, large);
+}
+
+int
lnet_rtrpools_enable(void)
{
int rc;
* time. */
return lnet_rtrpools_alloc(1);
- rc = lnet_rtrpools_adjust(0, 0, 0);
+ rc = lnet_rtrpools_adjust_helper(0, 0, 0);
if (rc != 0)
return rc;