Page MenuHomeFreeBSD

qlnxr: Properly initialize the Linux device structure
ClosedPublic

Authored by markj on Apr 5 2021, 8:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 6, 9:17 AM
Unknown Object (File)
Sat, Sep 5, 10:11 PM
Unknown Object (File)
Sat, Sep 5, 5:06 PM
Unknown Object (File)
Thu, Sep 3, 2:57 AM
Unknown Object (File)
Wed, Sep 2, 12:31 AM
Unknown Object (File)
Tue, Sep 1, 11:45 PM
Unknown Object (File)
Tue, Sep 1, 11:35 PM
Unknown Object (File)
Tue, Sep 1, 9:24 PM
Subscribers

Details

Summary

types.h defines device_t to be a struct device *, but the definition of
struct device is internal to subr_bus. But, the LinuxKPI also defines a
struct device, so type confusion is possible.

In this case, we were copying a FreeBSD device structure into a Linux
device structure. The Linux device structure is only used for the IB
device, for allocating DMA'able memory. I believe the old version
worked more or less by accident.

Use linux_pci_attach_device() instead, following the example of the
Chelso iwarp driver. Also ensure that we don't leak the faked device
during detach.

Test Plan

None, I do not have any way to test this.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 38342
Build 35231: arc lint + arc unit