]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
iflib: initialize netmap with the correct number of descriptors
authorvmaffione <vmaffione@FreeBSD.org>
Mon, 20 Jul 2020 21:08:56 +0000 (21:08 +0000)
committervmaffione <vmaffione@FreeBSD.org>
Mon, 20 Jul 2020 21:08:56 +0000 (21:08 +0000)
commit4bc07440bf742e7c6dc7cef38cd4282728d25be8
treee7b6d7ed66a2cf6029f3bda5fcc3a937fb8c98be
parentaebe9cb8782a1810ba875312d5fe58680b5435d3
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
sys/net/iflib.c