mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
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>
This commit is contained in:
commit
f8e76fbf51
26 changed files with 859 additions and 478 deletions
39
hw/rtl8139.c
39
hw/rtl8139.c
|
@ -790,9 +790,9 @@ static inline target_phys_addr_t rtl8139_addr64(uint32_t low, uint32_t high)
|
|||
#endif
|
||||
}
|
||||
|
||||
static int rtl8139_can_receive(void *opaque)
|
||||
static int rtl8139_can_receive(VLANClientState *vc)
|
||||
{
|
||||
RTL8139State *s = opaque;
|
||||
RTL8139State *s = vc->opaque;
|
||||
int avail;
|
||||
|
||||
/* Receive (drop) packets if card is disabled. */
|
||||
|
@ -812,9 +812,10 @@ static int rtl8139_can_receive(void *opaque)
|
|||
}
|
||||
}
|
||||
|
||||
static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int do_interrupt)
|
||||
static ssize_t rtl8139_do_receive(VLANClientState *vc, const uint8_t *buf, size_t size_, int do_interrupt)
|
||||
{
|
||||
RTL8139State *s = opaque;
|
||||
RTL8139State *s = vc->opaque;
|
||||
int size = size_;
|
||||
|
||||
uint32_t packet_header = 0;
|
||||
|
||||
|
@ -828,7 +829,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
if (!s->clock_enabled)
|
||||
{
|
||||
DEBUG_PRINT(("RTL8139: stopped ==========================\n"));
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* first check if receiver is enabled */
|
||||
|
@ -836,7 +837,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
if (!rtl8139_receiver_enabled(s))
|
||||
{
|
||||
DEBUG_PRINT(("RTL8139: receiver disabled ================\n"));
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* XXX: check this */
|
||||
|
@ -854,7 +855,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
/* update tally counter */
|
||||
++s->tally_counters.RxERR;
|
||||
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
|
||||
packet_header |= RxBroadcast;
|
||||
|
@ -873,7 +874,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
/* update tally counter */
|
||||
++s->tally_counters.RxERR;
|
||||
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
|
||||
int mcast_idx = compute_mcast_idx(buf);
|
||||
|
@ -885,7 +886,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
/* update tally counter */
|
||||
++s->tally_counters.RxERR;
|
||||
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
|
||||
packet_header |= RxMulticast;
|
||||
|
@ -909,7 +910,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
/* update tally counter */
|
||||
++s->tally_counters.RxERR;
|
||||
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
|
||||
packet_header |= RxPhysical;
|
||||
|
@ -926,7 +927,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
/* update tally counter */
|
||||
++s->tally_counters.RxERR;
|
||||
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -993,7 +994,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
++s->tally_counters.MissPkt;
|
||||
|
||||
rtl8139_update_irq(s);
|
||||
return;
|
||||
return size_;
|
||||
}
|
||||
|
||||
uint32_t rx_space = rxdw0 & CP_RX_BUFFER_SIZE_MASK;
|
||||
|
@ -1013,7 +1014,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
++s->tally_counters.MissPkt;
|
||||
|
||||
rtl8139_update_irq(s);
|
||||
return;
|
||||
return size_;
|
||||
}
|
||||
|
||||
target_phys_addr_t rx_addr = rtl8139_addr64(rxbufLO, rxbufHI);
|
||||
|
@ -1118,7 +1119,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
s->IntrStatus |= RxOverflow;
|
||||
++s->RxMissed;
|
||||
rtl8139_update_irq(s);
|
||||
return;
|
||||
return size_;
|
||||
}
|
||||
|
||||
packet_header |= RxStatusOK;
|
||||
|
@ -1156,11 +1157,13 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
|||
{
|
||||
rtl8139_update_irq(s);
|
||||
}
|
||||
|
||||
return size_;
|
||||
}
|
||||
|
||||
static void rtl8139_receive(void *opaque, const uint8_t *buf, int size)
|
||||
static ssize_t rtl8139_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
||||
{
|
||||
rtl8139_do_receive(opaque, buf, size, 1);
|
||||
return rtl8139_do_receive(vc, buf, size, 1);
|
||||
}
|
||||
|
||||
static void rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize)
|
||||
|
@ -1758,7 +1761,7 @@ static void rtl8139_transfer_frame(RTL8139State *s, const uint8_t *buf, int size
|
|||
if (TxLoopBack == (s->TxConfig & TxLoopBack))
|
||||
{
|
||||
DEBUG_PRINT(("RTL8139: +++ transmit loopback mode\n"));
|
||||
rtl8139_do_receive(s, buf, size, do_interrupt);
|
||||
rtl8139_do_receive(s->vc, buf, size, do_interrupt);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3479,7 +3482,7 @@ static void pci_rtl8139_init(PCIDevice *dev)
|
|||
qemu_register_reset(rtl8139_reset, 0, s);
|
||||
rtl8139_reset(s);
|
||||
s->vc = qdev_get_vlan_client(&dev->qdev,
|
||||
rtl8139_receive, rtl8139_can_receive,
|
||||
rtl8139_can_receive, rtl8139_receive, NULL,
|
||||
rtl8139_cleanup, s);
|
||||
|
||||
qemu_format_nic_info_str(s->vc, s->macaddr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue