diff options
author | sephe <sephe@FreeBSD.org> | 2016-04-27 04:51:28 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2016-04-27 04:51:28 +0000 |
commit | 9faf9cad616b990fb90318369a8c27e40f15eb1b (patch) | |
tree | b0a7ce74a82f69256a81399064e3edaf34d9efa7 | |
parent | da3816f04d09c0ed578e27cdd83ba204317f0688 (diff) | |
download | FreeBSD-src-9faf9cad616b990fb90318369a8c27e40f15eb1b.zip FreeBSD-src-9faf9cad616b990fb90318369a8c27e40f15eb1b.tar.gz |
hyperv/hn: Restart sending earlier once we gathered some free TX descs
This greatly reduces the oqdrops under heavy workload.
For TCP send/recv test (10K concurrent connections):
oqdrops is reduced by 17% on sending side, and 57% on receiving side.
For nginx-1.8/wrk-4 1KB object test (10K concurrent connections,
4 requests/connection):
oqdrops is reduced by 44% on nginx side, and 10% on wrk side.
MFC after: 1 week
Sponsored by: Microsoft OSTC
-rw-r--r-- | sys/dev/hyperv/netvsc/hv_net_vsc.h | 3 | ||||
-rw-r--r-- | sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 20 |
2 files changed, 20 insertions, 3 deletions
diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h index 3dbd6ef..39588ea 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -1185,7 +1185,8 @@ struct hn_tx_ring { #endif int hn_txdesc_cnt; int hn_txdesc_avail; - int hn_has_txeof; + u_short hn_has_txeof; + u_short hn_txdone_cnt; int hn_sched_tx; void (*hn_txeof)(struct hn_tx_ring *); diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index 87b9894..76c90d7 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -155,6 +155,8 @@ __FBSDID("$FreeBSD$"); #define HN_DIRECT_TX_SIZE_DEF 128 +#define HN_EARLY_TXEOF_THRESH 8 + struct hn_txdesc { #ifndef HN_USE_TXDESC_BUFRING SLIST_ENTRY(hn_txdesc) link; @@ -793,6 +795,13 @@ hn_txdesc_hold(struct hn_txdesc *txd) atomic_add_int(&txd->refs, 1); } +static __inline void +hn_txeof(struct hn_tx_ring *txr) +{ + txr->hn_has_txeof = 0; + txr->hn_txeof(txr); +} + static void hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt) { @@ -811,6 +820,13 @@ hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt) txr->hn_has_txeof = 1; hn_txdesc_put(txr, txd); + + ++txr->hn_txdone_cnt; + if (txr->hn_txdone_cnt >= HN_EARLY_TXEOF_THRESH) { + txr->hn_txdone_cnt = 0; + if (txr->hn_oactive) + hn_txeof(txr); + } } void @@ -831,8 +847,8 @@ netvsc_channel_rollup(struct hv_vmbus_channel *chan) if (txr == NULL || !txr->hn_has_txeof) return; - txr->hn_has_txeof = 0; - txr->hn_txeof(txr); + txr->hn_txdone_cnt = 0; + hn_txeof(txr); } /* |