s390/qeth: fix overestimated count of buffer elements
authorJulian Wiedmann <jwi@linux.vnet.ibm.com>
Tue, 27 Feb 2018 17:58:12 +0000 (18:58 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Feb 2018 16:13:12 +0000 (11:13 -0500)
commit12472af89632beb1ed8dea29d4efe208ca05b06a
tree7ff331b71a1d91c8614d0c7630cd8deba11c83bc
parent590399ddf9561f2ed0839311c8ae1be21597ba68
s390/qeth: fix overestimated count of buffer elements

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: 2863c61334aa ("qeth: refactor calculation of SBALE count")
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l3_main.c