Commit afe87cfe authored by Piotr Raczynski's avatar Piotr Raczynski Committed by Tony Nguyen

ice: use pci_irq_vector helper function

Currently, driver gets interrupt number directly from ice_pf::msix_entries
array. Use helper function dedicated to do just that.

While at it use a variable to store interrupt number in
ice_free_irq_msix_misc instead of calling the helper function twice.
Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: default avatarPiotr Raczynski <piotr.raczynski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 38e97a98
...@@ -616,7 +616,7 @@ int ice_set_cpu_rx_rmap(struct ice_vsi *vsi) ...@@ -616,7 +616,7 @@ int ice_set_cpu_rx_rmap(struct ice_vsi *vsi)
base_idx = vsi->base_vector; base_idx = vsi->base_vector;
ice_for_each_q_vector(vsi, i) ice_for_each_q_vector(vsi, i)
if (irq_cpu_rmap_add(netdev->rx_cpu_rmap, if (irq_cpu_rmap_add(netdev->rx_cpu_rmap,
pf->msix_entries[base_idx + i].vector)) { pci_irq_vector(pf->pdev, base_idx + i))) {
ice_free_cpu_rx_rmap(vsi); ice_free_cpu_rx_rmap(vsi);
return -EINVAL; return -EINVAL;
} }
......
...@@ -3056,7 +3056,7 @@ void ice_vsi_free_irq(struct ice_vsi *vsi) ...@@ -3056,7 +3056,7 @@ void ice_vsi_free_irq(struct ice_vsi *vsi)
u16 vector = i + base; u16 vector = i + base;
int irq_num; int irq_num;
irq_num = pf->msix_entries[vector].vector; irq_num = pci_irq_vector(pf->pdev, 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] ||
...@@ -3235,7 +3235,7 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi) ...@@ -3235,7 +3235,7 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi)
return; return;
ice_for_each_q_vector(vsi, i) ice_for_each_q_vector(vsi, i)
synchronize_irq(pf->msix_entries[i + base].vector); synchronize_irq(pci_irq_vector(pf->pdev, i + base));
} }
/** /**
......
...@@ -2501,7 +2501,7 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename) ...@@ -2501,7 +2501,7 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)
for (vector = 0; vector < q_vectors; vector++) { for (vector = 0; vector < q_vectors; vector++) {
struct ice_q_vector *q_vector = vsi->q_vectors[vector]; struct ice_q_vector *q_vector = vsi->q_vectors[vector];
irq_num = pf->msix_entries[base + vector].vector; irq_num = pci_irq_vector(pf->pdev, base + vector);
if (q_vector->tx.tx_ring && q_vector->rx.rx_ring) { if (q_vector->tx.tx_ring && q_vector->rx.rx_ring) {
snprintf(q_vector->name, sizeof(q_vector->name) - 1, snprintf(q_vector->name, sizeof(q_vector->name) - 1,
...@@ -2557,7 +2557,7 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename) ...@@ -2557,7 +2557,7 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)
free_q_irqs: free_q_irqs:
while (vector) { while (vector) {
vector--; vector--;
irq_num = pf->msix_entries[base + vector].vector; irq_num = pci_irq_vector(pf->pdev, base + vector);
if (!IS_ENABLED(CONFIG_RFS_ACCEL)) if (!IS_ENABLED(CONFIG_RFS_ACCEL))
irq_set_affinity_notifier(irq_num, NULL); irq_set_affinity_notifier(irq_num, NULL);
irq_set_affinity_hint(irq_num, NULL); irq_set_affinity_hint(irq_num, NULL);
...@@ -3234,6 +3234,7 @@ static void ice_dis_ctrlq_interrupts(struct ice_hw *hw) ...@@ -3234,6 +3234,7 @@ static void ice_dis_ctrlq_interrupts(struct ice_hw *hw)
*/ */
static void ice_free_irq_msix_misc(struct ice_pf *pf) static void ice_free_irq_msix_misc(struct ice_pf *pf)
{ {
int misc_irq_num = pci_irq_vector(pf->pdev, pf->oicr_idx);
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
ice_dis_ctrlq_interrupts(hw); ice_dis_ctrlq_interrupts(hw);
...@@ -3243,9 +3244,8 @@ static void ice_free_irq_msix_misc(struct ice_pf *pf) ...@@ -3243,9 +3244,8 @@ static void ice_free_irq_msix_misc(struct ice_pf *pf)
ice_flush(hw); ice_flush(hw);
if (pf->msix_entries) { if (pf->msix_entries) {
synchronize_irq(pf->msix_entries[pf->oicr_idx].vector); synchronize_irq(misc_irq_num);
devm_free_irq(ice_pf_to_dev(pf), devm_free_irq(ice_pf_to_dev(pf), misc_irq_num, pf);
pf->msix_entries[pf->oicr_idx].vector, pf);
} }
pf->num_avail_sw_msix += 1; pf->num_avail_sw_msix += 1;
...@@ -3317,7 +3317,7 @@ static int ice_req_irq_msix_misc(struct ice_pf *pf) ...@@ -3317,7 +3317,7 @@ static int ice_req_irq_msix_misc(struct ice_pf *pf)
pf->oicr_idx = (u16)oicr_idx; pf->oicr_idx = (u16)oicr_idx;
err = devm_request_threaded_irq(dev, err = devm_request_threaded_irq(dev,
pf->msix_entries[pf->oicr_idx].vector, pci_irq_vector(pf->pdev, pf->oicr_idx),
ice_misc_intr, ice_misc_intr_thread_fn, ice_misc_intr, ice_misc_intr_thread_fn,
0, pf->int_name, pf); 0, pf->int_name, pf);
if (err) { if (err) {
......
...@@ -911,7 +911,7 @@ ice_ptp_release_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx) ...@@ -911,7 +911,7 @@ ice_ptp_release_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
spin_unlock(&tx->lock); spin_unlock(&tx->lock);
/* wait for potentially outstanding interrupt to complete */ /* wait for potentially outstanding interrupt to complete */
synchronize_irq(pf->msix_entries[pf->oicr_idx].vector); synchronize_irq(pci_irq_vector(pf->pdev, pf->oicr_idx));
ice_ptp_flush_tx_tracker(pf, tx); ice_ptp_flush_tx_tracker(pf, tx);
......
...@@ -107,7 +107,7 @@ ice_qvec_dis_irq(struct ice_vsi *vsi, struct ice_rx_ring *rx_ring, ...@@ -107,7 +107,7 @@ ice_qvec_dis_irq(struct ice_vsi *vsi, struct ice_rx_ring *rx_ring,
wr32(hw, GLINT_DYN_CTL(q_vector->reg_idx), 0); wr32(hw, GLINT_DYN_CTL(q_vector->reg_idx), 0);
ice_flush(hw); ice_flush(hw);
synchronize_irq(pf->msix_entries[v_idx + base].vector); synchronize_irq(pci_irq_vector(pf->pdev, v_idx + base));
} }
} }
......
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