mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
stream: Add flow control API
Add basic flow control to stream. A stream slave may return short, indicating that it is not capable of accepting any more data at the present time. Polling or a callback can be used via the can_push() function to determine when the slave can receive again. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
This commit is contained in:
parent
210914e299
commit
35e60bfdbc
4 changed files with 48 additions and 9 deletions
|
@ -815,7 +815,7 @@ static void eth_cleanup(NetClientState *nc)
|
|||
g_free(s);
|
||||
}
|
||||
|
||||
static void
|
||||
static size_t
|
||||
xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size,
|
||||
uint32_t *hdr)
|
||||
{
|
||||
|
@ -824,13 +824,13 @@ xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size,
|
|||
|
||||
/* TX enable ? */
|
||||
if (!(s->tc & TC_TX)) {
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Jumbo or vlan sizes ? */
|
||||
if (!(s->tc & TC_JUM)) {
|
||||
if (size > 1518 && size <= 1522 && !(s->tc & TC_VLAN)) {
|
||||
return;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -858,6 +858,8 @@ xilinx_axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size,
|
|||
s->stats.tx_bytes += size;
|
||||
s->regs[R_IS] |= IS_TX_COMPLETE;
|
||||
enet_update_irq(s);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static NetClientInfo net_xilinx_enet_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue