virtio_net: pass well-formed sgs to virtqueue_add_*()
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 11 Sep 2014 00:47:36 +0000 (10:17 +0930)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Sep 2014 16:50:46 +0000 (12:50 -0400)
commita58354409a00f2d8f7882c6a91fde1df5d0a4bb8
treea4ee23b8017e37b0f9b255fb8ddecf23eb55c5f6
parent0fe13151beaf1853753339c677d1bb37e5dbff27
virtio_net: pass well-formed sgs to virtqueue_add_*()

This is the only driver which doesn't hand virtqueue_add_inbuf and
virtqueue_add_outbuf a well-formed, well-terminated sg.  Fix it,
so we can make virtio_add_* simpler.

pktgen results:
modprobe pktgen
echo 'add_device eth0' > /proc/net/pktgen/kpktgend_0
echo nowait 1 > /proc/net/pktgen/eth0
echo count 1000000 > /proc/net/pktgen/eth0
echo clone_skb 100000 > /proc/net/pktgen/eth0
echo dst_mac 4e:14:25:a9:30:ac > /proc/net/pktgen/eth0
echo dst 192.168.1.2 > /proc/net/pktgen/eth0
for i in `seq 20`; do echo start > /proc/net/pktgen/pgctrl; tail -n1 /proc/net/pktgen/eth0; done

Before:
  746547-793084(786421+/-9.6e+03)pps 346-367(364.4+/-4.4)Mb/sec (346397808-367990976(3.649e+08+/-4.5e+06)bps) errors: 0

After:
  767390-792966(785159+/-6.5e+03)pps 356-367(363.75+/-2.9)Mb/sec (356068960-367936224(3.64314e+08+/-3e+06)bps) errors: 0

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c