aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_exch.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libfc/fc_exch.c')
-rw-r--r--drivers/scsi/libfc/fc_exch.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 630291f01826..aceffadb21c7 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -2263,7 +2263,18 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport,
2263 mp->class = class; 2263 mp->class = class;
2264 /* adjust em exch xid range for offload */ 2264 /* adjust em exch xid range for offload */
2265 mp->min_xid = min_xid; 2265 mp->min_xid = min_xid;
2266 mp->max_xid = max_xid; 2266
2267 /* reduce range so per cpu pool fits into PCPU_MIN_UNIT_SIZE pool */
2268 pool_exch_range = (PCPU_MIN_UNIT_SIZE - sizeof(*pool)) /
2269 sizeof(struct fc_exch *);
2270 if ((max_xid - min_xid + 1) / (fc_cpu_mask + 1) > pool_exch_range) {
2271 mp->max_xid = pool_exch_range * (fc_cpu_mask + 1) +
2272 min_xid - 1;
2273 } else {
2274 mp->max_xid = max_xid;
2275 pool_exch_range = (mp->max_xid - mp->min_xid + 1) /
2276 (fc_cpu_mask + 1);
2277 }
2267 2278
2268 mp->ep_pool = mempool_create_slab_pool(2, fc_em_cachep); 2279 mp->ep_pool = mempool_create_slab_pool(2, fc_em_cachep);
2269 if (!mp->ep_pool) 2280 if (!mp->ep_pool)
@@ -2274,7 +2285,6 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport,
2274 * divided across all cpus. The exch pointers array memory is 2285 * divided across all cpus. The exch pointers array memory is
2275 * allocated for exch range per pool. 2286 * allocated for exch range per pool.
2276 */ 2287 */
2277 pool_exch_range = (mp->max_xid - mp->min_xid + 1) / (fc_cpu_mask + 1);
2278 mp->pool_max_index = pool_exch_range - 1; 2288 mp->pool_max_index = pool_exch_range - 1;
2279 2289
2280 /* 2290 /*