@samitouri / QOSamiQemu / commits / fa08447317

hw/net/rtl8139: Remove ineffective parameter

The do_interrupt parameter for rtl8139_do_receive was originally added in commit 6cadb320c7 to avoid generating interrupt when receiving in loopback mode. Later commit 5311fb805a changed this so that this parameter became ineffective and now this parameter is unused and always 1. If this turns out to be a problem maybe there's a better way to fix this so remove the do_interrupt parameter for now to simplify code. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260127173849.588F25969F0@zero.eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

BALATON Zoltan committed Jan 27, 2026 at 18:38 UTC fa084473179a17b7baf92d47d7171386bfbd35eb
1 file changed +8 -16
hw/net/rtl8139.c
+8 -16
@@ -815,7 +815,8 @@ static bool rtl8139_can_receive(NetClientState *nc)
815 return avail == 0 || avail >= 1514 || (s->IntrMask & RxOverflow);
816 }
817
818 -static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t size_, int do_interrupt)
818 +static ssize_t rtl8139_receive(NetClientState *nc,
819 + const uint8_t *buf, size_t size_)
820 {
821 RTL8139State *s = qemu_get_nic_opaque(nc);
822 PCIDevice *d = PCI_DEVICE(s);
@@ -1173,20 +1174,11 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
1174 }
1175
1176 s->IntrStatus |= RxOK;
1176 -
1177 - if (do_interrupt)
1178 - {
1179 - rtl8139_update_irq(s);
1180 - }
1177 + rtl8139_update_irq(s);
1178
1179 return size_;
1180 }
1181
1185 -static ssize_t rtl8139_receive(NetClientState *nc, const uint8_t *buf, size_t size)
1186 -{
1187 - return rtl8139_do_receive(nc, buf, size, 1);
1188 -}
1189 -
1182 static void rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize)
1183 {
1184 s->RxBufferSize = bufferSize;
@@ -1745,7 +1737,7 @@ static uint32_t rtl8139_RxConfig_read(RTL8139State *s)
1737 }
1738
1739 static void rtl8139_transfer_frame(RTL8139State *s, uint8_t *buf, int size,
1748 - int do_interrupt, const uint8_t *dot1q_buf)
1740 + const uint8_t *dot1q_buf)
1741 {
1742 struct iovec *iov = NULL;
1743 struct iovec vlan_iov[3];
@@ -1828,7 +1820,7 @@ static int rtl8139_transmit_one(RTL8139State *s, int descriptor)
1820 s->TxStatus[descriptor] |= TxHostOwns;
1821 s->TxStatus[descriptor] |= TxStatOK;
1822
1831 - rtl8139_transfer_frame(s, txbuffer, txsize, 0, NULL);
1823 + rtl8139_transfer_frame(s, txbuffer, txsize, NULL);
1824
1825 DPRINTF("+++ transmitted %d bytes from descriptor %d\n", txsize,
1826 descriptor);
@@ -2246,7 +2238,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
2238 DPRINTF("+++ C+ mode TSO transferring packet size "
2239 "%d\n", tso_send_size);
2240 rtl8139_transfer_frame(s, saved_buffer, tso_send_size,
2249 - 0, (uint8_t *) dot1q_buffer);
2241 + (uint8_t *)dot1q_buffer);
2242
2243 /* add transferred count to TCP sequence number */
2244 stl_be_p(&p_tcp_hdr->th_seq,
@@ -2323,8 +2315,8 @@ skip_offload:
2315
2316 DPRINTF("+++ C+ mode transmitting %d bytes packet\n", saved_size);
2317
2326 - rtl8139_transfer_frame(s, saved_buffer, saved_size, 1,
2327 - (uint8_t *) dot1q_buffer);
2318 + rtl8139_transfer_frame(s, saved_buffer, saved_size,
2319 + (uint8_t *)dot1q_buffer);
2320
2321 /* restore card space if there was no recursion and reset offset */
2322 if (!s->cplus_txbuffer)