HomeFreeBSD

ena: Share ena_global_lock between driver instances

Description

ena: Share ena_global_lock between driver instances

In order to use ena_global_lock in sysctl context, it must be kept
outside the driver instance's software context, as sysctls can be called
before attach and after detach, leading to lock use before sx_init and
after sx_destroy otherwise.
Solve this issue by turning ena_global_lock into a file scope
variable, shared between all instances of the driver and associated
sysctl context, and in turn initialized/destroyed in dedicated
SYSINIT/SYSUNINIT functions.
As a side effect, this change also fixes existing race in the reset
routine, when simultaneously accessing sysctl exposed properties.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

Details

Provenance
ar_semihalf.comAuthored on Aug 12 2021, 8:34 AM
mwCommitted on Sep 1 2021, 11:06 PM
Parents
rGa831466830de: ena: Disable meta descriptor caching for netmap
Branches
Unknown
Tags
Unknown