.. | .. |
---|
474 | 474 | csio_dbg(hw, "Reduced sqsets to %d\n", hw->num_sqsets); |
---|
475 | 475 | } |
---|
476 | 476 | |
---|
| 477 | +static void csio_calc_sets(struct irq_affinity *affd, unsigned int nvecs) |
---|
| 478 | +{ |
---|
| 479 | + struct csio_hw *hw = affd->priv; |
---|
| 480 | + u8 i; |
---|
| 481 | + |
---|
| 482 | + if (!nvecs) |
---|
| 483 | + return; |
---|
| 484 | + |
---|
| 485 | + if (nvecs < hw->num_pports) { |
---|
| 486 | + affd->nr_sets = 1; |
---|
| 487 | + affd->set_size[0] = nvecs; |
---|
| 488 | + return; |
---|
| 489 | + } |
---|
| 490 | + |
---|
| 491 | + affd->nr_sets = hw->num_pports; |
---|
| 492 | + for (i = 0; i < hw->num_pports; i++) |
---|
| 493 | + affd->set_size[i] = nvecs / hw->num_pports; |
---|
| 494 | +} |
---|
| 495 | + |
---|
477 | 496 | static int |
---|
478 | 497 | csio_enable_msix(struct csio_hw *hw) |
---|
479 | 498 | { |
---|
480 | 499 | int i, j, k, n, min, cnt; |
---|
481 | 500 | int extra = CSIO_EXTRA_VECS; |
---|
482 | 501 | struct csio_scsi_cpu_info *info; |
---|
483 | | - struct irq_affinity desc = { .pre_vectors = 2 }; |
---|
| 502 | + struct irq_affinity desc = { |
---|
| 503 | + .pre_vectors = CSIO_EXTRA_VECS, |
---|
| 504 | + .calc_sets = csio_calc_sets, |
---|
| 505 | + .priv = hw, |
---|
| 506 | + }; |
---|
| 507 | + |
---|
| 508 | + if (hw->num_pports > IRQ_AFFINITY_MAX_SETS) |
---|
| 509 | + return -ENOSPC; |
---|
484 | 510 | |
---|
485 | 511 | min = hw->num_pports + extra; |
---|
486 | 512 | cnt = hw->num_sqsets + extra; |
---|