• Alexander Duyck's avatar
    e1000e: Cleanup handling of VLAN_HLEN as a part of max frame size · 4d8d6906
    Alexander Duyck authored
    commit 8084b86d upstream.
    
    When the VLAN_HLEN was added to the calculation for the maximum frame size
    there seems to have been a number of issues added to the driver.
    
    The first issue is that in some cases the maximum frame size for a device
    never really reached the actual maximum frame size as the VLAN header
    length was not included the calculation for that value.  As a result some
    parts only supported a maximum frame size of either 1496 in the case of
    parts that didn't support jumbo frames, and 8996 in the case of the parts
    that do.
    
    The second issue is the fact that there were several checks that weren't
    updated so as a result setting an MTU of 1500 was treated as enabling jumbo
    frames as the calculated value was 1522 instead of 1518.  I have addressed
    those by replacing ETH_FRAME_LEN with VLAN_ETH_FRAME_LEN where appropriate.
    
    The final issue was the fact that lowering the MTU below 1500 would cause
    the driver to allocate 2K buffers for the rings.  This is an old issue that
    was fixed several years ago in igb/ixgbe and I am addressing now by just
    replacing == with a <= so that we always just round up to 1522 for anything
    that isn't a jumbo frame.
    
    Fixes: c751a3d5 ("e1000e: Correctly include VLAN_HLEN when changing interface MTU")
    Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@redhat.com>
    Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    [ luis: backported to 3.16:
      - dropped changes to struct e1000_pch_spt_info as i219 isn't supported ]
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    4d8d6906
netdev.c 203 KB