Skip to content

Commit e35b051

Browse files
committed
Merge branch 'bnxt_en-msix-improvements'
Michael Chan says: ==================== bnxt_en: MSIX improvements This patchset makes some improvements related to MSIX. The first patch adjusts the default MSIX vectors assigned for RoCE. On the PF, the number of MSIX is increased to 64 from the current 9. The second patch allocates additional MSIX vectors ahead of time when changing ethtool channels if dynamic MSIX is supported. The 3rd patch makes sure that the IRQ name is not truncated. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 955f5b1 + f77cdee commit e35b051

File tree

5 files changed

+42
-13
lines changed

5 files changed

+42
-13
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13803,6 +13803,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
1380313803
int max_rx, max_tx, max_cp, tx_sets = 1, tx_cp;
1380413804
struct bnxt_hw_rings hwr = {0};
1380513805
int rx_rings = rx;
13806+
int rc;
1380613807

1380713808
if (tcs)
1380813809
tx_sets = tcs;
@@ -13835,7 +13836,23 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
1383513836
}
1383613837
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
1383713838
hwr.cp_p5 = hwr.tx + rx;
13838-
return bnxt_hwrm_check_rings(bp, &hwr);
13839+
rc = bnxt_hwrm_check_rings(bp, &hwr);
13840+
if (!rc && pci_msix_can_alloc_dyn(bp->pdev)) {
13841+
if (!bnxt_ulp_registered(bp->edev)) {
13842+
hwr.cp += bnxt_get_ulp_msix_num(bp);
13843+
hwr.cp = min_t(int, hwr.cp, bnxt_get_max_func_irqs(bp));
13844+
}
13845+
if (hwr.cp > bp->total_irqs) {
13846+
int total_msix = bnxt_change_msix(bp, hwr.cp);
13847+
13848+
if (total_msix < hwr.cp) {
13849+
netdev_warn(bp->dev, "Unable to allocate %d MSIX vectors, maximum available %d\n",
13850+
hwr.cp, total_msix);
13851+
rc = -ENOSPC;
13852+
}
13853+
}
13854+
}
13855+
return rc;
1383913856
}
1384013857

1384113858
static void bnxt_unmap_bars(struct bnxt *bp, struct pci_dev *pdev)

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,12 +1217,15 @@ struct bnxt_napi {
12171217
bool in_reset;
12181218
};
12191219

1220+
/* "TxRx", 2 hypens, plus maximum integer */
1221+
#define BNXT_IRQ_NAME_EXTRA 17
1222+
12201223
struct bnxt_irq {
12211224
irq_handler_t handler;
12221225
unsigned int vector;
12231226
u8 requested:1;
12241227
u8 have_cpumask:1;
1225-
char name[IFNAMSIZ + 2];
1228+
char name[IFNAMSIZ + BNXT_IRQ_NAME_EXTRA];
12261229
cpumask_var_t cpu_mask;
12271230
};
12281231

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -955,11 +955,6 @@ static int bnxt_set_channels(struct net_device *dev,
955955
}
956956
tx_xdp = req_rx_rings;
957957
}
958-
rc = bnxt_check_rings(bp, req_tx_rings, req_rx_rings, sh, tcs, tx_xdp);
959-
if (rc) {
960-
netdev_warn(dev, "Unable to allocate the requested rings\n");
961-
return rc;
962-
}
963958

964959
if (bnxt_get_nr_rss_ctxs(bp, req_rx_rings) !=
965960
bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings) &&
@@ -968,6 +963,12 @@ static int bnxt_set_channels(struct net_device *dev,
968963
return -EINVAL;
969964
}
970965

966+
rc = bnxt_check_rings(bp, req_tx_rings, req_rx_rings, sh, tcs, tx_xdp);
967+
if (rc) {
968+
netdev_warn(dev, "Unable to allocate the requested rings\n");
969+
return rc;
970+
}
971+
971972
if (netif_running(dev)) {
972973
if (BNXT_PF(bp)) {
973974
/* TODO CHIMP_FW: Send message to all VF's

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,17 @@ EXPORT_SYMBOL(bnxt_unregister_dev);
176176

177177
static int bnxt_set_dflt_ulp_msix(struct bnxt *bp)
178178
{
179-
u32 roce_msix = BNXT_VF(bp) ?
180-
BNXT_MAX_VF_ROCE_MSIX : BNXT_MAX_ROCE_MSIX;
179+
int roce_msix = BNXT_MAX_ROCE_MSIX;
181180

182-
return ((bp->flags & BNXT_FLAG_ROCE_CAP) ?
183-
min_t(u32, roce_msix, num_online_cpus()) : 0);
181+
if (BNXT_VF(bp))
182+
roce_msix = BNXT_MAX_ROCE_MSIX_VF;
183+
else if (bp->port_partition_type)
184+
roce_msix = BNXT_MAX_ROCE_MSIX_NPAR_PF;
185+
186+
/* NQ MSIX vectors should match the number of CPUs plus 1 more for
187+
* the CREQ MSIX, up to the default.
188+
*/
189+
return min_t(int, roce_msix, num_online_cpus() + 1);
184190
}
185191

186192
int bnxt_send_msg(struct bnxt_en_dev *edev,

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
#define BNXT_MIN_ROCE_CP_RINGS 2
1717
#define BNXT_MIN_ROCE_STAT_CTXS 1
18-
#define BNXT_MAX_ROCE_MSIX 9
19-
#define BNXT_MAX_VF_ROCE_MSIX 2
18+
19+
#define BNXT_MAX_ROCE_MSIX_VF 2
20+
#define BNXT_MAX_ROCE_MSIX_NPAR_PF 5
21+
#define BNXT_MAX_ROCE_MSIX 64
2022

2123
struct hwrm_async_event_cmpl;
2224
struct bnxt;

0 commit comments

Comments
 (0)