Commit 26cdc443 authored by Anjali Singhai Jain's avatar Anjali Singhai Jain Committed by Jeff Kirsher

i40e: Fix legacy interrupt mode in the driver

This patch fixes the driver flow to take into account legacy interrupts.
Over time we added code that assumes MSIX is the only mode that the
driver runs in. It also enables a legacy workaround to trigger SWINT
when the TX ring has non-cache aligned descriptors pending and interrupts
are disabled.

We work with a single vector in MSI mode too, so apply the same
restrictions as Legacy.

Change-ID: I826ddff1f9bd45d2dbe11f56a3ddcef0dbf42563
Signed-off-by: default avatarAnjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 02b42498
...@@ -1550,7 +1550,10 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, ...@@ -1550,7 +1550,10 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,
* vectors available and so we need to lower the used * vectors available and so we need to lower the used
* q count. * q count.
*/ */
if (pf->flags & I40E_FLAG_MSIX_ENABLED)
qcount = min_t(int, vsi->alloc_queue_pairs, pf->num_lan_msix); qcount = min_t(int, vsi->alloc_queue_pairs, pf->num_lan_msix);
else
qcount = vsi->alloc_queue_pairs;
num_tc_qps = qcount / numtc; num_tc_qps = qcount / numtc;
num_tc_qps = min_t(int, num_tc_qps, i40e_pf_get_max_q_per_tc(pf)); num_tc_qps = min_t(int, num_tc_qps, i40e_pf_get_max_q_per_tc(pf));
...@@ -1614,7 +1617,7 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, ...@@ -1614,7 +1617,7 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,
if ((vsi->type == I40E_VSI_MAIN) && (numtc == 1)) { if ((vsi->type == I40E_VSI_MAIN) && (numtc == 1)) {
if (vsi->req_queue_pairs > 0) if (vsi->req_queue_pairs > 0)
vsi->num_queue_pairs = vsi->req_queue_pairs; vsi->num_queue_pairs = vsi->req_queue_pairs;
else else if (pf->flags & I40E_FLAG_MSIX_ENABLED)
vsi->num_queue_pairs = pf->num_lan_msix; vsi->num_queue_pairs = pf->num_lan_msix;
} }
...@@ -3416,7 +3419,7 @@ static irqreturn_t i40e_fdir_clean_ring(int irq, void *data) ...@@ -3416,7 +3419,7 @@ static irqreturn_t i40e_fdir_clean_ring(int irq, void *data)
* @v_idx: vector index * @v_idx: vector index
* @qp_idx: queue pair index * @qp_idx: queue pair index
**/ **/
static void map_vector_to_qp(struct i40e_vsi *vsi, int v_idx, int qp_idx) static void i40e_map_vector_to_qp(struct i40e_vsi *vsi, int v_idx, int qp_idx)
{ {
struct i40e_q_vector *q_vector = vsi->q_vectors[v_idx]; struct i40e_q_vector *q_vector = vsi->q_vectors[v_idx];
struct i40e_ring *tx_ring = vsi->tx_rings[qp_idx]; struct i40e_ring *tx_ring = vsi->tx_rings[qp_idx];
...@@ -3470,7 +3473,7 @@ static void i40e_vsi_map_rings_to_vectors(struct i40e_vsi *vsi) ...@@ -3470,7 +3473,7 @@ static void i40e_vsi_map_rings_to_vectors(struct i40e_vsi *vsi)
q_vector->tx.ring = NULL; q_vector->tx.ring = NULL;
while (num_ringpairs--) { while (num_ringpairs--) {
map_vector_to_qp(vsi, v_start, qp_idx); i40e_map_vector_to_qp(vsi, v_start, qp_idx);
qp_idx++; qp_idx++;
qp_remaining--; qp_remaining--;
} }
...@@ -8798,6 +8801,11 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi) ...@@ -8798,6 +8801,11 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi)
goto vector_setup_out; goto vector_setup_out;
} }
/* In Legacy mode, we do not have to get any other vector since we
* piggyback on the misc/ICR0 for queue interrupts.
*/
if (!(pf->flags & I40E_FLAG_MSIX_ENABLED))
return ret;
if (vsi->num_q_vectors) if (vsi->num_q_vectors)
vsi->base_vector = i40e_get_lump(pf, pf->irq_pile, vsi->base_vector = i40e_get_lump(pf, pf->irq_pile,
vsi->num_q_vectors, vsi->idx); vsi->num_q_vectors, vsi->idx);
......
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