svn commit: r298563 - head/sys/dev/hyperv/netvsc
Sepherosa Ziehau
sephe at FreeBSD.org
Mon Apr 25 03:48:29 UTC 2016
Author: sephe
Date: Mon Apr 25 03:48:28 2016
New Revision: 298563
URL: https://svnweb.freebsd.org/changeset/base/298563
Log:
hyperv/hn: Allow users to configure ifq or bufring depth.
MFC after: 1 week
Sponsored by: Microsoft OSTC
Modified:
head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Apr 25 03:24:48 2016 (r298562)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Apr 25 03:48:28 2016 (r298563)
@@ -291,6 +291,10 @@ static int hn_tx_ring_cnt = 0;
SYSCTL_INT(_hw_hn, OID_AUTO, tx_ring_cnt, CTLFLAG_RDTUN,
&hn_tx_ring_cnt, 0, "# of TX rings to use");
+static int hn_tx_swq_depth = 0;
+SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_depth, CTLFLAG_RDTUN,
+ &hn_tx_swq_depth, 0, "Depth of IFQ or BUFRING");
+
static u_int hn_cpu_index;
/*
@@ -348,6 +352,16 @@ hn_set_lro_lenlim(struct hn_softc *sc, i
#endif
static int
+hn_get_txswq_depth(const struct hn_tx_ring *txr)
+{
+
+ KASSERT(txr->hn_txdesc_cnt > 0, ("tx ring is not setup yet"));
+ if (hn_tx_swq_depth < txr->hn_txdesc_cnt)
+ return txr->hn_txdesc_cnt;
+ return hn_tx_swq_depth;
+}
+
+static int
hn_ifmedia_upd(struct ifnet *ifp __unused)
{
@@ -501,9 +515,11 @@ netvsc_attach(device_t dev)
/* needed by hv_rf_on_device_add() code */
ifp->if_mtu = ETHERMTU;
if (hn_use_if_start) {
+ int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]);
+
ifp->if_start = hn_start;
- IFQ_SET_MAXLEN(&ifp->if_snd, 512);
- ifp->if_snd.ifq_drv_maxlen = 511;
+ IFQ_SET_MAXLEN(&ifp->if_snd, qdepth);
+ ifp->if_snd.ifq_drv_maxlen = qdepth - 1;
IFQ_SET_READY(&ifp->if_snd);
} else {
ifp->if_transmit = hn_transmit;
@@ -2285,10 +2301,14 @@ hn_create_tx_ring(struct hn_softc *sc, i
TASK_INIT(&txr->hn_tx_task, 0, hn_start_taskfunc, txr);
TASK_INIT(&txr->hn_txeof_task, 0, hn_start_txeof_taskfunc, txr);
} else {
+ int br_depth;
+
txr->hn_txeof = hn_xmit_txeof;
TASK_INIT(&txr->hn_tx_task, 0, hn_xmit_taskfunc, txr);
TASK_INIT(&txr->hn_txeof_task, 0, hn_xmit_txeof_taskfunc, txr);
- txr->hn_mbuf_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_NETVSC,
+
+ br_depth = hn_get_txswq_depth(txr);
+ txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_NETVSC,
M_WAITOK, &txr->hn_tx_lock);
}
More information about the svn-src-all
mailing list