On 8/1/24 23:27, Nabih Estefan wrote:
From: Nabih Estefan Diaz <[email protected]>

- 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 <[email protected]>
Signed-off-by: Nabih Estefan <[email protected]>
Reviewed-by: Tyrone Ting <[email protected]>
---
  hw/net/npcm_gmac.c  | 324 +++++++++++++++++++++++++++++++++++++++++++-
  hw/net/trace-events |   5 +
  2 files changed, 327 insertions(+), 2 deletions(-)

diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c
index 44c4ffaff4..54c8af3b41 100644
--- a/hw/net/npcm_gmac.c
+++ b/hw/net/npcm_gmac.c
@@ -23,7 +23,11 @@
  #include "hw/registerfields.h"
  #include "hw/net/mii.h"
  #include "hw/net/npcm_gmac.h"
+#include "linux/if_ether.h"

Still doesn't build on macOS:

[1215/1649] Compiling C object libcommon.fa.p/hw_net_npcm_gmac.c.o
../../hw/net/npcm_gmac.c:26:10: fatal error: 'linux/if_ether.h' file not found
#include "linux/if_ether.h"
         ^~~~~~~~~~~~~~~~~~
1 error generated.
FAILED: libcommon.fa.p/hw_net_npcm_gmac.c.o

Reply via email to