modus
Menu
On this page

The entry network

Per-endpoint isolated receive queue helpers for network_service (contract-level helpers wired with owner-bound register/dequeue/unregister).

network module with an entry

Hash
a877c518b235b29058890f9414093645fc083f45b096475a0f1885264eb30132
Size
90112 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

Per-endpoint isolated receive queue helpers for network_service (contract-level helpers wired with owner-bound register/dequeue/unregister)

FactValue
KindModules with an entry
Sourcesrc/modules/system/network
Boot imageyes: in the boot image, 90112 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()The entry of the network service: it attaches to the frame service of the device, then moves frames and datagrams for the life of the machine

entry

entry()

The entry of the network service: it attaches to the frame service of the device, then moves frames and datagrams for the life of the machine.

The entry, in order:

  1. 1. opens the frame ring and the control ring of the root service; with no ring, it stops (fail);
  2. 2. creates the frame region, contiguous because the device reads and writes it, and gives it to the frame service with Attach;
  3. 3. reads the hardware address and the state of the link, and posts the places for the frames that arrive;
  4. 4. writes "network: ok, the address 10.0.2.15/24 ...", then measures the headers of IPv4 and Ethernet of one frame 20000 times and writes the cost of one.

Then one loop runs for ever. Each pass takes the frames that arrived and the frames that left, the new endpoints of the control ring, and the commands of each endpoint while its completion queue has room. A command that has no room waits in the endpoint, so a process that reads no completion slows only itself. The loop then wakes the rings that changed, and waits for a record or for the deadline of the oldest request that waits for an answer (an ARP request, an echo).

The stop of the frame service. This service holds the frame service with the right Read, so its stop is an event. At the start, at that stop or when the frame service does not answer a command in system.ANSWER_BOUND_MILLISECONDS, and in the loop at that stop, it writes "network: the frame service stopped: ..." (or the command that had no answer) and stops with Failed. The root service then refuses each process that needs an endpoint.

See: A missing or silent part of the machine in the repository

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

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
GrantsIt is the one client of the frame service of the network device, and it receives from this service the endpoint of each process with the grant Network.
Other terms of its start grant setnone
Budget that it asks for
  • the least budget
No MODULE_BUDGET in its source: it asks for the least budget.

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; 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).