|
@@ -1283,16 +1283,22 @@ static void kiblnd_map_tx_pool(kib_tx_pool_t *tpo)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-struct ib_mr *kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd,
|
|
|
+struct ib_mr *kiblnd_find_rd_dma_mr(struct lnet_ni *ni, kib_rdma_desc_t *rd,
|
|
|
int negotiated_nfrags)
|
|
|
{
|
|
|
- __u16 nfrags = (negotiated_nfrags != -1) ?
|
|
|
- negotiated_nfrags : *kiblnd_tunables.kib_map_on_demand;
|
|
|
+ kib_net_t *net = ni->ni_data;
|
|
|
+ kib_hca_dev_t *hdev = net->ibn_dev->ibd_hdev;
|
|
|
+ struct lnet_ioctl_config_o2iblnd_tunables *tunables;
|
|
|
+ __u16 nfrags;
|
|
|
+ int mod;
|
|
|
+
|
|
|
+ tunables = &ni->ni_lnd_tunables->lt_tun_u.lt_o2ib;
|
|
|
+ mod = tunables->lnd_map_on_demand;
|
|
|
+ nfrags = (negotiated_nfrags != -1) ? negotiated_nfrags : mod;
|
|
|
|
|
|
LASSERT(hdev->ibh_mrs);
|
|
|
|
|
|
- if (*kiblnd_tunables.kib_map_on_demand > 0 &&
|
|
|
- nfrags <= rd->rd_nfrags)
|
|
|
+ if (mod > 0 && nfrags <= rd->rd_nfrags)
|
|
|
return NULL;
|
|
|
|
|
|
return hdev->ibh_mrs;
|
|
@@ -1337,16 +1343,20 @@ static void kiblnd_destroy_fmr_pool_list(struct list_head *head)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static int kiblnd_fmr_pool_size(int ncpts)
|
|
|
+static int
|
|
|
+kiblnd_fmr_pool_size(struct lnet_ioctl_config_o2iblnd_tunables *tunables,
|
|
|
+ int ncpts)
|
|
|
{
|
|
|
- int size = *kiblnd_tunables.kib_fmr_pool_size / ncpts;
|
|
|
+ int size = tunables->lnd_fmr_pool_size / ncpts;
|
|
|
|
|
|
return max(IBLND_FMR_POOL, size);
|
|
|
}
|
|
|
|
|
|
-static int kiblnd_fmr_flush_trigger(int ncpts)
|
|
|
+static int
|
|
|
+kiblnd_fmr_flush_trigger(struct lnet_ioctl_config_o2iblnd_tunables *tunables,
|
|
|
+ int ncpts)
|
|
|
{
|
|
|
- int size = *kiblnd_tunables.kib_fmr_flush_trigger / ncpts;
|
|
|
+ int size = tunables->lnd_fmr_flush_trigger / ncpts;
|
|
|
|
|
|
return max(IBLND_FMR_POOL_FLUSH, size);
|
|
|
}
|
|
@@ -1362,7 +1372,7 @@ static int kiblnd_alloc_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t *fpo)
|
|
|
.dirty_watermark = fps->fps_flush_trigger,
|
|
|
.flush_function = NULL,
|
|
|
.flush_arg = NULL,
|
|
|
- .cache = !!*kiblnd_tunables.kib_fmr_cache};
|
|
|
+ .cache = !!fps->fps_cache };
|
|
|
int rc = 0;
|
|
|
|
|
|
fpo->fmr.fpo_fmr_pool = ib_create_fmr_pool(fpo->fpo_hdev->ibh_pd,
|
|
@@ -1508,9 +1518,10 @@ static void kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt,
|
|
|
- kib_net_t *net, int pool_size,
|
|
|
- int flush_trigger)
|
|
|
+static int
|
|
|
+kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, int ncpts,
|
|
|
+ kib_net_t *net,
|
|
|
+ struct lnet_ioctl_config_o2iblnd_tunables *tunables)
|
|
|
{
|
|
|
kib_fmr_pool_t *fpo;
|
|
|
int rc;
|
|
@@ -1519,8 +1530,11 @@ static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt,
|
|
|
|
|
|
fps->fps_net = net;
|
|
|
fps->fps_cpt = cpt;
|
|
|
- fps->fps_pool_size = pool_size;
|
|
|
- fps->fps_flush_trigger = flush_trigger;
|
|
|
+
|
|
|
+ fps->fps_pool_size = kiblnd_fmr_pool_size(tunables, ncpts);
|
|
|
+ fps->fps_flush_trigger = kiblnd_fmr_flush_trigger(tunables, ncpts);
|
|
|
+ fps->fps_cache = tunables->lnd_fmr_cache;
|
|
|
+
|
|
|
spin_lock_init(&fps->fps_lock);
|
|
|
INIT_LIST_HEAD(&fps->fps_pool_list);
|
|
|
INIT_LIST_HEAD(&fps->fps_failed_pool_list);
|
|
@@ -2150,25 +2164,28 @@ static void kiblnd_net_fini_pools(kib_net_t *net)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts)
|
|
|
+static int kiblnd_net_init_pools(kib_net_t *net, lnet_ni_t *ni, __u32 *cpts,
|
|
|
+ int ncpts)
|
|
|
{
|
|
|
+ struct lnet_ioctl_config_o2iblnd_tunables *tunables;
|
|
|
unsigned long flags;
|
|
|
int cpt;
|
|
|
- int rc = 0;
|
|
|
+ int rc;
|
|
|
int i;
|
|
|
|
|
|
+ tunables = &ni->ni_lnd_tunables->lt_tun_u.lt_o2ib;
|
|
|
+
|
|
|
read_lock_irqsave(&kiblnd_data.kib_global_lock, flags);
|
|
|
- if (!*kiblnd_tunables.kib_map_on_demand) {
|
|
|
+ if (!tunables->lnd_map_on_demand) {
|
|
|
read_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags);
|
|
|
goto create_tx_pool;
|
|
|
}
|
|
|
|
|
|
read_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags);
|
|
|
|
|
|
- if (*kiblnd_tunables.kib_fmr_pool_size <
|
|
|
- *kiblnd_tunables.kib_ntx / 4) {
|
|
|
+ if (tunables->lnd_fmr_pool_size < *kiblnd_tunables.kib_ntx / 4) {
|
|
|
CERROR("Can't set fmr pool size (%d) < ntx / 4(%d)\n",
|
|
|
- *kiblnd_tunables.kib_fmr_pool_size,
|
|
|
+ tunables->lnd_fmr_pool_size,
|
|
|
*kiblnd_tunables.kib_ntx / 4);
|
|
|
rc = -EINVAL;
|
|
|
goto failed;
|
|
@@ -2198,9 +2215,8 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts)
|
|
|
|
|
|
for (i = 0; i < ncpts; i++) {
|
|
|
cpt = !cpts ? i : cpts[i];
|
|
|
- rc = kiblnd_init_fmr_poolset(net->ibn_fmr_ps[cpt], cpt, net,
|
|
|
- kiblnd_fmr_pool_size(ncpts),
|
|
|
- kiblnd_fmr_flush_trigger(ncpts));
|
|
|
+ rc = kiblnd_init_fmr_poolset(net->ibn_fmr_ps[cpt], cpt, ncpts,
|
|
|
+ net, tunables);
|
|
|
if (rc) {
|
|
|
CERROR("Can't initialize FMR pool for CPT %d: %d\n",
|
|
|
cpt, rc);
|
|
@@ -2961,7 +2977,7 @@ static int kiblnd_startup(lnet_ni_t *ni)
|
|
|
if (rc)
|
|
|
goto failed;
|
|
|
|
|
|
- rc = kiblnd_net_init_pools(net, ni->ni_cpts, ni->ni_ncpts);
|
|
|
+ rc = kiblnd_net_init_pools(net, ni, ni->ni_cpts, ni->ni_ncpts);
|
|
|
if (rc) {
|
|
|
CERROR("Failed to initialize NI pools: %d\n", rc);
|
|
|
goto failed;
|