Net patches
[Qemu-devel] [PULL 1/4] MAINTAINERS: Stefan will not maintain net subsystem
In reply to Stefan HajnocziFrom: Jason Wang <[email protected]>
Talked with Stefan, he will not maintain net subsystem.
Message-id: [email protected]
--- MAINTAINERS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
MAINTAINERS +1 -2
@@ -955,11 +955,10 @@ F: hmp-commands.hx T: git git://repo.or.cz/qemu/qmp-unstable.git queue/qmp Network device layer -M: Stefan Hajnoczi <[email protected]> M: Jason Wang <[email protected]> S: Maintained F: net/ -T: git git://github.com/stefanha/qemu.git net +T: git git://github.com/jasowang/qemu.git net Netmap network backend M: Luigi Rizzo <[email protected]>
Signature · 1 line
2.4.3
The following changes since commit 619622424dba749feef752d76d79ef2569f7f250:
Merge remote-tracking branch 'remotes/berrange/tags/vnc-crypto-v9-for-upstream' into staging (2015-09-15 15:42:58 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.git tags/net-pull-request
for you to fetch changes up to 271a234a2359975101396916f37f3c7d347c61b8:
net: smc91c111: flush packets on RCR register changes (2015-09-17 12:36:03 +0100)
----------------------------------------------------------------
----------------------------------------------------------------
Jason Wang (1):
MAINTAINERS: Stefan will not maintain net subsystem
Peter Crosthwaite (3):
net: smc91c111: guard flush_queued_packets() on can_rx()
net: smc91c111: gate can_receive() on rx FIFO having a slot
net: smc91c111: flush packets on RCR register changes
MAINTAINERS | 3 +-- hw/net/smc91c111.c | 33 +++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-)
Signature · 1 line
2.4.3
[Qemu-devel] [PULL 4/4] net: smc91c111: flush packets on RCR register changes
From: Peter Crosthwaite <[email protected]>
The SOFT_RST or RXEN in the control register can be used as a condition to unblock the net layer via can_receive(). So check for possible flushes on RCR changes. This will drop all pending packets on soft reset or disable which is the functional intent of the can_receive() logic.
Message-id: b114d4c96f4afbdaa15f1361d9c07e3021755915.1441873621.git.crosthwaite.peter@gmail.com
--- hw/net/smc91c111.c | 1 + 1 file changed, 1 insertion(+)
hw/net/smc91c111.c +1 -0
@@ -331,6 +331,7 @@ static void smc91c111_writeb(void *opaque, hwaddr offset,if (s->rcr &RCR_SOFT_RST ) {smc91c111_reset (DEVICE (s)); } +smc91c111_flush_queued_packets (s);return ;case 10 :case 11 :/* RPCR */ /* Ignored */
Signature · 1 line
2.4.3
[Qemu-devel] [PULL 2/4] net: smc91c111: guard flush_queued_packets() on can_rx()
In reply to Stefan HajnocziFrom: Peter Crosthwaite <[email protected]>
Check that the core can once again receive packets before asking the net layer to do a flush. This will make it more convenient to flush packets when adding new conditions to can_receive.
Add missing if braces while moving the can_receive() core code.
Message-id: 92e15e12a6964274f4bc0eb71b61a7d94326f6c6.1441873621.git.crosthwaite.peter@gmail.com
--- hw/net/smc91c111.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
hw/net/smc91c111.c +22 -8
@@ -124,6 +124,24 @@ static void smc91c111_update(smc91c111_state *s)qemu_set_irq (s->irq, level); } +static int smc91c111_can_receive (smc91c111_state *s) +{ +if ((s->rcr &RCR_RXEN ) ==0 || (s->rcr &RCR_SOFT_RST )) { +return 1 ; + } +if (s->allocated == (1 <<NUM_PACKETS ) -1 ) { +return 0 ; + } +return 1 ; +} + +static inline void smc91c111_flush_queued_packets (smc91c111_state *s) +{ +if (smc91c111_can_receive (s)) { +qemu_flush_queued_packets (qemu_get_queue (s->nic)); + } +} +/* Try to allocate a packet. Returns 0x80 on failure. */ static int smc91c111_allocate_packet (smc91c111_state *s) {
@@ -185,7 +203,7 @@ static void smc91c111_release_packet(smc91c111_state *s, int packet) s->allocated &= ~(1 << packet);if (s->tx_alloc ==0x80 )smc91c111_tx_alloc (s); -qemu_flush_queued_packets (qemu_get_queue (s->nic)); +smc91c111_flush_queued_packets (s); }/* Flush the TX FIFO. */
@@ -636,15 +654,11 @@ static uint32_t smc91c111_readl(void *opaque, hwaddr offset)return val; } -static int smc91c111_can_receive (NetClientState *nc) +static int smc91c111_can_receive_nc (NetClientState *nc) {smc91c111_state *s =qemu_get_nic_opaque (nc); -if ((s->rcr &RCR_RXEN ) ==0 || (s->rcr &RCR_SOFT_RST )) -return 1 ; -if (s->allocated == (1 <<NUM_PACKETS ) -1 ) -return 0 ; -return 1 ; +return smc91c111_can_receive (s); }static ssize_t smc91c111_receive (NetClientState *nc,const uint8_t *buf,size_t size)
@@ -739,7 +753,7 @@ static const MemoryRegionOps smc91c111_mem_ops = {static NetClientInfo net_smc91c111_info = { .type =NET_CLIENT_OPTIONS_KIND_NIC , .size =sizeof (NICState), - .can_receive = smc91c111_can_receive, + .can_receive = smc91c111_can_receive_nc, .receive = smc91c111_receive, };
Signature · 1 line
2.4.3
[Qemu-devel] [PULL 3/4] net: smc91c111: gate can_receive() on rx FIFO having a slot
In reply to Stefan HajnocziFrom: Peter Crosthwaite <[email protected]>
Return false from can_receive() when the FIFO doesn't have a free RX slot. This fixes a bug in the current code where the allocated buffer is freed before the fifo pop, triggering a premature flush of queued RX packets. It also will handle a corner case, where the guest manually frees the allocated buffer before popping the rx FIFO (hence it is not enough to just delay the flush_queued_packets()).
Message-id: 97bfdfc5cbce0bd5e0cbbbff35ce7a1bf6f8603d.1441873621.git.crosthwaite.peter@gmail.com
--- hw/net/smc91c111.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/net/smc91c111.c +3 -1
@@ -129,7 +129,8 @@ static int smc91c111_can_receive(smc91c111_state *s)if ((s->rcr &RCR_RXEN ) ==0 || (s->rcr &RCR_SOFT_RST )) {return 1 ; } -if (s->allocated == (1 <<NUM_PACKETS ) -1 ) { +if (s->allocated == (1 <<NUM_PACKETS ) -1 || + s->rx_fifo_len ==NUM_PACKETS ) {return 0 ; }return 1 ;
@@ -182,6 +183,7 @@ static void smc91c111_pop_rx_fifo(smc91c111_state *s) }else { s->int_level &= ~INT_RCV ; } +smc91c111_flush_queued_packets (s);smc91c111_update (s); }
Signature · 1 line
2.4.3
Peter Maydell
AppliedQuoted 8 lines · Stefan Hajnoczi
The following changes since commit
619622424dba749feef752d76d79ef2569f7f250:Merge remote-tracking branch 'remotes/berrange/tags/vnc-crypto-v9-for-upstream' into staging (2015-09-15 15:42:58 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/net-pull-request
Quoted 7 lines
for you to fetch changes up to
271a234a2359975101396916f37f3c7d347c61b8:net: smc91c111: flush packets on RCR register changes (2015-09-17 12:36:03 +0100)
----------------------------------------------------------------
----------------------------------------------------------------
Applied, thanks.
-- PMM