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

Collapse All | Expand All

(-)sys/dev/virtio/network/if_vtnetvar.h (-6 lines)
Lines 82-90 Link Here
82
	struct taskqueue	*vtnrx_tq;
82
	struct taskqueue	*vtnrx_tq;
83
	struct task		 vtnrx_intrtask;
83
	struct task		 vtnrx_intrtask;
84
	struct lro_ctrl		 vtnrx_lro;
84
	struct lro_ctrl		 vtnrx_lro;
85
#ifdef DEV_NETMAP
86
	struct virtio_net_hdr_mrg_rxbuf vtnrx_shrhdr;
87
#endif  /* DEV_NETMAP */
88
	char			 vtnrx_name[16];
85
	char			 vtnrx_name[16];
89
} __aligned(CACHE_LINE_SIZE);
86
} __aligned(CACHE_LINE_SIZE);
90
87
Lines 121-129 Link Here
121
#ifndef VTNET_LEGACY_TX
118
#ifndef VTNET_LEGACY_TX
122
	struct task		 vtntx_defrtask;
119
	struct task		 vtntx_defrtask;
123
#endif
120
#endif
124
#ifdef DEV_NETMAP
125
	struct virtio_net_hdr_mrg_rxbuf vtntx_shrhdr;
126
#endif  /* DEV_NETMAP */
127
	char			 vtntx_name[16];
121
	char			 vtntx_name[16];
128
} __aligned(CACHE_LINE_SIZE);
122
} __aligned(CACHE_LINE_SIZE);
129
123
(-)sys/dev/virtio/network/if_vtnet.c (-43 lines)
Lines 347-356 Link Here
347
	DEVMETHOD_END
347
	DEVMETHOD_END
348
};
348
};
349
349
350
#ifdef DEV_NETMAP
351
#include <dev/netmap/if_vtnet_netmap.h>
352
#endif
353
354
static driver_t vtnet_driver = {
350
static driver_t vtnet_driver = {
355
	.name = "vtnet",
351
	.name = "vtnet",
356
	.methods = vtnet_methods,
352
	.methods = vtnet_methods,
Lines 364-372 Link Here
364
DRIVER_MODULE(vtnet, vtpcim, vtnet_driver, vtnet_devclass, vtnet_modevent, 0);
360
DRIVER_MODULE(vtnet, vtpcim, vtnet_driver, vtnet_devclass, vtnet_modevent, 0);
365
MODULE_VERSION(vtnet, 1);
361
MODULE_VERSION(vtnet, 1);
366
MODULE_DEPEND(vtnet, virtio, 1, 1, 1);
362
MODULE_DEPEND(vtnet, virtio, 1, 1, 1);
367
#ifdef DEV_NETMAP
368
MODULE_DEPEND(vtnet, netmap, 1, 1, 1);
369
#endif
370
363
371
static int
364
static int
372
vtnet_modevent(module_t mod, int type, void *unused)
365
vtnet_modevent(module_t mod, int type, void *unused)
Lines 472-480 Link Here
472
		goto fail;
465
		goto fail;
473
	}
466
	}
474
467
475
#ifdef DEV_NETMAP
476
	vtnet_netmap_attach(sc);
477
#endif
478
	vtnet_start_taskqueues(sc);
468
	vtnet_start_taskqueues(sc);
479
469
480
fail:
470
fail:
Lines 504-513 Link Here
504
		ether_ifdetach(ifp);
494
		ether_ifdetach(ifp);
505
	}
495
	}
506
496
507
#ifdef DEV_NETMAP
508
	netmap_detach(ifp);
509
#endif
510
511
	vtnet_free_taskqueues(sc);
497
	vtnet_free_taskqueues(sc);
512
498
513
	if (sc->vtnet_vlan_attach != NULL) {
499
	if (sc->vtnet_vlan_attach != NULL) {
Lines 2028-2038 Link Here
2028
2014
2029
	VTNET_RXQ_LOCK_ASSERT(rxq);
2015
	VTNET_RXQ_LOCK_ASSERT(rxq);
2030
2016
2031
#ifdef DEV_NETMAP
2032
	if (netmap_rx_irq(ifp, 0, &deq))
2033
		return (0);
2034
#endif
2035
2036
	while (count-- > 0) {
2017
	while (count-- > 0) {
2037
		struct mbuf *m;
2018
		struct mbuf *m;
2038
		int len, nbufs, adjsz;
2019
		int len, nbufs, adjsz;
Lines 2763-2775 Link Here
2763
	deq = 0;
2744
	deq = 0;
2764
	VTNET_TXQ_LOCK_ASSERT(txq);
2745
	VTNET_TXQ_LOCK_ASSERT(txq);
2765
2746
2766
#ifdef DEV_NETMAP
2767
	if (netmap_tx_irq(txq->vtntx_sc->vtnet_ifp, txq->vtntx_id)) {
2768
		virtqueue_disable_intr(vq); // XXX luigi
2769
		return (0); // XXX or 1 ?
2770
	}
2771
#endif
2772
2773
	while ((txhdr = virtqueue_dequeue(vq, NULL)) != NULL) {
2747
	while ((txhdr = virtqueue_dequeue(vq, NULL)) != NULL) {
2774
		m = txhdr->vth_mbuf;
2748
		m = txhdr->vth_mbuf;
2775
		deq++;
2749
		deq++;
Lines 3067-3077 Link Here
3067
	struct vtnet_txq *txq;
3041
	struct vtnet_txq *txq;
3068
	int i;
3042
	int i;
3069
3043
3070
#ifdef DEV_NETMAP
3071
	if (nm_native_on(NA(sc->vtnet_ifp)))
3072
		return;
3073
#endif
3074
3075
	for (i = 0; i < sc->vtnet_max_vq_pairs; i++) {
3044
	for (i = 0; i < sc->vtnet_max_vq_pairs; i++) {
3076
		rxq = &sc->vtnet_rxqs[i];
3045
		rxq = &sc->vtnet_rxqs[i];
3077
		vtnet_rxq_free_mbufs(rxq);
3046
		vtnet_rxq_free_mbufs(rxq);
Lines 3215-3225 Link Here
3215
	} else
3184
	} else
3216
		sc->vtnet_rx_nmbufs = 1;
3185
		sc->vtnet_rx_nmbufs = 1;
3217
3186
3218
#ifdef DEV_NETMAP
3219
	if (vtnet_netmap_init_rx_buffers(sc))
3220
		return (0);
3221
#endif
3222
3223
	for (i = 0; i < sc->vtnet_act_vq_pairs; i++) {
3187
	for (i = 0; i < sc->vtnet_act_vq_pairs; i++) {
3224
		rxq = &sc->vtnet_rxqs[i];
3188
		rxq = &sc->vtnet_rxqs[i];
3225
3189
Lines 3405-3417 Link Here
3405
	struct vtnet_softc *sc;
3369
	struct vtnet_softc *sc;
3406
3370
3407
	sc = xsc;
3371
	sc = xsc;
3408
3409
#ifdef DEV_NETMAP
3410
	if (!NA(sc->vtnet_ifp)) {
3411
		D("try to attach again");
3412
		vtnet_netmap_attach(sc);
3413
	}
3414
#endif
3415
3372
3416
	VTNET_CORE_LOCK(sc);
3373
	VTNET_CORE_LOCK(sc);
3417
	vtnet_init_locked(sc);
3374
	vtnet_init_locked(sc);
(-)sys/dev/netmap/if_ptnet.c (+2 lines)
Lines 87-92 Link Here
87
#include <dev/netmap/netmap_mem2.h>
87
#include <dev/netmap/netmap_mem2.h>
88
#include <dev/virtio/network/virtio_net.h>
88
#include <dev/virtio/network/virtio_net.h>
89
89
90
#ifdef WITH_PTNETMAP
90
#ifndef INET
91
#ifndef INET
91
#error "INET not defined, cannot support offloadings"
92
#error "INET not defined, cannot support offloadings"
92
#endif
93
#endif
Lines 2291-2293 Link Here
2291
	return count;
2292
	return count;
2292
}
2293
}
2293
#endif /* DEVICE_POLLING */
2294
#endif /* DEVICE_POLLING */
2295
#endif /* WITH_PTNETMAP */
(-)sys/dev/netmap/netmap_kern.h (-1 lines)
Lines 76-82 Link Here
76
#define WITH_PIPES
76
#define WITH_PIPES
77
#define WITH_MONITOR
77
#define WITH_MONITOR
78
#define WITH_GENERIC
78
#define WITH_GENERIC
79
#define WITH_PTNETMAP	/* ptnetmap guest support */
80
#define WITH_EXTMEM
79
#define WITH_EXTMEM
81
#define WITH_NMNULL
80
#define WITH_NMNULL
82
#endif
81
#endif
(-)sys/net/netmap_virt.h (-2 / +2 lines)
Lines 44-51 Link Here
44
/* PCI identifiers and PCI BARs for ptnetmap-memdev and ptnet. */
44
/* PCI identifiers and PCI BARs for ptnetmap-memdev and ptnet. */
45
#define PTNETMAP_MEMDEV_NAME            "ptnetmap-memdev"
45
#define PTNETMAP_MEMDEV_NAME            "ptnetmap-memdev"
46
#define PTNETMAP_PCI_VENDOR_ID          0x1b36  /* QEMU virtual devices */
46
#define PTNETMAP_PCI_VENDOR_ID          0x1b36  /* QEMU virtual devices */
47
#define PTNETMAP_PCI_DEVICE_ID          0x000c  /* memory device */
47
#define PTNETMAP_PCI_DEVICE_ID          0xcccc  /* memory device */
48
#define PTNETMAP_PCI_NETIF_ID           0x000d  /* ptnet network interface */
48
#define PTNETMAP_PCI_NETIF_ID           0xcccd  /* ptnet network interface */
49
#define PTNETMAP_IO_PCI_BAR             0
49
#define PTNETMAP_IO_PCI_BAR             0
50
#define PTNETMAP_MEM_PCI_BAR            1
50
#define PTNETMAP_MEM_PCI_BAR            1
51
#define PTNETMAP_MSIX_PCI_BAR           2
51
#define PTNETMAP_MSIX_PCI_BAR           2

Return to bug 236922