]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r342368, r342369
authorVincenzo Maffione <vmaffione@FreeBSD.org>
Mon, 31 Dec 2018 10:59:30 +0000 (10:59 +0000)
committerVincenzo Maffione <vmaffione@FreeBSD.org>
Mon, 31 Dec 2018 10:59:30 +0000 (10:59 +0000)
commit3d9e570df5904a194f160d564fc9461c6c8ab241
tree68ef094877723e896d9db3f7ea171757caaaae9f
parent89053a9189c0088e2f0c732a5ca4dbe5203dd96d
MFC r342368, r342369

netmap: fix bug in netmap_poll() optimization

The bug was introduced by r339639, although it is present in the upstream
netmap code since 2015. It is due to resetting the want_rx variable to
POLLIN, rather than resetting it to POLLIN|POLLRDNORM.
It only affects select(), which uses POLLRDNORM. poll() is not affected,
because it uses POLLIN.
Also, it only affects FreeBSD, because Linux skips the optimization
implemented by the piece of code where the bug occurs.
To check if txsync can be skipped, it is necessary to look for
unseen TX space. However, this means comparing ring->cur
against ring->tail, rather than ring->head against ring->tail
(like nm_ring_empty() does).

Sponsored by: Sunny Valley Networks
sys/dev/netmap/netmap.c