Revision e7b43f7e

b/hw/virtio-net.c
120 120
    if (!n->vhost_started) {
121 121
        int r = vhost_net_start(tap_get_vhost_net(n->nic->nc.peer), &n->vdev);
122 122
        if (r < 0) {
123
            fprintf(stderr, "unable to start vhost net: %d: "
124
                    "falling back on userspace virtio\n", -r);
123
            error_report("unable to start vhost net: %d: "
124
                         "falling back on userspace virtio", -r);
125 125
        } else {
126 126
            n->vhost_started = 1;
127 127
        }
......
271 271
    uint8_t on;
272 272

  
273 273
    if (elem->out_num != 2 || elem->out_sg[1].iov_len != sizeof(on)) {
274
        fprintf(stderr, "virtio-net ctrl invalid rx mode command\n");
274
        error_report("virtio-net ctrl invalid rx mode command");
275 275
        exit(1);
276 276
    }
277 277

  
......
353 353
    uint16_t vid;
354 354

  
355 355
    if (elem->out_num != 2 || elem->out_sg[1].iov_len != sizeof(vid)) {
356
        fprintf(stderr, "virtio-net ctrl invalid vlan command\n");
356
        error_report("virtio-net ctrl invalid vlan command");
357 357
        return VIRTIO_NET_ERR;
358 358
    }
359 359

  
......
381 381

  
382 382
    while (virtqueue_pop(vq, &elem)) {
383 383
        if ((elem.in_num < 1) || (elem.out_num < 1)) {
384
            fprintf(stderr, "virtio-net ctrl missing headers\n");
384
            error_report("virtio-net ctrl missing headers");
385 385
            exit(1);
386 386
        }
387 387

  
388 388
        if (elem.out_sg[0].iov_len < sizeof(ctrl) ||
389 389
            elem.in_sg[elem.in_num - 1].iov_len < sizeof(status)) {
390
            fprintf(stderr, "virtio-net ctrl header not in correct element\n");
390
            error_report("virtio-net ctrl header not in correct element");
391 391
            exit(1);
392 392
        }
393 393

  
......
591 591
        if (virtqueue_pop(n->rx_vq, &elem) == 0) {
592 592
            if (i == 0)
593 593
                return -1;
594
            fprintf(stderr, "virtio-net unexpected empty queue: "
594
            error_report("virtio-net unexpected empty queue: "
595 595
                    "i %zd mergeable %d offset %zd, size %zd, "
596
                    "guest hdr len %zd, host hdr len %zd guest features 0x%x\n",
596
                    "guest hdr len %zd, host hdr len %zd guest features 0x%x",
597 597
                    i, n->mergeable_rx_bufs, offset, size,
598 598
                    guest_hdr_len, host_hdr_len, n->vdev.guest_features);
599 599
            exit(1);
600 600
        }
601 601

  
602 602
        if (elem.in_num < 1) {
603
            fprintf(stderr, "virtio-net receive queue contains no in buffers\n");
603
            error_report("virtio-net receive queue contains no in buffers");
604 604
            exit(1);
605 605
        }
606 606

  
607 607
        if (!n->mergeable_rx_bufs && elem.in_sg[0].iov_len != guest_hdr_len) {
608
            fprintf(stderr, "virtio-net header not in first element\n");
608
            error_report("virtio-net header not in first element");
609 609
            exit(1);
610 610
        }
611 611

  
......
630 630
         * Otherwise, drop it. */
631 631
        if (!n->mergeable_rx_bufs && offset < size) {
632 632
#if 0
633
            fprintf(stderr, "virtio-net truncated non-mergeable packet: "
634

  
635
                    "i %zd mergeable %d offset %zd, size %zd, "
636
                    "guest hdr len %zd, host hdr len %zd\n",
637
                    i, n->mergeable_rx_bufs,
638
                    offset, size, guest_hdr_len, host_hdr_len);
633
            error_report("virtio-net truncated non-mergeable packet: "
634
                         "i %zd mergeable %d offset %zd, size %zd, "
635
                         "guest hdr len %zd, host hdr len %zd",
636
                         i, n->mergeable_rx_bufs,
637
                         offset, size, guest_hdr_len, host_hdr_len);
639 638
#endif
640 639
            return size;
641 640
        }
......
695 694
            sizeof(struct virtio_net_hdr);
696 695

  
697 696
        if (out_num < 1 || out_sg->iov_len != hdr_len) {
698
            fprintf(stderr, "virtio-net header not in first element\n");
697
            error_report("virtio-net header not in first element");
699 698
            exit(1);
700 699
        }
701 700

  
......
981 980
    n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);
982 981

  
983 982
    if (net->tx && strcmp(net->tx, "timer") && strcmp(net->tx, "bh")) {
984
        fprintf(stderr, "virtio-net: "
985
                "Unknown option tx=%s, valid options: \"timer\" \"bh\"\n",
986
                net->tx);
987
        fprintf(stderr, "Defaulting to \"bh\"\n");
983
        error_report("virtio-net: "
984
                     "Unknown option tx=%s, valid options: \"timer\" \"bh\"",
985
                     net->tx);
986
        error_report("Defaulting to \"bh\"");
988 987
    }
989 988

  
990 989
    if (net->tx && !strcmp(net->tx, "timer")) {

Also available in: Unified diff