Skip to content

Commit

Permalink
i40evf: Refactor VF RSS code
Browse files Browse the repository at this point in the history
Refactor VF RSS code to allow RSS on a single queue and eliminate
the need for the next_queue function.

Change-ID: I9253bad96b7f542ee7036e15636db0e5d58d8ef2
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Jim Young <james.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Anjali Singhai Jain authored and Jeff Kirsher committed Apr 3, 2015
1 parent 13acb54 commit 9a9c8ae
Showing 1 changed file with 11 additions and 32 deletions.
43 changes: 11 additions & 32 deletions drivers/net/ethernet/intel/i40evf/i40evf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,41 +1435,22 @@ static void i40evf_watchdog_task(struct work_struct *work)
}

/**
* next_queue - increment to next available tx queue
* @adapter: board private structure
* @j: queue counter
*
* Helper function for RSS programming to increment through available
* queus. Returns the next queue value.
**/
static int next_queue(struct i40evf_adapter *adapter, int j)
{
j += 1;

return j >= adapter->num_active_queues ? 0 : j;
}

/**
* i40evf_configure_rss - Prepare for RSS if used
* i40evf_configure_rss - Prepare for RSS
* @adapter: board private structure
**/
static void i40evf_configure_rss(struct i40evf_adapter *adapter)
{
u32 rss_key[I40E_VFQF_HKEY_MAX_INDEX + 1];
struct i40e_hw *hw = &adapter->hw;
u32 cqueue = 0;
u32 lut = 0;
int i, j;
u64 hena;

/* No RSS for single queue. */
if (adapter->num_active_queues == 1) {
wr32(hw, I40E_VFQF_HENA(0), 0);
wr32(hw, I40E_VFQF_HENA(1), 0);
return;
}

/* Hash type is configured by the PF - we just supply the key */
netdev_rss_key_fill(rss_key, sizeof(rss_key));

/* Fill out hash function seed */
for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++)
wr32(hw, I40E_VFQF_HKEY(i), rss_key[i]);

Expand All @@ -1479,16 +1460,14 @@ 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 */
j = adapter->num_active_queues;
for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
j = next_queue(adapter, j);
lut = j;
j = next_queue(adapter, j);
lut |= j << 8;
j = next_queue(adapter, j);
lut |= j << 16;
j = next_queue(adapter, j);
lut |= j << 24;
lut = 0;
for (j = 0; j < 4; j++) {
if (cqueue == adapter->vsi_res->num_queue_pairs)
cqueue = 0;
lut |= ((cqueue) << (8 * j));
cqueue++;
}
wr32(hw, I40E_VFQF_HLUT(i), lut);
}
i40e_flush(hw);
Expand Down

0 comments on commit 9a9c8ae

Please sign in to comment.