Page MenuHomeFreeBSD

iflib: add new field: isc_dma_width
ClosedPublic

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

Details

Summary

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_softc_ctx.

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

Submitted by: Artur Rojek <ar@semihalf.com>
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

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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.
sys/net/iflib.h
238

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

Changes:

  • 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.