Skip to content

Commit

Permalink
i40evf: correctly program RSS HLUT table
Browse files Browse the repository at this point in the history
The HLUT programming loop in in i40evf_configure_rss was a) overly-
complicated, and b) just plain broken. Most of the entries ended up being
not written at all, so most of the flows ended up at queue zero.

Refactor the HLUT programming loop to simply walk through the registers
and write four values to each one, incrementing through the number of
available queues.

Change-ID: I75766179bc67e4e997187794f3144e28c83fd00d
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Mitch Williams authored and Jeff Kirsher committed Mar 19, 2014
1 parent 588aefa commit 96d4770
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions drivers/net/ethernet/intel/i40evf/i40evf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,13 @@ static void i40evf_watchdog_task(struct work_struct *work)
schedule_work(&adapter->adminq_task);
}

static int next_queue(struct i40evf_adapter *adapter, int j)
{
j += 1;

return j >= adapter->vsi_res->num_queue_pairs ? 0 : j;
}

/**
* i40evf_configure_rss - Prepare for RSS if used
* @adapter: board private structure
Expand Down Expand Up @@ -1444,15 +1451,13 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter)
wr32(hw, I40E_VFQF_HENA(1), (u32)(hena >> 32));

/* Populate the LUT with max no. of queues in round robin fashion */
for (i = 0, j = 0; i < I40E_VFQF_HLUT_MAX_INDEX; i++, j++) {
if (j == adapter->vsi_res->num_queue_pairs)
j = 0;
/* lut = 4-byte sliding window of 4 lut entries */
lut = (lut << 8) | (j &
((0x1 << 8) - 1));
/* On i = 3, we have 4 entries in lut; write to the register */
if ((i & 3) == 3)
wr32(hw, I40E_VFQF_HLUT(i >> 2), lut);
j = adapter->vsi_res->num_queue_pairs;
for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
lut = next_queue(adapter, j);
lut |= next_queue(adapter, j) << 8;
lut |= next_queue(adapter, j) << 16;
lut |= next_queue(adapter, j) << 24;
wr32(hw, I40E_VFQF_HLUT(i), lut);
}
i40e_flush(hw);
}
Expand Down

0 comments on commit 96d4770

Please sign in to comment.