提交 06f4b081 编写于 作者: S Sara Sharon 提交者: Luca Coelho

iwlwifi: pcie: change indentation of iwl_pcie_set_interrupt_capa()

Function is very indented. Go to msi section if needed to avoid
it and by that make the code more readable.
Signed-off-by: NSara Sharon <sara.sharon@intel.com>
Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
上级 72c240fe
...@@ -1513,57 +1513,57 @@ static void iwl_pcie_set_interrupt_capa(struct pci_dev *pdev, ...@@ -1513,57 +1513,57 @@ static void iwl_pcie_set_interrupt_capa(struct pci_dev *pdev,
struct iwl_trans *trans) struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
int max_vector, nvec, i; int max_irqs, num_irqs, i, ret;
u16 pci_cmd; u16 pci_cmd;
if (trans->cfg->mq_rx_supported) { if (!trans->cfg->mq_rx_supported)
max_vector = min_t(u32, (num_possible_cpus() + 2), goto enable_msi;
IWL_MAX_RX_HW_QUEUES);
for (i = 0; i < max_vector; i++) max_irqs = min_t(u32, num_possible_cpus() + 2, IWL_MAX_RX_HW_QUEUES);
for (i = 0; i < max_irqs; i++)
trans_pcie->msix_entries[i].entry = i; trans_pcie->msix_entries[i].entry = i;
nvec = pci_enable_msix_range(pdev, trans_pcie->msix_entries, num_irqs = pci_enable_msix_range(pdev, trans_pcie->msix_entries,
MSIX_MIN_INTERRUPT_VECTORS, MSIX_MIN_INTERRUPT_VECTORS,
max_vector); max_irqs);
if (nvec < 0) { if (num_irqs < 0) {
IWL_DEBUG_INFO(trans, IWL_DEBUG_INFO(trans,
"ret = %d failed to enable msi-x mode move to msi mode\n", "Failed to enable msi-x mode (ret %d). Moving to msi mode.\n",
nvec); num_irqs);
goto msi; goto enable_msi;
} }
trans_pcie->def_irq = (num_irqs == max_irqs) ? num_irqs - 1 : 0;
IWL_DEBUG_INFO(trans, IWL_DEBUG_INFO(trans,
"Enable MSI-X allocate %d interrupt vector\n", "MSI-X enabled. %d interrupt vectors were allocated\n",
nvec); num_irqs);
trans_pcie->def_irq = (nvec == max_vector) ? nvec - 1 : 0;
/* /*
* In case the OS provides fewer interrupts than requested, * In case the OS provides fewer interrupts than requested, different
* different causes will share the same interrupt vector * causes will share the same interrupt vector as follows:
* as follow:
* One interrupt less: non rx causes shared with FBQ. * One interrupt less: non rx causes shared with FBQ.
* Two interrupts less: non rx causes shared with FBQ and RSS. * Two interrupts less: non rx causes shared with FBQ and RSS.
* More than two interrupts: we will use fewer RSS queues. * More than two interrupts: we will use fewer RSS queues.
*/ */
if (nvec <= num_online_cpus()) { if (num_irqs <= num_online_cpus()) {
trans_pcie->trans->num_rx_queues = nvec + 1; trans_pcie->trans->num_rx_queues = num_irqs + 1;
trans_pcie->shared_vec_mask = IWL_SHARED_IRQ_NON_RX | trans_pcie->shared_vec_mask = IWL_SHARED_IRQ_NON_RX |
IWL_SHARED_IRQ_FIRST_RSS; IWL_SHARED_IRQ_FIRST_RSS;
} else if (nvec == num_online_cpus() + 1) { } else if (num_irqs == num_online_cpus() + 1) {
trans_pcie->trans->num_rx_queues = nvec; trans_pcie->trans->num_rx_queues = num_irqs;
trans_pcie->shared_vec_mask = IWL_SHARED_IRQ_NON_RX; trans_pcie->shared_vec_mask = IWL_SHARED_IRQ_NON_RX;
} else { } else {
trans_pcie->trans->num_rx_queues = nvec - 1; trans_pcie->trans->num_rx_queues = num_irqs - 1;
} }
trans_pcie->alloc_vecs = nvec; trans_pcie->alloc_vecs = num_irqs;
trans_pcie->msix_enabled = true; trans_pcie->msix_enabled = true;
return; return;
}
msi:
nvec = pci_enable_msi(pdev); enable_msi:
if (nvec) { ret = pci_enable_msi(pdev);
dev_err(&pdev->dev, "pci_enable_msi failed - %d\n", nvec); if (ret) {
dev_err(&pdev->dev, "pci_enable_msi failed - %d\n", ret);
/* enable rfkill interrupt: hw bug w/a */ /* enable rfkill interrupt: hw bug w/a */
pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd);
if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册