Skip to content

Commit e5811b8

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Add IRQ remapping logic.
Add remapping logic so that bnxt_en can use any arbitrary MSIX vectors. This will allow the driver to reserve one range of MSIX vectors to be used by both bnxt_en and bnxt_re. bnxt_en can now skip over the MSIX vectors used by bnxt_re. Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 08654eb commit e5811b8

File tree

1 file changed

+42
-17
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+42
-17
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,8 +2444,10 @@ static void bnxt_free_cp_rings(struct bnxt *bp)
24442444

24452445
static int bnxt_alloc_cp_rings(struct bnxt *bp)
24462446
{
2447-
int i, rc;
2447+
int i, rc, ulp_base_vec, ulp_msix;
24482448

2449+
ulp_msix = bnxt_get_ulp_msix_num(bp);
2450+
ulp_base_vec = bnxt_get_ulp_msix_base(bp);
24492451
for (i = 0; i < bp->cp_nr_rings; i++) {
24502452
struct bnxt_napi *bnapi = bp->bnapi[i];
24512453
struct bnxt_cp_ring_info *cpr;
@@ -2460,7 +2462,11 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
24602462
rc = bnxt_alloc_ring(bp, ring);
24612463
if (rc)
24622464
return rc;
2463-
ring->map_idx = i;
2465+
2466+
if (ulp_msix && i >= ulp_base_vec)
2467+
ring->map_idx = i + ulp_msix;
2468+
else
2469+
ring->map_idx = i;
24642470
}
24652471
return 0;
24662472
}
@@ -3384,15 +3390,27 @@ static void bnxt_disable_int(struct bnxt *bp)
33843390
}
33853391
}
33863392

3393+
static int bnxt_cp_num_to_irq_num(struct bnxt *bp, int n)
3394+
{
3395+
struct bnxt_napi *bnapi = bp->bnapi[n];
3396+
struct bnxt_cp_ring_info *cpr;
3397+
3398+
cpr = &bnapi->cp_ring;
3399+
return cpr->cp_ring_struct.map_idx;
3400+
}
3401+
33873402
static void bnxt_disable_int_sync(struct bnxt *bp)
33883403
{
33893404
int i;
33903405

33913406
atomic_inc(&bp->intr_sem);
33923407

33933408
bnxt_disable_int(bp);
3394-
for (i = 0; i < bp->cp_nr_rings; i++)
3395-
synchronize_irq(bp->irq_tbl[i].vector);
3409+
for (i = 0; i < bp->cp_nr_rings; i++) {
3410+
int map_idx = bnxt_cp_num_to_irq_num(bp, i);
3411+
3412+
synchronize_irq(bp->irq_tbl[map_idx].vector);
3413+
}
33963414
}
33973415

33983416
static void bnxt_enable_int(struct bnxt *bp)
@@ -5824,6 +5842,7 @@ static void bnxt_setup_msix(struct bnxt *bp)
58245842
}
58255843

58265844
for (i = 0; i < bp->cp_nr_rings; i++) {
5845+
int map_idx = bnxt_cp_num_to_irq_num(bp, i);
58275846
char *attr;
58285847

58295848
if (bp->flags & BNXT_FLAG_SHARED_RINGS)
@@ -5833,9 +5852,9 @@ static void bnxt_setup_msix(struct bnxt *bp)
58335852
else
58345853
attr = "tx";
58355854

5836-
snprintf(bp->irq_tbl[i].name, len, "%s-%s-%d", dev->name, attr,
5837-
i);
5838-
bp->irq_tbl[i].handler = bnxt_msix;
5855+
snprintf(bp->irq_tbl[map_idx].name, len, "%s-%s-%d", dev->name,
5856+
attr, i);
5857+
bp->irq_tbl[map_idx].handler = bnxt_msix;
58395858
}
58405859
}
58415860

@@ -6059,7 +6078,9 @@ static void bnxt_free_irq(struct bnxt *bp)
60596078
return;
60606079

60616080
for (i = 0; i < bp->cp_nr_rings; i++) {
6062-
irq = &bp->irq_tbl[i];
6081+
int map_idx = bnxt_cp_num_to_irq_num(bp, i);
6082+
6083+
irq = &bp->irq_tbl[map_idx];
60636084
if (irq->requested) {
60646085
if (irq->have_cpumask) {
60656086
irq_set_affinity_hint(irq->vector, NULL);
@@ -6078,14 +6099,25 @@ static int bnxt_request_irq(struct bnxt *bp)
60786099
int i, j, rc = 0;
60796100
unsigned long flags = 0;
60806101
#ifdef CONFIG_RFS_ACCEL
6081-
struct cpu_rmap *rmap = bp->dev->rx_cpu_rmap;
6102+
struct cpu_rmap *rmap;
60826103
#endif
60836104

6105+
rc = bnxt_setup_int_mode(bp);
6106+
if (rc) {
6107+
netdev_err(bp->dev, "bnxt_setup_int_mode err: %x\n",
6108+
rc);
6109+
return rc;
6110+
}
6111+
#ifdef CONFIG_RFS_ACCEL
6112+
rmap = bp->dev->rx_cpu_rmap;
6113+
#endif
60846114
if (!(bp->flags & BNXT_FLAG_USING_MSIX))
60856115
flags = IRQF_SHARED;
60866116

60876117
for (i = 0, j = 0; i < bp->cp_nr_rings; i++) {
6088-
struct bnxt_irq *irq = &bp->irq_tbl[i];
6118+
int map_idx = bnxt_cp_num_to_irq_num(bp, i);
6119+
struct bnxt_irq *irq = &bp->irq_tbl[map_idx];
6120+
60896121
#ifdef CONFIG_RFS_ACCEL
60906122
if (rmap && bp->bnapi[i]->rx_ring) {
60916123
rc = irq_cpu_rmap_add(rmap, irq->vector);
@@ -6805,13 +6837,6 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
68056837
rc = bnxt_reserve_rings(bp);
68066838
if (rc)
68076839
return rc;
6808-
6809-
rc = bnxt_setup_int_mode(bp);
6810-
if (rc) {
6811-
netdev_err(bp->dev, "bnxt_setup_int_mode err: %x\n",
6812-
rc);
6813-
return rc;
6814-
}
68156840
}
68166841
if ((bp->flags & BNXT_FLAG_RFS) &&
68176842
!(bp->flags & BNXT_FLAG_USING_MSIX)) {

0 commit comments

Comments
 (0)