Page MenuHomeFreeBSD

iflib: initialize netmap with the correct number of descriptors
ClosedPublic

Authored by vmaffione on Jul 1 2020, 7:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 11:10 PM
Unknown Object (File)
Feb 16 2024, 11:06 PM
Unknown Object (File)
Jan 17 2024, 6:09 PM
Unknown Object (File)
Dec 29 2023, 8:20 AM
Unknown Object (File)
Dec 22 2023, 10:45 PM
Unknown Object (File)
Dec 20 2023, 11:02 PM
Unknown Object (File)
Dec 1 2023, 6:19 AM
Unknown Object (File)
Sep 9 2023, 10:58 PM
Subscribers

Details

Summary

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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247647

Test Plan

Tested on vmx0 interface on QEMU/KVM. After the fix, iflib does not panic anymore.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

The PR reporter has tested the patch and confirmed that the panic has been fixed. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247647

This revision was not accepted when it landed; it landed in state Needs Review.Jul 20 2020, 9:09 PM
This revision was automatically updated to reflect the committed changes.