sepherosa_gmail.com created this revision.
sepherosa_gmail.com added reviewers: network, adrian, delphij, royger,
decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com.
sepherosa_gmail.com added subscribers: freebsd-net-list,
freebsd-virtualization-list.
REVISION SUMMARY
It is off by default. This eases more experiment on hn(4).
REVISION DETAIL
https://reviews.freebsd.org/D5175
AFFECTED FILES
sys/dev/hyperv/netvsc/hv_net_vsc.h
sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
CHANGE DETAILS
diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
--- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -534,6 +534,10 @@
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "direct_tx_size",
CTLFLAG_RW, &sc->hn_direct_tx_size, 0,
"Size of the packet for direct transmission");
+ SYSCTL_ADD_INT(ctx, child, OID_AUTO, "sched_tx",
+ CTLFLAG_RW, &sc->hn_sched_tx, 0,
+ "Always schedule transmission "
+ "instead of doing direct transmission");
if (unit == 0) {
struct sysctl_ctx_list *dc_ctx;
@@ -1602,26 +1606,31 @@
static void
hn_start(struct ifnet *ifp)
{
- hn_softc_t *sc;
+ struct hn_softc *sc = ifp->if_softc;
+
+ if (sc->hn_sched_tx)
+ goto do_sched;
- sc = ifp->if_softc;
if (NV_TRYLOCK(sc)) {
int sched;
sched = hn_start_locked(ifp, sc->hn_direct_tx_size);
NV_UNLOCK(sc);
if (!sched)
return;
}
+do_sched:
taskqueue_enqueue_fast(sc->hn_tx_taskq, &sc->hn_start_task);
}
static void
hn_start_txeof(struct ifnet *ifp)
{
- hn_softc_t *sc;
+ struct hn_softc *sc = ifp->if_softc;
+
+ if (sc->hn_sched_tx)
+ goto do_sched;
- sc = ifp->if_softc;
if (NV_TRYLOCK(sc)) {
int sched;
@@ -1633,6 +1642,7 @@
&sc->hn_start_task);
}
} else {
+do_sched:
/*
* Release the OACTIVE earlier, with the hope, that
* others could catch up. The task will clear the
diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h
b/sys/dev/hyperv/netvsc/hv_net_vsc.h
--- a/sys/dev/hyperv/netvsc/hv_net_vsc.h
+++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h
@@ -1023,6 +1023,7 @@
int hn_txdesc_avail;
int hn_txeof;
+ int hn_sched_tx;
int hn_direct_tx_size;
struct taskqueue *hn_tx_taskq;
struct task hn_start_task;
EMAIL PREFERENCES
https://reviews.freebsd.org/settings/panel/emailpreferences/
To: sepherosa_gmail.com, network, adrian, delphij, royger, decui_microsoft.com,
honzhan_microsoft.com, howard0su_gmail.com
Cc: freebsd-virtualization-list, freebsd-net-list
diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
--- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -534,6 +534,10 @@
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "direct_tx_size",
CTLFLAG_RW, &sc->hn_direct_tx_size, 0,
"Size of the packet for direct transmission");
+ SYSCTL_ADD_INT(ctx, child, OID_AUTO, "sched_tx",
+ CTLFLAG_RW, &sc->hn_sched_tx, 0,
+ "Always schedule transmission "
+ "instead of doing direct transmission");
if (unit == 0) {
struct sysctl_ctx_list *dc_ctx;
@@ -1602,26 +1606,31 @@
static void
hn_start(struct ifnet *ifp)
{
- hn_softc_t *sc;
+ struct hn_softc *sc = ifp->if_softc;
+
+ if (sc->hn_sched_tx)
+ goto do_sched;
- sc = ifp->if_softc;
if (NV_TRYLOCK(sc)) {
int sched;
sched = hn_start_locked(ifp, sc->hn_direct_tx_size);
NV_UNLOCK(sc);
if (!sched)
return;
}
+do_sched:
taskqueue_enqueue_fast(sc->hn_tx_taskq, &sc->hn_start_task);
}
static void
hn_start_txeof(struct ifnet *ifp)
{
- hn_softc_t *sc;
+ struct hn_softc *sc = ifp->if_softc;
+
+ if (sc->hn_sched_tx)
+ goto do_sched;
- sc = ifp->if_softc;
if (NV_TRYLOCK(sc)) {
int sched;
@@ -1633,6 +1642,7 @@
&sc->hn_start_task);
}
} else {
+do_sched:
/*
* Release the OACTIVE earlier, with the hope, that
* others could catch up. The task will clear the
diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h
--- a/sys/dev/hyperv/netvsc/hv_net_vsc.h
+++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h
@@ -1023,6 +1023,7 @@
int hn_txdesc_avail;
int hn_txeof;
+ int hn_sched_tx;
int hn_direct_tx_size;
struct taskqueue *hn_tx_taskq;
struct task hn_start_task;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to
"[email protected]"