]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
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)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 15 Mar 2018 13:28:27 +0000 (08:28 -0500)
commit46d0f7929577af12c19a3df61af9251a18780932
tree3d4d7753dc95bcbe63e85ec53a9f0db9e8cf3dbb
parent272c24ca179d217ddd59d5012ebb3b88d69181ac
s390/qeth: fix overestimated count of buffer elements

BugLink: http://bugs.launchpad.net/bugs/1755179
[ Upstream commit 12472af89632beb1ed8dea29d4efe208ca05b06a ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l3_main.c