aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Brandeburg <jesse.brandeburg@intel.com>2015-09-28 14:16:52 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-10-19 18:34:30 -0400
commit51cc6d9fccde27310b7dfba2be268ff5b8dcf52d (patch)
tree3e66b4fba7e5258e25bfd20d63c2610866d3565d
parent8f5e39ce9214888464d34ef7949e56bdc999b46c (diff)
i40e/i40evf: fix bug in throttle rate math
The driver was using a value expressed in 2us increments for the divisor to figure out our bytes/usec values. Fix the usecs variable to contain a value in microseconds. Change-ID: I5c20493103c295d6f201947bb908add7040b7c41 Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c9
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.c9
2 files changed, 16 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 889d25d6fde2..c96e581cc2b7 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -830,6 +830,7 @@ static bool i40e_set_new_dynamic_itr(struct i40e_ring_container *rc)
830 enum i40e_latency_range new_latency_range = rc->latency_range; 830 enum i40e_latency_range new_latency_range = rc->latency_range;
831 u32 new_itr = rc->itr; 831 u32 new_itr = rc->itr;
832 int bytes_per_int; 832 int bytes_per_int;
833 int usecs;
833 834
834 if (rc->total_packets == 0 || !rc->itr) 835 if (rc->total_packets == 0 || !rc->itr)
835 return false; 836 return false;
@@ -838,8 +839,14 @@ static bool i40e_set_new_dynamic_itr(struct i40e_ring_container *rc)
838 * 0-10MB/s lowest (100000 ints/s) 839 * 0-10MB/s lowest (100000 ints/s)
839 * 10-20MB/s low (20000 ints/s) 840 * 10-20MB/s low (20000 ints/s)
840 * 20-1249MB/s bulk (8000 ints/s) 841 * 20-1249MB/s bulk (8000 ints/s)
842 *
843 * The math works out because the divisor is in 10^(-6) which
844 * turns the bytes/us input value into MB/s values, but
845 * make sure to use usecs, as the register values written
846 * are in 2 usec increments in the ITR registers.
841 */ 847 */
842 bytes_per_int = rc->total_bytes / rc->itr; 848 usecs = (rc->itr << 1);
849 bytes_per_int = rc->total_bytes / usecs;
843 switch (new_latency_range) { 850 switch (new_latency_range) {
844 case I40E_LOWEST_LATENCY: 851 case I40E_LOWEST_LATENCY:
845 if (bytes_per_int > 10) 852 if (bytes_per_int > 10)
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 597e0964c232..7d98042338e0 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -333,6 +333,7 @@ static bool i40e_set_new_dynamic_itr(struct i40e_ring_container *rc)
333 enum i40e_latency_range new_latency_range = rc->latency_range; 333 enum i40e_latency_range new_latency_range = rc->latency_range;
334 u32 new_itr = rc->itr; 334 u32 new_itr = rc->itr;
335 int bytes_per_int; 335 int bytes_per_int;
336 int usecs;
336 337
337 if (rc->total_packets == 0 || !rc->itr) 338 if (rc->total_packets == 0 || !rc->itr)
338 return false; 339 return false;
@@ -341,8 +342,14 @@ static bool i40e_set_new_dynamic_itr(struct i40e_ring_container *rc)
341 * 0-10MB/s lowest (100000 ints/s) 342 * 0-10MB/s lowest (100000 ints/s)
342 * 10-20MB/s low (20000 ints/s) 343 * 10-20MB/s low (20000 ints/s)
343 * 20-1249MB/s bulk (8000 ints/s) 344 * 20-1249MB/s bulk (8000 ints/s)
345 *
346 * The math works out because the divisor is in 10^(-6) which
347 * turns the bytes/us input value into MB/s values, but
348 * make sure to use usecs, as the register values written
349 * are in 2 usec increments in the ITR registers.
344 */ 350 */
345 bytes_per_int = rc->total_bytes / rc->itr; 351 usecs = (rc->itr << 1);
352 bytes_per_int = rc->total_bytes / usecs;
346 switch (new_latency_range) { 353 switch (new_latency_range) {
347 case I40E_LOWEST_LATENCY: 354 case I40E_LOWEST_LATENCY:
348 if (bytes_per_int > 10) 355 if (bytes_per_int > 10)