virtio-net.c (ec7a9bd5bb2c46c60cc0ec9b9d9f2ce404226ec0) virtio-net.c (97cd965c070152bc626c7507df9fb356bbe1cd81)
1/*
2 * Virtio Network Device
3 *
4 * Copyright IBM, Corp. 2007
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

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

1125 return 1;
1126 }
1127 }
1128 }
1129
1130 return 0;
1131}
1132
1/*
2 * Virtio Network Device
3 *
4 * Copyright IBM, Corp. 2007
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

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

1125 return 1;
1126 }
1127 }
1128 }
1129
1130 return 0;
1131}
1132
1133static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t size)
1133static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
1134 size_t size)
1134{
1135 VirtIONet *n = qemu_get_nic_opaque(nc);
1136 VirtIONetQueue *q = virtio_net_get_subqueue(nc);
1137 VirtIODevice *vdev = VIRTIO_DEVICE(n);
1138 struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
1139 struct virtio_net_hdr_mrg_rxbuf mhdr;
1140 unsigned mhdr_cnt = 0;
1141 size_t offset, i, guest_offset;

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

1228 }
1229
1230 virtqueue_flush(q->rx_vq, i);
1231 virtio_notify(vdev, q->rx_vq);
1232
1233 return size;
1234}
1235
1135{
1136 VirtIONet *n = qemu_get_nic_opaque(nc);
1137 VirtIONetQueue *q = virtio_net_get_subqueue(nc);
1138 VirtIODevice *vdev = VIRTIO_DEVICE(n);
1139 struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
1140 struct virtio_net_hdr_mrg_rxbuf mhdr;
1141 unsigned mhdr_cnt = 0;
1142 size_t offset, i, guest_offset;

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

1229 }
1230
1231 virtqueue_flush(q->rx_vq, i);
1232 virtio_notify(vdev, q->rx_vq);
1233
1234 return size;
1235}
1236
1237static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf,
1238 size_t size)
1239{
1240 ssize_t r;
1241
1242 rcu_read_lock();
1243 r = virtio_net_receive_rcu(nc, buf, size);
1244 rcu_read_unlock();
1245 return r;
1246}
1247
1236static int32_t virtio_net_flush_tx(VirtIONetQueue *q);
1237
1238static void virtio_net_tx_complete(NetClientState *nc, ssize_t len)
1239{
1240 VirtIONet *n = qemu_get_nic_opaque(nc);
1241 VirtIONetQueue *q = virtio_net_get_subqueue(nc);
1242 VirtIODevice *vdev = VIRTIO_DEVICE(n);
1243

--- 873 unchanged lines hidden ---
1248static int32_t virtio_net_flush_tx(VirtIONetQueue *q);
1249
1250static void virtio_net_tx_complete(NetClientState *nc, ssize_t len)
1251{
1252 VirtIONet *n = qemu_get_nic_opaque(nc);
1253 VirtIONetQueue *q = virtio_net_get_subqueue(nc);
1254 VirtIODevice *vdev = VIRTIO_DEVICE(n);
1255

--- 873 unchanged lines hidden ---