]> git.ipfire.org Git - thirdparty/qemu.git/commit
net: netmap: improve netmap_receive_iov()
authorVincenzo Maffione <v.maffione@gmail.com>
Thu, 6 Dec 2018 16:59:07 +0000 (17:59 +0100)
committerJason Wang <jasowang@redhat.com>
Tue, 5 Mar 2019 03:27:40 +0000 (11:27 +0800)
commit4875bf140662b214ad9f94b0d566354977d8c01d
tree9d989767f0ba5826e12492234446034febbf1000
parentc7cbb6b48fc2dbfeeb4c126ee4b909220a418fb0
net: netmap: improve netmap_receive_iov()

Changes:
  - Save CPU cycles by computing the return value while scanning the
    input iovec, rather than calling iov_size() at the end.
  - Remove check for s->tx != NULL, because it cannot happen.
  - Cache ring->tail in a local variable and use it to check for
    space in the TX ring. The use of nm_ring_empty() was invalid,
    because nobody is updating ring->cur and ring->head at that point.
  - In case we run out of netmap slots in the middle of a packet,
    move the wake-up point by advancing ring->cur, but do not
    expose the incomplete packet (i.e., by updating also ring->head).

Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/netmap.c