forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/scsi/csiostor/csio_isr.c
....@@ -474,13 +474,39 @@
474474 csio_dbg(hw, "Reduced sqsets to %d\n", hw->num_sqsets);
475475 }
476476
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
+
477496 static int
478497 csio_enable_msix(struct csio_hw *hw)
479498 {
480499 int i, j, k, n, min, cnt;
481500 int extra = CSIO_EXTRA_VECS;
482501 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;
484510
485511 min = hw->num_pports + extra;
486512 cnt = hw->num_sqsets + extra;