Page MenuHomeFreeBSD

cxgb(4): Remove assumption of physically contiguous mbufs.
ClosedPublic

Authored by mav on Jan 30 2021, 3:53 PM.
Referenced Files
F81598451: D28428.diff
Thu, Apr 18, 5:56 PM
Unknown Object (File)
Mon, Apr 8, 11:50 AM
Unknown Object (File)
Feb 7 2024, 1:38 PM
Unknown Object (File)
Jan 31 2024, 2:21 AM
Unknown Object (File)
Jan 31 2024, 2:21 AM
Unknown Object (File)
Jan 31 2024, 2:21 AM
Unknown Object (File)
Jan 31 2024, 2:09 AM
Unknown Object (File)
Jan 26 2024, 3:58 PM
Subscribers
None

Details

Summary

Investigation of iSCSI data corruption reports brought me to discovery that cxgb(4) expects mbufs to be physically contiguous, that is not true after I've started using m_extaddref() in software iSCSI for large zero-copy transmissions. In case of fragmented memory the driver transmitted garbage from pages following the first one due to simple use of pmap_kextract() for the first pointer instead of proper bus_dmamap_load_mbuf_sg(). Seems like it was done as some optimization many years ago, and at very least it is wrong in a world of IOMMUs.

This patch just removes that optimization, plus limits packet coalescing for mbufs crossing page boundary, also depending on assumption of one segment per packet.

Test Plan

With this patch no longer see corruptions on simple iSCSI reads with cxgb(4) NIC used at the target, where previously I saw them a lot.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mav requested review of this revision.Jan 30 2021, 3:53 PM
mav created this revision.
This revision is now accepted and ready to land.Jan 30 2021, 7:31 PM