[PATCH net-next v3 7/7] netvsc: signal host if receive ring is emptied
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2017-07-28 15:59:47
Subsystem:
hyper-v/azure core and drivers, networking drivers, the rest · Maintainers:
"K. Y. Srinivasan", Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
Latency improvement related to NAPI conversion.
If all packets are processed from receive ring then need
to signal host.
Signed-off-by: Stephen Hemminger <redacted>
---
drivers/net/hyperv/netvsc.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index db95487807fd..c64934c64dca 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -1195,10 +1195,15 @@ int netvsc_poll(struct napi_struct *napi, int budget)
nvchan->desc = hv_pkt_iter_next(channel, nvchan->desc);
}
- /* If send of pending receive completions suceeded
- * and did not exhaust NAPI budget
+ /* if ring is empty, signal host */
+ if (!nvchan->desc)
+ hv_pkt_iter_close(channel);
+
+ /* If send of pending receive completions suceeded
+ * and did not exhaust NAPI budget this time
* and not doing busy poll
- * then reschedule if more data has arrived from host
+ * then re-enable host interrupts
+ * and reschedule if ring is not empty.
*/
if (send_recv_completions(nvchan) == 0 &&
work_done < budget &&
--
2.11.0