qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] net: cadence_gem: clear RX control descriptor
@ 2019-06-15  5:17 Ramon Fried
  2019-07-16  7:11 ` Ramon Fried
  2019-07-16  8:42 ` Jason Wang
  0 siblings, 2 replies; 6+ messages in thread
From: Ramon Fried @ 2019-06-15  5:17 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Peter Maydell, Jason Wang, Alistair Francis,
	open list:Xilinx Zynq, Ramon Fried, Edgar E. Iglesias

The RX ring descriptors control field is used for setting
SOF and EOF (start of frame and end of frame).
The SOF and EOF weren't cleared from the previous descriptors,
causing inconsistencies in ring buffer.
Fix that by clearing the control field of every descriptors we're
processing.

Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
---
 hw/net/cadence_gem.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index ecee22525c..d83a82bdb0 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -406,6 +406,11 @@ static inline void rx_desc_set_sof(uint32_t *desc)
     desc[1] |= DESC_1_RX_SOF;
 }
 
+static inline void rx_desc_clear(uint32_t *desc)
+{
+    desc[1]  = 0;
+}
+
 static inline void rx_desc_set_eof(uint32_t *desc)
 {
     desc[1] |= DESC_1_RX_EOF;
@@ -994,6 +999,8 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)
         bytes_to_copy -= MIN(bytes_to_copy, rxbufsize);
 
         /* Update the descriptor.  */
+        rx_desc_clear(s->rx_desc[q]);
+
         if (first_desc) {
             rx_desc_set_sof(s->rx_desc[q]);
             first_desc = false;
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-07-16 11:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-15  5:17 [Qemu-devel] [PATCH] net: cadence_gem: clear RX control descriptor Ramon Fried
2019-07-16  7:11 ` Ramon Fried
2019-07-16  7:19   ` Philippe Mathieu-Daudé
2019-07-16 11:01     ` Ramon Fried
2019-07-16  8:42 ` Jason Wang
2019-07-16 11:01   ` Ramon Fried

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).