pub trait TransferDescriptorHandler {
// Required method
fn handle_transfer_descriptor(
&self,
descriptor: Vec<AddressedTrb>,
complete_event: Event
) -> Result<()>;
// Provided method
fn stop(&self) -> bool { ... }
}
Expand description
TransferDescriptorHandler handles transfer descriptor. User should implement this trait and build a ring buffer controller with the struct.
Required Methods§
sourcefn handle_transfer_descriptor(
&self,
descriptor: Vec<AddressedTrb>,
complete_event: Event
) -> Result<()>
fn handle_transfer_descriptor( &self, descriptor: Vec<AddressedTrb>, complete_event: Event ) -> Result<()>
Process descriptor asynchronously, write complete_event when done.
Provided Methods§
sourcefn stop(&self) -> bool
fn stop(&self) -> bool
Stop is called when trying to stop ring buffer controller. Returns true when stop must be
performed asynchronously. This happens because the handler is handling some descriptor
asynchronously, the stop callback of ring buffer controller must be called after the
async
part is handled or canceled. If the TransferDescriptorHandler decide it could stop
immediately, it could return false.
For example, if a handler submitted a transfer but the transfer has not yet finished. Then
guest kernel requests to stop the ring buffer controller. Transfer descriptor handler will
return true, thus RingBufferController would transfer to Stopping state. It will be stopped
when all pending transfer completed.
On the other hand, if hander does not have any pending transfers, it would return false.