Page MenuHomeFreeBSD

iflib: add new field: isc_dma_width

Authored by on Feb 16 2021, 4:38 PM.



Some DMA controllers are unable to address the full host memory space
and are instead limited to a subset of address range (e.g. 48-bit).

Allow the driver to specify the maximum allowed DMA addressing width
(in bits) for the NIC hardware, by introducing a new field in

If said field is omitted (set to 0), the lowaddr of DMA window bounds
defaults to BUS_SPACE_MAXADDR.

Submitted by: Artur Rojek <>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

Test Plan

In order to test, set scctx->isc_dma_width to a non-zero value, e.g. scctx->isc_dma_width = 48.

Diff Detail

rG FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

I'm shocked that this feature was not present before.

This revision is now accepted and ready to land.Feb 16 2021, 5:02 PM
erj added inline comments.

You should validate this value -- what if someone puts in something ridiculous by accident?


  • provide a sanity check for isc_dma_width,
  • introduce a DMA_WIDTH_TO_BUS_LOWADDR macro to correctly handle edge cases where isc_dma_width equals either 0 or the number of bits in BUS_SPACE_MAXADDR
This revision now requires review to proceed.Feb 21 2021, 1:32 PM
This revision is now accepted and ready to land.Feb 22 2021, 1:23 AM
This revision was automatically updated to reflect the committed changes.