• Julian Wiedmann's avatar
    s390/qeth: fix overestimated count of buffer elements · 12472af8
    Julian Wiedmann authored
    qeth_get_elements_for_range() doesn't know how to handle a 0-length
    range (ie. start == end), and returns 1 when it should return 0.
    Such ranges occur on TSO skbs, where the L2/L3/L4 headers (and thus all
    of the skb's linear data) are skipped when mapping the skb into regular
    buffer elements.
    
    This overestimation may cause several performance-related issues:
    1. sub-optimal IO buffer selection, where the next buffer gets selected
       even though the skb would actually still fit into the current buffer.
    2. forced linearization, if the element count for a non-linear skb
       exceeds QETH_MAX_BUFFER_ELEMENTS.
    
    Rather than modifying qeth_get_elements_for_range() and adding overhead
    to every caller, fix up those callers that are in risk of passing a
    0-length range.
    
    Fixes: 2863c613 ("qeth: refactor calculation of SBALE count")
    Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    12472af8
qeth_l3_main.c 83 KB