HomeFreeBSD

ena: Reinit netmap adapter struct upon sysctl changes

Description

ena: Reinit netmap adapter struct upon sysctl changes

When attaching ENA driver, ena_netmap_attach() is invoked which, in turn
calls netmap_attach which, initializes a struct netmap_adapter,
allocating the struct's netmap_ring and the struct selinfo.

When we change the interface number of queues we need to reinit the
netmap adapter struct as well, so we need to detach it in order to free
the memory allocated by netmap_attach and allocate new memory based on
the new parameters like number of rings, ring size etc...

Without detaching and attaching the netmap interface, if we're to change
the number of queues from 8 to 2 for example and try to enable netmap,
the kernel will panic since the original netmap struct within the
kernel's possession still thinks that the driver has 8 queues which will
eventually cause a non-allocated virtual address access fault.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit f9c9c01de87e0440380b939c684d9939d48ce175)

Details

Provenance
osamaabb_amazon.comAuthored on Aug 7 2024, 6:24 AM
Parents
rG8b43095ad8cd: ena: Clear NS_MOREFRAG flag for last netmap slot
Branches
Unknown
Tags
Unknown