提交 84f67018 编写于 作者: H Hariprasad Shenai 提交者: David S. Miller

cxgb4vf: Enable interrupts before we register our network devices

This avoids a race condition where a system that has network devices set up
to be automatically configured and we get the first Port Link Status
message from the firmware on the Asynchronous Firmware Event Queue before
we've enabled interrupts. If that happens, we end up losing the interrupt
and never realizing that the links has actually come up.
Signed-off-by: NHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5220ef1e
......@@ -2771,6 +2771,24 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
}
}
/* See what interrupts we'll be using. If we've been configured to
* use MSI-X interrupts, try to enable them but fall back to using
* MSI interrupts if we can't enable MSI-X interrupts. If we can't
* get MSI interrupts we bail with the error.
*/
if (msi == MSI_MSIX && enable_msix(adapter) == 0)
adapter->flags |= USING_MSIX;
else {
err = pci_enable_msi(pdev);
if (err) {
dev_err(&pdev->dev, "Unable to allocate %s interrupts;"
" err=%d\n",
msi == MSI_MSIX ? "MSI-X or MSI" : "MSI", err);
goto err_free_dev;
}
adapter->flags |= USING_MSI;
}
/*
* The "card" is now ready to go. If any errors occur during device
* registration we do not fail the whole "card" but rather proceed
......@@ -2793,7 +2811,7 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
}
if (adapter->registered_device_map == 0) {
dev_err(&pdev->dev, "could not register any net devices\n");
goto err_free_dev;
goto err_disable_interrupts;
}
/*
......@@ -2810,25 +2828,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
setup_debugfs(adapter);
}
/*
* See what interrupts we'll be using. If we've been configured to
* use MSI-X interrupts, try to enable them but fall back to using
* MSI interrupts if we can't enable MSI-X interrupts. If we can't
* get MSI interrupts we bail with the error.
*/
if (msi == MSI_MSIX && enable_msix(adapter) == 0)
adapter->flags |= USING_MSIX;
else {
err = pci_enable_msi(pdev);
if (err) {
dev_err(&pdev->dev, "Unable to allocate %s interrupts;"
" err=%d\n",
msi == MSI_MSIX ? "MSI-X or MSI" : "MSI", err);
goto err_free_debugfs;
}
adapter->flags |= USING_MSI;
}
/*
* Now that we know how many "ports" we have and what their types are,
* and how many Queue Sets we can support, we can configure our queue
......@@ -2856,11 +2855,13 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
* Error recovery and exit code. Unwind state that's been created
* so far and return the error.
*/
err_free_debugfs:
if (!IS_ERR_OR_NULL(adapter->debugfs_root)) {
cleanup_debugfs(adapter);
debugfs_remove_recursive(adapter->debugfs_root);
err_disable_interrupts:
if (adapter->flags & USING_MSIX) {
pci_disable_msix(adapter->pdev);
adapter->flags &= ~USING_MSIX;
} else if (adapter->flags & USING_MSI) {
pci_disable_msi(adapter->pdev);
adapter->flags &= ~USING_MSI;
}
err_free_dev:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册