net: re-name vc->fd_read() to vc->receive()

VLANClientState's fd_read() handler doesn't read from file
descriptors, it adds a buffer to the client's receive queue.

Re-name the handlers to make things a little less confusing.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
This commit is contained in:
Mark McLoughlin 2009-05-18 13:13:16 +01:00
parent 463af5349a
commit cda9046ba7
20 changed files with 57 additions and 56 deletions

View file

@ -409,7 +409,7 @@ static void do_transmit_packets(dp8393xState *s)
s->regs[SONIC_TCR] |= SONIC_TCR_CRSL;
if (s->vc->fd_can_read(s)) {
s->loopback_packet = 1;
s->vc->fd_read(s, s->tx_buffer, tx_len);
s->vc->receive(s, s->tx_buffer, tx_len);
}
} else {
/* Transmit packet */
@ -725,7 +725,7 @@ static int receive_filter(dp8393xState *s, const uint8_t * buf, int size)
return -1;
}
static void nic_receive(void *opaque, const uint8_t * buf, int size)
static void nic_receive(void *opaque, const uint8_t * buf, size_t size)
{
uint16_t data[10];
dp8393xState *s = opaque;

View file

@ -600,7 +600,7 @@ e1000_can_receive(void *opaque)
}
static void
e1000_receive(void *opaque, const uint8_t *buf, int size)
e1000_receive(void *opaque, const uint8_t *buf, size_t size)
{
E1000State *s = opaque;
struct e1000_rx_desc desc;
@ -614,8 +614,8 @@ e1000_receive(void *opaque, const uint8_t *buf, int size)
return;
if (size > s->rxbuf_size) {
DBGOUT(RX, "packet too large for buffers (%d > %d)\n", size,
s->rxbuf_size);
DBGOUT(RX, "packet too large for buffers (%lu > %d)\n",
(unsigned long)size, s->rxbuf_size);
return;
}

View file

@ -1441,7 +1441,7 @@ static int nic_can_receive(void *opaque)
//~ return !eepro100_buffer_full(s);
}
static void nic_receive(void *opaque, const uint8_t * buf, int size)
static void nic_receive(void *opaque, const uint8_t * buf, size_t size)
{
/* TODO:
* - Magic packets should set bit 30 in power management driver register.

View file

@ -501,7 +501,7 @@ static int eth_can_receive(void *opaque)
return 1;
}
static void eth_receive(void *opaque, const uint8_t *buf, int size)
static void eth_receive(void *opaque, const uint8_t *buf, size_t size)
{
unsigned char sa_bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
struct fs_eth *eth = opaque;

View file

@ -353,7 +353,7 @@ static int mcf_fec_can_receive(void *opaque)
return s->rx_enabled;
}
static void mcf_fec_receive(void *opaque, const uint8_t *buf, int size)
static void mcf_fec_receive(void *opaque, const uint8_t *buf, size_t size)
{
mcf_fec_state *s = (mcf_fec_state *)opaque;
mcf_fec_bd bd;

View file

@ -75,7 +75,7 @@ static int mipsnet_can_receive(void *opaque)
return !mipsnet_buffer_full(s);
}
static void mipsnet_receive(void *opaque, const uint8_t *buf, int size)
static void mipsnet_receive(void *opaque, const uint8_t *buf, size_t size)
{
MIPSnetState *s = opaque;

View file

@ -562,7 +562,7 @@ static int eth_can_receive(void *opaque)
return 1;
}
static void eth_receive(void *opaque, const uint8_t *buf, int size)
static void eth_receive(void *opaque, const uint8_t *buf, size_t size)
{
mv88w8618_eth_state *s = opaque;
uint32_t desc_addr;

View file

@ -224,7 +224,7 @@ static int ne2000_can_receive(void *opaque)
#define MIN_BUF_SIZE 60
static void ne2000_receive(void *opaque, const uint8_t *buf, int size)
static void ne2000_receive(void *opaque, const uint8_t *buf, size_t size)
{
NE2000State *s = opaque;
uint8_t *p;

View file

@ -1076,7 +1076,7 @@ static int pcnet_can_receive(void *opaque)
#define MIN_BUF_SIZE 60
static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
static void pcnet_receive(void *opaque, const uint8_t *buf, size_t size)
{
PCNetState *s = opaque;
int is_padr = 0, is_bcast = 0, is_ladr = 0;

View file

@ -258,16 +258,16 @@ void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin)
}
VLANClientState *qdev_get_vlan_client(DeviceState *dev,
IOCanRWHandler *fd_can_read,
IOReadHandler *fd_read,
IOReadvHandler *fd_readv,
NetCanReceive *can_receive,
NetReceive *receive,
NetReceiveIOV *receive_iov,
NetCleanup *cleanup,
void *opaque)
{
NICInfo *nd = dev->nd;
assert(nd);
return qemu_new_vlan_client(nd->vlan, nd->model, nd->name, fd_can_read,
fd_read, fd_readv, cleanup, opaque);
return qemu_new_vlan_client(nd->vlan, nd->model, nd->name, can_receive,
receive, receive_iov, cleanup, opaque);
}

View file

@ -1158,7 +1158,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
}
}
static void rtl8139_receive(void *opaque, const uint8_t *buf, int size)
static void rtl8139_receive(void *opaque, const uint8_t *buf, size_t size)
{
rtl8139_do_receive(opaque, buf, size, 1);
}

View file

@ -602,7 +602,7 @@ static int smc91c111_can_receive(void *opaque)
return 1;
}
static void smc91c111_receive(void *opaque, const uint8_t *buf, int size)
static void smc91c111_receive(void *opaque, const uint8_t *buf, size_t size)
{
smc91c111_state *s = (smc91c111_state *)opaque;
int status;

View file

@ -78,7 +78,7 @@ static void stellaris_enet_update(stellaris_enet_state *s)
}
/* TODO: Implement MAC address filtering. */
static void stellaris_enet_receive(void *opaque, const uint8_t *buf, int size)
static void stellaris_enet_receive(void *opaque, const uint8_t *buf, size_t size)
{
stellaris_enet_state *s = (stellaris_enet_state *)opaque;
int n;

View file

@ -1369,7 +1369,7 @@ static int usb_net_handle_data(USBDevice *dev, USBPacket *p)
return ret;
}
static void usbnet_receive(void *opaque, const uint8_t *buf, int size)
static void usbnet_receive(void *opaque, const uint8_t *buf, size_t size)
{
USBNetState *s = opaque;
struct rndis_packet_msg_type *msg;

View file

@ -361,7 +361,7 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)
return 0;
}
static void virtio_net_receive(void *opaque, const uint8_t *buf, int size)
static void virtio_net_receive(void *opaque, const uint8_t *buf, size_t size)
{
VirtIONet *n = opaque;
struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL;

View file

@ -243,7 +243,7 @@ static int net_rx_ok(void *opaque)
return 1;
}
static void net_rx_packet(void *opaque, const uint8_t *buf, int size)
static void net_rx_packet(void *opaque, const uint8_t *buf, size_t size)
{
struct XenNetDev *netdev = opaque;
netif_rx_request_t rxreq;
@ -262,8 +262,8 @@ static void net_rx_packet(void *opaque, const uint8_t *buf, int size)
return;
}
if (size > XC_PAGE_SIZE - NET_IP_ALIGN) {
xen_be_printf(&netdev->xendev, 0, "packet too big (%d > %ld)",
size, XC_PAGE_SIZE - NET_IP_ALIGN);
xen_be_printf(&netdev->xendev, 0, "packet too big (%lu > %ld)",
(unsigned long)size, XC_PAGE_SIZE - NET_IP_ALIGN);
return;
}