]> git.baikalelectronics.ru Git - kernel.git/commit
virtio-net: avoid unnecessary sg initialzation
authorJason Wang <jasowang@redhat.com>
Thu, 27 Aug 2015 06:53:06 +0000 (14:53 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Aug 2015 22:51:45 +0000 (15:51 -0700)
commitbd19cfc670c32a90b74c609d9fa532372d048d33
tree9d4c1428dff69ecf799eeb0e313a72257551a3b1
parent943bf63b91e3911975af9846a094cea11240aeb9
virtio-net: avoid unnecessary sg initialzation

Usually an skb does not have up to MAX_SKB_FRAGS frags. So no need to
initialize the unuse part of sg. This patch initialize the sg based on
the real number it will used:

- during xmit, it could be inferred from nr_frags and can_push.
- for small receive buffer, it will also be 2.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c