Date: Thu, 18 Feb 2016 06:55:32 +0000 From: Phabricator <phabric-noreply@FreeBSD.org> To: freebsd-net@freebsd.org Subject: [Differential] [Closed] D5272: hyperv/hn: Add option to allow sharing TX taskq between hn instances Message-ID: <1e223473c9e3d04c17512c4ad63bb9f1@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-5ew7qdtgrz2cn67gpxpi-req@FreeBSD.org> References: <differential-rev-PHID-DREV-5ew7qdtgrz2cn67gpxpi-req@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--b1_1e223473c9e3d04c17512c4ad63bb9f1 Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: 8bit This revision was automatically updated to reflect the committed changes. Closed by commit rS295741: hyperv/hn: Add option to allow sharing TX taskq between hn instances (authored by sephe). CHANGED PRIOR TO COMMIT https://reviews.freebsd.org/D5272?vs=13283&id=13399#toc REPOSITORY rS FreeBSD src repository CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D5272?vs=13283&id=13399 REVISION DETAIL https://reviews.freebsd.org/D5272 AFFECTED FILES head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c CHANGE DETAILS diff --git a/head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c --- a/head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -238,6 +238,11 @@ #endif #endif +static int hn_share_tx_taskq = 0; +TUNABLE_INT("hw.hn.share_tx_taskq", &hn_share_tx_taskq); + +static struct taskqueue *hn_tx_taskq; + /* * Forward declarations */ @@ -353,10 +358,14 @@ if (hn_trust_hostip) sc->hn_trust_hcsum |= HN_TRUST_HCSUM_IP; - sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK, - taskqueue_thread_enqueue, &sc->hn_tx_taskq); - taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx", - device_get_nameunit(dev)); + if (hn_tx_taskq == NULL) { + sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_tx_taskq); + taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx", + device_get_nameunit(dev)); + } else { + sc->hn_tx_taskq = hn_tx_taskq; + } TASK_INIT(&sc->hn_start_task, 0, hn_start_taskfunc, sc); TASK_INIT(&sc->hn_txeof_task, 0, hn_txeof_taskfunc, sc); @@ -602,7 +611,8 @@ taskqueue_drain(sc->hn_tx_taskq, &sc->hn_start_task); taskqueue_drain(sc->hn_tx_taskq, &sc->hn_txeof_task); - taskqueue_free(sc->hn_tx_taskq); + if (sc->hn_tx_taskq != hn_tx_taskq) + taskqueue_free(sc->hn_tx_taskq); ifmedia_removeall(&sc->hn_media); #if defined(INET) || defined(INET6) @@ -2039,6 +2049,28 @@ NV_UNLOCK(sc); } +static void +hn_tx_taskq_create(void *arg __unused) +{ + if (!hn_share_tx_taskq) + return; + + hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK, + taskqueue_thread_enqueue, &hn_tx_taskq); + taskqueue_start_threads(&hn_tx_taskq, 1, PI_NET, "hn tx"); +} +SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_FIRST, + hn_tx_taskq_create, NULL); + +static void +hn_tx_taskq_destroy(void *arg __unused) +{ + if (hn_tx_taskq != NULL) + taskqueue_free(hn_tx_taskq); +} +SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_FIRST, + hn_tx_taskq_destroy, NULL); + static device_method_t netvsc_methods[] = { /* Device interface */ DEVMETHOD(device_probe, netvsc_probe), EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: sepherosa_gmail.com, delphij, royger, decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com, adrian, network Cc: freebsd-virtualization-list, freebsd-net-list --b1_1e223473c9e3d04c17512c4ad63bb9f1 Content-Type: text/x-patch; charset=utf-8; name="D5272.13399.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D5272.13399.patch" ZGlmZiAtLWdpdCBhL2hlYWQvc3lzL2Rldi9oeXBlcnYvbmV0dnNjL2h2X25ldHZzY19kcnZfZnJl ZWJzZC5jIGIvaGVhZC9zeXMvZGV2L2h5cGVydi9uZXR2c2MvaHZfbmV0dnNjX2Rydl9mcmVlYnNk LmMKLS0tIGEvaGVhZC9zeXMvZGV2L2h5cGVydi9uZXR2c2MvaHZfbmV0dnNjX2Rydl9mcmVlYnNk LmMKKysrIGIvaGVhZC9zeXMvZGV2L2h5cGVydi9uZXR2c2MvaHZfbmV0dnNjX2Rydl9mcmVlYnNk LmMKQEAgLTIzOCw2ICsyMzgsMTEgQEAKICNlbmRpZgogI2VuZGlmCiAKK3N0YXRpYyBpbnQgaG5f c2hhcmVfdHhfdGFza3EgPSAwOworVFVOQUJMRV9JTlQoImh3LmhuLnNoYXJlX3R4X3Rhc2txIiwg JmhuX3NoYXJlX3R4X3Rhc2txKTsKKworc3RhdGljIHN0cnVjdCB0YXNrcXVldWUJKmhuX3R4X3Rh c2txOworCiAvKgogICogRm9yd2FyZCBkZWNsYXJhdGlvbnMKICAqLwpAQCAtMzUzLDEwICszNTgs MTQgQEAKIAlpZiAoaG5fdHJ1c3RfaG9zdGlwKQogCQlzYy0+aG5fdHJ1c3RfaGNzdW0gfD0gSE5f VFJVU1RfSENTVU1fSVA7CiAKLQlzYy0+aG5fdHhfdGFza3EgPSB0YXNrcXVldWVfY3JlYXRlX2Zh c3QoImhuX3R4IiwgTV9XQUlUT0ssCi0JICAgIHRhc2txdWV1ZV90aHJlYWRfZW5xdWV1ZSwgJnNj LT5obl90eF90YXNrcSk7Ci0JdGFza3F1ZXVlX3N0YXJ0X3RocmVhZHMoJnNjLT5obl90eF90YXNr cSwgMSwgUElfTkVULCAiJXMgdHgiLAotCSAgICBkZXZpY2VfZ2V0X25h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dGljIHZvaWQKK2huX3R4X3Rhc2tx X2NyZWF0ZSh2b2lkICphcmcgX191bnVzZWQpCit7CisJaWYgKCFobl9zaGFyZV90eF90YXNrcSkK KwkJcmV0dXJuOworCisJaG5fdHhfdGFza3EgPSB0YXNrcXVldWVfY3JlYXRlX2Zhc3QoImhuX3R4 IiwgTV9XQUlUT0ssCisJICAgIHRhc2txdWV1ZV90aHJlYWRfZW5xdWV1ZSwgJmhuX3R4X3Rhc2tx KTsKKwl0YXNrcXVldWVfc3RhcnRfdGhyZWFkcygmaG5fdHhfdGFza3EsIDEsIFBJX05FVCwgImhu IHR4Iik7Cit9CitTWVNJTklUKGhuX3R4dHFfY3JlYXRlLCBTSV9TVUJfRFJJVkVSUywgU0lfT1JE RVJfRklSU1QsCisgICAgaG5fdHhfdGFza3FfY3JlYXRlLCBOVUxMKTsKKworc3RhdGljIHZvaWQK K2huX3R4X3Rhc2txX2Rlc3Ryb3kodm9pZCAqYXJnIF9fdW51c2VkKQoreworCWlmIChobl90eF90 YXNrcSAhPSBOVUxMKQorCQl0YXNrcXVldWVfZnJlZShobl90eF90YXNrcSk7Cit9CitTWVNVTklO SVQoaG5fdHh0cV9kZXN0cm95LCBTSV9TVUJfRFJJVkVSUywgU0lfT1JERVJfRklSU1QsCisgICAg aG5fdHhfdGFza3FfZGVzdHJveSwgTlVMTCk7CisKIHN0YXRpYyBkZXZpY2VfbWV0aG9kX3QgbmV0 dnNjX21ldGhvZHNbXSA9IHsKICAgICAgICAgLyogRGV2aWNlIGludGVyZmFjZSAqLwogICAgICAg ICBERVZNRVRIT0QoZGV2aWNlX3Byb2JlLCAgICAgICAgIG5ldHZzY19wcm9iZSksCgo= --b1_1e223473c9e3d04c17512c4ad63bb9f1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1e223473c9e3d04c17512c4ad63bb9f1>