aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_dcb.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.r.fastabend@intel.com>2010-10-27 20:59:57 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-28 13:19:00 -0400
commit9806307a1c5a2a79e268ae4e78b437d38c8adf7f (patch)
tree1a4ceada09e85a3cd9083790c6b16a16e99bb928 /drivers/net/ixgbe/ixgbe_dcb.c
parentaffa9dfb04b7e2e3a0b0e6d844ea0c9ed97505f9 (diff)
ixgbe: DCB, fix TX hang occurring in stress condition with PFC
The DCB credits refill quantum _must_ be greater than half the max packet size. This is needed to guarantee that TX DMA operations are not attempted during a pause state. Additionally, the min IFG must be set correctly for DCB mode. If a DMA operation is requested unexpectedly during the pause state the HW data store may be corrupted leading to a DMA hang. The DMA hang requires a reset to correct. This fixes the HW configuration to avoid this condition. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_dcb.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb.c b/drivers/net/ixgbe/ixgbe_dcb.c
index 8bb9ddb6dffe..0d44c6470ca3 100644
--- a/drivers/net/ixgbe/ixgbe_dcb.c
+++ b/drivers/net/ixgbe/ixgbe_dcb.c
@@ -43,9 +43,12 @@
43 * ixgbe_dcb_check_config(). 43 * ixgbe_dcb_check_config().
44 */ 44 */
45s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_dcb_config *dcb_config, 45s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_dcb_config *dcb_config,
46 u8 direction) 46 int max_frame, u8 direction)
47{ 47{
48 struct tc_bw_alloc *p; 48 struct tc_bw_alloc *p;
49 int min_credit;
50 int min_multiplier;
51 int min_percent = 100;
49 s32 ret_val = 0; 52 s32 ret_val = 0;
50 /* Initialization values default for Tx settings */ 53 /* Initialization values default for Tx settings */
51 u32 credit_refill = 0; 54 u32 credit_refill = 0;
@@ -59,6 +62,31 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_dcb_config *dcb_config,
59 goto out; 62 goto out;
60 } 63 }
61 64
65 min_credit = ((max_frame / 2) + DCB_CREDIT_QUANTUM - 1) /
66 DCB_CREDIT_QUANTUM;
67
68 /* Find smallest link percentage */
69 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
70 p = &dcb_config->tc_config[i].path[direction];
71 bw_percent = dcb_config->bw_percentage[direction][p->bwg_id];
72 link_percentage = p->bwg_percent;
73
74 link_percentage = (link_percentage * bw_percent) / 100;
75
76 if (link_percentage && link_percentage < min_percent)
77 min_percent = link_percentage;
78 }
79
80 /*
81 * The ratio between traffic classes will control the bandwidth
82 * percentages seen on the wire. To calculate this ratio we use
83 * a multiplier. It is required that the refill credits must be
84 * larger than the max frame size so here we find the smallest
85 * multiplier that will allow all bandwidth percentages to be
86 * greater than the max frame size.
87 */
88 min_multiplier = (min_credit / min_percent) + 1;
89
62 /* Find out the link percentage for each TC first */ 90 /* Find out the link percentage for each TC first */
63 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { 91 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
64 p = &dcb_config->tc_config[i].path[direction]; 92 p = &dcb_config->tc_config[i].path[direction];
@@ -73,8 +101,9 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_dcb_config *dcb_config,
73 /* Save link_percentage for reference */ 101 /* Save link_percentage for reference */
74 p->link_percent = (u8)link_percentage; 102 p->link_percent = (u8)link_percentage;
75 103
76 /* Calculate credit refill and save it */ 104 /* Calculate credit refill ratio using multiplier */
77 credit_refill = link_percentage * MINIMUM_CREDIT_REFILL; 105 credit_refill = min(link_percentage * min_multiplier,
106 MAX_CREDIT_REFILL);
78 p->data_credits_refill = (u16)credit_refill; 107 p->data_credits_refill = (u16)credit_refill;
79 108
80 /* Calculate maximum credit for the TC */ 109 /* Calculate maximum credit for the TC */
@@ -85,8 +114,8 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_dcb_config *dcb_config,
85 * of a TC is too small, the maximum credit may not be 114 * of a TC is too small, the maximum credit may not be
86 * enough to send out a jumbo frame in data plane arbitration. 115 * enough to send out a jumbo frame in data plane arbitration.
87 */ 116 */
88 if (credit_max && (credit_max < MINIMUM_CREDIT_FOR_JUMBO)) 117 if (credit_max && (credit_max < min_credit))
89 credit_max = MINIMUM_CREDIT_FOR_JUMBO; 118 credit_max = min_credit;
90 119
91 if (direction == DCB_TX_CONFIG) { 120 if (direction == DCB_TX_CONFIG) {
92 /* 121 /*