Skip to contentSkip to conversation

Cadence: gem: fix wraparound in 64bit descriptors

PATCH Applied Ramon Fried 2 participants 2 messages Apr 17, 2020 – Apr 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Cadence: gem: fix wraparound in 64bit descriptors

Wraparound of TX descriptor cyclic buffer only updated the low 32 bits of the descriptor.
Fix that by checking if we're working with 64bit descriptors.

---
v2: Fix indention problem.

 hw/net/cadence_gem.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
hw/net/cadence_gem.c +8 -1
index 51ec5a072d..b7b7985bf2 100644
@@ -1238,7 +1238,14 @@ static void gem_transmit(CadenceGEMState *s)
             /* read next descriptor */
             if (tx_desc_get_wrap(desc)) {
                 tx_desc_set_last(desc);
-                packet_desc_addr = s->regs[GEM_TXQBASE];
+
+                if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) {
+                    packet_desc_addr = s->regs[GEM_TBQPH];
+                    packet_desc_addr <<= 32;
+                } else {
+                    packet_desc_addr = 0;
+                }
+                packet_desc_addr |= s->regs[GEM_TXQBASE];
             } else {
                 packet_desc_addr += 4 * gem_get_desc_len(s, false);
             }
Signature · 1 line
2.26.0
#1 lore raw
Quoted 5 lines · Ramon Fried

Wraparound of TX descriptor cyclic buffer only updated the low 32 bits of the descriptor.
Fix that by checking if we're working with 64bit descriptors.

Quoted 7 lines

---
v2: Fix indention problem.

 hw/net/cadence_gem.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Applied to target-arm.next for 5.1, thanks.

-- PMM