diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-29 17:17:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-29 17:17:12 -0400 |
commit | 1840897ab5d39b2e510c610ee262ded79919e718 (patch) | |
tree | 0b7fe95e3eda357d35b0d017f2b678b652307827 /drivers/net/ixgbe/ixgbe_dcb.c | |
parent | d56f84e7e317c69adefb2454a3d538a6d7e11e4b (diff) | |
parent | a4765fa7bfb92d5b9de19a503674b6624f95a7ae (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (34 commits)
b43: Fix warning at drivers/mmc/core/core.c:237 in mmc_wait_for_cmd
mac80211: fix failure to check kmalloc return value in key_key_read
libertas: Fix sd8686 firmware reload
ath9k: Fix incorrect access of rate flags in RC
netfilter: xt_socket: Make tproto signed in socket_mt6_v1().
stmmac: enable/disable rx/tx in the core with a single write.
net: atarilance - flags should be unsigned long
netxen: fix kdump
pktgen: Limit how much data we copy onto the stack.
net: Limit socket I/O iovec total length to INT_MAX.
USB: gadget: fix ethernet gadget crash in gether_setup
fib: Fix fib zone and its hash leak on namespace stop
cxgb3: Fix panic in free_tx_desc()
cxgb3: fix crash due to manipulating queues before registration
8390: Don't oops on starting dev queue
dccp ccid-2: Stop polling
dccp: Refine the wait-for-ccid mechanism
dccp: Extend CCID packet dequeueing interface
dccp: Return-value convention of hc_tx_send_packet()
igbvf: fix panic on load
...
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_dcb.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_dcb.c | 39 |
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 | */ |
45 | s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_dcb_config *dcb_config, | 45 | s32 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 | /* |