diff options
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 128 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 62 |
7 files changed, 190 insertions, 38 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c index b816a624a6ce..fa079bbab89a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | |||
@@ -358,7 +358,6 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
358 | u32 fctrl_reg; | 358 | u32 fctrl_reg; |
359 | u32 rmcs_reg; | 359 | u32 rmcs_reg; |
360 | u32 reg; | 360 | u32 reg; |
361 | u32 rx_pba_size; | ||
362 | u32 link_speed = 0; | 361 | u32 link_speed = 0; |
363 | bool link_up; | 362 | bool link_up; |
364 | 363 | ||
@@ -461,16 +460,13 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
461 | 460 | ||
462 | /* Set up and enable Rx high/low water mark thresholds, enable XON. */ | 461 | /* Set up and enable Rx high/low water mark thresholds, enable XON. */ |
463 | if (hw->fc.current_mode & ixgbe_fc_tx_pause) { | 462 | if (hw->fc.current_mode & ixgbe_fc_tx_pause) { |
464 | rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(packetbuf_num)); | 463 | reg = hw->fc.low_water << 6; |
465 | rx_pba_size >>= IXGBE_RXPBSIZE_SHIFT; | ||
466 | |||
467 | reg = (rx_pba_size - hw->fc.low_water) << 6; | ||
468 | if (hw->fc.send_xon) | 464 | if (hw->fc.send_xon) |
469 | reg |= IXGBE_FCRTL_XONE; | 465 | reg |= IXGBE_FCRTL_XONE; |
470 | 466 | ||
471 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), reg); | 467 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), reg); |
472 | 468 | ||
473 | reg = (rx_pba_size - hw->fc.high_water) << 6; | 469 | reg = hw->fc.high_water[packetbuf_num] << 6; |
474 | reg |= IXGBE_FCRTH_FCEN; | 470 | reg |= IXGBE_FCRTH_FCEN; |
475 | 471 | ||
476 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), reg); | 472 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), reg); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c index 84ed9ef7288d..59cd54cfdc1f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | |||
@@ -1932,7 +1932,6 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1932 | s32 ret_val = 0; | 1932 | s32 ret_val = 0; |
1933 | u32 mflcn_reg, fccfg_reg; | 1933 | u32 mflcn_reg, fccfg_reg; |
1934 | u32 reg; | 1934 | u32 reg; |
1935 | u32 rx_pba_size; | ||
1936 | u32 fcrtl, fcrth; | 1935 | u32 fcrtl, fcrth; |
1937 | 1936 | ||
1938 | #ifdef CONFIG_DCB | 1937 | #ifdef CONFIG_DCB |
@@ -2012,11 +2011,8 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
2012 | IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); | 2011 | IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); |
2013 | IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); | 2012 | IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); |
2014 | 2013 | ||
2015 | rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(packetbuf_num)); | 2014 | fcrth = hw->fc.high_water[packetbuf_num] << 10; |
2016 | rx_pba_size >>= IXGBE_RXPBSIZE_SHIFT; | 2015 | fcrtl = hw->fc.low_water << 10; |
2017 | |||
2018 | fcrth = (rx_pba_size - hw->fc.high_water) << 10; | ||
2019 | fcrtl = (rx_pba_size - hw->fc.low_water) << 10; | ||
2020 | 2016 | ||
2021 | if (hw->fc.current_mode & ixgbe_fc_tx_pause) { | 2017 | if (hw->fc.current_mode & ixgbe_fc_tx_pause) { |
2022 | fcrth |= IXGBE_FCRTH_FCEN; | 2018 | fcrth |= IXGBE_FCRTH_FCEN; |
@@ -2293,7 +2289,9 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
2293 | * Validate the water mark configuration. Zero water marks are invalid | 2289 | * Validate the water mark configuration. Zero water marks are invalid |
2294 | * because it causes the controller to just blast out fc packets. | 2290 | * because it causes the controller to just blast out fc packets. |
2295 | */ | 2291 | */ |
2296 | if (!hw->fc.low_water || !hw->fc.high_water || !hw->fc.pause_time) { | 2292 | if (!hw->fc.low_water || |
2293 | !hw->fc.high_water[packetbuf_num] || | ||
2294 | !hw->fc.pause_time) { | ||
2297 | hw_dbg(hw, "Invalid water mark configuration\n"); | 2295 | hw_dbg(hw, "Invalid water mark configuration\n"); |
2298 | ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; | 2296 | ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; |
2299 | goto out; | 2297 | goto out; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h index 0a68aa7f5d18..df095a9bbe2b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h | |||
@@ -36,7 +36,6 @@ | |||
36 | 36 | ||
37 | #define IXGBE_MAX_PACKET_BUFFERS 8 | 37 | #define IXGBE_MAX_PACKET_BUFFERS 8 |
38 | #define MAX_USER_PRIORITY 8 | 38 | #define MAX_USER_PRIORITY 8 |
39 | #define MAX_TRAFFIC_CLASS 8 | ||
40 | #define MAX_BW_GROUP 8 | 39 | #define MAX_BW_GROUP 8 |
41 | #define BW_PERCENT 100 | 40 | #define BW_PERCENT 100 |
42 | 41 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c index 2288c3cac010..fcd0e479721f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c | |||
@@ -191,7 +191,7 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82598(struct ixgbe_hw *hw, | |||
191 | */ | 191 | */ |
192 | s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw, u8 pfc_en) | 192 | s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw, u8 pfc_en) |
193 | { | 193 | { |
194 | u32 reg, rx_pba_size; | 194 | u32 reg; |
195 | u8 i; | 195 | u8 i; |
196 | 196 | ||
197 | if (pfc_en) { | 197 | if (pfc_en) { |
@@ -222,9 +222,8 @@ s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw, u8 pfc_en) | |||
222 | */ | 222 | */ |
223 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { | 223 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { |
224 | int enabled = pfc_en & (1 << i); | 224 | int enabled = pfc_en & (1 << i); |
225 | rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)); | 225 | |
226 | rx_pba_size >>= IXGBE_RXPBSIZE_SHIFT; | 226 | reg = hw->fc.low_water << 10; |
227 | reg = (rx_pba_size - hw->fc.low_water) << 10; | ||
228 | 227 | ||
229 | if (enabled == pfc_enabled_tx || | 228 | if (enabled == pfc_enabled_tx || |
230 | enabled == pfc_enabled_full) | 229 | enabled == pfc_enabled_full) |
@@ -232,7 +231,7 @@ s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw, u8 pfc_en) | |||
232 | 231 | ||
233 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL(i), reg); | 232 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL(i), reg); |
234 | 233 | ||
235 | reg = (rx_pba_size - hw->fc.high_water) << 10; | 234 | reg = hw->fc.high_water[i] << 10; |
236 | if (enabled == pfc_enabled_tx || | 235 | if (enabled == pfc_enabled_tx || |
237 | enabled == pfc_enabled_full) | 236 | enabled == pfc_enabled_full) |
238 | reg |= IXGBE_FCRTH_FCEN; | 237 | reg |= IXGBE_FCRTH_FCEN; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c index d64fb872978e..02f6724bf48e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82599.c | |||
@@ -210,21 +210,19 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw, | |||
210 | */ | 210 | */ |
211 | s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, u8 pfc_en) | 211 | s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, u8 pfc_en) |
212 | { | 212 | { |
213 | u32 i, reg, rx_pba_size; | 213 | u32 i, reg; |
214 | 214 | ||
215 | /* Configure PFC Tx thresholds per TC */ | 215 | /* Configure PFC Tx thresholds per TC */ |
216 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { | 216 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { |
217 | int enabled = pfc_en & (1 << i); | 217 | int enabled = pfc_en & (1 << i); |
218 | rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)); | ||
219 | rx_pba_size >>= IXGBE_RXPBSIZE_SHIFT; | ||
220 | 218 | ||
221 | reg = (rx_pba_size - hw->fc.low_water) << 10; | 219 | reg = hw->fc.low_water << 10; |
222 | 220 | ||
223 | if (enabled) | 221 | if (enabled) |
224 | reg |= IXGBE_FCRTL_XONE; | 222 | reg |= IXGBE_FCRTL_XONE; |
225 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg); | 223 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg); |
226 | 224 | ||
227 | reg = (rx_pba_size - hw->fc.high_water) << 10; | 225 | reg = hw->fc.high_water[i] << 10; |
228 | if (enabled) | 226 | if (enabled) |
229 | reg |= IXGBE_FCRTH_FCEN; | 227 | reg |= IXGBE_FCRTH_FCEN; |
230 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg); | 228 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 3594b09f4993..ba703d30f3a9 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -3351,9 +3351,128 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter) | |||
3351 | IXGBE_WRITE_REG(hw, IXGBE_RQTC, reg); | 3351 | IXGBE_WRITE_REG(hw, IXGBE_RQTC, reg); |
3352 | } | 3352 | } |
3353 | } | 3353 | } |
3354 | #endif | ||
3355 | |||
3356 | /* Additional bittime to account for IXGBE framing */ | ||
3357 | #define IXGBE_ETH_FRAMING 20 | ||
3358 | |||
3359 | /* | ||
3360 | * ixgbe_hpbthresh - calculate high water mark for flow control | ||
3361 | * | ||
3362 | * @adapter: board private structure to calculate for | ||
3363 | * @pb - packet buffer to calculate | ||
3364 | */ | ||
3365 | static int ixgbe_hpbthresh(struct ixgbe_adapter *adapter, int pb) | ||
3366 | { | ||
3367 | struct ixgbe_hw *hw = &adapter->hw; | ||
3368 | struct net_device *dev = adapter->netdev; | ||
3369 | int link, tc, kb, marker; | ||
3370 | u32 dv_id, rx_pba; | ||
3371 | |||
3372 | /* Calculate max LAN frame size */ | ||
3373 | tc = link = dev->mtu + ETH_HLEN + ETH_FCS_LEN + IXGBE_ETH_FRAMING; | ||
3374 | |||
3375 | #ifdef IXGBE_FCOE | ||
3376 | /* FCoE traffic class uses FCOE jumbo frames */ | ||
3377 | if (dev->features & NETIF_F_FCOE_MTU) { | ||
3378 | int fcoe_pb = 0; | ||
3354 | 3379 | ||
3380 | #ifdef CONFIG_IXGBE_DCB | ||
3381 | fcoe_pb = netdev_get_prio_tc_map(dev, adapter->fcoe.up); | ||
3382 | |||
3383 | #endif | ||
3384 | if (fcoe_pb == pb && tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) | ||
3385 | tc = IXGBE_FCOE_JUMBO_FRAME_SIZE; | ||
3386 | } | ||
3355 | #endif | 3387 | #endif |
3356 | 3388 | ||
3389 | /* Calculate delay value for device */ | ||
3390 | switch (hw->mac.type) { | ||
3391 | case ixgbe_mac_X540: | ||
3392 | dv_id = IXGBE_DV_X540(link, tc); | ||
3393 | break; | ||
3394 | default: | ||
3395 | dv_id = IXGBE_DV(link, tc); | ||
3396 | break; | ||
3397 | } | ||
3398 | |||
3399 | /* Loopback switch introduces additional latency */ | ||
3400 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) | ||
3401 | dv_id += IXGBE_B2BT(tc); | ||
3402 | |||
3403 | /* Delay value is calculated in bit times convert to KB */ | ||
3404 | kb = IXGBE_BT2KB(dv_id); | ||
3405 | rx_pba = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(pb)) >> 10; | ||
3406 | |||
3407 | marker = rx_pba - kb; | ||
3408 | |||
3409 | /* It is possible that the packet buffer is not large enough | ||
3410 | * to provide required headroom. In this case throw an error | ||
3411 | * to user and a do the best we can. | ||
3412 | */ | ||
3413 | if (marker < 0) { | ||
3414 | e_warn(drv, "Packet Buffer(%i) can not provide enough" | ||
3415 | "headroom to support flow control." | ||
3416 | "Decrease MTU or number of traffic classes\n", pb); | ||
3417 | marker = tc + 1; | ||
3418 | } | ||
3419 | |||
3420 | return marker; | ||
3421 | } | ||
3422 | |||
3423 | /* | ||
3424 | * ixgbe_lpbthresh - calculate low water mark for for flow control | ||
3425 | * | ||
3426 | * @adapter: board private structure to calculate for | ||
3427 | * @pb - packet buffer to calculate | ||
3428 | */ | ||
3429 | static int ixgbe_lpbthresh(struct ixgbe_adapter *adapter) | ||
3430 | { | ||
3431 | struct ixgbe_hw *hw = &adapter->hw; | ||
3432 | struct net_device *dev = adapter->netdev; | ||
3433 | int tc; | ||
3434 | u32 dv_id; | ||
3435 | |||
3436 | /* Calculate max LAN frame size */ | ||
3437 | tc = dev->mtu + ETH_HLEN + ETH_FCS_LEN; | ||
3438 | |||
3439 | /* Calculate delay value for device */ | ||
3440 | switch (hw->mac.type) { | ||
3441 | case ixgbe_mac_X540: | ||
3442 | dv_id = IXGBE_LOW_DV_X540(tc); | ||
3443 | break; | ||
3444 | default: | ||
3445 | dv_id = IXGBE_LOW_DV(tc); | ||
3446 | break; | ||
3447 | } | ||
3448 | |||
3449 | /* Delay value is calculated in bit times convert to KB */ | ||
3450 | return IXGBE_BT2KB(dv_id); | ||
3451 | } | ||
3452 | |||
3453 | /* | ||
3454 | * ixgbe_pbthresh_setup - calculate and setup high low water marks | ||
3455 | */ | ||
3456 | static void ixgbe_pbthresh_setup(struct ixgbe_adapter *adapter) | ||
3457 | { | ||
3458 | struct ixgbe_hw *hw = &adapter->hw; | ||
3459 | int num_tc = netdev_get_num_tc(adapter->netdev); | ||
3460 | int i; | ||
3461 | |||
3462 | if (!num_tc) | ||
3463 | num_tc = 1; | ||
3464 | |||
3465 | hw->fc.low_water = ixgbe_lpbthresh(adapter); | ||
3466 | |||
3467 | for (i = 0; i < num_tc; i++) { | ||
3468 | hw->fc.high_water[i] = ixgbe_hpbthresh(adapter, i); | ||
3469 | |||
3470 | /* Low water marks must not be larger than high water marks */ | ||
3471 | if (hw->fc.low_water > hw->fc.high_water[i]) | ||
3472 | hw->fc.low_water = 0; | ||
3473 | } | ||
3474 | } | ||
3475 | |||
3357 | static void ixgbe_configure_pb(struct ixgbe_adapter *adapter) | 3476 | static void ixgbe_configure_pb(struct ixgbe_adapter *adapter) |
3358 | { | 3477 | { |
3359 | struct ixgbe_hw *hw = &adapter->hw; | 3478 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -3367,6 +3486,7 @@ static void ixgbe_configure_pb(struct ixgbe_adapter *adapter) | |||
3367 | hdrm = 0; | 3486 | hdrm = 0; |
3368 | 3487 | ||
3369 | hw->mac.ops.set_rxpba(hw, tc, hdrm, PBA_STRATEGY_EQUAL); | 3488 | hw->mac.ops.set_rxpba(hw, tc, hdrm, PBA_STRATEGY_EQUAL); |
3489 | ixgbe_pbthresh_setup(adapter); | ||
3370 | } | 3490 | } |
3371 | 3491 | ||
3372 | static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) | 3492 | static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) |
@@ -4769,13 +4889,11 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
4769 | { | 4889 | { |
4770 | struct ixgbe_hw *hw = &adapter->hw; | 4890 | struct ixgbe_hw *hw = &adapter->hw; |
4771 | struct pci_dev *pdev = adapter->pdev; | 4891 | struct pci_dev *pdev = adapter->pdev; |
4772 | struct net_device *dev = adapter->netdev; | ||
4773 | unsigned int rss; | 4892 | unsigned int rss; |
4774 | #ifdef CONFIG_IXGBE_DCB | 4893 | #ifdef CONFIG_IXGBE_DCB |
4775 | int j; | 4894 | int j; |
4776 | struct tc_configuration *tc; | 4895 | struct tc_configuration *tc; |
4777 | #endif | 4896 | #endif |
4778 | int max_frame = dev->mtu + ETH_HLEN + ETH_FCS_LEN; | ||
4779 | 4897 | ||
4780 | /* PCI config space info */ | 4898 | /* PCI config space info */ |
4781 | 4899 | ||
@@ -4851,8 +4969,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
4851 | #ifdef CONFIG_DCB | 4969 | #ifdef CONFIG_DCB |
4852 | adapter->last_lfc_mode = hw->fc.current_mode; | 4970 | adapter->last_lfc_mode = hw->fc.current_mode; |
4853 | #endif | 4971 | #endif |
4854 | hw->fc.high_water = FC_HIGH_WATER(max_frame); | 4972 | ixgbe_pbthresh_setup(adapter); |
4855 | hw->fc.low_water = FC_LOW_WATER(max_frame); | ||
4856 | hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE; | 4973 | hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE; |
4857 | hw->fc.send_xon = true; | 4974 | hw->fc.send_xon = true; |
4858 | hw->fc.disable_fc_autoneg = false; | 4975 | hw->fc.disable_fc_autoneg = false; |
@@ -5119,9 +5236,6 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu) | |||
5119 | /* must set new MTU before calling down or up */ | 5236 | /* must set new MTU before calling down or up */ |
5120 | netdev->mtu = new_mtu; | 5237 | netdev->mtu = new_mtu; |
5121 | 5238 | ||
5122 | hw->fc.high_water = FC_HIGH_WATER(max_frame); | ||
5123 | hw->fc.low_water = FC_LOW_WATER(max_frame); | ||
5124 | |||
5125 | if (netif_running(netdev)) | 5239 | if (netif_running(netdev)) |
5126 | ixgbe_reinit_locked(adapter); | 5240 | ixgbe_reinit_locked(adapter); |
5127 | 5241 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h index 9a03341e5261..16dd461d4af3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | |||
@@ -404,6 +404,7 @@ | |||
404 | #define IXGBE_WUPL_LENGTH_MASK 0xFFFF | 404 | #define IXGBE_WUPL_LENGTH_MASK 0xFFFF |
405 | 405 | ||
406 | /* DCB registers */ | 406 | /* DCB registers */ |
407 | #define MAX_TRAFFIC_CLASS 8 | ||
407 | #define IXGBE_RMCS 0x03D00 | 408 | #define IXGBE_RMCS 0x03D00 |
408 | #define IXGBE_DPMCS 0x07F40 | 409 | #define IXGBE_DPMCS 0x07F40 |
409 | #define IXGBE_PDPMCS 0x0CD00 | 410 | #define IXGBE_PDPMCS 0x0CD00 |
@@ -2323,13 +2324,60 @@ typedef u32 ixgbe_physical_layer; | |||
2323 | #define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI 0x1000 | 2324 | #define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI 0x1000 |
2324 | #define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA 0x2000 | 2325 | #define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA 0x2000 |
2325 | 2326 | ||
2326 | /* Flow Control Macros */ | 2327 | /* Flow Control Data Sheet defined values |
2327 | #define PAUSE_RTT 8 | 2328 | * Calculation and defines taken from 802.1bb Annex O |
2328 | #define PAUSE_MTU(MTU) ((MTU + 1024 - 1) / 1024) | 2329 | */ |
2330 | |||
2331 | /* BitTimes (BT) conversion */ | ||
2332 | #define IXGBE_BT2KB(BT) ((BT + 1023) / (8 * 1024)) | ||
2333 | #define IXGBE_B2BT(BT) (BT * 8) | ||
2334 | |||
2335 | /* Calculate Delay to respond to PFC */ | ||
2336 | #define IXGBE_PFC_D 672 | ||
2337 | |||
2338 | /* Calculate Cable Delay */ | ||
2339 | #define IXGBE_CABLE_DC 5556 /* Delay Copper */ | ||
2340 | #define IXGBE_CABLE_DO 5000 /* Delay Optical */ | ||
2341 | |||
2342 | /* Calculate Interface Delay X540 */ | ||
2343 | #define IXGBE_PHY_DC 25600 /* Delay 10G BASET */ | ||
2344 | #define IXGBE_MAC_DC 8192 /* Delay Copper XAUI interface */ | ||
2345 | #define IXGBE_XAUI_DC (2 * 2048) /* Delay Copper Phy */ | ||
2346 | |||
2347 | #define IXGBE_ID_X540 (IXGBE_MAC_DC + IXGBE_XAUI_DC + IXGBE_PHY_DC) | ||
2348 | |||
2349 | /* Calculate Interface Delay 82598, 82599 */ | ||
2350 | #define IXGBE_PHY_D 12800 | ||
2351 | #define IXGBE_MAC_D 4096 | ||
2352 | #define IXGBE_XAUI_D (2 * 1024) | ||
2353 | |||
2354 | #define IXGBE_ID (IXGBE_MAC_D + IXGBE_XAUI_D + IXGBE_PHY_D) | ||
2355 | |||
2356 | /* Calculate Delay incurred from higher layer */ | ||
2357 | #define IXGBE_HD 6144 | ||
2358 | |||
2359 | /* Calculate PCI Bus delay for low thresholds */ | ||
2360 | #define IXGBE_PCI_DELAY 10000 | ||
2361 | |||
2362 | /* Calculate X540 delay value in bit times */ | ||
2363 | #define IXGBE_FILL_RATE (36 / 25) | ||
2364 | |||
2365 | #define IXGBE_DV_X540(LINK, TC) (IXGBE_FILL_RATE * \ | ||
2366 | (IXGBE_B2BT(LINK) + IXGBE_PFC_D + \ | ||
2367 | (2 * IXGBE_CABLE_DC) + \ | ||
2368 | (2 * IXGBE_ID_X540) + \ | ||
2369 | IXGBE_HD + IXGBE_B2BT(TC))) | ||
2370 | |||
2371 | /* Calculate 82599, 82598 delay value in bit times */ | ||
2372 | #define IXGBE_DV(LINK, TC) (IXGBE_FILL_RATE * \ | ||
2373 | (IXGBE_B2BT(LINK) + IXGBE_PFC_D + \ | ||
2374 | (2 * IXGBE_CABLE_DC) + (2 * IXGBE_ID) + \ | ||
2375 | IXGBE_HD + IXGBE_B2BT(TC))) | ||
2329 | 2376 | ||
2330 | #define FC_HIGH_WATER(MTU) ((((PAUSE_RTT + PAUSE_MTU(MTU)) * 144) + 99) / 100 +\ | 2377 | /* Calculate low threshold delay values */ |
2331 | PAUSE_MTU(MTU)) | 2378 | #define IXGBE_LOW_DV_X540(TC) (2 * IXGBE_B2BT(TC) + \ |
2332 | #define FC_LOW_WATER(MTU) (2 * (2 * PAUSE_MTU(MTU) + PAUSE_RTT)) | 2379 | (IXGBE_FILL_RATE * IXGBE_PCI_DELAY)) |
2380 | #define IXGBE_LOW_DV(TC) (2 * IXGBE_LOW_DV_X540(TC)) | ||
2333 | 2381 | ||
2334 | /* Software ATR hash keys */ | 2382 | /* Software ATR hash keys */ |
2335 | #define IXGBE_ATR_BUCKET_HASH_KEY 0x3DAD14E2 | 2383 | #define IXGBE_ATR_BUCKET_HASH_KEY 0x3DAD14E2 |
@@ -2548,7 +2596,7 @@ struct ixgbe_bus_info { | |||
2548 | 2596 | ||
2549 | /* Flow control parameters */ | 2597 | /* Flow control parameters */ |
2550 | struct ixgbe_fc_info { | 2598 | struct ixgbe_fc_info { |
2551 | u32 high_water; /* Flow Control High-water */ | 2599 | u32 high_water[MAX_TRAFFIC_CLASS]; /* Flow Control High-water */ |
2552 | u32 low_water; /* Flow Control Low-water */ | 2600 | u32 low_water; /* Flow Control Low-water */ |
2553 | u16 pause_time; /* Flow Control Pause timer */ | 2601 | u16 pause_time; /* Flow Control Pause timer */ |
2554 | bool send_xon; /* Flow control send XON */ | 2602 | bool send_xon; /* Flow control send XON */ |