Commit ba880734 authored by Brett Creeley's avatar Brett Creeley Committed by Jeff Kirsher

ice: Remove unnecessary flag ICE_FLAG_MSIX_ENA

This flag is not needed and is called every time we re-enable interrupts
in the hotpath so remove it. Also remove ice_vsi_req_irq() because it
was a wrapper function for ice_vsi_req_irq_msix() whose sole purpose was
checking the ICE_FLAG_MSIX_ENA flag.
Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 99214944
...@@ -329,7 +329,6 @@ struct ice_q_vector { ...@@ -329,7 +329,6 @@ struct ice_q_vector {
} ____cacheline_internodealigned_in_smp; } ____cacheline_internodealigned_in_smp;
enum ice_pf_flags { enum ice_pf_flags {
ICE_FLAG_MSIX_ENA,
ICE_FLAG_FLTR_SYNC, ICE_FLAG_FLTR_SYNC,
ICE_FLAG_RSS_ENA, ICE_FLAG_RSS_ENA,
ICE_FLAG_SRIOV_ENA, ICE_FLAG_SRIOV_ENA,
......
...@@ -1129,12 +1129,7 @@ static int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi) ...@@ -1129,12 +1129,7 @@ static int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi)
return -EEXIST; return -EEXIST;
} }
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) { num_q_vectors = vsi->num_q_vectors;
num_q_vectors = vsi->num_q_vectors;
} else {
err = -EINVAL;
goto err_out;
}
for (v_idx = 0; v_idx < num_q_vectors; v_idx++) { for (v_idx = 0; v_idx < num_q_vectors; v_idx++) {
err = ice_vsi_alloc_q_vector(vsi, v_idx); err = ice_vsi_alloc_q_vector(vsi, v_idx);
...@@ -1180,9 +1175,6 @@ static int ice_vsi_setup_vector_base(struct ice_vsi *vsi) ...@@ -1180,9 +1175,6 @@ static int ice_vsi_setup_vector_base(struct ice_vsi *vsi)
return -EEXIST; return -EEXIST;
} }
if (!test_bit(ICE_FLAG_MSIX_ENA, pf->flags))
return -ENOENT;
num_q_vectors = vsi->num_q_vectors; num_q_vectors = vsi->num_q_vectors;
/* reserve slots from OS requested IRQs */ /* reserve slots from OS requested IRQs */
vsi->base_vector = ice_get_res(pf, pf->irq_tracker, num_q_vectors, vsi->base_vector = ice_get_res(pf, pf->irq_tracker, num_q_vectors,
...@@ -2605,39 +2597,36 @@ void ice_vsi_free_irq(struct ice_vsi *vsi) ...@@ -2605,39 +2597,36 @@ void ice_vsi_free_irq(struct ice_vsi *vsi)
{ {
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
int base = vsi->base_vector; int base = vsi->base_vector;
int i;
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) { if (!vsi->q_vectors || !vsi->irqs_ready)
int i; return;
if (!vsi->q_vectors || !vsi->irqs_ready)
return;
ice_vsi_release_msix(vsi); ice_vsi_release_msix(vsi);
if (vsi->type == ICE_VSI_VF) if (vsi->type == ICE_VSI_VF)
return; return;
vsi->irqs_ready = false; vsi->irqs_ready = false;
ice_for_each_q_vector(vsi, i) { ice_for_each_q_vector(vsi, i) {
u16 vector = i + base; u16 vector = i + base;
int irq_num; int irq_num;
irq_num = pf->msix_entries[vector].vector; irq_num = pf->msix_entries[vector].vector;
/* free only the irqs that were actually requested */ /* free only the irqs that were actually requested */
if (!vsi->q_vectors[i] || if (!vsi->q_vectors[i] ||
!(vsi->q_vectors[i]->num_ring_tx || !(vsi->q_vectors[i]->num_ring_tx ||
vsi->q_vectors[i]->num_ring_rx)) vsi->q_vectors[i]->num_ring_rx))
continue; continue;
/* clear the affinity notifier in the IRQ descriptor */ /* clear the affinity notifier in the IRQ descriptor */
irq_set_affinity_notifier(irq_num, NULL); irq_set_affinity_notifier(irq_num, NULL);
/* clear the affinity_mask in the IRQ descriptor */ /* clear the affinity_mask in the IRQ descriptor */
irq_set_affinity_hint(irq_num, NULL); irq_set_affinity_hint(irq_num, NULL);
synchronize_irq(irq_num); synchronize_irq(irq_num);
devm_free_irq(&pf->pdev->dev, irq_num, devm_free_irq(&pf->pdev->dev, irq_num,
vsi->q_vectors[i]); vsi->q_vectors[i]);
}
} }
} }
...@@ -2816,15 +2805,13 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi) ...@@ -2816,15 +2805,13 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi)
} }
/* disable each interrupt */ /* disable each interrupt */
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) { ice_for_each_q_vector(vsi, i)
ice_for_each_q_vector(vsi, i) wr32(hw, GLINT_DYN_CTL(vsi->q_vectors[i]->reg_idx), 0);
wr32(hw, GLINT_DYN_CTL(vsi->q_vectors[i]->reg_idx), 0);
ice_flush(hw); ice_flush(hw);
ice_for_each_q_vector(vsi, i) ice_for_each_q_vector(vsi, i)
synchronize_irq(pf->msix_entries[i + base].vector); synchronize_irq(pf->msix_entries[i + base].vector);
}
} }
/** /**
......
...@@ -1547,15 +1547,11 @@ static void ice_irq_affinity_release(struct kref __always_unused *ref) {} ...@@ -1547,15 +1547,11 @@ static void ice_irq_affinity_release(struct kref __always_unused *ref) {}
*/ */
static int ice_vsi_ena_irq(struct ice_vsi *vsi) static int ice_vsi_ena_irq(struct ice_vsi *vsi)
{ {
struct ice_pf *pf = vsi->back; struct ice_hw *hw = &vsi->back->hw;
struct ice_hw *hw = &pf->hw; int i;
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) {
int i;
ice_for_each_q_vector(vsi, i) ice_for_each_q_vector(vsi, i)
ice_irq_dynamic_ena(hw, vsi, vsi->q_vectors[i]); ice_irq_dynamic_ena(hw, vsi, vsi->q_vectors[i]);
}
ice_flush(hw); ice_flush(hw);
return 0; return 0;
...@@ -1803,7 +1799,7 @@ static void ice_free_irq_msix_misc(struct ice_pf *pf) ...@@ -1803,7 +1799,7 @@ static void ice_free_irq_msix_misc(struct ice_pf *pf)
wr32(hw, PFINT_OICR_ENA, 0); wr32(hw, PFINT_OICR_ENA, 0);
ice_flush(hw); ice_flush(hw);
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags) && pf->msix_entries) { if (pf->msix_entries) {
synchronize_irq(pf->msix_entries[pf->oicr_idx].vector); synchronize_irq(pf->msix_entries[pf->oicr_idx].vector);
devm_free_irq(&pf->pdev->dev, devm_free_irq(&pf->pdev->dev,
pf->msix_entries[pf->oicr_idx].vector, pf); pf->msix_entries[pf->oicr_idx].vector, pf);
...@@ -2229,7 +2225,6 @@ static void ice_deinit_pf(struct ice_pf *pf) ...@@ -2229,7 +2225,6 @@ static void ice_deinit_pf(struct ice_pf *pf)
static void ice_init_pf(struct ice_pf *pf) static void ice_init_pf(struct ice_pf *pf)
{ {
bitmap_zero(pf->flags, ICE_PF_FLAGS_NBITS); bitmap_zero(pf->flags, ICE_PF_FLAGS_NBITS);
set_bit(ICE_FLAG_MSIX_ENA, pf->flags);
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
if (pf->hw.func_caps.common_cap.sr_iov_1_1) { if (pf->hw.func_caps.common_cap.sr_iov_1_1) {
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
...@@ -2329,7 +2324,6 @@ static int ice_ena_msix_range(struct ice_pf *pf) ...@@ -2329,7 +2324,6 @@ static int ice_ena_msix_range(struct ice_pf *pf)
exit_err: exit_err:
pf->num_lan_msix = 0; pf->num_lan_msix = 0;
clear_bit(ICE_FLAG_MSIX_ENA, pf->flags);
return err; return err;
} }
...@@ -2342,7 +2336,6 @@ static void ice_dis_msix(struct ice_pf *pf) ...@@ -2342,7 +2336,6 @@ static void ice_dis_msix(struct ice_pf *pf)
pci_disable_msix(pf->pdev); pci_disable_msix(pf->pdev);
devm_kfree(&pf->pdev->dev, pf->msix_entries); devm_kfree(&pf->pdev->dev, pf->msix_entries);
pf->msix_entries = NULL; pf->msix_entries = NULL;
clear_bit(ICE_FLAG_MSIX_ENA, pf->flags);
} }
/** /**
...@@ -2351,8 +2344,7 @@ static void ice_dis_msix(struct ice_pf *pf) ...@@ -2351,8 +2344,7 @@ static void ice_dis_msix(struct ice_pf *pf)
*/ */
static void ice_clear_interrupt_scheme(struct ice_pf *pf) static void ice_clear_interrupt_scheme(struct ice_pf *pf)
{ {
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) ice_dis_msix(pf);
ice_dis_msix(pf);
if (pf->irq_tracker) { if (pf->irq_tracker) {
devm_kfree(&pf->pdev->dev, pf->irq_tracker); devm_kfree(&pf->pdev->dev, pf->irq_tracker);
...@@ -2368,10 +2360,7 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf) ...@@ -2368,10 +2360,7 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf)
{ {
int vectors; int vectors;
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) vectors = ice_ena_msix_range(pf);
vectors = ice_ena_msix_range(pf);
else
return -ENODEV;
if (vectors < 0) if (vectors < 0)
return vectors; return vectors;
...@@ -2528,12 +2517,10 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) ...@@ -2528,12 +2517,10 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
* the misc functionality and queue processing is combined in * the misc functionality and queue processing is combined in
* the same vector and that gets setup at open. * the same vector and that gets setup at open.
*/ */
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) { err = ice_req_irq_msix_misc(pf);
err = ice_req_irq_msix_misc(pf); if (err) {
if (err) { dev_err(dev, "setup of misc vector failed: %d\n", err);
dev_err(dev, "setup of misc vector failed: %d\n", err); goto err_init_interrupt_unroll;
goto err_init_interrupt_unroll;
}
} }
/* create switch struct for the switch element created by FW on boot */ /* create switch struct for the switch element created by FW on boot */
...@@ -3146,10 +3133,7 @@ static int ice_up_complete(struct ice_vsi *vsi) ...@@ -3146,10 +3133,7 @@ static int ice_up_complete(struct ice_vsi *vsi)
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
int err; int err;
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) ice_vsi_cfg_msix(vsi);
ice_vsi_cfg_msix(vsi);
else
return -ENOTSUPP;
/* Enable only Rx rings, Tx rings were enabled by the FW when the /* Enable only Rx rings, Tx rings were enabled by the FW when the
* Tx queue group list was configured and the context bits were * Tx queue group list was configured and the context bits were
...@@ -3609,24 +3593,6 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi) ...@@ -3609,24 +3593,6 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi)
return err; return err;
} }
/**
* ice_vsi_req_irq - Request IRQ from the OS
* @vsi: The VSI IRQ is being requested for
* @basename: name for the vector
*
* Return 0 on success and a negative value on error
*/
static int ice_vsi_req_irq(struct ice_vsi *vsi, char *basename)
{
struct ice_pf *pf = vsi->back;
int err = -EINVAL;
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags))
err = ice_vsi_req_irq_msix(vsi, basename);
return err;
}
/** /**
* ice_vsi_open - Called when a network interface is made active * ice_vsi_open - Called when a network interface is made active
* @vsi: the VSI to open * @vsi: the VSI to open
...@@ -3656,7 +3622,7 @@ static int ice_vsi_open(struct ice_vsi *vsi) ...@@ -3656,7 +3622,7 @@ static int ice_vsi_open(struct ice_vsi *vsi)
snprintf(int_name, sizeof(int_name) - 1, "%s-%s", snprintf(int_name, sizeof(int_name) - 1, "%s-%s",
dev_driver_string(&pf->pdev->dev), vsi->netdev->name); dev_driver_string(&pf->pdev->dev), vsi->netdev->name);
err = ice_vsi_req_irq(vsi, int_name); err = ice_vsi_req_irq_msix(vsi, int_name);
if (err) if (err)
goto err_setup_rx; goto err_setup_rx;
...@@ -3893,12 +3859,10 @@ static void ice_rebuild(struct ice_pf *pf) ...@@ -3893,12 +3859,10 @@ static void ice_rebuild(struct ice_pf *pf)
} }
/* start misc vector */ /* start misc vector */
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) { err = ice_req_irq_msix_misc(pf);
err = ice_req_irq_msix_misc(pf); if (err) {
if (err) { dev_err(dev, "misc vector setup failed: %d\n", err);
dev_err(dev, "misc vector setup failed: %d\n", err); goto err_vsi_rebuild;
goto err_vsi_rebuild;
}
} }
/* restart the VSIs that were rebuilt and running before the reset */ /* restart the VSIs that were rebuilt and running before the reset */
...@@ -4295,9 +4259,7 @@ static void ice_tx_timeout(struct net_device *netdev) ...@@ -4295,9 +4259,7 @@ static void ice_tx_timeout(struct net_device *netdev)
head = (rd32(hw, QTX_COMM_HEAD(vsi->txq_map[hung_queue])) & head = (rd32(hw, QTX_COMM_HEAD(vsi->txq_map[hung_queue])) &
QTX_COMM_HEAD_HEAD_M) >> QTX_COMM_HEAD_HEAD_S; QTX_COMM_HEAD_HEAD_M) >> QTX_COMM_HEAD_HEAD_S;
/* Read interrupt register */ /* Read interrupt register */
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) val = rd32(hw, GLINT_DYN_CTL(tx_ring->q_vector->reg_idx));
val = rd32(hw,
GLINT_DYN_CTL(tx_ring->q_vector->reg_idx));
netdev_info(netdev, "tx_timeout: VSI_num: %d, Q %d, NTC: 0x%x, HW_HEAD: 0x%x, NTU: 0x%x, INT: 0x%x\n", netdev_info(netdev, "tx_timeout: VSI_num: %d, Q %d, NTC: 0x%x, HW_HEAD: 0x%x, NTU: 0x%x, INT: 0x%x\n",
vsi->vsi_num, hung_queue, tx_ring->next_to_clean, vsi->vsi_num, hung_queue, tx_ring->next_to_clean,
......
...@@ -1413,7 +1413,6 @@ int ice_napi_poll(struct napi_struct *napi, int budget) ...@@ -1413,7 +1413,6 @@ int ice_napi_poll(struct napi_struct *napi, int budget)
struct ice_q_vector *q_vector = struct ice_q_vector *q_vector =
container_of(napi, struct ice_q_vector, napi); container_of(napi, struct ice_q_vector, napi);
struct ice_vsi *vsi = q_vector->vsi; struct ice_vsi *vsi = q_vector->vsi;
struct ice_pf *pf = vsi->back;
bool clean_complete = true; bool clean_complete = true;
int budget_per_ring = 0; int budget_per_ring = 0;
struct ice_ring *ring; struct ice_ring *ring;
...@@ -1454,8 +1453,7 @@ int ice_napi_poll(struct napi_struct *napi, int budget) ...@@ -1454,8 +1453,7 @@ int ice_napi_poll(struct napi_struct *napi, int budget)
* poll us due to busy-polling * poll us due to busy-polling
*/ */
if (likely(napi_complete_done(napi, work_done))) if (likely(napi_complete_done(napi, work_done)))
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) ice_update_ena_itr(vsi, q_vector);
ice_update_ena_itr(vsi, q_vector);
return min_t(int, work_done, budget - 1); return min_t(int, work_done, budget - 1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment