aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-11-09 02:00:54 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-09 02:00:54 -0500
commitd0e1e88d6e7dbd8e1661cb6a058ca30f54ee39e4 (patch)
treedaab7cc0db83226672f76d2fc9277e4355f89e6b /drivers/net/ixgbe
parent9e0d57fd6dad37d72a3ca6db00ca8c76f2215454 (diff)
parent2606289779cb297320a185db5997729d29b6700b (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/can/usb/ems_usb.c
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c84
1 files changed, 78 insertions, 6 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 45c5faf0824a..448e84d56601 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -44,6 +44,7 @@
44 44
45#include "ixgbe.h" 45#include "ixgbe.h"
46#include "ixgbe_common.h" 46#include "ixgbe_common.h"
47#include "ixgbe_dcb_82599.h"
47 48
48char ixgbe_driver_name[] = "ixgbe"; 49char ixgbe_driver_name[] = "ixgbe";
49static const char ixgbe_driver_string[] = 50static const char ixgbe_driver_string[] =
@@ -228,6 +229,56 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter,
228 /* tx_buffer_info must be completely set up in the transmit path */ 229 /* tx_buffer_info must be completely set up in the transmit path */
229} 230}
230 231
232/**
233 * ixgbe_tx_is_paused - check if the tx ring is paused
234 * @adapter: the ixgbe adapter
235 * @tx_ring: the corresponding tx_ring
236 *
237 * If not in DCB mode, checks TFCS.TXOFF, otherwise, find out the
238 * corresponding TC of this tx_ring when checking TFCS.
239 *
240 * Returns : true if paused
241 */
242static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
243 struct ixgbe_ring *tx_ring)
244{
245 int tc;
246 u32 txoff = IXGBE_TFCS_TXOFF;
247
248#ifdef CONFIG_IXGBE_DCB
249 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
250 int reg_idx = tx_ring->reg_idx;
251 int dcb_i = adapter->ring_feature[RING_F_DCB].indices;
252
253 if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
254 tc = reg_idx >> 2;
255 txoff = IXGBE_TFCS_TXOFF0;
256 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
257 tc = 0;
258 txoff = IXGBE_TFCS_TXOFF;
259 if (dcb_i == 8) {
260 /* TC0, TC1 */
261 tc = reg_idx >> 5;
262 if (tc == 2) /* TC2, TC3 */
263 tc += (reg_idx - 64) >> 4;
264 else if (tc == 3) /* TC4, TC5, TC6, TC7 */
265 tc += 1 + ((reg_idx - 96) >> 3);
266 } else if (dcb_i == 4) {
267 /* TC0, TC1 */
268 tc = reg_idx >> 6;
269 if (tc == 1) {
270 tc += (reg_idx - 64) >> 5;
271 if (tc == 2) /* TC2, TC3 */
272 tc += (reg_idx - 96) >> 4;
273 }
274 }
275 }
276 txoff <<= tc;
277 }
278#endif
279 return IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & txoff;
280}
281
231static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, 282static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
232 struct ixgbe_ring *tx_ring, 283 struct ixgbe_ring *tx_ring,
233 unsigned int eop) 284 unsigned int eop)
@@ -239,7 +290,7 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
239 adapter->detect_tx_hung = false; 290 adapter->detect_tx_hung = false;
240 if (tx_ring->tx_buffer_info[eop].time_stamp && 291 if (tx_ring->tx_buffer_info[eop].time_stamp &&
241 time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) && 292 time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) &&
242 !(IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF)) { 293 !ixgbe_tx_is_paused(adapter, tx_ring)) {
243 /* detected Tx unit hang */ 294 /* detected Tx unit hang */
244 union ixgbe_adv_tx_desc *tx_desc; 295 union ixgbe_adv_tx_desc *tx_desc;
245 tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); 296 tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
@@ -414,19 +465,23 @@ static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter,
414 u32 txctrl; 465 u32 txctrl;
415 int cpu = get_cpu(); 466 int cpu = get_cpu();
416 int q = tx_ring - adapter->tx_ring; 467 int q = tx_ring - adapter->tx_ring;
468 struct ixgbe_hw *hw = &adapter->hw;
417 469
418 if (tx_ring->cpu != cpu) { 470 if (tx_ring->cpu != cpu) {
419 txctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q));
420 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { 471 if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
472 txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(q));
421 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; 473 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK;
422 txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); 474 txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu);
475 txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN;
476 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(q), txctrl);
423 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 477 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
478 txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(q));
424 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599; 479 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599;
425 txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) << 480 txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) <<
426 IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599); 481 IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599);
482 txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN;
483 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(q), txctrl);
427 } 484 }
428 txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN;
429 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q), txctrl);
430 tx_ring->cpu = cpu; 485 tx_ring->cpu = cpu;
431 } 486 }
432 put_cpu(); 487 put_cpu();
@@ -1908,11 +1963,25 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter)
1908 break; 1963 break;
1909 } 1964 }
1910 } 1965 }
1966
1911 if (hw->mac.type == ixgbe_mac_82599EB) { 1967 if (hw->mac.type == ixgbe_mac_82599EB) {
1968 u32 rttdcs;
1969
1970 /* disable the arbiter while setting MTQC */
1971 rttdcs = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
1972 rttdcs |= IXGBE_RTTDCS_ARBDIS;
1973 IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
1974
1912 /* We enable 8 traffic classes, DCB only */ 1975 /* We enable 8 traffic classes, DCB only */
1913 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) 1976 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
1914 IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA | 1977 IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA |
1915 IXGBE_MTQC_8TC_8TQ)); 1978 IXGBE_MTQC_8TC_8TQ));
1979 else
1980 IXGBE_WRITE_REG(hw, IXGBE_MTQC, IXGBE_MTQC_64Q_1PB);
1981
1982 /* re-eable the arbiter */
1983 rttdcs &= ~IXGBE_RTTDCS_ARBDIS;
1984 IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
1916 } 1985 }
1917} 1986}
1918 1987
@@ -2466,7 +2535,10 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
2466 ixgbe_restore_vlan(adapter); 2535 ixgbe_restore_vlan(adapter);
2467#ifdef CONFIG_IXGBE_DCB 2536#ifdef CONFIG_IXGBE_DCB
2468 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 2537 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
2469 netif_set_gso_max_size(netdev, 32768); 2538 if (hw->mac.type == ixgbe_mac_82598EB)
2539 netif_set_gso_max_size(netdev, 32768);
2540 else
2541 netif_set_gso_max_size(netdev, 65536);
2470 ixgbe_configure_dcb(adapter); 2542 ixgbe_configure_dcb(adapter);
2471 } else { 2543 } else {
2472 netif_set_gso_max_size(netdev, 65536); 2544 netif_set_gso_max_size(netdev, 65536);