Loading...
Searching...
No Matches
L4virtio::Svr::Request_processor Class Reference

Encapsulate the state for processing a VIRTIO request. More...

`#include <virtio>`

Inheritance diagram for L4virtio::Svr::Request_processor:
Collaboration diagram for L4virtio::Svr::Request_processor:

## Public Member Functions

template<typename DESC_MAN, typename ... ARGS>
void | start (DESC_MAN *dm, Virtqueue *ring, Virtqueue::Head_desc const &request, ARGS... args)
| Start processing a new request.
template<typename DESC_MAN, typename ... ARGS>
Virtqueue::Request const & | start (DESC_MAN *dm, Virtqueue::Request const &request, ARGS... args)
| Start processing a new request.
Virtqueue::Desc::Flags | current_flags () const
| Get the flags of the currently processed descriptor.
bool | has_more () const
| Are there more chained descriptors?
template<typename DESC_MAN, typename ... ARGS>
bool | next (DESC_MAN *dm, ARGS... args)
| Switch to the next descriptor in a descriptor chain.

## Detailed Description

Encapsulate the state for processing a VIRTIO request.

A VIRTIO request is a possibly chained list of descriptors retrieved from the available ring of a virtqueue, using Virtqueue::next_avail().

The descriptor processing depends on helper (DESC_MAN) for interpreting the descriptors in the context of the device implementation.

DESC_MAN has to provide the functionality to safely dereference a descriptor from a descriptor list.

The following methods must be provided by DESC_MAN:

- DESC_MAN::load_desc(Virtqueue::Desc const &desc,
  Request_processor const *proc,
  Virtqueue::Desc const **table)
  L4virtio::Svr::Request_processor
  Encapsulate the state for processing a VIRTIO request.
  Definition virtio:473
  L4virtio::Virtqueue::Desc
  Descriptor in the descriptor table.
  Definition virtqueue:87
  This function is used to dereference desc as an indirect descriptor table, and must return a pointer to an indirect descriptor table.
- DESC_MAN::load_desc(Virtqueue::Desc const &desc,
  Request_processor const *proc, ...)
  This function is used to dereference a descriptor as a normal data buffer, and '...' are the arguments that are passed to start() and next().

Definition at line 472 of file virtio.

## Member Function Documentation

## current_flags()

Virtqueue::Desc::Flags L4virtio::Svr::Request_processor::current_flags | ( |  | ) | const

inline

Get the flags of the currently processed descriptor.

Returns
  The flags of the currently processed descriptor.

Definition at line 545 of file virtio.

Referenced by L4virtio::Svr::Virtio_gpio< Request_handler, Epiface >::Request_processor::get_request().

Here is the caller graph for this function:

## has_more()

bool L4virtio::Svr::Request_processor::has_more | ( |  | ) | const

inline

Are there more chained descriptors?

Returns
  true if there are more chained descriptors in the current request.

Definition at line 553 of file virtio.

Referenced by L4virtio::Svr::Block_request< Ds_data >::data_size().

Here is the caller graph for this function:

## next()

template<typename DESC_MAN, typename ... ARGS>

bool L4virtio::Svr::Request_processor::next | ( | DESC_MAN * | dm,
|  | ARGS... | args )

inline

Switch to the next descriptor in a descriptor chain.

Template Parameters

  DESC_MAN | Type of descriptor manager (implicit).

Parameters

  dm | Descriptor manager that is used to translate VIRTIO descriptor addresses.
  args | Extra arguments passed to dm->load_desc()

Return values

  true | A next descriptor is available.
  false | No descriptor available.

Exceptions

  Bad_descriptor | The next index of this descriptor is invalid.

Definition at line 570 of file virtio.

References cxx::access_once(), L4virtio::Svr::Bad_descriptor::Bad_flags, L4virtio::Svr::Bad_descriptor::Bad_next, and L4_UNLIKELY.

Referenced by L4virtio::Svr::Block_request< Ds_data >::data_size(), L4virtio::Svr::Virtio_gpio< Request_handler, Epiface >::Request_processor::get_request(), L4virtio::Svr::Virtio_i2c< Request_handler, Epiface >::Request_processor::get_request(), L4virtio::Svr::Console::Device::port_read(), and L4virtio::Svr::Console::Device::port_write().

Here is the call graph for this function:
Here is the caller graph for this function:

## start() [1/2]

template<typename DESC_MAN, typename ... ARGS>

void L4virtio::Svr::Request_processor::start | ( | DESC_MAN * | dm,
|  | Virtqueue * | ring,
|  | Virtqueue::Head_desc const & | request,
|  | ARGS... | args )

inline

Start processing a new request.

Template Parameters

  DESC_MAN | Type of descriptor manager (implicit).

Parameters

  dm | Descriptor manager that is used to translate VIRTIO descriptor addresses.
  ring | VIRTIO ring of the request.
  request | VIRTIO request from Virtqueue::next_avail()
  args | Extra arguments passed to dm->load_desc()

Precondition
  The given request must be valid.

Exceptions

  Bad_descriptor | The descriptor has an invalid size or load_desc() has thrown an exception by itself.

Definition at line 501 of file virtio.

References cxx::access_once(), L4virtio::Svr::Bad_descriptor::Bad_size, L4virtio::Svr::Virtqueue::desc(), L4virtio::Svr::Virtqueue::Head_desc::desc(), L4_UNLIKELY, and L4virtio::Virtqueue::num().

Referenced by L4virtio::Svr::Block_request< Ds_data >::data_size(), Virtio_net_request::drop_requests(), L4virtio::Svr::Console::Virtio_con::handle_control_message(), L4virtio::Svr::Console::Device::port_read(), L4virtio::Svr::Console::Device::port_write(), L4virtio::Svr::Console::Virtio_con::send_control_message(), and start().

Here is the call graph for this function:
Here is the caller graph for this function:

## start() [2/2]

template<typename DESC_MAN, typename ... ARGS>

Virtqueue::Request const & L4virtio::Svr::Request_processor::start | ( | DESC_MAN * | dm,
|  | Virtqueue::Request const & | request,
|  | ARGS... | args )

inline

Start processing a new request.

Template Parameters

  DESC_MAN | Type of descriptor manager (implicit).

Parameters

  dm | Descriptor manager that is used to translate VIRTIO descriptor addresses.
  request | VIRTIO request from Virtqueue::next_avail()
  args | Extra arguments passed to dm->load_desc()

Precondition
  The given request must be valid.

Definition at line 534 of file virtio.

References start().

Here is the call graph for this function:

The documentation for this class was generated from the following file:

- l4/l4virtio/server/virtio