Page MenuHomeFreeBSD

iflib: add new field: isc_dma_width
ClosedPublic

Authored by ar_semihalf.com on Feb 16 2021, 4:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 5, 7:59 AM
Unknown Object (File)
Fri, Apr 5, 7:43 AM
Unknown Object (File)
Thu, Mar 28, 8:32 AM
Unknown Object (File)
Mar 9 2024, 5:45 PM
Unknown Object (File)
Feb 16 2024, 4:44 AM
Unknown Object (File)
Feb 16 2024, 4:44 AM
Unknown Object (File)
Feb 16 2024, 4:44 AM
Unknown Object (File)
Feb 16 2024, 4:44 AM

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
rG FreeBSD src repository
Lint
Lint Not Applicable
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
239

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.