linux/drivers/net
David Vrabel f48da8b14d xen-netback: fix unlimited guest Rx internal queue and carrier flapping
Netback needs to discard old to-guest skb's (guest Rx queue drain) and
it needs detect guest Rx stalls (to disable the carrier so packets are
discarded earlier), but the current implementation is very broken.

1. The check in hard_start_xmit of the slot availability did not
   consider the number of packets that were already in the guest Rx
   queue.  This could allow the queue to grow without bound.

   The guest stops consuming packets and the ring was allowed to fill
   leaving S slot free.  Netback queues a packet requiring more than S
   slots (ensuring that the ring stays with S slots free).  Netback
   queue indefinately packets provided that then require S or fewer
   slots.

2. The Rx stall detection is not triggered in this case since the
   (host) Tx queue is not stopped.

3. If the Tx queue is stopped and a guest Rx interrupt occurs, netback
   will consider this an Rx purge event which may result in it taking
   the carrier down unnecessarily.  It also considers a queue with
   only 1 slot free as unstalled (even though the next packet might
   not fit in this).

The internal guest Rx queue is limited by a byte length (to 512 Kib,
enough for half the ring).  The (host) Tx queue is stopped and started
based on this limit.  This sets an upper bound on the amount of memory
used by packets on the internal queue.

This allows the estimatation of the number of slots for an skb to be
removed (it wasn't a very good estimate anyway).  Instead, the guest
Rx thread just waits for enough free slots for a maximum sized packet.

skbs queued on the internal queue have an 'expires' time (set to the
current time plus the drain timeout).  The guest Rx thread will detect
when the skb at the head of the queue has expired and discard expired
skbs.  This sets a clear upper bound on the length of time an skb can
be queued for.  For a guest being destroyed the maximum time needed to
wait for all the packets it sent to be dropped is still the drain
timeout (10 s) since it will not be sending new packets.

Rx stall detection is reintroduced in a later commit.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-10-25 14:15:20 -04:00
..
appletalk net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
arcnet ARCNET: enable eae arcnet card support 2014-09-29 14:36:26 -04:00
bonding Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-10-08 21:40:54 -04:00
caif net: set name_assign_type in alloc_netdev() 2014-07-15 16:12:48 -07:00
can drivers/net/can/Kconfig: Let CAN_AT91 depend on HAS_IOMEM 2014-10-03 15:52:03 -07:00
cris eth_v10: remove unnecessary break after return 2014-07-20 21:29:49 -07:00
dsa dsa: Fix conversion from host device to mii bus 2014-10-17 23:52:08 -04:00
ethernet amd-xgbe: Fix napi Rx budget accounting 2014-10-22 17:50:31 -04:00
fddi defxx: DEFEA's ESIC port I/O decoding cleanup 2014-09-28 17:22:10 -04:00
hamradio net: set name_assign_type in alloc_netdev() 2014-07-15 16:12:48 -07:00
hippi PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use 2014-08-12 12:15:14 -06:00
hyperv hyperv: Fix the total_data_buflen in send path 2014-10-22 17:58:50 -04:00
ieee802154 mrf24j40: use pr_* / dev_* instead of printk() 2014-09-24 14:14:42 +02:00
irda drivers/net/irda/Kconfig: Let SH_IRDA depend on HAS_IOMEM 2014-10-03 15:52:04 -07:00
phy phy/micrel: KSZ8031RNL RMII clock reconfiguration bug 2014-10-14 12:41:03 -04:00
plip
ppp Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-10-13 11:28:42 +02:00
slip net: set name_assign_type in alloc_netdev() 2014-07-15 16:12:48 -07:00
team Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-10-08 16:22:22 -04:00
usb ax88179_178a: fix bonding failure 2014-10-20 00:53:30 -04:00
vmxnet3 PCI changes for the v3.18 merge window: 2014-10-09 15:03:49 -04:00
wan net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
wimax kbuild: remove unnecessary "obj- := dummy.o" trick 2014-10-02 13:55:02 +02:00
wireless wireless: hostap: proc: print properly escaped SSID 2014-10-14 02:18:27 +02:00
xen-netback xen-netback: fix unlimited guest Rx internal queue and carrier flapping 2014-10-25 14:15:20 -04:00
Kconfig openvswitch: fix a compilation error when CONFIG_INET is not setW! 2014-10-07 00:10:49 -04:00
LICENSE.SRC
Makefile net: reduce USB network driver config options. 2014-08-05 16:48:59 -07:00
Space.c
dummy.c net: set name_assign_type in alloc_netdev() 2014-07-15 16:12:48 -07:00
eql.c net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
ifb.c net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
loopback.c net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
macvlan.c macvlan: optimize the receive path 2014-10-10 15:09:47 -04:00
macvtap.c net: Add ndo_gso_check 2014-10-15 12:11:00 -04:00
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c sungem: Fix global namespace pollution of phy accessors. 2014-08-27 23:07:12 -07:00
tun.c security: make security_file_set_fowner, f_setown and __f_setown void return 2014-09-09 16:01:36 -04:00
veth.c net: rtnetlink - make create_link take name_assign_type 2014-07-15 16:13:07 -07:00
virtio_net.c One cc: stable commit, the rest are a series of minor cleanups which have 2014-10-18 10:25:09 -07:00
vxlan.c vxlan: fix a free after use 2014-10-17 16:23:58 -04:00
xen-netfront.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-10-18 09:31:37 -07:00