Page MenuHomeFreeBSD

iflib: expose the Rx mbuf buffer size to drivers
ClosedPublic

Authored by jacob.e.keller_intel.com on Mar 7 2019, 12:09 AM.
Tags
None
Referenced Files
F105785138: D19489.diff
Fri, Dec 20, 4:15 PM
Unknown Object (File)
Wed, Dec 11, 8:19 PM
Unknown Object (File)
Mon, Dec 9, 3:36 AM
Unknown Object (File)
Sun, Dec 1, 7:02 PM
Unknown Object (File)
Sun, Nov 24, 12:25 PM
Unknown Object (File)
Thu, Nov 21, 5:02 PM
Unknown Object (File)
Thu, Nov 21, 12:07 AM
Unknown Object (File)
Nov 14 2024, 1:01 PM
Subscribers

Details

Summary

iflib_fl_setup calculates a suitable buffer size for the Rx mbufs based
on the isc_max_frame_size value that drivers setup. This calculation is
repeated by drivers when programming their hardware with the size of
each Rx buffer.

This can lead to a mismatch where the iflib mbuf size is different from
the expected size of the buffer as programmed by the hardware. This can
lead to unexpected results.

If iflib ever wants to support mbuf sizes larger than one page, every
driver must be updated to account for the new possible buffer sizes.

Fix this by calculating the mbuf size prior to calling IFDI_INIT, and
adding the iflib_get_rx_mbuf_sz function which will expose this value to
drivers, so that they do not repeat the same calculation.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

The intention here is to ensure that device drivers which need the size of the rx buffers can ensure they use the same size as iflib, (possibly incase we want to re-enable something like the old CONTIG_MALLOCWORKS again)

sys/net/iflib.c
2327 ↗(On Diff #54792)

style(9) nit -- there should be parentheses around this return value

2365 ↗(On Diff #54792)

You would also start the comment on the line after the opening "/*".

sys/net/iflib.c
2318 ↗(On Diff #54840)

I know this is copied from the original code, but shouldn't this check be against MCLBYTES, just in case that ever changes to not being 2048?

Replace the 2048 magic number with MCLBYTES

jacob.e.keller_intel.com added inline comments.
sys/net/iflib.c
2318 ↗(On Diff #54840)

Yes, I agree.

And again now that I've joined iflib...

This revision is now accepted and ready to land.Mar 14 2019, 5:02 PM
This revision was automatically updated to reflect the committed changes.