mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 13:05:45 +00:00
net_util: queue_pair: Handle tap write returning EAGAIN/EWOULDBLOCK
If the tap file descriptor is not writable then try again later. Update the RX side to match the test on std::io::ErrorKind::WouldBlock Fixes: #2517 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
fd72612e91
commit
5784285894
@ -92,8 +92,14 @@ impl TxVirtio {
|
||||
};
|
||||
if result < 0 {
|
||||
let e = std::io::Error::last_os_error();
|
||||
error!("net: tx: failed writing to tap: {}", e);
|
||||
queue.go_to_previous_position();
|
||||
|
||||
/* EAGAIN */
|
||||
if e.kind() == std::io::ErrorKind::WouldBlock {
|
||||
warn!("net: tx: (recoverable) failed writing to tap: {}", e);
|
||||
break;
|
||||
}
|
||||
error!("net: tx: failed writing to tap: {}", e);
|
||||
return Err(NetQueuePairError::WriteTap(e));
|
||||
}
|
||||
|
||||
@ -179,11 +185,10 @@ impl RxVirtio {
|
||||
exhausted_descs = false;
|
||||
queue.go_to_previous_position();
|
||||
|
||||
if let Some(raw_err) = e.raw_os_error() {
|
||||
if raw_err == libc::EAGAIN {
|
||||
/* EAGAIN */
|
||||
if e.kind() == std::io::ErrorKind::WouldBlock {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
error!("net: rx: failed reading from tap: {}", e);
|
||||
return Err(NetQueuePairError::ReadTap(e));
|
||||
|
Loading…
Reference in New Issue
Block a user