linux/drivers/net
David Vrabel 0ff773f59f xen-netback: count number required slots for an skb more carefully
[ Upstream commit 6e43fc04a6 ]

When a VM is providing an iSCSI target and the LUN is used by the
backend domain, the generated skbs for direct I/O writes to the disk
have large, multi-page skb->data but no frags.

With some lengths and starting offsets, xen_netbk_count_skb_slots()
would be one short because the simple calculation of
DIV_ROUND_UP(skb_headlen(), PAGE_SIZE) was not accounting for the
decisions made by start_new_rx_buffer() which does not guarantee
responses are fully packed.

For example, a skb with length < 2 pages but which spans 3 pages would
be counted as requiring 2 slots but would actually use 3 slots.

skb->data:

    |        1111|222222222222|3333        |

Fully packed, this would need 2 slots:

    |111122222222|22223333    |

But because the 2nd page wholy fits into a slot it is not split across
slots and goes into a slot of its own:

    |1111        |222222222222|3333        |

Miscounting the number of slots means netback may push more responses
than the number of available requests.  This will cause the frontend
to get very confused and report "Too many frags/slots".  The frontend
never recovers and will eventually BUG.

Fix this by counting the number of required slots more carefully.  In
xen_netbk_count_skb_slots(), more closely follow the algorithm used by
xen_netbk_gop_skb() by introducing xen_netbk_count_frag_slots() which
is the dry-run equivalent of netbk_gop_frag_copy().

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-13 16:08:29 -07:00
..
appletalk appletalk: remove "config IPDDP_DECAP" 2013-03-22 10:21:09 -04:00
arcnet arcnet: cleanup sizeof parameter 2013-08-11 18:35:25 -07:00
bonding bonding: modify only neigh_parms owned by us 2013-09-14 06:54:54 -07:00
caif caif: CAIF_VIRTIO should depend on HAS_DMA 2013-05-11 16:28:24 -07:00
can can: pcan_usb: fix wrong memcpy() bytes length 2013-08-20 08:43:03 -07:00
cris ethtool: fix drvinfo strings set in drivers 2013-01-06 21:06:31 -08:00
dsa DSA: Convert spaces to tabs where appropriate 2013-01-10 00:04:34 -08:00
ethernet r8169: enforce RX_MULTI_EN for the 8168f. 2013-10-13 16:08:29 -07:00
fddi drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0) 2013-03-17 12:50:24 -04:00
hamradio drivers/net: rename random32() to prandom_u32() 2013-05-07 18:38:27 -07:00
hippi rrunner.c: fix possible memory leak in rr_init_one() 2013-03-10 16:42:23 -04:00
hyperv hyperv: Fix the NETIF_F_SG flag setting in netvsc 2013-07-28 16:30:04 -07:00
ieee802154 at86rf230: change irq handling to prevent lockups with edge type irq 2013-04-16 16:34:08 -04:00
irda net/irda: fix error return code in bfin_sir_open() 2013-05-08 13:13:29 -07:00
phy net: phy: fix a bug when verify the EEE support 2013-05-27 23:30:09 -07:00
plip net: add ETH_P_802_3_MIN 2013-03-28 01:20:42 -04:00
ppp Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-05-01 14:08:52 -07:00
slip tty: Added a CONFIG_TTY option to allow removal of TTY 2013-01-18 16:15:27 -08:00
team team: move add to port list before port enablement 2013-06-12 00:56:27 -07:00
usb net: usb: cdc_ether: Use wwan interface for Telit modules 2013-10-01 09:17:45 -07:00
vmxnet3 net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
wan dlci: validate the net device in dlci_del() 2013-06-26 15:36:42 -07:00
wimax Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-02-20 18:58:50 -08:00
wireless mwifiex: fix memory corruption when unsetting multicast list 2013-10-13 16:08:28 -07:00
xen-netback xen-netback: count number required slots for an skb more carefully 2013-10-13 16:08:29 -07:00
dummy.c dummy: fix oops when loading the dummy failed 2013-07-28 16:30:01 -07:00
eql.c
ifb.c ifb: fix oops when loading the ifb failed 2013-07-28 16:30:01 -07:00
Kconfig VXLAN: Fix vxlan stats handling. 2013-03-26 12:27:18 -04:00
LICENSE.SRC
loopback.c net: loopback: fix a dst refcounting issue 2013-01-27 01:30:35 -05:00
macvlan.c macvlan: validate flags 2013-09-14 06:54:54 -07:00
macvtap.c macvtap: do not zerocopy if iov needs more pages than MAX_SKB_FRAGS 2013-07-28 16:30:05 -07:00
Makefile net: Add support for NTB virtual ethernet device 2013-01-17 19:11:14 -08:00
mdio.c
mii.c
netconsole.c netconsole: don't call __netpoll_cleanup() while atomic 2013-03-12 06:58:55 -04:00
ntb_netdev.c ntb_netdev: remove from list on exit 2013-05-15 10:58:14 -07:00
rionet.c ethtool: fix drvinfo strings set in drivers 2013-01-06 21:06:31 -08:00
sb1000.c
Space.c drivers/net: delete old x86 variant of the seeq8005 driver 2013-01-22 10:39:56 -05:00
sungem_phy.c
tun.c tuntap: correctly handle error in tun_set_iff() 2013-10-13 16:08:29 -07:00
veth.c net: vlan: announce STAG offload capability in some drivers 2013-04-19 14:46:06 -04:00
virtio_net.c virtio_net: fix race in RX VQ processing 2013-07-28 16:29:56 -07:00
vxlan.c ip_tunnel: Do not use inner ip-header-id for tunnel ip-header-id. 2013-09-14 06:54:55 -07:00
xen-netfront.c xen-netfront: pull on receive skb may need to happen earlier 2013-08-04 16:50:53 +08:00