diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2012-02-08 02:50:35 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-03-17 04:04:33 -0400 |
commit | 655309e944fd482e59850d55186571c1b2a91e55 (patch) | |
tree | 80c5bb8a37188aebe3378b10a8b9059045aaee43 /drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |
parent | f800326dca7bc158f4c886aa92f222de37993c80 (diff) |
ixgbe: cleanup logic in ixgbe_change_mtu
This change is meant to just cleanup the logic in ixgbe_change_mtu since we
are making it unnecessarily complex due to a workaround required for 82599
when SR-IOV is enabled.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index e97ef4591ade..db1f17c3ed47 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -5544,20 +5544,24 @@ static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter) | |||
5544 | static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu) | 5544 | static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu) |
5545 | { | 5545 | { |
5546 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 5546 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
5547 | struct ixgbe_hw *hw = &adapter->hw; | ||
5548 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; | 5547 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
5549 | 5548 | ||
5550 | /* MTU < 68 is an error and causes problems on some kernels */ | 5549 | /* MTU < 68 is an error and causes problems on some kernels */ |
5551 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED && | 5550 | if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE)) |
5552 | hw->mac.type != ixgbe_mac_X540) { | 5551 | return -EINVAL; |
5553 | if ((new_mtu < 68) || (max_frame > MAXIMUM_ETHERNET_VLAN_SIZE)) | 5552 | |
5554 | return -EINVAL; | 5553 | /* |
5555 | } else { | 5554 | * For 82599EB we cannot allow PF to change MTU greater than 1500 |
5556 | if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE)) | 5555 | * in SR-IOV mode as it may cause buffer overruns in guest VFs that |
5556 | * don't allocate and chain buffers correctly. | ||
5557 | */ | ||
5558 | if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && | ||
5559 | (adapter->hw.mac.type == ixgbe_mac_82599EB) && | ||
5560 | (max_frame > MAXIMUM_ETHERNET_VLAN_SIZE)) | ||
5557 | return -EINVAL; | 5561 | return -EINVAL; |
5558 | } | ||
5559 | 5562 | ||
5560 | e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu); | 5563 | e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu); |
5564 | |||
5561 | /* must set new MTU before calling down or up */ | 5565 | /* must set new MTU before calling down or up */ |
5562 | netdev->mtu = new_mtu; | 5566 | netdev->mtu = new_mtu; |
5563 | 5567 | ||