net: add receive_disabled logic to iov delivery path
This patch adds the missing NetClient->receive_disabled logic in the
sendv delivery code path.  It seems that commit
893379efd0e1b84ceb0c42a713293f3dbd27b1bd ("net: disable receiving if
client returns zero") only added the logic to qemu_deliver_packet() and
not qemu_deliver_packet_iov().
The receive_disabled flag should be automatically set when .receive(),
.receive_raw(), or .receive_iov() return 0.  No further packets will be
delivered to the NetClient until the receive_disabled flag is cleared
again by calling qemu_flush_queued_packets().
Typically the NetClient will wait until its file descriptor becomes
writable and then invoke qemu_flush_queued_packets() to resume
transmission.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
			
			
This commit is contained in:
		
							parent
							
								
									1069985fb1
								
							
						
					
					
						commit
						c67f5dc105
					
				
							
								
								
									
										19
									
								
								net.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								net.c
									
									
									
									
									
								
							@ -423,16 +423,27 @@ ssize_t qemu_deliver_packet_iov(NetClientState *sender,
 | 
				
			|||||||
                                void *opaque)
 | 
					                                void *opaque)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetClientState *nc = opaque;
 | 
					    NetClientState *nc = opaque;
 | 
				
			||||||
 | 
					    int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (nc->link_down) {
 | 
					    if (nc->link_down) {
 | 
				
			||||||
        return iov_size(iov, iovcnt);
 | 
					        return iov_size(iov, iovcnt);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (nc->info->receive_iov) {
 | 
					    if (nc->receive_disabled) {
 | 
				
			||||||
        return nc->info->receive_iov(nc, iov, iovcnt);
 | 
					        return 0;
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        return nc_sendv_compat(nc, iov, iovcnt);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (nc->info->receive_iov) {
 | 
				
			||||||
 | 
					        ret = nc->info->receive_iov(nc, iov, iovcnt);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        ret = nc_sendv_compat(nc, iov, iovcnt);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (ret == 0) {
 | 
				
			||||||
 | 
					        nc->receive_disabled = 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t qemu_sendv_packet_async(NetClientState *sender,
 | 
					ssize_t qemu_sendv_packet_async(NetClientState *sender,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user