rtl8139: Remove ineffective parameter
PATCH 1/1 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.
--- hw/net/rtl8139.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
hw/net/rtl8139.c +8 -16
@@ -815,7 +815,8 @@ static bool rtl8139_can_receive(NetClientState *nc)return avail ==0 || avail >=1514 || (s->IntrMask & RxOverflow); } -static ssize_t rtl8139_do_receive (NetClientState *nc,const uint8_t *buf,size_t size_,int do_interrupt) +static ssize_t rtl8139_receive (NetClientState *nc, +const uint8_t *buf,size_t size_) {RTL8139State *s =qemu_get_nic_opaque (nc);PCIDevice *d =PCI_DEVICE (s);
@@ -1173,20 +1174,11 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t } s->IntrStatus |= RxOK; - -if (do_interrupt) - { -rtl8139_update_irq (s); - } +rtl8139_update_irq (s);return size_; } -static ssize_t rtl8139_receive (NetClientState *nc,const uint8_t *buf,size_t size) -{ -return rtl8139_do_receive (nc, buf, size,1 ); -} -static void rtl8139_reset_rxring (RTL8139State *s,uint32_t bufferSize) { s->RxBufferSize = bufferSize;
@@ -1745,7 +1737,7 @@ static uint32_t rtl8139_RxConfig_read(RTL8139State *s) }static void rtl8139_transfer_frame (RTL8139State *s,uint8_t *buf,int size, -int do_interrupt,const uint8_t *dot1q_buf) +const uint8_t *dot1q_buf) {struct iovec *iov =NULL ;struct iovec vlan_iov[3 ];
@@ -1828,7 +1820,7 @@ static int rtl8139_transmit_one(RTL8139State *s, int descriptor) s->TxStatus[descriptor] |= TxHostOwns; s->TxStatus[descriptor] |= TxStatOK; -rtl8139_transfer_frame (s, txbuffer, txsize,0 ,NULL ); +rtl8139_transfer_frame (s, txbuffer, txsize,NULL );DPRINTF ("+++ transmitted %d bytes from descriptor %d\n" , txsize, descriptor);
@@ -2246,7 +2238,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)DPRINTF ("+++ C+ mode TSO transferring packet size " "%d\n" , tso_send_size);rtl8139_transfer_frame (s, saved_buffer, tso_send_size, -0 , (uint8_t *) dot1q_buffer); + (uint8_t *)dot1q_buffer);/* add transferred count to TCP sequence number */ stl_be_p(&p_tcp_hdr->th_seq,
@@ -2323,8 +2315,8 @@ skip_offload:DPRINTF ("+++ C+ mode transmitting %d bytes packet\n" , saved_size); -rtl8139_transfer_frame (s, saved_buffer, saved_size,1 , - (uint8_t *) dot1q_buffer); +rtl8139_transfer_frame (s, saved_buffer, saved_size, + (uint8_t *)dot1q_buffer);/* restore card space if there was no recursion and reset offset */ if (!s->cplus_txbuffer)
Signature · 1 line
2.41.3
Quoted 8 lines · BALATON Zoltan
The
do_interruptparameter forrtl8139_do_receivewas originally added in commit6cadb320c7to avoid generating interrupt when receiving in loopback mode. Later commit5311fb805achanged 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 thedo_interruptparameter for now to simplify code.
Quoted 4 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/net/rtl8139.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
Quoted 7 lines · BALATON Zoltan
The
do_interruptparameter forrtl8139_do_receivewas originally added in commit6cadb320c7to avoid generating interrupt when receiving in loopback mode. Later commit5311fb805achanged 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 thedo_interruptparameter for now to simplify code.
Ping?
Quoted 80 lines
Signed-off-by BALATON Zoltan <[email protected]>---
hw/net/rtl8139.c| 24 ++++++++----------------1 file changed, 8 insertions(+), 16 deletions(-)hw/net/rtl8139.c +8
-16@@ -815,7 +815,8 @@ static bool rtl8139_can_receive(NetClientState *nc)return avail ==0 || avail >=1514 || (s->IntrMask & RxOverflow); } -static ssize_t rtl8139_do_receive (NetClientState *nc,const uint8_t *buf,size_t size_,int do_interrupt) +static ssize_t rtl8139_receive (NetClientState *nc, +const uint8_t *buf,size_t size_) {RTL8139State *s =qemu_get_nic_opaque (nc);PCIDevice *d =PCI_DEVICE (s);@@ -1173,20 +1174,11 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t } s->IntrStatus |= RxOK; - -if (do_interrupt) - { -rtl8139_update_irq (s); - } +rtl8139_update_irq (s);return size_; } -static ssize_t rtl8139_receive (NetClientState *nc,const uint8_t *buf,size_t size) -{ -return rtl8139_do_receive (nc, buf, size,1 ); -} -static void rtl8139_reset_rxring (RTL8139State *s,uint32_t bufferSize) { s->RxBufferSize = bufferSize;@@ -1745,7 +1737,7 @@ static uint32_t rtl8139_RxConfig_read(RTL8139State *s) }static void rtl8139_transfer_frame (RTL8139State *s,uint8_t *buf,int size, -int do_interrupt,const uint8_t *dot1q_buf) +const uint8_t *dot1q_buf) {struct iovec *iov =NULL ;struct iovec vlan_iov[3 ];@@ -1828,7 +1820,7 @@ static int rtl8139_transmit_one(RTL8139State *s, int descriptor) s->TxStatus[descriptor] |= TxHostOwns; s->TxStatus[descriptor] |= TxStatOK; -rtl8139_transfer_frame (s, txbuffer, txsize,0 ,NULL ); +rtl8139_transfer_frame (s, txbuffer, txsize,NULL );DPRINTF ("+++ transmitted %d bytes from descriptor %d\n" , txsize, descriptor);@@ -2246,7 +2238,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)DPRINTF ("+++ C+ mode TSO transferring packet size " "%d\n" , tso_send_size);rtl8139_transfer_frame (s, saved_buffer, tso_send_size, -0 , (uint8_t *) dot1q_buffer); + (uint8_t *)dot1q_buffer);/* add transferred count to TCP sequence number */ stl_be_p(&p_tcp_hdr->th_seq,@@ -2323,8 +2315,8 @@ skip_offload:DPRINTF ("+++ C+ mode transmitting %d bytes packet\n" , saved_size); -rtl8139_transfer_frame (s, saved_buffer, saved_size,1 , - (uint8_t *) dot1q_buffer); +rtl8139_transfer_frame (s, saved_buffer, saved_size, + (uint8_t *)dot1q_buffer);/* restore card space if there was no recursion and reset offset */ if (!s->cplus_txbuffer)
Quoted 10 lines · BALATON Zoltan
Quoted 7 lines · BALATON Zoltan
The
do_interruptparameter forrtl8139_do_receivewas originally added in commit6cadb320c7to avoid generating interrupt when receiving in loopback mode. Later commit5311fb805achanged 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 thedo_interruptparameter for now to simplify code.Ping?
Jason usually only does 1 pull request per dev cycle, close to soft freeze.
Jason, since this patch is trivial enough, I'll take it via my hw-misc tree for convenience. Please object if you disagree :)
Regards,
Phil.
Quoted 87 lines
Quoted 87 lines
Signed-off-by BALATON Zoltan <[email protected]>---
hw/net/rtl8139.c| 24 ++++++++----------------1 file changed, 8 insertions(+), 16 deletions(-)hw/net/rtl8139.c +2
-1@@ -815,7 +815,8 @@ static bool rtl8139_can_receive(NetClientState *nc) return avail == 0 || avail >= 1514 || (s->IntrMask & RxOverflow); } -static ssize_t rtl8139_do_receive (NetClientState *nc,const uint8_t *buf, size_t size_, int do_interrupt) +static ssize_t rtl8139_receive (NetClientState *nc, + const uint8_t *buf, size_t size_) { RTL8139State *s = qemu_get_nic_opaque(nc);PCIDevice *d =
PCI_DEVICE(s);hw/net/rtl8139.c +0
-0@@ -1173,20 +1174,11 @@ static ssize_trtl8139_do_receive(NetClientState *nc, const
uint8_t*buf,size_t}
s->IntrStatus|= RxOK;
-
- if (do_interrupt)
- {
-rtl8139_update_irq(s);
- }
+rtl8139_update_irq(s);return
size_;
}-static
ssize_trtl8139_receive(NetClientState *nc, const uint8_t *buf, size_t size)hw/net/rtl8139.c +0
-4-{ - return rtl8139_do_receive(nc, buf, size, 1); -} -static void
rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize){
s->RxBufferSize= bufferSize;hw/net/rtl8139.c +1
-1@@ -1745,7 +1737,7 @@ static uint32_t rtl8139_RxConfig_read(RTL8139State *s) }static void rtl8139_transfer_frame (RTL8139State *s,uint8_t *buf,int size, - int do_interrupt, const uint8_t *dot1q_buf) + const uint8_t *dot1q_buf) { struct iovec *iov = NULL;struct iovec vlan_iov[3];
hw/net/rtl8139.c +1
-1@@ -1828,7 +1820,7 @@ static int rtl8139_transmit_one(RTL8139State *s, int descriptor) s->TxStatus[descriptor] |= TxHostOwns; s->TxStatus[descriptor] |= TxStatOK; - rtl8139_transfer_frame(s, txbuffer, txsize, 0, NULL); + rtl8139_transfer_frame(s, txbuffer, txsize, NULL); DPRINTF("+++ transmitted %d bytes from descriptor %d\n", txsize,descriptor);
hw/net/rtl8139.c +0
-0@@ -2246,7 +2238,7 @@ static intrtl8139_cplus_transmit_one (RTL8139State *s)
DPRINTF("+++ C+ mode TSO transferring packet size " "%d\n", tso_send_size); rtl8139_transfer_frame(s,saved_buffer,tso_send_size, - 0, (uint8_t*)dot1q_buffer);
+ (uint8_t*)dot1q_buffer);/* add transferred count to TCP sequence number */ stl_be_p(&p_tcp_hdr->th_seq,
hw/net/rtl8139.c +2
-2@@ -2323,8 +2315,8 @@ skip_offload: DPRINTF("+++ C+ mode transmitting %d bytes packet\n", saved_size); - rtl8139_transfer_frame(s, saved_buffer, saved_size, 1, - (uint8_t *) dot1q_buffer); + rtl8139_transfer_frame(s, saved_buffer, saved_size, + (uint8_t *)dot1q_buffer); /* restore card space if there was no recursion and reset offset */ if (!s->cplus_txbuffer)
Thomas Huth
Reviewed-byQuoted 10 lines · BALATON Zoltan
Quoted 7 lines · BALATON Zoltan
The
do_interruptparameter forrtl8139_do_receivewas originally added in commit6cadb320c7to avoid generating interrupt when receiving in loopback mode. Later commit5311fb805achanged 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 thedo_interruptparameter for now to simplify code.Ping?
... it's not a very complicated patch, so maybe this could also go via qemu-trivial? (now on CC:)
Anyway,
Quoted 85 lines
Quoted 84 lines
Signed-off-by BALATON Zoltan <[email protected]>---
hw/net/rtl8139.c| 24 ++++++++----------------1 file changed, 8 insertions(+), 16 deletions(-)hw/net/rtl8139.c +2
-1@@ -815,7 +815,8 @@ static bool rtl8139_can_receive(NetClientState *nc) return avail == 0 || avail >= 1514 || (s->IntrMask & RxOverflow); } -static ssize_t rtl8139_do_receive (NetClientState *nc,const uint8_t *buf, size_t size_, int do_interrupt) +static ssize_t rtl8139_receive(NetClientState *nc, + const uint8_t *buf, size_t size_) { RTL8139State *s = qemu_get_nic_opaque(nc);PCIDevice *d =
PCI_DEVICE(s);hw/net/rtl8139.c +1
-10@@ -1173,20 +1174,11 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t } s->IntrStatus |= RxOK; - - if (do_interrupt) - { - rtl8139_update_irq(s); - } + rtl8139_update_irq(s); return size_; } -static ssize_t rtl8139_receive (NetClientState *nc,const uint8_t *buf, size_t size) -{ - return rtl8139_do_receive(nc, buf, size, 1); -} -static void rtl8139_reset_rxring (RTL8139State *s,uint32_t bufferSize){
s->RxBufferSize= bufferSize;hw/net/rtl8139.c +2
-2@@ -1745,7 +1737,7 @@ static uint32_t rtl8139_RxConfig_read(RTL8139State *s) }static void rtl8139_transfer_frame (RTL8139State *s,uint8_t *buf,int size, - int do_interrupt, const uint8_t *dot1q_buf) + const uint8_t *dot1q_buf) { struct iovec *iov = NULL; struct iovec vlan_iov[3];@@ -1828,7 +1820,7 @@ static int rtl8139_transmit_one(RTL8139State *s, int descriptor) s->TxStatus[descriptor] |= TxHostOwns; s->TxStatus[descriptor] |= TxStatOK; - rtl8139_transfer_frame(s, txbuffer, txsize, 0, NULL); + rtl8139_transfer_frame(s, txbuffer, txsize, NULL); DPRINTF("+++ transmitted %d bytes from descriptor %d\n", txsize,descriptor);
hw/net/rtl8139.c +0
-0@@ -2246,7 +2238,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
DPRINTF("+++ C+ mode TSO transferring packet size " "%d\n", tso_send_size); rtl8139_transfer_frame(s,saved_buffer,tso_send_size, - 0, (uint8_t*)dot1q_buffer);
+ (uint8_t*)dot1q_buffer);/* add transferred count to TCP sequence number */ stl_be_p(&p_tcp_hdr->th_seq,
hw/net/rtl8139.c +2
-2@@ -2323,8 +2315,8 @@ skip_offload: DPRINTF("+++ C+ mode transmitting %d bytes packet\n", saved_size); - rtl8139_transfer_frame(s, saved_buffer, saved_size, 1, - (uint8_t *) dot1q_buffer); + rtl8139_transfer_frame(s, saved_buffer, saved_size, + (uint8_t *)dot1q_buffer); /* restore card space if there was no recursion and reset offset */ if (!s->cplus_txbuffer)
Quoted 10 lines · Thomas Huth
Quoted 9 lines · BALATON Zoltan
Quoted 7 lines · BALATON Zoltan
The
do_interruptparameter forrtl8139_do_receivewas originally added in commit6cadb320c7to avoid generating interrupt when receiving in loopback mode. Later commit5311fb805achanged 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 thedo_interruptparameter for now to simplify code.
Quoted 6 lines
Quoted 1 line
Ping?
... it's not a very complicated patch, so maybe this could also go via qemu-trivial? (now on CC:)
Anyway,
Reviewed-by Thomas Huth <[email protected]>
Thanks but too late, Philippe already took it via his hw misc pull request.
Regards,
BALATON Zoltan
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 9 lines · BALATON Zoltan
Quoted 7 lines · BALATON Zoltan
The
do_interruptparameter forrtl8139_do_receivewas originally added in commit6cadb320c7to avoid generating interrupt when receiving in loopback mode. Later commit5311fb805achanged 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 thedo_interruptparameter for now to simplify code.
Quoted 7 lines
Quoted 1 line
Ping?
Jason usually only does 1 pull request per dev cycle, close to soft freeze.
Jason, since this patch is trivial enough, I'll take it via my hw-misc tree for convenience. Please object if you disagree :)
Feel free to do that.
Thanks
Quoted 97 lines
Regards,
Phil.
Quoted 91 lines
Quoted 91 lines
Signed-off-by BALATON Zoltan <[email protected]>---
hw/net/rtl8139.c| 24 ++++++++----------------1 file changed, 8 insertions(+), 16 deletions(-)hw/net/rtl8139.c +2
-1@@ -815,7 +815,8 @@ static bool rtl8139_can_receive(NetClientState *nc)return avail ==0 || avail >=1514 || (s->IntrMask & RxOverflow); } -static ssize_t rtl8139_do_receive (NetClientState *nc,const uint8_t *buf, size_t size_, int do_interrupt) +static ssize_t rtl8139_receive (NetClientState *nc, +const uint8_t *buf,size_t size_) {RTL8139State *s =qemu_get_nic_opaque (nc);PCIDevice *d = PCI_DEVICE(s);hw/net/rtl8139.c +0
-0@@ -1173,20 +1174,11 @@ static ssize_trtl8139_do_receive(NetClientState *nc, const
uint8_t*buf,size_t} s->IntrStatus |= RxOK;hw/net/rtl8139.c +1
-5- -if (do_interrupt) - { -rtl8139_update_irq (s); - } +rtl8139_update_irq (s);return size_;}
-static
ssize_trtl8139_receive(NetClientState *nc, const uint8_t *buf, size_t size)hw/net/rtl8139.c +0
-4-{ -return rtl8139_do_receive (nc, buf, size,1 ); -} -static void
rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize){ s->RxBufferSize = bufferSize;hw/net/rtl8139.c +0
-0@@ -1745,7 +1737,7 @@ static uint32_t rtl8139_RxConfig_read(RTL8139State *s) }static void rtl8139_transfer_frame(RTL8139State *s,
uint8_t*buf, int size,hw/net/rtl8139.c +1
-1- int do_interrupt, const uint8_t *dot1q_buf) + const uint8_t *dot1q_buf){ struct iovec *iov = NULL; struct iovec vlan_iov[3];hw/net/rtl8139.c +1
-1@@ -1828,7 +1820,7 @@ static int rtl8139_transmit_one(RTL8139State *s, int descriptor) s->TxStatus[descriptor] |= TxHostOwns; s->TxStatus[descriptor] |= TxStatOK; -rtl8139_transfer_frame (s, txbuffer, txsize,0 ,NULL ); +rtl8139_transfer_frame (s, txbuffer, txsize,NULL ); DPRINTF("+++ transmitted %d bytes from descriptor %d\n", txsize,descriptor);hw/net/rtl8139.c +1
-1@@ -2246,7 +2238,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)DPRINTF ("+++ C+ mode TSO transferring packet size " "%d\n" , tso_send_size);rtl8139_transfer_frame (s, saved_buffer, tso_send_size, -0 , (uint8_t *) dot1q_buffer); + (uint8_t *)dot1q_buffer);/* add transferred count to TCP sequence number */ stl_be_p(&p_tcp_hdr->th_seq,hw/net/rtl8139.c +2
-2@@ -2323,8 +2315,8 @@ skip_offload:DPRINTF ("+++ C+ mode transmitting %d bytes packet\n" , saved_size); -rtl8139_transfer_frame (s, saved_buffer, saved_size,1 , - (uint8_t *) dot1q_buffer); +rtl8139_transfer_frame (s, saved_buffer, saved_size, + (uint8_t *)dot1q_buffer);/* restore card space if there was no recursion and reset offset */
if (!s->cplus_txbuffer)