mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 07:21:15 +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 {
|
if result < 0 {
|
||||||
let e = std::io::Error::last_os_error();
|
let e = std::io::Error::last_os_error();
|
||||||
error!("net: tx: failed writing to tap: {}", e);
|
|
||||||
queue.go_to_previous_position();
|
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));
|
return Err(NetQueuePairError::WriteTap(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,10 +185,9 @@ impl RxVirtio {
|
|||||||
exhausted_descs = false;
|
exhausted_descs = false;
|
||||||
queue.go_to_previous_position();
|
queue.go_to_previous_position();
|
||||||
|
|
||||||
if let Some(raw_err) = e.raw_os_error() {
|
/* EAGAIN */
|
||||||
if raw_err == libc::EAGAIN {
|
if e.kind() == std::io::ErrorKind::WouldBlock {
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
error!("net: rx: failed reading from tap: {}", e);
|
error!("net: rx: failed reading from tap: {}", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user