diff options
Diffstat (limited to 'drivers/net/ixgbe')
| -rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 84 |
1 files changed, 78 insertions, 6 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index cbb143ca1eb8..5bd9e6bf6f2f 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 | ||
| 48 | char ixgbe_driver_name[] = "ixgbe"; | 49 | char ixgbe_driver_name[] = "ixgbe"; |
| 49 | static const char ixgbe_driver_string[] = | 50 | static const char ixgbe_driver_string[] = |
| @@ -226,6 +227,56 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter, | |||
| 226 | /* tx_buffer_info must be completely set up in the transmit path */ | 227 | /* tx_buffer_info must be completely set up in the transmit path */ |
| 227 | } | 228 | } |
| 228 | 229 | ||
| 230 | /** | ||
| 231 | * ixgbe_tx_is_paused - check if the tx ring is paused | ||
| 232 | * @adapter: the ixgbe adapter | ||
| 233 | * @tx_ring: the corresponding tx_ring | ||
| 234 | * | ||
| 235 | * If not in DCB mode, checks TFCS.TXOFF, otherwise, find out the | ||
| 236 | * corresponding TC of this tx_ring when checking TFCS. | ||
| 237 | * | ||
| 238 | * Returns : true if paused | ||
| 239 | */ | ||
| 240 | static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, | ||
| 241 | struct ixgbe_ring *tx_ring) | ||
| 242 | { | ||
| 243 | int tc; | ||
| 244 | u32 txoff = IXGBE_TFCS_TXOFF; | ||
| 245 | |||
| 246 | #ifdef CONFIG_IXGBE_DCB | ||
| 247 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | ||
| 248 | int reg_idx = tx_ring->reg_idx; | ||
| 249 | int dcb_i = adapter->ring_feature[RING_F_DCB].indices; | ||
| 250 | |||
| 251 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { | ||
| 252 | tc = reg_idx >> 2; | ||
| 253 | txoff = IXGBE_TFCS_TXOFF0; | ||
| 254 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | ||
| 255 | tc = 0; | ||
| 256 | txoff = IXGBE_TFCS_TXOFF; | ||
| 257 | if (dcb_i == 8) { | ||
| 258 | /* TC0, TC1 */ | ||
| 259 | tc = reg_idx >> 5; | ||
| 260 | if (tc == 2) /* TC2, TC3 */ | ||
| 261 | tc += (reg_idx - 64) >> 4; | ||
| 262 | else if (tc == 3) /* TC4, TC5, TC6, TC7 */ | ||
| 263 | tc += 1 + ((reg_idx - 96) >> 3); | ||
| 264 | } else if (dcb_i == 4) { | ||
| 265 | /* TC0, TC1 */ | ||
| 266 | tc = reg_idx >> 6; | ||
| 267 | if (tc == 1) { | ||
| 268 | tc += (reg_idx - 64) >> 5; | ||
| 269 | if (tc == 2) /* TC2, TC3 */ | ||
| 270 | tc += (reg_idx - 96) >> 4; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | } | ||
| 274 | txoff <<= tc; | ||
| 275 | } | ||
| 276 | #endif | ||
| 277 | return IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & txoff; | ||
| 278 | } | ||
| 279 | |||
| 229 | static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, | 280 | static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, |
| 230 | struct ixgbe_ring *tx_ring, | 281 | struct ixgbe_ring *tx_ring, |
| 231 | unsigned int eop) | 282 | unsigned int eop) |
| @@ -237,7 +288,7 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, | |||
| 237 | adapter->detect_tx_hung = false; | 288 | adapter->detect_tx_hung = false; |
| 238 | if (tx_ring->tx_buffer_info[eop].time_stamp && | 289 | if (tx_ring->tx_buffer_info[eop].time_stamp && |
| 239 | time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) && | 290 | time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) && |
| 240 | !(IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF)) { | 291 | !ixgbe_tx_is_paused(adapter, tx_ring)) { |
| 241 | /* detected Tx unit hang */ | 292 | /* detected Tx unit hang */ |
| 242 | union ixgbe_adv_tx_desc *tx_desc; | 293 | union ixgbe_adv_tx_desc *tx_desc; |
| 243 | tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); | 294 | tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); |
| @@ -412,19 +463,23 @@ static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter, | |||
| 412 | u32 txctrl; | 463 | u32 txctrl; |
| 413 | int cpu = get_cpu(); | 464 | int cpu = get_cpu(); |
| 414 | int q = tx_ring - adapter->tx_ring; | 465 | int q = tx_ring - adapter->tx_ring; |
| 466 | struct ixgbe_hw *hw = &adapter->hw; | ||
| 415 | 467 | ||
| 416 | if (tx_ring->cpu != cpu) { | 468 | if (tx_ring->cpu != cpu) { |
| 417 | txctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q)); | ||
| 418 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { | 469 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { |
| 470 | txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(q)); | ||
| 419 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; | 471 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; |
| 420 | txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); | 472 | txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); |
| 473 | txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; | ||
| 474 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(q), txctrl); | ||
| 421 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | 475 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { |
| 476 | txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(q)); | ||
| 422 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599; | 477 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599; |
| 423 | txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) << | 478 | txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) << |
| 424 | IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599); | 479 | IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599); |
| 480 | txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; | ||
| 481 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(q), txctrl); | ||
| 425 | } | 482 | } |
| 426 | txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; | ||
| 427 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q), txctrl); | ||
| 428 | tx_ring->cpu = cpu; | 483 | tx_ring->cpu = cpu; |
| 429 | } | 484 | } |
| 430 | put_cpu(); | 485 | put_cpu(); |
| @@ -1913,11 +1968,25 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter) | |||
| 1913 | break; | 1968 | break; |
| 1914 | } | 1969 | } |
| 1915 | } | 1970 | } |
| 1971 | |||
| 1916 | if (hw->mac.type == ixgbe_mac_82599EB) { | 1972 | if (hw->mac.type == ixgbe_mac_82599EB) { |
| 1973 | u32 rttdcs; | ||
| 1974 | |||
| 1975 | /* disable the arbiter while setting MTQC */ | ||
| 1976 | rttdcs = IXGBE_READ_REG(hw, IXGBE_RTTDCS); | ||
| 1977 | rttdcs |= IXGBE_RTTDCS_ARBDIS; | ||
| 1978 | IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs); | ||
| 1979 | |||
| 1917 | /* We enable 8 traffic classes, DCB only */ | 1980 | /* We enable 8 traffic classes, DCB only */ |
| 1918 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) | 1981 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) |
| 1919 | IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA | | 1982 | IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA | |
| 1920 | IXGBE_MTQC_8TC_8TQ)); | 1983 | IXGBE_MTQC_8TC_8TQ)); |
| 1984 | else | ||
| 1985 | IXGBE_WRITE_REG(hw, IXGBE_MTQC, IXGBE_MTQC_64Q_1PB); | ||
| 1986 | |||
| 1987 | /* re-eable the arbiter */ | ||
| 1988 | rttdcs &= ~IXGBE_RTTDCS_ARBDIS; | ||
| 1989 | IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs); | ||
| 1921 | } | 1990 | } |
| 1922 | } | 1991 | } |
| 1923 | 1992 | ||
| @@ -2471,7 +2540,10 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter) | |||
| 2471 | ixgbe_restore_vlan(adapter); | 2540 | ixgbe_restore_vlan(adapter); |
| 2472 | #ifdef CONFIG_IXGBE_DCB | 2541 | #ifdef CONFIG_IXGBE_DCB |
| 2473 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 2542 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
| 2474 | netif_set_gso_max_size(netdev, 32768); | 2543 | if (hw->mac.type == ixgbe_mac_82598EB) |
| 2544 | netif_set_gso_max_size(netdev, 32768); | ||
| 2545 | else | ||
| 2546 | netif_set_gso_max_size(netdev, 65536); | ||
| 2475 | ixgbe_configure_dcb(adapter); | 2547 | ixgbe_configure_dcb(adapter); |
| 2476 | } else { | 2548 | } else { |
| 2477 | netif_set_gso_max_size(netdev, 65536); | 2549 | netif_set_gso_max_size(netdev, 65536); |
