• Bjørn Mork's avatar
    net: cdc_ncm: simplify and optimize frame padding · 20572226
    Bjørn Mork authored
    We can avoid the costly division for the common case where
    we pad the frame to tx_max size as long as we ensure that
    tx_max is either the device specified dwNtbOutMaxSize or not
    a multiplum of wMaxPacketSize.
    
    Using the preconverted 'maxpacket' field avoids converting
    wMaxPacketSize to CPU endianness for every transmitted frame
    
    And since we only will hit the one byte padding rule for short
    frames, we can drop testing the skb for tailroom.
    
    The change means that tx_max now represents the real maximum
    skb size, enabling us to allocate the correct size instead of
    always making room for one extra byte.
    
    Cc: Alexey Orishko <alexey.orishko@gmail.com>
    Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    20572226
cdc_ncm.c 36.4 KB