linux/drivers/net
Zhangjie \(HZ\) 6ebbc1a638 virtio-net: Set needed_headroom for virtio-net when VIRTIO_F_ANY_LAYOUT is true
This is a small supplement for commit e7428e95a0
("virtio-net: put virtio-net header inline with data"). TCP packages have
enough room to put virtio-net header in, but UDP packages do not. By
setting dev->needed_headroom for virtio-net device, UDP packages could have
enough room.

For UDP packages, sk_buff is alloced in fun __ip_append_data. The size is
"alloclen + hh_len + 15", and "hh_len = LL_RESERVED_SPACE(rt-dst.dev);".
The Macro is defined as follows:
#define LL_RESERVED_SPACE(dev) \
     ((((dev)->hard_header_len+(dev)->needed_headroom)\
     &~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
By default, for UDP packages, after skb is allocated, only 16 bytes
reserved. And 2 bytes remained after mac header is set. That is not enough
to put virtio-net header in. If we set dev->needed_headroom to 12 or 10
(according to mergeable_rx_bufs is on or off ), more room can be reserved.
Then there is enough room for UDP packages to put the header in.

test result list as below:
guest and host: suse11sp3, netperf, intel 2.4GHz
+-------+---------+---------+---------+---------+
|       |   old             |   new             |
+-------+---------+---------+---------+---------+
| UDP   |  Gbit/s | pps     |  Gbit/s | pps     |
| 64    |  0.57   | 692232  |  0.61   | 742420  |
| 256   |  1.60   | 686860  |  1.71   | 733331  |
| 512   |  2.92   | 674576  |  3.07   | 710446  |
| 1024  |  4.99   | 598977  |  5.17   | 620821  |
| 1460  |  5.68   | 483757  |  7.16   | 610519  |
| 4096  |  6.98   | 637468  |  7.21   | 658471  |
+-------+---------+---------+---------+---------+

Signed-off-by: Zhang Jie <zhangjie14@huawei.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-04-30 13:31:26 -04:00
..
appletalk
arcnet
bonding bonding: Add tlb_dynamic_lb parameter for tlb mode 2014-04-24 13:04:34 -04:00
caif
can can: softing: remove unused sysfs attributes 2014-04-25 00:09:03 +02:00
cris
dsa net: dsa: update DSA drivers to use ds_to_priv 2014-04-30 13:31:25 -04:00
ethernet i40e/i40evf: Bump build version 2014-04-28 06:06:08 -07:00
fddi
hamradio yam: replace del_timer by del_timer_sync 2014-03-27 15:28:06 -04:00
hippi
hyperv hyperv: Simplify the send_completion variables 2014-04-23 14:48:39 -04:00
ieee802154 at86rf230: remove function for setting irq polarity 2014-04-26 12:20:35 -04:00
irda
phy Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-04-24 13:19:00 -04:00
plip
ppp net: ppp: use sk_unattached_filter api 2014-03-31 00:45:09 -04:00
slip
team netpoll: Remove gfp parameter from __netpoll_setup 2014-03-29 17:58:37 -04:00
usb r8152: check RTL8152_UNPLUG 2014-04-12 01:59:38 -04:00
vmxnet3 vmxnet3: Call dev_kfree_skb_any instead of dev_kfree_skb. 2014-03-24 21:19:23 -07:00
wan driver/net: cosa driver uses udelay incorrectly 2014-04-15 00:08:22 -04:00
wimax wimax/i2400m: remove open-coded skb_cow_head. 2014-03-29 17:49:47 -04:00
wireless mwifiex: fix hung task on command timeout 2014-04-15 13:27:05 -04:00
xen-netback xen-netback: Trivial format string fix 2014-04-04 10:49:53 -04:00
dummy.c
eql.c
ifb.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-03-29 18:48:54 -04:00
Kconfig netpoll: Remove dead packet receive code (CONFIG_NETPOLL_TRAP) 2014-03-17 15:48:12 -04:00
LICENSE.SRC
loopback.c
macvlan.c macvlan: Fix leak and NULL dereference on error path 2014-04-23 14:55:30 -04:00
macvtap.c
Makefile
mdio.c
mii.c
netconsole.c
nlmon.c net: nlmon: flag nlmon devs with LLTX/SG 2014-03-28 16:49:47 -04:00
ntb_netdev.c NTB: Code Style Clean-up 2014-04-07 10:59:19 -07:00
rionet.c rapidio: rework device hierarchy and introduce mport class of devices 2014-04-07 16:36:07 -07:00
sb1000.c
Space.c
sungem_phy.c
tun.c drivers/net: Use RCU_INIT_POINTER(x, NULL) in tun.c 2014-03-27 00:18:09 -04:00
veth.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-03-29 18:48:54 -04:00
virtio_net.c virtio-net: Set needed_headroom for virtio-net when VIRTIO_F_ANY_LAYOUT is true 2014-04-30 13:31:26 -04:00
vxlan.c vxlan: add x-netns support 2014-04-24 16:18:26 -04:00
xen-netfront.c drivers: net: xen-netfront: fix array initialization bug 2014-04-12 16:49:06 -04:00