Commit 73d80953dfd1d5a92948005798c857c311c2834b
Committed by
Jeff Kirsher
1 parent
e507d0cdb3
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
ixgbe: fix fc autoneg ethtool reporting.
Originally ixgbe_device_supports_autoneg_fc() was only expected to be called by copper devices. This would lead to false information to be displayed via ethtool. v2: changed ixgbe_device_supports_autoneg_fc() to a bool function, it returns bool. Based on feedback from David Miller Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Showing 4 changed files with 40 additions and 16 deletions Side-by-side Diff
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
... | ... | @@ -65,17 +65,41 @@ |
65 | 65 | * function check the device id to see if the associated phy supports |
66 | 66 | * autoneg flow control. |
67 | 67 | **/ |
68 | -s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw) | |
68 | +bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw) | |
69 | 69 | { |
70 | + bool supported = false; | |
71 | + ixgbe_link_speed speed; | |
72 | + bool link_up; | |
70 | 73 | |
71 | - switch (hw->device_id) { | |
72 | - case IXGBE_DEV_ID_X540T: | |
73 | - case IXGBE_DEV_ID_X540T1: | |
74 | - case IXGBE_DEV_ID_82599_T3_LOM: | |
75 | - return 0; | |
74 | + switch (hw->phy.media_type) { | |
75 | + case ixgbe_media_type_fiber: | |
76 | + hw->mac.ops.check_link(hw, &speed, &link_up, false); | |
77 | + /* if link is down, assume supported */ | |
78 | + if (link_up) | |
79 | + supported = speed == IXGBE_LINK_SPEED_1GB_FULL ? | |
80 | + true : false; | |
81 | + else | |
82 | + supported = true; | |
83 | + break; | |
84 | + case ixgbe_media_type_backplane: | |
85 | + supported = true; | |
86 | + break; | |
87 | + case ixgbe_media_type_copper: | |
88 | + /* only some copper devices support flow control autoneg */ | |
89 | + switch (hw->device_id) { | |
90 | + case IXGBE_DEV_ID_82599_T3_LOM: | |
91 | + case IXGBE_DEV_ID_X540T: | |
92 | + case IXGBE_DEV_ID_X540T1: | |
93 | + supported = true; | |
94 | + break; | |
95 | + default: | |
96 | + break; | |
97 | + } | |
76 | 98 | default: |
77 | - return IXGBE_ERR_FC_NOT_SUPPORTED; | |
99 | + break; | |
78 | 100 | } |
101 | + | |
102 | + return supported; | |
79 | 103 | } |
80 | 104 | |
81 | 105 | /** |
... | ... | @@ -234,7 +258,7 @@ |
234 | 258 | IXGBE_GSSR_MAC_CSR_SM); |
235 | 259 | |
236 | 260 | } else if ((hw->phy.media_type == ixgbe_media_type_copper) && |
237 | - (ixgbe_device_supports_autoneg_fc(hw) == 0)) { | |
261 | + ixgbe_device_supports_autoneg_fc(hw)) { | |
238 | 262 | hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE, |
239 | 263 | MDIO_MMD_AN, reg_cu); |
240 | 264 | } |
... | ... | @@ -2392,7 +2416,7 @@ |
2392 | 2416 | |
2393 | 2417 | /* Autoneg flow control on copper adapters */ |
2394 | 2418 | case ixgbe_media_type_copper: |
2395 | - if (ixgbe_device_supports_autoneg_fc(hw) == 0) | |
2419 | + if (ixgbe_device_supports_autoneg_fc(hw)) | |
2396 | 2420 | ret_val = ixgbe_fc_autoneg_copper(hw); |
2397 | 2421 | break; |
2398 | 2422 |
drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
... | ... | @@ -80,7 +80,7 @@ |
80 | 80 | s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw); |
81 | 81 | s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); |
82 | 82 | s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw); |
83 | -s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw); | |
83 | +bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw); | |
84 | 84 | void ixgbe_fc_autoneg(struct ixgbe_hw *hw); |
85 | 85 | |
86 | 86 | s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask); |
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
... | ... | @@ -355,10 +355,11 @@ |
355 | 355 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
356 | 356 | struct ixgbe_hw *hw = &adapter->hw; |
357 | 357 | |
358 | - if (hw->fc.disable_fc_autoneg) | |
359 | - pause->autoneg = 0; | |
360 | - else | |
358 | + if (ixgbe_device_supports_autoneg_fc(hw) && | |
359 | + !hw->fc.disable_fc_autoneg) | |
361 | 360 | pause->autoneg = 1; |
361 | + else | |
362 | + pause->autoneg = 0; | |
362 | 363 | |
363 | 364 | if (hw->fc.current_mode == ixgbe_fc_rx_pause) { |
364 | 365 | pause->rx_pause = 1; |
... | ... | @@ -384,7 +385,7 @@ |
384 | 385 | |
385 | 386 | /* some devices do not support autoneg of link flow control */ |
386 | 387 | if ((pause->autoneg == AUTONEG_ENABLE) && |
387 | - (ixgbe_device_supports_autoneg_fc(hw) != 0)) | |
388 | + !ixgbe_device_supports_autoneg_fc(hw)) | |
388 | 389 | return -EINVAL; |
389 | 390 | |
390 | 391 | fc.disable_fc_autoneg = (pause->autoneg != AUTONEG_ENABLE); |
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
... | ... | @@ -4721,8 +4721,7 @@ |
4721 | 4721 | ixgbe_pbthresh_setup(adapter); |
4722 | 4722 | hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE; |
4723 | 4723 | hw->fc.send_xon = true; |
4724 | - hw->fc.disable_fc_autoneg = | |
4725 | - (ixgbe_device_supports_autoneg_fc(hw) == 0) ? false : true; | |
4724 | + hw->fc.disable_fc_autoneg = ixgbe_device_supports_autoneg_fc(hw); | |
4726 | 4725 | |
4727 | 4726 | #ifdef CONFIG_PCI_IOV |
4728 | 4727 | /* assign number of SR-IOV VFs */ |