Deleted Added
full compact
pci_virtio_net.c (259301) pci_virtio_net.c (267393)
1/*-
2 * Copyright (c) 2011 NetApp, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2011 NetApp, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: stable/10/usr.sbin/bhyve/pci_virtio_net.c 259301 2013-12-13 06:59:18Z grehan $
26 * $FreeBSD: stable/10/usr.sbin/bhyve/pci_virtio_net.c 267393 2014-06-12 13:13:15Z jhb $
27 */
28
29#include <sys/cdefs.h>
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/10/usr.sbin/bhyve/pci_virtio_net.c 259301 2013-12-13 06:59:18Z grehan $");
30__FBSDID("$FreeBSD: stable/10/usr.sbin/bhyve/pci_virtio_net.c 267393 2014-06-12 13:13:15Z jhb $");
31
32#include <sys/param.h>
33#include <sys/linker_set.h>
34#include <sys/select.h>
35#include <sys/uio.h>
36#include <sys/ioctl.h>
37#include <net/ethernet.h>
38

--- 475 unchanged lines hidden (view full) ---

514 int mac_provided;
515
516 sc = malloc(sizeof(struct pci_vtnet_softc));
517 memset(sc, 0, sizeof(struct pci_vtnet_softc));
518
519 pthread_mutex_init(&sc->vsc_mtx, NULL);
520
521 vi_softc_linkup(&sc->vsc_vs, &vtnet_vi_consts, sc, pi, sc->vsc_queues);
31
32#include <sys/param.h>
33#include <sys/linker_set.h>
34#include <sys/select.h>
35#include <sys/uio.h>
36#include <sys/ioctl.h>
37#include <net/ethernet.h>
38

--- 475 unchanged lines hidden (view full) ---

514 int mac_provided;
515
516 sc = malloc(sizeof(struct pci_vtnet_softc));
517 memset(sc, 0, sizeof(struct pci_vtnet_softc));
518
519 pthread_mutex_init(&sc->vsc_mtx, NULL);
520
521 vi_softc_linkup(&sc->vsc_vs, &vtnet_vi_consts, sc, pi, sc->vsc_queues);
522 sc->vsc_vs.vs_mtx = &sc->vsc_mtx;
523
522 sc->vsc_queues[VTNET_RXQ].vq_qsize = VTNET_RINGSZ;
523 sc->vsc_queues[VTNET_RXQ].vq_notify = pci_vtnet_ping_rxq;
524 sc->vsc_queues[VTNET_TXQ].vq_qsize = VTNET_RINGSZ;
525 sc->vsc_queues[VTNET_TXQ].vq_notify = pci_vtnet_ping_txq;
526#ifdef notyet
527 sc->vsc_queues[VTNET_CTLQ].vq_qsize = VTNET_RINGSZ;
528 sc->vsc_queues[VTNET_CTLQ].vq_notify = pci_vtnet_ping_ctlq;
529#endif

--- 73 unchanged lines hidden (view full) ---

603 }
604
605 /* initialize config space */
606 pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_NET);
607 pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR);
608 pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK);
609 pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET);
610
524 sc->vsc_queues[VTNET_RXQ].vq_qsize = VTNET_RINGSZ;
525 sc->vsc_queues[VTNET_RXQ].vq_notify = pci_vtnet_ping_rxq;
526 sc->vsc_queues[VTNET_TXQ].vq_qsize = VTNET_RINGSZ;
527 sc->vsc_queues[VTNET_TXQ].vq_notify = pci_vtnet_ping_txq;
528#ifdef notyet
529 sc->vsc_queues[VTNET_CTLQ].vq_qsize = VTNET_RINGSZ;
530 sc->vsc_queues[VTNET_CTLQ].vq_notify = pci_vtnet_ping_ctlq;
531#endif

--- 73 unchanged lines hidden (view full) ---

605 }
606
607 /* initialize config space */
608 pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_NET);
609 pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR);
610 pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK);
611 pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET);
612
613 pci_lintr_request(pi);
614
611 /* link always up */
612 sc->vsc_config.status = 1;
613
614 /* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */
615 if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix()))
616 return (1);
617
618 /* use BAR 0 to map config regs in IO space */

--- 61 unchanged lines hidden ---
615 /* link always up */
616 sc->vsc_config.status = 1;
617
618 /* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */
619 if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix()))
620 return (1);
621
622 /* use BAR 0 to map config regs in IO space */

--- 61 unchanged lines hidden ---