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

Collapse All | Expand All

(-)b/sys/dev/virtio/network/if_vtnet.c (-5 / +15 lines)
Lines 653-658 Link Here
653
	} else
653
	} else
654
		max_pairs = 1;
654
		max_pairs = 1;
655
	/*
656
	 * This value needs to be saved before we limit it below because
657
	 * the control virtqueue is located after all the virtqueues the
658
	 * device advertises support for.
659
	 */
660
	sc->vtnet_device_max_vq_pairs = max_pairs;
661
655
	if (max_pairs > 1) {
662
	if (max_pairs > 1) {
656
		/*
663
		/*
657
		 * Limit the maximum number of queue pairs to the number of
664
		 * Limit the maximum number of queue pairs to the number of
Lines 738-744 Link Here
738
{
745
{
739
	int i, npairs, error;
746
	int i, npairs, error;
740
	npairs = sc->vtnet_max_vq_pairs;
747
	npairs = sc->vtnet_device_max_vq_pairs;
741
	sc->vtnet_rxqs = malloc(sizeof(struct vtnet_rxq) * npairs, M_DEVBUF,
748
	sc->vtnet_rxqs = malloc(sizeof(struct vtnet_rxq) * npairs, M_DEVBUF,
742
	    M_NOWAIT | M_ZERO);
749
	    M_NOWAIT | M_ZERO);
Lines 806-819 Link Here
806
	int i;
813
	int i;
807
	if (sc->vtnet_rxqs != NULL) {
814
	if (sc->vtnet_rxqs != NULL) {
808
		for (i = 0; i < sc->vtnet_max_vq_pairs; i++)
815
		for (i = 0; i < sc->vtnet_device_max_vq_pairs; i++)
809
			vtnet_destroy_rxq(&sc->vtnet_rxqs[i]);
816
			vtnet_destroy_rxq(&sc->vtnet_rxqs[i]);
810
		free(sc->vtnet_rxqs, M_DEVBUF);
817
		free(sc->vtnet_rxqs, M_DEVBUF);
811
		sc->vtnet_rxqs = NULL;
818
		sc->vtnet_rxqs = NULL;
812
	}
819
	}
813
	if (sc->vtnet_txqs != NULL) {
820
	if (sc->vtnet_txqs != NULL) {
814
		for (i = 0; i < sc->vtnet_max_vq_pairs; i++)
821
		for (i = 0; i < sc->vtnet_device_max_vq_pairs; i++)
815
			vtnet_destroy_txq(&sc->vtnet_txqs[i]);
822
			vtnet_destroy_txq(&sc->vtnet_txqs[i]);
816
		free(sc->vtnet_txqs, M_DEVBUF);
823
		free(sc->vtnet_txqs, M_DEVBUF);
817
		sc->vtnet_txqs = NULL;
824
		sc->vtnet_txqs = NULL;
Lines 868-874 Link Here
868
	dev = sc->vtnet_dev;
875
	dev = sc->vtnet_dev;
869
	flags = 0;
876
	flags = 0;
870
	nvqs = sc->vtnet_max_vq_pairs * 2;
877
	nvqs = sc->vtnet_device_max_vq_pairs * 2;
871
	if (sc->vtnet_flags & VTNET_FLAG_CTRL_VQ)
878
	if (sc->vtnet_flags & VTNET_FLAG_CTRL_VQ)
872
		nvqs++;
879
		nvqs++;
Lines 876-882 Link Here
876
	if (info == NULL)
883
	if (info == NULL)
877
		return (ENOMEM);
884
		return (ENOMEM);
878
	for (i = 0, idx = 0; i < sc->vtnet_max_vq_pairs; i++, idx+=2) {
885
	for (i = 0, idx = 0; i < sc->vtnet_device_max_vq_pairs; i++, idx+=2) {
879
		rxq = &sc->vtnet_rxqs[i];
886
		rxq = &sc->vtnet_rxqs[i];
880
		VQ_ALLOC_INFO_INIT(&info[idx], sc->vtnet_rx_nsegs,
887
		VQ_ALLOC_INFO_INIT(&info[idx], sc->vtnet_rx_nsegs,
881
		    vtnet_rx_vq_intr, rxq, &rxq->vtnrx_vq,
888
		    vtnet_rx_vq_intr, rxq, &rxq->vtnrx_vq,
Lines 3848-3853 Link Here
3848
	tree = device_get_sysctl_tree(dev);
3855
	tree = device_get_sysctl_tree(dev);
3849
	child = SYSCTL_CHILDREN(tree);
3856
	child = SYSCTL_CHILDREN(tree);
3857
	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "device_max_vq_pairs",
3858
	    CTLFLAG_RD, &sc->vtnet_device_max_vq_pairs, 0,
3859
	    "Device supported virtqueue pairs");
3850
	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "max_vq_pairs",
3860
	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "max_vq_pairs",
3851
	    CTLFLAG_RD, &sc->vtnet_max_vq_pairs, 0,
3861
	    CTLFLAG_RD, &sc->vtnet_max_vq_pairs, 0,
3852
	    "Maximum number of supported virtqueue pairs");
3862
	    "Maximum number of supported virtqueue pairs");
(-)b/sys/dev/virtio/network/if_vtnetvar.h (+1 lines)
Lines 155-160 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_device_max_vq_pairs;
158
	struct virtqueue	*vtnet_ctrl_vq;
159
	struct virtqueue	*vtnet_ctrl_vq;
159
	struct vtnet_mac_filter	*vtnet_mac_filter;
160
	struct vtnet_mac_filter	*vtnet_mac_filter;

Return to bug 207446