Skip to content

Commit ae2104b

Browse files
YijingWangdavem330
authored andcommitted
bnx2x: clean up unnecessary MSI/MSI-X capability find
PCI core will initialize device MSI/MSI-X capability in pci_msi_init_pci_dev(). So device driver should use pci_dev->msi_cap/msix_cap to determine whether the device support MSI/MSI-X instead of using pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX). Access to PCIe device config space again will consume more time. Signed-off-by: Yijing Wang <[email protected]> Cc: Eilon Greenstein <[email protected]> Cc: [email protected] Acked-by: Ariel Elior <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 555a842 commit ae2104b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12544,16 +12544,14 @@ static int bnx2x_set_qm_cid_count(struct bnx2x *bp)
1254412544
static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev,
1254512545
int cnic_cnt, bool is_vf)
1254612546
{
12547-
int pos, index;
12547+
int index;
1254812548
u16 control = 0;
1254912549

12550-
pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
12551-
1255212550
/*
1255312551
* If MSI-X is not supported - return number of SBs needed to support
1255412552
* one fast path queue: one FP queue + SB for CNIC
1255512553
*/
12556-
if (!pos) {
12554+
if (!pdev->msix_cap) {
1255712555
dev_info(&pdev->dev, "no msix capability found\n");
1255812556
return 1 + cnic_cnt;
1255912557
}
@@ -12566,7 +12564,7 @@ static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev,
1256612564
* without the default SB.
1256712565
* For VFs there is no default SB, then we return (index+1).
1256812566
*/
12569-
pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &control);
12567+
pci_read_config_word(pdev, pdev->msix_cap + PCI_MSI_FLAGS, &control);
1257012568

1257112569
index = control & PCI_MSIX_FLAGS_QSIZE;
1257212570

0 commit comments

Comments
 (0)