mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 21:55:20 +00:00
virtio-devices: net: Refactor 'handle_tx_event'
This patch moves out the actual processing on the TX queue from the `handle_tx_event()` function into a separate function, e.g. `process_tx()`. This allows us to resume the TX queue processing without reading from the TX queue EventFd, which is needed for rate limiting support. No functional change. Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
ee871278ee
commit
bfa37f89c4
@ -101,11 +101,7 @@ impl NetEpollHandler {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_tx_event(&mut self) -> result::Result<(), DeviceError> {
|
||||
let queue_evt = &self.queue_evt_pair[1];
|
||||
if let Err(e) = queue_evt.read() {
|
||||
error!("Failed to get tx queue event: {:?}", e);
|
||||
}
|
||||
fn process_tx(&mut self) -> result::Result<(), DeviceError> {
|
||||
if self
|
||||
.net
|
||||
.process_tx(&mut self.queue_pair[1])
|
||||
@ -120,6 +116,17 @@ impl NetEpollHandler {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_tx_event(&mut self) -> result::Result<(), DeviceError> {
|
||||
let queue_evt = &self.queue_evt_pair[1];
|
||||
if let Err(e) = queue_evt.read() {
|
||||
error!("Failed to get tx queue event: {:?}", e);
|
||||
}
|
||||
|
||||
self.process_tx()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_rx_tap_event(&mut self) -> result::Result<(), DeviceError> {
|
||||
if self
|
||||
.net
|
||||
|
Loading…
Reference in New Issue
Block a user