modus
Menu
On this page

The entry frame

The frame service: the device service of one virtio network device (virtio 1.x over PCI, the "modern" interface). It serves the frame contract (src/library/modus/contract/frame) to one client, through the frame ring that the root service gives to both.

It has one device and nothing else: the registers of the device, one message interrupt, memory for the queues, the machine with the right Physical only, and a copy of the configuration of the device. The root service found the device, enabled it and set its interrupt. The kernel has no code for this device: the code that knows a device is a module: a service or a library. The code of virtio that the block service also uses is in src/library/modus/virtio.

The device reads and writes the frame region of the client, and reads its read regions: the kernel is not on the path of the data, so data moves with no kernel entry. This service does not read a frame: the client builds and checks each one.

What it is for. It shows that a network driver is a process, with no right beyond its one device, and that the frames move with no copy by the kernel: the client holds a frame region, lends it once with Attach, and the device reads and writes it directly.

Who uses it. The root service starts it for the process with the grant Network_Device: the network service, which builds and checks each frame. It gives the frame ring to that one client.

The commands of the frame ring (src/library/modus/contract/frame):

  • Attach: take the frame region of the client.
  • Info: the hardware address, whether the link is up, the most bytes of a frame, and the most Receive and Send in flight.
  • Send: send the frame at a place of the frame region, with a second part from a read region when the client names one; the completion comes when the device read the frame.
  • Receive: give a place of the frame region for the next frame that arrives; the completion comes with the frame.
  • Read_Region_Add, Read_Region_Remove: take, then end, a read region: memory that the device only reads, where the network service lets the device read the data of a datagram in the datagram region of the process that sends it.
  • Statistics: the frames and bytes sent and received, the kernel entries and the interrupts of the service, for a measure.

What a reader sees. No window: the line frame: ok, the hardware address <address>, the link is up, queues of ... on the log, then one line for each read region that it takes. A failure at the start writes a line at the level error and stops the service.

What it does not prove. It drives virtio under QEMU only, and sends no offload. The design of the network is in The network: TCP as a library in the process.

frame module with an entry

Hash
d7e1a735fe98a325d23cbf49857c08986de61ff2c05f277fe345f04d0084f142
Size
49152 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

The frame service: the device service of one virtio network device (virtio 1.x over PCI, the "modern" interface)

FactValue
KindModules with an entry
Sourcesrc/modules/system/frame
Boot imageyes: in the boot image, 49152 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported bynone

Neighbours

It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.

Exports

ExportWhat it does
entry()starts the device and then serves the frame ring, until the machine stops

entry

entry()

entry starts the device and then serves the frame ring, until the machine stops. It finds the virtio registers in the configuration that the root service copied, agrees on the features, gives the device its receive queue and its send queue, and writes frame: ok, .... Its loop completes the frames that the device sent or received, gives the device each new command of the client, and waits for the interrupt of the device or a new command. With no ring, no configuration, or a device that refuses its setup, it writes the reason at the level error and stops with Failed.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/system/frame/main.odin:481

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

What the root service gives it

WhatValueAs the root service says
GrantsThe network device and the ring of its one client (driver_start).
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 179
  • pages of its threads 72
  • pages of the pictures of its window 0
  • pages of the module and its imports from the files of the build
  • processes 1
  • threads 1
The working memory: the rest of the pages that the root service gave it by its name, once the tool counts its module and its thread.

The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).