au-ts / sddf

A collection of interfaces, libraries and tools for writing device drivers for seL4 that allow accessing devices securely and with low overhead.
Other
23 stars 18 forks source link

Update ethernet driver HW rings #254

Open Courtney3141 opened 2 months ago

Courtney3141 commented 2 months ago

This PR updates the ethernet driver HW rings to comply with sDDF queue conventions. Changes are:

  1. Use overflowing unsigneds for head and tail indices (rather than keeping indices modulo ring capacity).
  2. Use the entire capacity of the HW rings (rather than keeping 1-2 entries as guard entries which was previously required before changing 1).
  3. Keep ring capacity as an element in the HW ring struct. Prior to this PR, it was used as a macro throughout the code, and required as a function parameter to queue functions which already took the queue data structure as a parameter.
  4. Correct the memory barriers when reading from and writing to the ring DMA region. This involved the addition of two acquire fences to prevent re-orderings before reading, and the relaxing of a full memory barrier to a release barrier when adding an entry to the ring (writing).

Note that this PR is based off https://github.com/au-ts/sddf/pull/253, and should be merged secondary to that.