View | Details | Raw Unified | Return to bug 207446 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/virtio/network/if_vtnet.c (-24 / +37 lines)
Lines 230-247 static void vtnet_disable_interrupts(str Link Here
230
static int	vtnet_tunable_int(struct vtnet_softc *, const char *, int);
230
static int	vtnet_tunable_int(struct vtnet_softc *, const char *, int);
231
231
232
/* Tunables. */
232
/* Tunables. */
233
static SYSCTL_NODE(_hw, OID_AUTO, vtnet, CTLFLAG_RD, 0, "VNET driver parameters");
233
static int vtnet_csum_disable = 0;
234
static int vtnet_csum_disable = 0;
234
TUNABLE_INT("hw.vtnet.csum_disable", &vtnet_csum_disable);
235
TUNABLE_INT("hw.vtnet.csum_disable", &vtnet_csum_disable);
236
SYSCTL_INT(_hw_vtnet, OID_AUTO, csum_disable, CTLFLAG_RDTUN,
237
    &vtnet_csum_disable, 0, "Disables receive and send checksum offload");
235
static int vtnet_tso_disable = 0;
238
static int vtnet_tso_disable = 0;
236
TUNABLE_INT("hw.vtnet.tso_disable", &vtnet_tso_disable);
239
TUNABLE_INT("hw.vtnet.tso_disable", &vtnet_tso_disable);
240
SYSCTL_INT(_hw_vtnet, OID_AUTO, tso_disable, CTLFLAG_RDTUN, &vtnet_tso_disable,
241
    0, "Disables TCP Segmentation Offload");
237
static int vtnet_lro_disable = 0;
242
static int vtnet_lro_disable = 0;
238
TUNABLE_INT("hw.vtnet.lro_disable", &vtnet_lro_disable);
243
TUNABLE_INT("hw.vtnet.lro_disable", &vtnet_lro_disable);
244
SYSCTL_INT(_hw_vtnet, OID_AUTO, lro_disable, CTLFLAG_RDTUN, &vtnet_lro_disable,
245
    0, "Disables TCP Large Receive Offload");
239
static int vtnet_mq_disable = 0;
246
static int vtnet_mq_disable = 0;
240
TUNABLE_INT("hw.vtnet.mq_disable", &vtnet_mq_disable);
247
TUNABLE_INT("hw.vtnet.mq_disable", &vtnet_mq_disable);
241
static int vtnet_mq_max_pairs = 0;
248
SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_disable, CTLFLAG_RDTUN, &vtnet_mq_disable,
249
    0, "Disables Multi Queue support");
250
static int vtnet_mq_max_pairs = VTNET_MAX_QUEUE_PAIRS;
242
TUNABLE_INT("hw.vtnet.mq_max_pairs", &vtnet_mq_max_pairs);
251
TUNABLE_INT("hw.vtnet.mq_max_pairs", &vtnet_mq_max_pairs);
252
SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_max_pairs, CTLFLAG_RDTUN,
253
    &vtnet_mq_max_pairs, 0, "Sets the maximum number of Multi Queue pairs");
243
static int vtnet_rx_process_limit = 512;
254
static int vtnet_rx_process_limit = 512;
244
TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit);
255
TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit);
256
SYSCTL_INT(_hw_vtnet, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN,
257
    &vtnet_rx_process_limit, 0,
258
    "Limits the number RX segments processed in a single pass");
245
259
246
static uma_zone_t vtnet_tx_header_zone;
260
static uma_zone_t vtnet_tx_header_zone;
247
261
Lines 591-597 static void Link Here
591
vtnet_setup_features(struct vtnet_softc *sc)
605
vtnet_setup_features(struct vtnet_softc *sc)
592
{
606
{
593
	device_t dev;
607
	device_t dev;
594
	int max_pairs, max;
595
608
596
	dev = sc->vtnet_dev;
609
	dev = sc->vtnet_dev;
597
610
Lines 640-671 vtnet_setup_features(struct vtnet_softc Link Here
640
653
641
	if (virtio_with_feature(dev, VIRTIO_NET_F_MQ) &&
654
	if (virtio_with_feature(dev, VIRTIO_NET_F_MQ) &&
642
	    sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) {
655
	    sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) {
643
		max_pairs = virtio_read_dev_config_2(dev,
656
		sc->vtnet_max_vq_pairs = virtio_read_dev_config_2(dev,
644
		    offsetof(struct virtio_net_config, max_virtqueue_pairs));
657
		    offsetof(struct virtio_net_config, max_virtqueue_pairs));
645
		if (max_pairs < VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN ||
646
		    max_pairs > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX)
647
			max_pairs = 1;
648
	} else
658
	} else
649
		max_pairs = 1;
659
		sc->vtnet_max_vq_pairs = 1;
650
660
651
	if (max_pairs > 1) {
661
	if (sc->vtnet_max_vq_pairs > 1) {
652
		/*
662
		/*
653
		 * Limit the maximum number of queue pairs to the number of
663
		 * Limit the maximum number of queue pairs to the lower of
654
		 * CPUs or the configured maximum. The actual number of
664
		 * the number of CPUs and the configured maximum.
655
		 * queues that get used may be less.
665
		 * The actual number of queues that get used may be less.
656
		 */
666
		 */
667
		int max;
668
657
		max = vtnet_tunable_int(sc, "mq_max_pairs", vtnet_mq_max_pairs);
669
		max = vtnet_tunable_int(sc, "mq_max_pairs", vtnet_mq_max_pairs);
658
		if (max > 0 && max_pairs > max)
670
		if (max > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN) {
659
			max_pairs = max;
671
			if (max > mp_ncpus)
660
		if (max_pairs > mp_ncpus)
672
				max = mp_ncpus;
661
			max_pairs = mp_ncpus;
673
			if (max > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX)
662
		if (max_pairs > VTNET_MAX_QUEUE_PAIRS)
674
				max = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX;
663
			max_pairs = VTNET_MAX_QUEUE_PAIRS;
675
			if (max > 1) {
664
		if (max_pairs > 1)
676
				sc->vtnet_requested_vq_pairs = max;
665
			sc->vtnet_flags |= VTNET_FLAG_MULTIQ;
677
				sc->vtnet_flags |= VTNET_FLAG_MULTIQ;
678
			}
679
		}
666
	}
680
	}
667
668
	sc->vtnet_max_vq_pairs = max_pairs;
669
}
681
}
670
682
671
static int
683
static int
Lines 2991-3003 vtnet_set_active_vq_pairs(struct vtnet_s Link Here
2991
	dev = sc->vtnet_dev;
3003
	dev = sc->vtnet_dev;
2992
3004
2993
	if ((sc->vtnet_flags & VTNET_FLAG_MULTIQ) == 0) {
3005
	if ((sc->vtnet_flags & VTNET_FLAG_MULTIQ) == 0) {
2994
		MPASS(sc->vtnet_max_vq_pairs == 1);
2995
		sc->vtnet_act_vq_pairs = 1;
3006
		sc->vtnet_act_vq_pairs = 1;
2996
		return;
3007
		return;
2997
	}
3008
	}
2998
3009
2999
	/* BMV: Just use the maximum configured for now. */
3010
	npairs = sc->vtnet_requested_vq_pairs;
3000
	npairs = sc->vtnet_max_vq_pairs;
3001
3011
3002
	if (vtnet_ctrl_mq_cmd(sc, npairs) != 0) {
3012
	if (vtnet_ctrl_mq_cmd(sc, npairs) != 0) {
3003
		device_printf(dev,
3013
		device_printf(dev,
Lines 3853-3858 vtnet_setup_sysctl(struct vtnet_softc *s Link Here
3853
	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "max_vq_pairs",
3863
	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "max_vq_pairs",
3854
	    CTLFLAG_RD, &sc->vtnet_max_vq_pairs, 0,
3864
	    CTLFLAG_RD, &sc->vtnet_max_vq_pairs, 0,
3855
	    "Maximum number of supported virtqueue pairs");
3865
	    "Maximum number of supported virtqueue pairs");
3866
	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "requested_vq_pairs",
3867
	    CTLFLAG_RD, &sc->vtnet_requested_vq_pairs, 0,
3868
	    "Requested number of virtqueue pairs");
3856
	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "act_vq_pairs",
3869
	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "act_vq_pairs",
3857
	    CTLFLAG_RD, &sc->vtnet_act_vq_pairs, 0,
3870
	    CTLFLAG_RD, &sc->vtnet_act_vq_pairs, 0,
3858
	    "Number of active virtqueue pairs");
3871
	    "Number of active virtqueue pairs");
(-)sys/dev/virtio/network/if_vtnetvar.h (+1 lines)
Lines 155-160 struct vtnet_softc { Link Here
155
	int			 vtnet_if_flags;
155
	int			 vtnet_if_flags;
156
	int			 vtnet_act_vq_pairs;
156
	int			 vtnet_act_vq_pairs;
157
	int			 vtnet_max_vq_pairs;
157
	int			 vtnet_max_vq_pairs;
158
	int			 vtnet_requested_vq_pairs;
158
159
159
	struct virtqueue	*vtnet_ctrl_vq;
160
	struct virtqueue	*vtnet_ctrl_vq;
160
	struct vtnet_mac_filter	*vtnet_mac_filter;
161
	struct vtnet_mac_filter	*vtnet_mac_filter;

Return to bug 207446