Skip to content

Working on this

Start here if you have an appliance in front of you, or if you want to work on a family nobody here has hardware for. Both are possible and the second is less obvious.

The one thing to understand first

The kernel modules are not packaged and that is deliberate. They are C against one kernel's headers, OPNsense ships no kernel sources, and a module built against a different kernel in the same branch loads without complaining and then reads structures at the wrong offsets. The loud refusal you would expect does not arrive.

So the modules ship as source, are built on the appliance by its own clang with every warning fatal, and are loaded by hand. build.sh stamps each one with uname -v and install/verify.sh compares the stamp rather than probing. If you change nothing else about how you work here, carry that habit.

With an appliance

sh contrib/npuep/fetch-sources.sh        # pins kernel sources to the running kernel
sh contrib/octep/build.sh                # or contrib/npuep/build.sh for ARMADA
kldload ./octep.ko
sh install/verify.sh

Then read docs/families/octeon-tx-reference.md for the bring-up order. The order matters more than it looks: the endpoint handshake gates the control plane as well as the datapath, so a blank NetAgent window means "do the handshake", not "NetAgent is broken".

After a change to octep's stop or detach, sh contrib/octep/test-detach-refusal.sh on a lab appliance checks that nothing frees memory a receive servicer still uses, and sh contrib/octep/test-stop-writes.sh, with frames arriving, that the coprocessor writes nothing into a ring once it is stopped. After a change to npuep's module event handler, its IPsec interposition or reload.sh, sh contrib/npuep/test-unload-refusal.sh on the lab XGS 136, with a tunnel up through a front port, checks that nothing unloads the driver once an association points into it. After a change to how npuep makes a connection between its sweeps, sh contrib/npuep/test-fast-make.sh on the lab XGS 136 counts what flow.fast_make made and the table's churn, and checks that 0 leaves the making to the sweep; run it under both loads - a new connection for each response, and connections kept open - each with 1 and 0 by turns, and read the failed responses at the load's client, which the script cannot see. RELEASING.md lists what else is checked before a release, and where.

Console speeds differ by what is booted. The host console is 38400 under the vendor firmware and 115200 under OPNsense, on the same port. The coprocessor's own console is the host's third UART at 115200.

Without an appliance

More is possible here than the page count suggests. The vendor ships a fast-path binary per family - ARMADA, OCTEON TX, OCTEON TX2 and TX2 98XX - and they carry full symbols and DWARF. Most of what this project knows about the OCTEON TX control plane came out of one of those rather than out of source. Two families have no hardware here and nobody has done that work.

See docs/families/README.md for what material exists per family.

The copyright in this repository is Abdelmonem Awad's - AUTHORS says so and every source file carries the line - and the licence is BSD-2-Clause, in LICENSE. A licence is permission; it does not move the copyright, and the copyright holder is the one who can change the licence later.

So that this stays so with more than one pair of hands, a contribution is taken on these terms, and sending a pull request is agreeing to them:

  • you wrote it, or have the right to give it;
  • you give the copyright holder a perpetual, irrevocable, royalty-free right to use, change, relicense and distribute it, under this licence or any other, without owing you anything but the credit the licence already requires;
  • you keep your own copyright and every right to use your own work elsewhere.

The reason is the licence itself. It can only be changed by whoever holds the copyright, and a repository with ten contributors and no agreement has ten holders and cannot be relicensed without all of them. tools/add-copyright.py puts the holder's line in every new source file and the checks workflow refuses a file without one.

House rules, and the reasons

  • Claim only what has been run. A page here says what was measured, and says plainly what was not. "Should work" is not a state this project records.
  • Cite the function and the expression, then the file and line. Line numbers move with every kernel update and every SDK drop; a function name and a literal expression do not. A document written on 2026-10-04 cited pf.c:1871 correctly, and the appliance took a kernel update the same day that moved it to 1873 - the content was right and the number was not, and nothing about reading it would have said so. Write it as pf_state_insert(), at LIST_INSERT_HEAD(&ih->states, s, entry) - sys/netpfil/pf/pf.c:1873 in stable/26.7 at 083dc7025377, naming the tree, so the next reader can find it by the expression when the number has moved.
  • Withdraw a wrong claim in the same change that disproves it, and keep the reasoning that led to it. Several pages carry a diagnosis that turned out wrong together with what withdrew it, because deleting the reasoning loses why anyone believed it.
  • No measurement is left out, and none waits. Every figure that was taken goes into the page it bears on, or into the appliance's measurements, in the change that took it - the rows that do not fit the account being written as well as the ones that do: a build on the way to the merged one, one frame dropped in one rekey of nine, a tunnel that went down for a reason nobody looked for. A row taken on a build that turned out to be at fault is published as withdrawn, with why, and not dropped. The same goes for a page: it is written when the work is, not later. And where a figure bears on an issue, open or closed, a comment goes on that issue at the same time. The reason is one day's omissions, all found by being asked: a ten-hour run kept in a private directory, whose "64 downloads, every one cut" turned out on reading to be sixty and four; a day's rows held back for a page whose change was not merged; and a replay drop left out of the page of the very build it happened on. A measurement nobody else can read cannot be checked, and the ones left out are the ones that did not fit.
  • A page says when it was last read. Every page under docs/ opens with <!-- reviewed: YYYY-MM-DD -->; a new page gets the day it was written, and a page read against the tree and found right gets today with tools/docs-index.py --stamp <page>. Then run tools/docs-index.py and commit the docs/INDEX.md it writes - CI holds the catalogue to the pages, and docs/REVIEW.md says how often each kind of page is read again.
  • A null reading is not a result until the instrument is proven. Two separate measurements here were nearly recorded from tools that had silently failed. Grep for something you know is present alongside whatever you are looking for.
  • Never read BAR1 entry 15. It is the GICD window and reading it hangs the appliance hard.
  • Never re-arm the endpoint handshake. It runs once per coprocessor boot.
  • Do not sweep unknown message sub-codes at a live service. A cleanly rejected input is evidence about that input and nothing else; a sweep here took a service down permanently.

House style

The code is written the same way in every file, and that is kept on purpose: it makes the code easier to read here, and it marks every copy as this project's work, whoever made the copy. These are the rules the tree already follows. Old code is not rewritten to them; new code follows them. A CI check that holds new code to them follows in a later release; until then the review reads for them.

  • New names carry the project's prefix. Every function another file can call starts with its driver's name: octep_ in contrib/octep (octep_nwa_port_link()), npu and its part in contrib/npuep (npugiu_port_link(), npuflow_tcp_seg()), fchemmc_ in contrib/fchemmc. The plugin's hooks start with xgs_ (xgs_configure() in src/etc/inc/plugins.inc.d/xgs.inc), its pages, models and API live under OPNsense\XGS, and every file it puts under src/etc carries xgs or the name of its part in its own (rc.syshook.d/early/31-xgs-mgmt-link, 08-octep). A plugin does the same with its own name: os-fanctl's scripts/fanctl/ and OPNsense\FanCtl. A static helper that never leaves its file is not held to it.
  • A log line starts with the component's name. In a driver device_printf() does it (octep0: barmap not written yet (version all ones)), and a line with no device behind it writes the name itself (printf("npuep: assembly '%s' is not in the table; ...")). A script or hook logs under its own tag (/usr/bin/logger -t xgs-carp ... in rc.syshook.d/carp/20-xgs-flows), and the plugin's PHP starts its line with xgs: (syslog(LOG_ERR, 'xgs: ...') in xgs.inc). So one grep for the name finds every line a part of the project wrote.
  • A comment says why, and a number says where it came from. The code says what it does; a comment says why it is so, and what it replaced. A value chosen from a measurement names the page under docs/measurements/ that took it, with the date and the figure: the comment above npugiu_rx_msix in contrib/npuep/npugiu.c follows its default back to docs/measurements/rx-msix-136-2026-10-20.md - 948 Mbit/s into the host on the doorbells against 270 on a 10 ms poll alone. The page goes in with the change. A number nobody can trace is one nobody can change safely.
  • Every source file keeps its header, in the file's own comment style, as at the top of contrib/octep/octep.c: its SPDX line, SPDX-License-Identifier: BSD-2-Clause; its copyright line, Copyright (c) 2026 Abdelmonem Awad; and its origin lines, Origin: os-xgs-npu (https://github.com/AbdelmonemAwad/os-xgs-npu). Any copy, port, translation or rewrite of this file, by any person or tool, must keep these lines and the BSD-2-Clause licence text; removing them infringes the author's copyright. Once a new file is added to git, python3 tools/check-headers.py . --origin --write writes all three into it, and without --write checks every file. CI asks for the first two on every change now, and for the origin lines too once every repository of the family carries them.
  • What is never removed, by a change here or from a copy anywhere: a file's header lines; LICENSE, NOTICE and AUTHORS; the notice at the top of README.md; and the credit line at the foot of every page the plugin adds (views/OPNsense/XGS/credit.volt). The licence asks for the notice, its two conditions and its disclaimer to stay with every copy, port, translation or rewrite, and NOTICE says why. A pull request that drops any of them is not merged.

What CI does and does not do

It parses Python and shell, refuses Arabic written straight into code, refuses a real MAC or serial number in a document, checks that the derived datapath constants still agree with the documentation, checks that what the documents point at still exists - every repository path, every dev.<driver>.0.* sysctl and every driver constant they name - and checks that docs/INDEX.md lists every page with the date at its top. Once a month a separate workflow keeps one issue open with the pages whose review is due.

One check it cannot run is the one for citations into somebody else's source - the giu_nic.c:1714 form, of which this repository now has more than twenty. CI has no vendor tree. Whoever holds one should run it after unpacking a different SDK drop, because a new release renumbers every line of every file while every citation here goes on reading perfectly plausibly:

python3 tools/check-doc-references.py . --vendor path/to/the/unpacked/sources

The project's repositories are written once, in family.json, and the appliance models once, in scripts/xgs/models.py and tools/devices-table.py, which write website/data/devices.json. tools/check-family.py holds every list here that names them to those two: a new plugin goes into family.json first, and the check then names each list it has to join - the Plugins tab, the problem reporter's parts, the relay, About, the forms tables, the site. A plugin's own checks.yml can call .github/workflows/plugin-family-check.yml, which holds the models its issue forms and tables name to os-xgs-npu's main, and its repository to family.json there. This repository's checks run each plugin's job as its checks.yml writes it, so a change to the models that would break a plugin fails here first. Every plugin's checks.yml also calls .github/workflows/plugin-headers.yml: each source file it tracks opens with its SPDX line and its author's copyright line, "Copyright (c) 2026 Abdelmonem Awad", in its own comment style (tools/check-headers.py; with --write it puts most right). What every image carries is family.json's image list: the image builder's page on the site names those, and the checks hold the list to xgs-image-builder's components.list.

It does not compile the drivers - they cannot be built on a Linux runner - so a green tick says nothing about whether the coprocessor is still written to correctly. Nor can it check a claim about behaviour. A page saying a module is never loaded, beside a boot hook that loads it, is a defect no name check finds; that one is caught by opening the code the sentence is about, and it is the reason a change to a driver should come with a pass over the pages that describe it.

A change comes with the test that shows it works: a tools/test-*.py for what runs off an appliance, with its own step in checks.yml - which runs only the tests it names - on every pull request, and for a driver a lab script under contrib/ - contrib/octep/test-detach-refusal.sh, say - run on an appliance before the merge. A plugin that relies on how OPNsense behaves - which way a counter counts, what a pf table holds - carries a behaviour test for it, run on an appliance by tools/behaviour/run.py: docs/behaviour-tests.md.

How a pull request is reviewed

From the day it is opened, in this order:

  1. Checks. Until your first pull request here is merged, the checks on it wait for a maintainer to let them run. A red one says in its log what failed.
  2. Reading. The change is read against the code it touches and the pages that describe that code. Questions go on the pull request.
  3. A run on the lab's appliances, as a user meets it: the change installed, the appliance restarted, then install/verify.sh and the pages the change shows. The lab has an XGS 136 and two XGS 3300s. For a model it does not have, that run shows nothing changed on these, and your run shows the change works on yours. Both must be of the commit that is merged: a push after them means another. What ran is posted on the pull request, figures included. A change to the connection path is soaked there as well, for 30 minutes, and the soak's line goes into the pull request's body (RELEASING.md, "What keeps a fault from coming back"); its check stays red until then.
  4. Merge, by hand, once every check is green: squashed into one commit, whose subject becomes its line in CHANGELOG.md and may be reworded to read as one. You stay the commit's author.
  5. Release. The change reaches appliances with the next release. An issue it fixes stays open until its reporter says the fix works.

A pull request is not merged while it holds a claim nobody has run; an address, a MAC address or a serial number; or anything of the vendor's closed software - its code, or the names of its files and functions: say what it does instead. Open-source code, the vendor's included, is cited by name.

Arabic. Every string a page shows has its Arabic in opnsense-arabic's catalogue. If you do not write Arabic, leave it out: a change that adds or changes a menu entry, a form's label or help, or a whole new page is merged without it, the string shows in English until its Arabic follows, and the checks list every string still waiting. The same holds in every plugin.

Labels, and waiting for an answer

An issue opened from a form is labelled with the model it names, and a pull request with what it changes (.github/workflows/labels.yml). When an issue waits on an answer from you, it carries the label waiting for reply: a week without one brings a single reminder, and nothing is ever closed for it (tools/reminder.py). The other way round, an issue you open or comment on, or a report you write by hand in your appliance's problem reporter, carries unanswered until the developer replies, and answered from then on; if thirty minutes pass first, a single automated note says the developer is not available at the moment and will reply as soon as possible (tools/answered.py). Every message the project's bot writes ends by saying it is automated.

Conduct, and vulnerabilities

Everyone here is held to the Code of Conduct. A vulnerability goes to the address in SECURITY.md, not into an issue. A problem, a measurement or an idea goes into an issue through its form, a question into Discussions, and a pull request through its template. Your first report from the appliance or measurement form, first problem solved or first pull request merged is answered once by the project's bot with a thank-you (tools/thanks.py).