struct NetPacket {
QTAILQ_ENTRY(NetPacket) entry;
VLANClientState *sender;
+ unsigned flags;
int size;
NetPacketSent *sent_cb;
uint8_t data[0];
static ssize_t qemu_net_queue_append(NetQueue *queue,
VLANClientState *sender,
+ unsigned flags,
const uint8_t *buf,
size_t size,
NetPacketSent *sent_cb)
packet = qemu_malloc(sizeof(NetPacket) + size);
packet->sender = sender;
+ packet->flags = flags;
packet->size = size;
packet->sent_cb = sent_cb;
memcpy(packet->data, buf, size);
static ssize_t qemu_net_queue_append_iov(NetQueue *queue,
VLANClientState *sender,
+ unsigned flags,
const struct iovec *iov,
int iovcnt,
NetPacketSent *sent_cb)
packet = qemu_malloc(sizeof(NetPacket) + max_len);
packet->sender = sender;
packet->sent_cb = sent_cb;
+ packet->flags = flags;
packet->size = 0;
for (i = 0; i < iovcnt; i++) {
static ssize_t qemu_net_queue_deliver(NetQueue *queue,
VLANClientState *sender,
+ unsigned flags,
const uint8_t *data,
size_t size)
{
ssize_t ret = -1;
queue->delivering = 1;
- ret = queue->deliver(sender, data, size, queue->opaque);
+ ret = queue->deliver(sender, flags, data, size, queue->opaque);
queue->delivering = 0;
return ret;
static ssize_t qemu_net_queue_deliver_iov(NetQueue *queue,
VLANClientState *sender,
+ unsigned flags,
const struct iovec *iov,
int iovcnt)
{
ssize_t ret = -1;
queue->delivering = 1;
- ret = queue->deliver_iov(sender, iov, iovcnt, queue->opaque);
+ ret = queue->deliver_iov(sender, flags, iov, iovcnt, queue->opaque);
queue->delivering = 0;
return ret;
ssize_t qemu_net_queue_send(NetQueue *queue,
VLANClientState *sender,
+ unsigned flags,
const uint8_t *data,
size_t size,
NetPacketSent *sent_cb)
ssize_t ret;
if (queue->delivering) {
- return qemu_net_queue_append(queue, sender, data, size, NULL);
+ return qemu_net_queue_append(queue, sender, flags, data, size, NULL);
}
- ret = qemu_net_queue_deliver(queue, sender, data, size);
+ ret = qemu_net_queue_deliver(queue, sender, flags, data, size);
if (ret == 0 && sent_cb != NULL) {
- qemu_net_queue_append(queue, sender, data, size, sent_cb);
+ qemu_net_queue_append(queue, sender, flags, data, size, sent_cb);
return 0;
}
ssize_t qemu_net_queue_send_iov(NetQueue *queue,
VLANClientState *sender,
+ unsigned flags,
const struct iovec *iov,
int iovcnt,
NetPacketSent *sent_cb)
ssize_t ret;
if (queue->delivering) {
- return qemu_net_queue_append_iov(queue, sender, iov, iovcnt, NULL);
+ return qemu_net_queue_append_iov(queue, sender, flags, iov, iovcnt, NULL);
}
- ret = qemu_net_queue_deliver_iov(queue, sender, iov, iovcnt);
+ ret = qemu_net_queue_deliver_iov(queue, sender, flags, iov, iovcnt);
if (ret == 0 && sent_cb != NULL) {
- qemu_net_queue_append_iov(queue, sender, iov, iovcnt, sent_cb);
+ qemu_net_queue_append_iov(queue, sender, flags, iov, iovcnt, sent_cb);
return 0;
}
ret = qemu_net_queue_deliver(queue,
packet->sender,
+ packet->flags,
packet->data,
packet->size);
if (ret == 0 && packet->sent_cb != NULL) {
}
static ssize_t qemu_deliver_packet(VLANClientState *sender,
+ unsigned flags,
const uint8_t *data,
size_t size,
void *opaque);
static ssize_t qemu_deliver_packet_iov(VLANClientState *sender,
+ unsigned flags,
const struct iovec *iov,
int iovcnt,
void *opaque);
}
static ssize_t qemu_deliver_packet(VLANClientState *sender,
+ unsigned flags,
const uint8_t *data,
size_t size,
void *opaque)
}
static ssize_t qemu_vlan_deliver_packet(VLANClientState *sender,
+ unsigned flags,
const uint8_t *buf,
size_t size,
void *opaque)
queue = sender->vlan->send_queue;
}
- return qemu_net_queue_send(queue, sender, buf, size, sent_cb);
+ return qemu_net_queue_send(queue, sender,
+ QEMU_NET_PACKET_FLAG_NONE,
+ buf, size, sent_cb);
}
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size)
}
static ssize_t qemu_deliver_packet_iov(VLANClientState *sender,
+ unsigned flags,
const struct iovec *iov,
int iovcnt,
void *opaque)
}
static ssize_t qemu_vlan_deliver_packet_iov(VLANClientState *sender,
+ unsigned flags,
const struct iovec *iov,
int iovcnt,
void *opaque)
queue = sender->vlan->send_queue;
}
- return qemu_net_queue_send_iov(queue, sender, iov, iovcnt, sent_cb);
+ return qemu_net_queue_send_iov(queue, sender,
+ QEMU_NET_PACKET_FLAG_NONE,
+ iov, iovcnt, sent_cb);
}
ssize_t