Skip to content

Commit 6afc248

Browse files
committed
refactor(queue): remove mem from pop_or_enable_notification method
`mem` parameter was not used for anything. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 0c25f6b commit 6afc248

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/vmm/src/devices/virtio/block/virtio/device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ impl VirtioBlock {
411411
let queue = &mut self.queues[queue_index];
412412
let mut used_any = false;
413413

414-
while let Some(head) = queue.pop_or_enable_notification(mem) {
414+
while let Some(head) = queue.pop_or_enable_notification() {
415415
self.metrics.remaining_reqs_count.add(queue.len().into());
416416
let processing_result = match Request::parse(&head, mem, self.disk.nsectors) {
417417
Ok(request) => {

src/vmm/src/devices/virtio/net/device.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl Net {
389389
let mem = self.device_state.mem().unwrap();
390390

391391
let queue = &mut self.queues[RX_INDEX];
392-
let head_descriptor = queue.pop_or_enable_notification(mem).ok_or_else(|| {
392+
let head_descriptor = queue.pop_or_enable_notification().ok_or_else(|| {
393393
self.metrics.no_rx_avail_buffer.inc();
394394
FrontendError::EmptyQueue
395395
})?;
@@ -594,7 +594,7 @@ impl Net {
594594
let mut used_any = false;
595595
let tx_queue = &mut self.queues[TX_INDEX];
596596

597-
while let Some(head) = tx_queue.pop_or_enable_notification(mem) {
597+
while let Some(head) = tx_queue.pop_or_enable_notification() {
598598
self.metrics
599599
.tx_remaining_reqs_count
600600
.add(tx_queue.len().into());

src/vmm/src/devices/virtio/queue.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,7 @@ impl Queue {
527527

528528
/// Try to pop the first available descriptor chain from the avail ring.
529529
/// If no descriptor is available, enable notifications.
530-
pub fn pop_or_enable_notification<M: GuestMemory>(
531-
&mut self,
532-
_mem: &M,
533-
) -> Option<DescriptorChain> {
530+
pub fn pop_or_enable_notification(&mut self) -> Option<DescriptorChain> {
534531
if !self.uses_notif_suppression {
535532
return self.pop();
536533
}
@@ -1363,7 +1360,7 @@ mod tests {
13631360

13641361
// Walk the last chain again (three descriptors) using pop_or_enable_notification().
13651362
let d = q
1366-
.pop_or_enable_notification(m)
1363+
.pop_or_enable_notification()
13671364
.unwrap()
13681365
.next_descriptor()
13691366
.unwrap()
@@ -1375,13 +1372,13 @@ mod tests {
13751372
// There are no more descriptors, but notification suppression is disabled.
13761373
// Calling pop_or_enable_notification() should simply return None.
13771374
assert_eq!(q.avail_event(m), 0);
1378-
assert!(q.pop_or_enable_notification(m).is_none());
1375+
assert!(q.pop_or_enable_notification().is_none());
13791376
assert_eq!(q.avail_event(m), 0);
13801377

13811378
// There are no more descriptors and notification suppression is enabled. Calling
13821379
// pop_or_enable_notification() should enable notifications.
13831380
q.enable_notif_suppression();
1384-
assert!(q.pop_or_enable_notification(m).is_none());
1381+
assert!(q.pop_or_enable_notification().is_none());
13851382
assert_eq!(q.avail_event(m), 2);
13861383
}
13871384

@@ -1458,7 +1455,7 @@ mod tests {
14581455
// driver sets available index to suspicious value.
14591456
vq.avail.idx.set(6);
14601457

1461-
q.pop_or_enable_notification(m);
1458+
q.pop_or_enable_notification();
14621459
}
14631460

14641461
#[test]

0 commit comments

Comments
 (0)