Skip to content
  • Bjørn Mork's avatar
    net: cdc_ncm: avoid changing RX/TX buffers on MTU changes · 1dfddff5
    Bjørn Mork authored
    
    
    NCM buffer sizes are negotiated with the device independently of
    the network device MTU.  The RX buffers are allocated by the
    usbnet framework based on the rx_urb_size value set by cdc_ncm. A
    single RX buffer can hold a number of MTU sized packets.
    
    The default usbnet change_mtu ndo only modifies rx_urb_size if it
    is equal to hard_mtu.  And the cdc_ncm driver will set rx_urb_size
    and hard_mtu independently of each other, based on dwNtbInMaxSize
    and dwNtbOutMaxSize respectively. It was therefore assumed that
    usbnet_change_mtu() would never touch rx_urb_size.  This failed to
    consider the case where dwNtbInMaxSize and dwNtbOutMaxSize happens
    to be equal.
    
    Fix by implementing an NCM specific change_mtu ndo, modifying the
    netdev MTU without touching the buffer size settings.
    
    Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1dfddff5