[Differential] [Closed] D5272: hyperv/hn: Add option to allow sharing TX taskq between hn instances

Phabricator phabric-noreply at FreeBSD.org
Thu Feb 18 06:55:32 UTC 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5272.13399.patch
Type: text/x-patch
Size: 2216 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20160218/78d0c482/attachment.bin>


More information about the freebsd-net mailing list