hyperv/hn: Allow users to configure ifq or bufring depth.
MFC after: 1 week Sponsored by: Microsoft OSTC
This commit is contained in:
parent
a99d821068
commit
4e0c3dc461
@ -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;
|
||||
|
||||
/*
|
||||
@ -347,6 +351,16 @@ hn_set_lro_lenlim(struct hn_softc *sc, int lenlim)
|
||||
}
|
||||
#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, int id)
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user