Skip to contentSkip to conversation

pcnet: switch to use qemu_receive_packet() for loopback

PATCH In review Alexander Bulekov 3 participants 5 messages Mar 1, 2021 – Mar 9, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 pcnet: switch to use qemu_receive_packet() for loopback

This patch switches to use qemu_receive_packet() which can detect reentrancy and return early.

---

Here's another one, that looks like the same issue. -Alex

 hw/net/pcnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/pcnet.c +1 -1
index f3f18d8598..dcd3fc4948 100644
@@ -1250,7 +1250,7 @@ txagain:
             if (BCR_SWSTYLE(s) == 1)
                 add_crc = !GET_FIELD(tmd.status, TMDS, NOFCS);
             s->looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC;
-            pcnet_receive(qemu_get_queue(s->nic), s->buffer, s->xmit_pos);
+            qemu_receive_packet(qemu_get_queue(s->nic), s->buffer, s->xmit_pos);
             s->looptest = 0;
         } else {
             if (s->nic) {
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#2 lore raw
Quoted 5 lines · Alexander Bulekov

This patch switches to use qemu_receive_packet() which can detect reentrancy and return early.

Quoted 7 lines

---

Here's another one, that looks like the same issue. -Alex

 hw/net/pcnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw

PATCH 1/1 cadence_gem: switch to use qemu_receive_packet() for loopback

In reply to a message not in the archive

This patch switches to use qemu_receive_packet() which can detect reentrancy and return early.

---
 hw/net/cadence_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/cadence_gem.c +1 -1
index 9a4474a084..1c576a130c 100644
@@ -1275,7 +1275,7 @@ static void gem_transmit(CadenceGEMState *s)
                 /* Send the packet somewhere */
                 if (s->phy_loop || (s->regs[GEM_NWCTRL] &
                                     GEM_NWCTRL_LOCALLOOP)) {
-                    gem_receive(qemu_get_queue(s->nic), s->tx_packet,
+                    qemu_receive_packet(qemu_get_queue(s->nic), s->tx_packet,
                                 total_bytes);
                 } else {
                     qemu_send_packet(qemu_get_queue(s->nic), s->tx_packet,
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#4 lore raw

Re: [PATCH] cadence_gem: switch to use qemu_receive_packet() for loopback

Quoted 5 lines · Alexander Bulekov

This patch switches to use qemu_receive_packet() which can detect reentrancy and return early.

Alistair

Quoted 21 lines
---
 hw/net/cadence_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/cadence_gem.c +1 -2
index 9a4474a084..1c576a130c 100644
@@ -1275,7 +1275,7 @@ static void gem_transmit(CadenceGEMState *s)
                 /* Send the packet somewhere */
                 if (s->phy_loop || (s->regs[GEM_NWCTRL] &
                                     GEM_NWCTRL_LOCALLOOP)) {
-                    gem_receive(qemu_get_queue(s->nic), s->tx_packet,
+                    qemu_receive_packet(qemu_get_queue(s->nic), s->tx_packet,
                                 total_bytes);
                 } else {
                     qemu_send_packet(qemu_get_queue(s->nic), s->tx_packet,
--

2.28.0

#5 lore raw

PATCH 1/1 lan9118: switch to use qemu_receive_packet() for loopback

In reply to a message not in the archive

This patch switches to use qemu_receive_packet() which can detect reentrancy and return early.

---

I think this is the last one that directly calls its own receive function to do loopback (or the last one within my grepping capapbilities).
-Alex

 hw/net/lan9118.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/lan9118.c +1 -1
index abc796285a..6aff424cbe 100644
@@ -680,7 +680,7 @@ static void do_tx_packet(lan9118_state *s)
     /* FIXME: Honor TX disable, and allow queueing of packets.  */
     if (s->phy_control & 0x4000)  {
         /* This assumes the receive routine doesn't touch the VLANClient.  */
-        lan9118_receive(qemu_get_queue(s->nic), s->txp->data, s->txp->len);
+        qemu_receive_packet(qemu_get_queue(s->nic), s->txp->data, s->txp->len);
     } else {
         qemu_send_packet(qemu_get_queue(s->nic), s->txp->data, s->txp->len);
     }
Signature · 1 line
2.28.0