diff options
author | Anjali Singhai Jain <anjali.singhai@intel.com> | 2015-03-31 03:45:06 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-04-03 06:54:32 -0400 |
commit | 9a9c8ae1c1b43e12a5ab786d3463b251fe2fd4aa (patch) | |
tree | 68aeef5ef7ec493fc5df9a4aa968d02836da8371 /drivers/net/ethernet | |
parent | 13acb54683f834cb16baf7ad7fd6e15a97b0762f (diff) |
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: 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>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/intel/i40evf/i40evf_main.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c index 46aef2a45cbf..6d5f3b21c68a 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c | |||
@@ -1435,41 +1435,22 @@ restart_watchdog: | |||
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | /** | 1437 | /** |
1438 | * next_queue - increment to next available tx queue | 1438 | * i40evf_configure_rss - Prepare for RSS |
1439 | * @adapter: board private structure | ||
1440 | * @j: queue counter | ||
1441 | * | ||
1442 | * Helper function for RSS programming to increment through available | ||
1443 | * queus. Returns the next queue value. | ||
1444 | **/ | ||
1445 | static int next_queue(struct i40evf_adapter *adapter, int j) | ||
1446 | { | ||
1447 | j += 1; | ||
1448 | |||
1449 | return j >= adapter->num_active_queues ? 0 : j; | ||
1450 | } | ||
1451 | |||
1452 | /** | ||
1453 | * i40evf_configure_rss - Prepare for RSS if used | ||
1454 | * @adapter: board private structure | 1439 | * @adapter: board private structure |
1455 | **/ | 1440 | **/ |
1456 | static void i40evf_configure_rss(struct i40evf_adapter *adapter) | 1441 | static void i40evf_configure_rss(struct i40evf_adapter *adapter) |
1457 | { | 1442 | { |
1458 | u32 rss_key[I40E_VFQF_HKEY_MAX_INDEX + 1]; | 1443 | u32 rss_key[I40E_VFQF_HKEY_MAX_INDEX + 1]; |
1459 | struct i40e_hw *hw = &adapter->hw; | 1444 | struct i40e_hw *hw = &adapter->hw; |
1445 | u32 cqueue = 0; | ||
1460 | u32 lut = 0; | 1446 | u32 lut = 0; |
1461 | int i, j; | 1447 | int i, j; |
1462 | u64 hena; | 1448 | u64 hena; |
1463 | 1449 | ||
1464 | /* No RSS for single queue. */ | ||
1465 | if (adapter->num_active_queues == 1) { | ||
1466 | wr32(hw, I40E_VFQF_HENA(0), 0); | ||
1467 | wr32(hw, I40E_VFQF_HENA(1), 0); | ||
1468 | return; | ||
1469 | } | ||
1470 | |||
1471 | /* Hash type is configured by the PF - we just supply the key */ | 1450 | /* Hash type is configured by the PF - we just supply the key */ |
1472 | netdev_rss_key_fill(rss_key, sizeof(rss_key)); | 1451 | netdev_rss_key_fill(rss_key, sizeof(rss_key)); |
1452 | |||
1453 | /* Fill out hash function seed */ | ||
1473 | for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) | 1454 | for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) |
1474 | wr32(hw, I40E_VFQF_HKEY(i), rss_key[i]); | 1455 | wr32(hw, I40E_VFQF_HKEY(i), rss_key[i]); |
1475 | 1456 | ||
@@ -1479,16 +1460,14 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter) | |||
1479 | wr32(hw, I40E_VFQF_HENA(1), (u32)(hena >> 32)); | 1460 | wr32(hw, I40E_VFQF_HENA(1), (u32)(hena >> 32)); |
1480 | 1461 | ||
1481 | /* Populate the LUT with max no. of queues in round robin fashion */ | 1462 | /* Populate the LUT with max no. of queues in round robin fashion */ |
1482 | j = adapter->num_active_queues; | ||
1483 | for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) { | 1463 | for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) { |
1484 | j = next_queue(adapter, j); | 1464 | lut = 0; |
1485 | lut = j; | 1465 | for (j = 0; j < 4; j++) { |
1486 | j = next_queue(adapter, j); | 1466 | if (cqueue == adapter->vsi_res->num_queue_pairs) |
1487 | lut |= j << 8; | 1467 | cqueue = 0; |
1488 | j = next_queue(adapter, j); | 1468 | lut |= ((cqueue) << (8 * j)); |
1489 | lut |= j << 16; | 1469 | cqueue++; |
1490 | j = next_queue(adapter, j); | 1470 | } |
1491 | lut |= j << 24; | ||
1492 | wr32(hw, I40E_VFQF_HLUT(i), lut); | 1471 | wr32(hw, I40E_VFQF_HLUT(i), lut); |
1493 | } | 1472 | } |
1494 | i40e_flush(hw); | 1473 | i40e_flush(hw); |