hw/net: GMAC Rx Implementation
commita4dd7a1dad1d3d0ca270a403212ea93c801927db
authorNabih Estefan Diaz <nabihestefan@google.com>
Wed, 31 Jan 2024 00:27:57 +0000 (31 00:27 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 2 Feb 2024 13:51:59 +0000 (2 13:51 +0000)
treeae776225b116b5caf1ebc39c5eaef11f43baed22
parent327b680877b79c4b5473b5d59265194f35a24c6f
hw/net: GMAC Rx Implementation

- Implementation of Receive function for packets
- Implementation for reading and writing from and to descriptors in
  memory for Rx

When RX starts, we need to flush the queued packets so that they
can be received by the GMAC device. Without this it won't work
with TAP NIC device.

When RX descriptor list is full, it returns a DMA_STATUS for
software to handle it. But there's no way to indicate the software has
handled all RX descriptors and the whole pipeline stalls.

We do something similar to NPCM7XX EMC to handle this case.

1. Return packet size when RX descriptor is full, effectively dropping
these packets in such a case.
2. When software clears RX descriptor full bit, continue receiving
further packets by flushing QEMU packet queue.

Added relevant trace-events

Change-Id: I132aa254a94cda1a586aba2ea33bbfc74ecdb831
Signed-off-by: Hao Wu <wuhaotsh@google.com>
Signed-off-by: Nabih Estefan <nabihestefan@google.com>
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Message-id: 20240131002800.989285-5-nabihestefan@google.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/net/npcm_gmac.c
hw/net/trace-events