hyperv/hn: Reduce TCP segment aggregation limit for multiple RX rings

This mainly used to improve ACK timeliness when multiple RX rings
are enabled.

This value gives the best performance in both Azure and Hyper-V
environment, w/ both 10Ge and 40Ge using non-{INVARIANTS,WITNESS}
kernel.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5691
This commit is contained in:
sephe 2016-03-22 06:31:39 +00:00
parent 96842098f8
commit de7ddcd5bb

View File

@ -181,6 +181,7 @@ struct hn_txdesc {
#define HN_CSUM_ASSIST_WIN8 (CSUM_IP | CSUM_TCP)
#define HN_CSUM_ASSIST (CSUM_IP | CSUM_UDP | CSUM_TCP)
#define HN_LRO_LENLIM_MULTIRX_DEF (12 * ETHERMTU)
#define HN_LRO_LENLIM_DEF (25 * ETHERMTU)
/* YYY 2*MTU is a bit rough, but should be good enough. */
#define HN_LRO_LENLIM_MIN(ifp) (2 * (ifp)->if_mtu)
@ -530,6 +531,21 @@ netvsc_attach(device_t dev)
device_printf(dev, "%d TX ring, %d RX ring\n",
sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse);
#if __FreeBSD_version >= 1100099
if (sc->hn_rx_ring_inuse > 1) {
int i;
/*
* Reduce TCP segment aggregation limit for multiple
* RX rings to increase ACK timeliness.
*/
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
sc->hn_rx_ring[i].hn_lro.lro_length_lim =
HN_LRO_LENLIM_MULTIRX_DEF;
}
}
#endif
if (device_info.link_state == 0) {
sc->hn_carrier = 1;
}