HomeFreeBSD

iflib: initialize netmap with the correct number of descriptors

Description

iflib: initialize netmap with the correct number of descriptors

In case the network device has a RX or TX control queue, the correct
number of TX/RX descriptors is contained in the second entry of the
isc_ntxd (or isc_nrxd) array, rather than in the first entry.
This case is correctly handled by iflib_device_register() and
iflib_pseudo_register(), but not by iflib_netmap_attach().
If the first entry is larger than the second, this can result in a
panic. This change fixes the bug by introducing two helper functions
that also lead to some code simplification.

PR: 247647
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D25541

Details

Provenance
vmaffioneAuthored on
Differential Revision
D25541: iflib: initialize netmap with the correct number of descriptors
Parents
rS363377: add a few tests for sendfile.
Branches
Unknown
Tags
Unknown