xen-netback: worse-case estimate in xenvif_rx_action is underestimating
authorPaul Durrant <Paul.Durrant@citrix.com>
Fri, 28 Mar 2014 11:39:06 +0000 (11:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Apr 2014 13:50:03 +0000 (06:50 -0700)
commit6240b9f5211277efd093b6470d9dba33931684e0
treec61fdcb0bbdeda7d2967a2bccf7e0b61fce28d86
parent4d1893255fd1d4bad3f4e4187cc817d60795f0de
xen-netback: worse-case estimate in xenvif_rx_action is underestimating

[ Upstream commit a02eb4732cf975d7fc71b6d1a71c058c9988b949 ]

The worse-case estimate for skb ring slot usage in xenvif_rx_action()
fails to take fragment page_offset into account. The page_offset does,
however, affect the number of times the fragmentation code calls
start_new_rx_buffer() (i.e. consume another slot) and the worse-case
should assume that will always return true. This patch adds the page_offset
into the DIV_ROUND_UP for each frag.

Unfortunately some frontends aggressively limit the number of requests
they post into the shared ring so to avoid an estimate that is 'too'
pessimal it is capped at MAX_SKB_FRAGS.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/xen-netback/netback.c