Browse Source

[hermon] Tidy up ICM allocations

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
0d6b1d98fa
2 changed files with 86 additions and 91 deletions
  1. 83
    90
      src/drivers/infiniband/hermon.c
  2. 3
    1
      src/drivers/infiniband/hermon.h

+ 83
- 90
src/drivers/infiniband/hermon.c View File

2226
 	       MLX_GET ( &fw, fw_rev_subminor ) );
2226
 	       MLX_GET ( &fw, fw_rev_subminor ) );
2227
 	fw_pages = MLX_GET ( &fw, fw_pages );
2227
 	fw_pages = MLX_GET ( &fw, fw_pages );
2228
 	DBGC ( hermon, "Hermon %p requires %d pages (%d kB) for firmware\n",
2228
 	DBGC ( hermon, "Hermon %p requires %d pages (%d kB) for firmware\n",
2229
-	       hermon, fw_pages, ( fw_pages * ( HERMON_PAGE_SIZE / 1024 ) ) );
2229
+	       hermon, fw_pages, ( fw_pages * 4 ) );
2230
 
2230
 
2231
 	/* Allocate firmware pages and map firmware area */
2231
 	/* Allocate firmware pages and map firmware area */
2232
 	fw_size = ( fw_pages * HERMON_PAGE_SIZE );
2232
 	fw_size = ( fw_pages * HERMON_PAGE_SIZE );
2341
 }
2341
 }
2342
 
2342
 
2343
 /**
2343
 /**
2344
- * Get ICM usage
2344
+ * Align ICM table
2345
  *
2345
  *
2346
- * @v log_num_entries	Log2 of the number of entries
2347
- * @v entry_size	Entry size
2348
- * @ret usage		Usage size in ICM
2346
+ * @v icm_offset	Current ICM offset
2347
+ * @v len		ICM table length
2348
+ * @ret icm_offset	ICM offset
2349
  */
2349
  */
2350
-static size_t icm_usage ( unsigned int log_num_entries, size_t entry_size ) {
2351
-	size_t usage;
2350
+static uint64_t icm_align ( uint64_t icm_offset, size_t len ) {
2352
 
2351
 
2353
-	usage = ( ( 1 << log_num_entries ) * entry_size );
2354
-	usage = ( ( usage + HERMON_PAGE_SIZE - 1 ) &
2355
-		  ~( HERMON_PAGE_SIZE - 1 ) );
2356
-	return usage;
2352
+	/* Round up to a multiple of the table size */
2353
+	assert ( len == ( 1UL << ( fls ( len ) - 1 ) ) );
2354
+	return ( ( icm_offset + len - 1 ) & ~( ( ( uint64_t ) len ) - 1 ) );
2357
 }
2355
 }
2358
 
2356
 
2359
-/**
2360
- * Align ICM
2361
- *
2362
- * @v member_size		Member size
2363
- * @v cur_icm_offset	Current ICM offset
2364
- * @ret align_offset	Align to offset
2365
- */
2366
-static size_t icm_align ( u32 member_size,
2367
-						  u64 cur_icm_offset ) {
2368
-	size_t	align_offset = 0;
2369
-
2370
-	member_size = member_size & 0xfffff000;
2371
-	if ( member_size ) {
2372
-		while ( ( cur_icm_offset + align_offset ) % member_size ) {
2373
-			align_offset += HERMON_PAGE_SIZE;
2374
-		}
2375
-	}
2376
-
2377
-	return align_offset;
2378
-}
2379
-
2380
-
2381
 /**
2357
 /**
2382
  * Allocate ICM
2358
  * Allocate ICM
2383
  *
2359
  *
2390
 	struct hermonprm_scalar_parameter icm_size;
2366
 	struct hermonprm_scalar_parameter icm_size;
2391
 	struct hermonprm_scalar_parameter icm_aux_size;
2367
 	struct hermonprm_scalar_parameter icm_aux_size;
2392
 	uint64_t icm_offset = 0;
2368
 	uint64_t icm_offset = 0;
2393
-	u32 icm_member_size = 0;
2394
 	unsigned int log_num_qps, log_num_srqs, log_num_cqs, log_num_eqs;
2369
 	unsigned int log_num_qps, log_num_srqs, log_num_cqs, log_num_eqs;
2395
-	unsigned int log_num_mtts, log_num_mpts;
2370
+	unsigned int log_num_mtts, log_num_mpts, log_num_mcs;
2396
 	size_t cmpt_max_len;
2371
 	size_t cmpt_max_len;
2397
-	size_t qp_cmpt_len, srq_cmpt_len, cq_cmpt_len, eq_cmpt_len;
2398
 	size_t icm_len, icm_aux_len;
2372
 	size_t icm_len, icm_aux_len;
2373
+	size_t len;
2399
 	physaddr_t icm_phys;
2374
 	physaddr_t icm_phys;
2400
 	int i;
2375
 	int i;
2401
 	int rc;
2376
 	int rc;
2412
 	log_num_cqs = fls ( hermon->cap.reserved_cqs + HERMON_MAX_CQS - 1 );
2387
 	log_num_cqs = fls ( hermon->cap.reserved_cqs + HERMON_MAX_CQS - 1 );
2413
 	log_num_eqs = fls ( hermon->cap.reserved_eqs + HERMON_MAX_EQS - 1 );
2388
 	log_num_eqs = fls ( hermon->cap.reserved_eqs + HERMON_MAX_EQS - 1 );
2414
 	log_num_mtts = fls ( hermon->cap.reserved_mtts + HERMON_MAX_MTTS - 1 );
2389
 	log_num_mtts = fls ( hermon->cap.reserved_mtts + HERMON_MAX_MTTS - 1 );
2390
+	log_num_mpts = fls ( hermon->cap.reserved_mrws + 1 - 1 );
2391
+	log_num_mcs = HERMON_LOG_MULTICAST_HASH_SIZE;
2415
 
2392
 
2416
 	/* ICM starts with the cMPT tables, which are sparse */
2393
 	/* ICM starts with the cMPT tables, which are sparse */
2417
 	cmpt_max_len = ( HERMON_CMPT_MAX_ENTRIES *
2394
 	cmpt_max_len = ( HERMON_CMPT_MAX_ENTRIES *
2418
 			 ( ( uint64_t ) hermon->cap.cmpt_entry_size ) );
2395
 			 ( ( uint64_t ) hermon->cap.cmpt_entry_size ) );
2419
-	qp_cmpt_len = icm_usage ( log_num_qps, hermon->cap.cmpt_entry_size );
2396
+	len = ( ( ( ( 1 << log_num_qps ) * hermon->cap.cmpt_entry_size ) +
2397
+		  HERMON_PAGE_SIZE - 1 ) & ~( HERMON_PAGE_SIZE - 1 ) );
2420
 	hermon->icm_map[HERMON_ICM_QP_CMPT].offset = icm_offset;
2398
 	hermon->icm_map[HERMON_ICM_QP_CMPT].offset = icm_offset;
2421
-	hermon->icm_map[HERMON_ICM_QP_CMPT].len = qp_cmpt_len;
2399
+	hermon->icm_map[HERMON_ICM_QP_CMPT].len = len;
2422
 	icm_offset += cmpt_max_len;
2400
 	icm_offset += cmpt_max_len;
2423
-	srq_cmpt_len = icm_usage ( log_num_srqs, hermon->cap.cmpt_entry_size );
2401
+	len = ( ( ( ( 1 << log_num_srqs ) * hermon->cap.cmpt_entry_size ) +
2402
+		  HERMON_PAGE_SIZE - 1 ) & ~( HERMON_PAGE_SIZE - 1 ) );
2424
 	hermon->icm_map[HERMON_ICM_SRQ_CMPT].offset = icm_offset;
2403
 	hermon->icm_map[HERMON_ICM_SRQ_CMPT].offset = icm_offset;
2425
-	hermon->icm_map[HERMON_ICM_SRQ_CMPT].len = srq_cmpt_len;
2404
+	hermon->icm_map[HERMON_ICM_SRQ_CMPT].len = len;
2426
 	icm_offset += cmpt_max_len;
2405
 	icm_offset += cmpt_max_len;
2427
-	cq_cmpt_len = icm_usage ( log_num_cqs, hermon->cap.cmpt_entry_size );
2406
+	len = ( ( ( ( 1 << log_num_cqs ) * hermon->cap.cmpt_entry_size ) +
2407
+		  HERMON_PAGE_SIZE - 1 ) & ~( HERMON_PAGE_SIZE - 1 ) );
2428
 	hermon->icm_map[HERMON_ICM_CQ_CMPT].offset = icm_offset;
2408
 	hermon->icm_map[HERMON_ICM_CQ_CMPT].offset = icm_offset;
2429
-	hermon->icm_map[HERMON_ICM_CQ_CMPT].len = cq_cmpt_len;
2409
+	hermon->icm_map[HERMON_ICM_CQ_CMPT].len = len;
2430
 	icm_offset += cmpt_max_len;
2410
 	icm_offset += cmpt_max_len;
2431
-	eq_cmpt_len = icm_usage ( log_num_eqs, hermon->cap.cmpt_entry_size );
2411
+	len = ( ( ( ( 1 << log_num_eqs ) * hermon->cap.cmpt_entry_size ) +
2412
+		  HERMON_PAGE_SIZE - 1 ) & ~( HERMON_PAGE_SIZE - 1 ) );
2432
 	hermon->icm_map[HERMON_ICM_EQ_CMPT].offset = icm_offset;
2413
 	hermon->icm_map[HERMON_ICM_EQ_CMPT].offset = icm_offset;
2433
-	hermon->icm_map[HERMON_ICM_EQ_CMPT].len = eq_cmpt_len;
2414
+	hermon->icm_map[HERMON_ICM_EQ_CMPT].len = len;
2434
 	icm_offset += cmpt_max_len;
2415
 	icm_offset += cmpt_max_len;
2435
 
2416
 
2436
 	hermon->icm_map[HERMON_ICM_OTHER].offset = icm_offset;
2417
 	hermon->icm_map[HERMON_ICM_OTHER].offset = icm_offset;
2437
 
2418
 
2438
 	/* Queue pair contexts */
2419
 	/* Queue pair contexts */
2439
-	icm_member_size = icm_usage ( log_num_qps, hermon->cap.qpc_entry_size );
2440
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2420
+	len = ( ( 1 << log_num_qps ) * hermon->cap.qpc_entry_size );
2421
+	icm_offset = icm_align ( icm_offset, len );
2441
 	MLX_FILL_1 ( init_hca, 12,
2422
 	MLX_FILL_1 ( init_hca, 12,
2442
 		     qpc_eec_cqc_eqc_rdb_parameters.qpc_base_addr_h,
2423
 		     qpc_eec_cqc_eqc_rdb_parameters.qpc_base_addr_h,
2443
 		     ( icm_offset >> 32 ) );
2424
 		     ( icm_offset >> 32 ) );
2446
 		     ( icm_offset >> 5 ),
2427
 		     ( icm_offset >> 5 ),
2447
 		     qpc_eec_cqc_eqc_rdb_parameters.log_num_of_qp,
2428
 		     qpc_eec_cqc_eqc_rdb_parameters.log_num_of_qp,
2448
 		     log_num_qps );
2429
 		     log_num_qps );
2449
-	DBGC ( hermon, "Hermon %p ICM QPC base = %llx\n", hermon, icm_offset );
2450
-	icm_offset += icm_member_size;
2430
+	DBGC ( hermon, "Hermon %p ICM QPC is %d x %#zx at [%08llx,%08llx)\n",
2431
+	       hermon, ( 1 << log_num_qps ), hermon->cap.qpc_entry_size,
2432
+	       icm_offset, ( icm_offset + len ) );
2433
+	icm_offset += len;
2451
 
2434
 
2452
 	/* Extended alternate path contexts */
2435
 	/* Extended alternate path contexts */
2453
-	icm_member_size = icm_usage ( log_num_qps,
2454
-				  hermon->cap.altc_entry_size );
2455
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2436
+	len = ( ( 1 << log_num_qps ) * hermon->cap.altc_entry_size );
2437
+	icm_offset = icm_align ( icm_offset, len );
2456
 	MLX_FILL_1 ( init_hca, 24,
2438
 	MLX_FILL_1 ( init_hca, 24,
2457
 		     qpc_eec_cqc_eqc_rdb_parameters.altc_base_addr_h,
2439
 		     qpc_eec_cqc_eqc_rdb_parameters.altc_base_addr_h,
2458
 		     ( icm_offset >> 32 ) );
2440
 		     ( icm_offset >> 32 ) );
2459
 	MLX_FILL_1 ( init_hca, 25,
2441
 	MLX_FILL_1 ( init_hca, 25,
2460
 		     qpc_eec_cqc_eqc_rdb_parameters.altc_base_addr_l,
2442
 		     qpc_eec_cqc_eqc_rdb_parameters.altc_base_addr_l,
2461
 		     icm_offset );
2443
 		     icm_offset );
2462
-	DBGC ( hermon, "Hermon %p ICM ALTC base = %llx\n", hermon, icm_offset);
2463
-	icm_offset += icm_member_size;
2444
+	DBGC ( hermon, "Hermon %p ICM ALTC is %d x %#zx at [%08llx,%08llx)\n",
2445
+	       hermon, ( 1 << log_num_qps ), hermon->cap.altc_entry_size,
2446
+	       icm_offset, ( icm_offset + len ) );
2447
+	icm_offset += len;
2464
 
2448
 
2465
 	/* Extended auxiliary contexts */
2449
 	/* Extended auxiliary contexts */
2466
-	icm_member_size = icm_usage ( log_num_qps,
2467
-				  hermon->cap.auxc_entry_size );
2468
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2450
+	len = ( ( 1 << log_num_qps ) * hermon->cap.auxc_entry_size );
2451
+	icm_offset = icm_align ( icm_offset, len );
2469
 	MLX_FILL_1 ( init_hca, 28,
2452
 	MLX_FILL_1 ( init_hca, 28,
2470
 		     qpc_eec_cqc_eqc_rdb_parameters.auxc_base_addr_h,
2453
 		     qpc_eec_cqc_eqc_rdb_parameters.auxc_base_addr_h,
2471
 		     ( icm_offset >> 32 ) );
2454
 		     ( icm_offset >> 32 ) );
2472
 	MLX_FILL_1 ( init_hca, 29,
2455
 	MLX_FILL_1 ( init_hca, 29,
2473
 		     qpc_eec_cqc_eqc_rdb_parameters.auxc_base_addr_l,
2456
 		     qpc_eec_cqc_eqc_rdb_parameters.auxc_base_addr_l,
2474
 		     icm_offset );
2457
 		     icm_offset );
2475
-	DBGC ( hermon, "Hermon %p ICM AUXC base = %llx\n", hermon, icm_offset);
2476
-	icm_offset += icm_member_size;
2458
+	DBGC ( hermon, "Hermon %p ICM AUXC is %d x %#zx at [%08llx,%08llx)\n",
2459
+	       hermon, ( 1 << log_num_qps ), hermon->cap.auxc_entry_size,
2460
+	       icm_offset, ( icm_offset + len ) );
2461
+	icm_offset += len;
2462
+
2477
 	/* Shared receive queue contexts */
2463
 	/* Shared receive queue contexts */
2478
-	icm_member_size = icm_usage ( log_num_srqs,
2479
-				  hermon->cap.srqc_entry_size );
2480
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2464
+	len = ( ( 1 << log_num_srqs ) * hermon->cap.srqc_entry_size );
2465
+	icm_offset = icm_align ( icm_offset, len );
2481
 	MLX_FILL_1 ( init_hca, 18,
2466
 	MLX_FILL_1 ( init_hca, 18,
2482
 		     qpc_eec_cqc_eqc_rdb_parameters.srqc_base_addr_h,
2467
 		     qpc_eec_cqc_eqc_rdb_parameters.srqc_base_addr_h,
2483
 		     ( icm_offset >> 32 ) );
2468
 		     ( icm_offset >> 32 ) );
2486
 		     ( icm_offset >> 5 ),
2471
 		     ( icm_offset >> 5 ),
2487
 		     qpc_eec_cqc_eqc_rdb_parameters.log_num_of_srq,
2472
 		     qpc_eec_cqc_eqc_rdb_parameters.log_num_of_srq,
2488
 		     log_num_srqs );
2473
 		     log_num_srqs );
2489
-	DBGC ( hermon, "Hermon %p ICM SRQC base = %llx\n", hermon, icm_offset);
2490
-	icm_offset += icm_member_size;
2474
+	DBGC ( hermon, "Hermon %p ICM SRQC is %d x %#zx at [%08llx,%08llx)\n",
2475
+	       hermon, ( 1 << log_num_srqs ), hermon->cap.srqc_entry_size,
2476
+	       icm_offset, ( icm_offset + len ) );
2477
+	icm_offset += len;
2491
 
2478
 
2492
 	/* Completion queue contexts */
2479
 	/* Completion queue contexts */
2493
-	icm_member_size = icm_usage ( log_num_cqs, hermon->cap.cqc_entry_size );
2494
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2480
+	len = ( ( 1 << log_num_cqs ) * hermon->cap.cqc_entry_size );
2481
+	icm_offset = icm_align ( icm_offset, len );
2495
 	MLX_FILL_1 ( init_hca, 20,
2482
 	MLX_FILL_1 ( init_hca, 20,
2496
 		     qpc_eec_cqc_eqc_rdb_parameters.cqc_base_addr_h,
2483
 		     qpc_eec_cqc_eqc_rdb_parameters.cqc_base_addr_h,
2497
 		     ( icm_offset >> 32 ) );
2484
 		     ( icm_offset >> 32 ) );
2500
 		     ( icm_offset >> 5 ),
2487
 		     ( icm_offset >> 5 ),
2501
 		     qpc_eec_cqc_eqc_rdb_parameters.log_num_of_cq,
2488
 		     qpc_eec_cqc_eqc_rdb_parameters.log_num_of_cq,
2502
 		     log_num_cqs );
2489
 		     log_num_cqs );
2503
-	DBGC ( hermon, "Hermon %p ICM CQC base = %llx\n", hermon, icm_offset );
2504
-	icm_offset += icm_member_size;
2490
+	DBGC ( hermon, "Hermon %p ICM CQC is %d x %#zx at [%08llx,%08llx)\n",
2491
+	       hermon, ( 1 << log_num_cqs ), hermon->cap.cqc_entry_size,
2492
+	       icm_offset, ( icm_offset + len ) );
2493
+	icm_offset += len;
2505
 
2494
 
2506
 	/* Event queue contexts */
2495
 	/* Event queue contexts */
2507
-	icm_member_size = icm_usage ( log_num_eqs, hermon->cap.eqc_entry_size );
2508
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2496
+	len = ( ( 1 << log_num_eqs ) * hermon->cap.eqc_entry_size );
2497
+	icm_offset = icm_align ( icm_offset, len );
2509
 	MLX_FILL_1 ( init_hca, 32,
2498
 	MLX_FILL_1 ( init_hca, 32,
2510
 		     qpc_eec_cqc_eqc_rdb_parameters.eqc_base_addr_h,
2499
 		     qpc_eec_cqc_eqc_rdb_parameters.eqc_base_addr_h,
2511
 		     ( icm_offset >> 32 ) );
2500
 		     ( icm_offset >> 32 ) );
2514
 		     ( icm_offset >> 5 ),
2503
 		     ( icm_offset >> 5 ),
2515
 		     qpc_eec_cqc_eqc_rdb_parameters.log_num_of_eq,
2504
 		     qpc_eec_cqc_eqc_rdb_parameters.log_num_of_eq,
2516
 		     log_num_eqs );
2505
 		     log_num_eqs );
2517
-	DBGC ( hermon, "Hermon %p ICM EQC base = %llx\n", hermon, icm_offset );
2518
-	icm_offset += icm_member_size;
2506
+	DBGC ( hermon, "Hermon %p ICM EQC is %d x %#zx at [%08llx,%08llx)\n",
2507
+	       hermon, ( 1 << log_num_eqs ), hermon->cap.eqc_entry_size,
2508
+	       icm_offset, ( icm_offset + len ) );
2509
+	icm_offset += len;
2519
 
2510
 
2520
 	/* Memory translation table */
2511
 	/* Memory translation table */
2521
-	icm_member_size = icm_usage ( log_num_mtts,
2522
-				  hermon->cap.mtt_entry_size );
2523
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2512
+	len = ( ( 1 << log_num_mtts ) * hermon->cap.mtt_entry_size );
2513
+	icm_offset = icm_align ( icm_offset, len );
2524
 	MLX_FILL_1 ( init_hca, 64,
2514
 	MLX_FILL_1 ( init_hca, 64,
2525
 		     tpt_parameters.mtt_base_addr_h, ( icm_offset >> 32 ) );
2515
 		     tpt_parameters.mtt_base_addr_h, ( icm_offset >> 32 ) );
2526
 	MLX_FILL_1 ( init_hca, 65,
2516
 	MLX_FILL_1 ( init_hca, 65,
2527
 		     tpt_parameters.mtt_base_addr_l, icm_offset );
2517
 		     tpt_parameters.mtt_base_addr_l, icm_offset );
2528
-	DBGC ( hermon, "Hermon %p ICM MTT base = %llx\n", hermon, icm_offset );
2529
-	icm_offset += icm_member_size;
2518
+	DBGC ( hermon, "Hermon %p ICM MTT is %d x %#zx at [%08llx,%08llx)\n",
2519
+	       hermon, ( 1 << log_num_mtts ), hermon->cap.mtt_entry_size,
2520
+	       icm_offset, ( icm_offset + len ) );
2521
+	icm_offset += len;
2530
 
2522
 
2531
 	/* Memory protection table */
2523
 	/* Memory protection table */
2532
-	log_num_mpts = fls ( hermon->cap.reserved_mrws + 1 - 1 );
2533
-	icm_member_size = icm_usage ( log_num_mpts,
2534
-				  hermon->cap.dmpt_entry_size );
2535
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2524
+	len = ( ( 1 << log_num_mpts ) * hermon->cap.dmpt_entry_size );
2525
+	icm_offset = icm_align ( icm_offset, len );
2536
 	MLX_FILL_1 ( init_hca, 60,
2526
 	MLX_FILL_1 ( init_hca, 60,
2537
 		     tpt_parameters.dmpt_base_adr_h, ( icm_offset >> 32 ) );
2527
 		     tpt_parameters.dmpt_base_adr_h, ( icm_offset >> 32 ) );
2538
 	MLX_FILL_1 ( init_hca, 61,
2528
 	MLX_FILL_1 ( init_hca, 61,
2539
 		     tpt_parameters.dmpt_base_adr_l, icm_offset );
2529
 		     tpt_parameters.dmpt_base_adr_l, icm_offset );
2540
 	MLX_FILL_1 ( init_hca, 62,
2530
 	MLX_FILL_1 ( init_hca, 62,
2541
 		     tpt_parameters.log_dmpt_sz, log_num_mpts );
2531
 		     tpt_parameters.log_dmpt_sz, log_num_mpts );
2542
-	DBGC ( hermon, "Hermon %p ICM DMPT base = %llx\n", hermon, icm_offset);
2543
-	icm_offset += icm_usage ( log_num_mpts,
2544
-				  hermon->cap.dmpt_entry_size );
2532
+	DBGC ( hermon, "Hermon %p ICM DMPT is %d x %#zx at [%08llx,%08llx)\n",
2533
+	       hermon, ( 1 << log_num_mpts ), hermon->cap.dmpt_entry_size,
2534
+	       icm_offset, ( icm_offset + len ) );
2535
+	icm_offset += len;
2545
 
2536
 
2546
 	/* Multicast table */
2537
 	/* Multicast table */
2547
-	icm_member_size = ( ( 128 * sizeof ( struct hermonprm_mcg_entry ) +
2548
-						 HERMON_PAGE_SIZE - 1 ) & ~( HERMON_PAGE_SIZE - 1 ) );
2549
-	icm_offset += icm_align ( icm_member_size, icm_offset );
2538
+	len = ( ( 1 << log_num_mcs ) * sizeof ( struct hermonprm_mcg_entry ) );
2539
+	icm_offset = icm_align ( icm_offset, len );
2550
 	MLX_FILL_1 ( init_hca, 48,
2540
 	MLX_FILL_1 ( init_hca, 48,
2551
 		     multicast_parameters.mc_base_addr_h,
2541
 		     multicast_parameters.mc_base_addr_h,
2552
 		     ( icm_offset >> 32 ) );
2542
 		     ( icm_offset >> 32 ) );
2556
 		     multicast_parameters.log_mc_table_entry_sz,
2546
 		     multicast_parameters.log_mc_table_entry_sz,
2557
 		     fls ( sizeof ( struct hermonprm_mcg_entry ) - 1 ) );
2547
 		     fls ( sizeof ( struct hermonprm_mcg_entry ) - 1 ) );
2558
 	MLX_FILL_1 ( init_hca, 53,
2548
 	MLX_FILL_1 ( init_hca, 53,
2559
-		     multicast_parameters.log_mc_table_hash_sz, 7 );
2549
+		     multicast_parameters.log_mc_table_hash_sz, log_num_mcs );
2560
 	MLX_FILL_1 ( init_hca, 54,
2550
 	MLX_FILL_1 ( init_hca, 54,
2561
-		     multicast_parameters.log_mc_table_sz, 7 );
2562
-	DBGC ( hermon, "Hermon %p ICM MC base = %llx\n", hermon, icm_offset );
2563
-	icm_offset += icm_member_size;
2551
+		     multicast_parameters.log_mc_table_sz, log_num_mcs );
2552
+	DBGC ( hermon, "Hermon %p ICM MC is %d x %#zx at [%08llx,%08llx)\n",
2553
+	       hermon, ( 1 << log_num_mcs ),
2554
+	       sizeof ( struct hermonprm_mcg_entry ),
2555
+	       icm_offset, ( icm_offset + len ) );
2556
+	icm_offset += len;
2564
 
2557
 
2565
 
2558
 
2566
 	hermon->icm_map[HERMON_ICM_OTHER].len =
2559
 	hermon->icm_map[HERMON_ICM_OTHER].len =

+ 3
- 1
src/drivers/infiniband/hermon.h View File

89
 
89
 
90
 #define HERMON_INVALID_LKEY		0x00000100UL
90
 #define HERMON_INVALID_LKEY		0x00000100UL
91
 
91
 
92
-#define HERMON_PAGE_SIZE		4096
92
+#define HERMON_PAGE_SIZE		( ( size_t ) 4096 )
93
 
93
 
94
 #define HERMON_DB_POST_SND_OFFSET	0x14
94
 #define HERMON_DB_POST_SND_OFFSET	0x14
95
 #define HERMON_DB_EQ_OFFSET(_eqn)	\
95
 #define HERMON_DB_EQ_OFFSET(_eqn)	\
107
 #define HERMON_SCHED_QP0		0x3f
107
 #define HERMON_SCHED_QP0		0x3f
108
 #define HERMON_SCHED_DEFAULT		0x83
108
 #define HERMON_SCHED_DEFAULT		0x83
109
 
109
 
110
+#define HERMON_LOG_MULTICAST_HASH_SIZE	7
111
+
110
 #define HERMON_PM_STATE_ARMED		0x00
112
 #define HERMON_PM_STATE_ARMED		0x00
111
 #define HERMON_PM_STATE_REARM		0x01
113
 #define HERMON_PM_STATE_REARM		0x01
112
 #define HERMON_PM_STATE_MIGRATED	0x03
114
 #define HERMON_PM_STATE_MIGRATED	0x03

Loading…
Cancel
Save