提交 9a9c8ae1 编写于 作者: A Anjali Singhai Jain 提交者: Jeff Kirsher

i40evf: Refactor VF RSS code

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: NAnjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: NJim Young <james.m.young@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 13acb546
...@@ -1435,41 +1435,22 @@ static void i40evf_watchdog_task(struct work_struct *work) ...@@ -1435,41 +1435,22 @@ static void i40evf_watchdog_task(struct work_struct *work)
} }
/** /**
* next_queue - increment to next available tx queue * i40evf_configure_rss - Prepare for RSS
* @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
* @adapter: board private structure * @adapter: board private structure
**/ **/
static void i40evf_configure_rss(struct i40evf_adapter *adapter) static void i40evf_configure_rss(struct i40evf_adapter *adapter)
{ {
u32 rss_key[I40E_VFQF_HKEY_MAX_INDEX + 1]; u32 rss_key[I40E_VFQF_HKEY_MAX_INDEX + 1];
struct i40e_hw *hw = &adapter->hw; struct i40e_hw *hw = &adapter->hw;
u32 cqueue = 0;
u32 lut = 0; u32 lut = 0;
int i, j; int i, j;
u64 hena; 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 */ /* Hash type is configured by the PF - we just supply the key */
netdev_rss_key_fill(rss_key, sizeof(rss_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++) for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++)
wr32(hw, I40E_VFQF_HKEY(i), rss_key[i]); wr32(hw, I40E_VFQF_HKEY(i), rss_key[i]);
...@@ -1479,16 +1460,14 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter) ...@@ -1479,16 +1460,14 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter)
wr32(hw, I40E_VFQF_HENA(1), (u32)(hena >> 32)); wr32(hw, I40E_VFQF_HENA(1), (u32)(hena >> 32));
/* Populate the LUT with max no. of queues in round robin fashion */ /* 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++) { for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
j = next_queue(adapter, j); lut = 0;
lut = j; for (j = 0; j < 4; j++) {
j = next_queue(adapter, j); if (cqueue == adapter->vsi_res->num_queue_pairs)
lut |= j << 8; cqueue = 0;
j = next_queue(adapter, j); lut |= ((cqueue) << (8 * j));
lut |= j << 16; cqueue++;
j = next_queue(adapter, j); }
lut |= j << 24;
wr32(hw, I40E_VFQF_HLUT(i), lut); wr32(hw, I40E_VFQF_HLUT(i), lut);
} }
i40e_flush(hw); i40e_flush(hw);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册