diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-10 18:05:55 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-10 18:08:35 -0500 |
commit | f8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc (patch) | |
tree | c67bf81b0bfa6b897f4fb7a236962a85819e15f7 /net.h | |
parent | b319820d4099ec6b98c9c260e06d519fc41d544c (diff) | |
parent | 4ffb17f5c3244e405198ae285ffbb20a62e0d4b3 (diff) |
Merge branch 'net-queue'
* net-queue: (28 commits)
virtio-net: Increase filter and control limits
virtio-net: Add new RX filter controls
virtio-net: MAC filter optimization
virtio-net: Fix MAC filter overflow handling
virtio-net: reorganize receive_filter()
virtio-net: Use a byte to store RX mode flags
virtio-net: Add version_id 7 placeholder for vnet header support
virtio-net: implement rx packet queueing
net: make use of async packet sending API in tap client
net: add qemu_send_packet_async()
net: split out packet queueing and flushing into separate functions
net: return status from qemu_deliver_packet()
net: add return value to packet receive handler
net: pass VLANClientState* as first arg to receive handlers
net: re-name vc->fd_read() to vc->receive()
net: add fd_readv() handler to qemu_new_vlan_client() args
net: only read from tapfd when we can send
net: vlan clients with no fd_can_read() can always receive
net: move the tap buffer into TAPState
net: factor tap_read_packet() out of tap_send()
...
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net.h')
-rw-r--r-- | net.h | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -5,19 +5,20 @@ /* VLANs support */ -typedef ssize_t (IOReadvHandler)(void *, const struct iovec *, int); - typedef struct VLANClientState VLANClientState; +typedef int (NetCanReceive)(VLANClientState *); +typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t); +typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int); typedef void (NetCleanup) (VLANClientState *); typedef void (LinkStatusChanged)(VLANClientState *); struct VLANClientState { - IOReadHandler *fd_read; - IOReadvHandler *fd_readv; + NetReceive *receive; + NetReceiveIOV *receive_iov; /* Packets may still be sent if this returns zero. It's used to rate-limit the slirp code. */ - IOCanRWHandler *fd_can_read; + NetCanReceive *can_receive; NetCleanup *cleanup; LinkStatusChanged *link_status_changed; int link_down; @@ -31,10 +32,13 @@ struct VLANClientState { typedef struct VLANPacket VLANPacket; +typedef void (NetPacketSent) (VLANClientState *); + struct VLANPacket { struct VLANPacket *next; VLANClientState *sender; int size; + NetPacketSent *sent_cb; uint8_t data[0]; }; @@ -51,8 +55,9 @@ VLANState *qemu_find_vlan(int id); VLANClientState *qemu_new_vlan_client(VLANState *vlan, const char *model, const char *name, - IOReadHandler *fd_read, - IOCanRWHandler *fd_can_read, + NetCanReceive *can_receive, + NetReceive *receive, + NetReceiveIOV *receive_iov, NetCleanup *cleanup, void *opaque); void qemu_del_vlan_client(VLANClientState *vc); @@ -60,7 +65,12 @@ VLANClientState *qemu_find_vlan_client(VLANState *vlan, void *opaque); int qemu_can_send_packet(VLANClientState *vc); ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov, int iovcnt); +ssize_t qemu_sendv_packet_async(VLANClientState *vc, const struct iovec *iov, + int iovcnt, NetPacketSent *sent_cb); void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size); +ssize_t qemu_send_packet_async(VLANClientState *vc, const uint8_t *buf, + int size, NetPacketSent *sent_cb); +void qemu_flush_queued_packets(VLANClientState *vc); void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]); void qemu_check_nic_model(NICInfo *nd, const char *model); void qemu_check_nic_model_list(NICInfo *nd, const char * const *models, @@ -108,7 +118,7 @@ uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto, void net_checksum_calculate(uint8_t *data, int length); /* from net.c */ -int net_client_init(const char *device, const char *p); +int net_client_init(Monitor *mon, const char *device, const char *p); void net_client_uninit(NICInfo *nd); int net_client_parse(const char *str); void net_slirp_smb(const char *exported_dir); @@ -129,8 +139,9 @@ void net_host_device_remove(Monitor *mon, int vlan_id, const char *device); void qdev_get_macaddr(DeviceState *dev, uint8_t *macaddr); VLANClientState *qdev_get_vlan_client(DeviceState *dev, - IOReadHandler *fd_read, - IOCanRWHandler *fd_can_read, + NetCanReceive *can_receive, + NetReceive *receive, + NetReceiveIOV *receive_iov, NetCleanup *cleanup, void *opaque); |