Skip to content

Commit

Permalink
virtq: don't allow splitting contigous buffers to multiple descriptors
Browse files Browse the repository at this point in the history
Remove the functionality in prep_transfer_from_raw for splitting a single buffer into multiple descriptors, as it does not have an advantage and complicates the method quite a bit.
  • Loading branch information
cagatay-y committed May 22, 2024
1 parent 34ff76d commit dba2213
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 490 deletions.
15 changes: 4 additions & 11 deletions src/drivers/fs/virtio_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::drivers::virtio::transport::mmio::{ComCfg, IsrStatus, NotifCfg};
use crate::drivers::virtio::transport::pci::{ComCfg, IsrStatus, NotifCfg};
use crate::drivers::virtio::virtqueue::error::VirtqError;
use crate::drivers::virtio::virtqueue::split::SplitVq;
use crate::drivers::virtio::virtqueue::{AsSliceU8, BuffSpec, Bytes, Virtq, VqIndex, VqSize};
use crate::drivers::virtio::virtqueue::{AsSliceU8, BufferType, Virtq, VqIndex, VqSize};
use crate::fs::fuse::{self, FuseInterface};

/// A wrapper struct for the raw configuration structure.
Expand Down Expand Up @@ -146,18 +146,11 @@ impl FuseInterface for VirtioFsDriver {
cmd: &fuse::Cmd<O>,
rsp: &mut fuse::Rsp<O>,
) -> Result<(), VirtqError> {
let send = (
cmd.as_slice_u8(),
BuffSpec::Single(Bytes::new(cmd.len()).ok_or(VirtqError::BufferToLarge)?),
);
let rsp_len = rsp.len();
let recv = (
rsp.as_slice_u8_mut(),
BuffSpec::Single(Bytes::new(rsp_len).ok_or(VirtqError::BufferToLarge)?),
);
let send = cmd.as_slice_u8();
let recv = rsp.as_slice_u8_mut();
let transfer_tkn = self.vqueues[1]
.clone()
.prep_transfer_from_raw(Some(send), Some(recv))
.prep_transfer_from_raw(Some(send), Some(recv), BufferType::Direct)
.unwrap();
transfer_tkn.dispatch_blocking()?;
Ok(())
Expand Down
Loading

0 comments on commit dba2213

Please sign in to comment.