Page MenuHomeFreeBSD

qlnxe: Fix SIOCGI2C ioctl
ClosedPublic

Authored by zlei on Jul 16 2025, 4:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 10, 10:13 PM
Unknown Object (File)
Fri, Oct 10, 10:13 PM
Unknown Object (File)
Fri, Oct 10, 10:12 PM
Unknown Object (File)
Fri, Oct 10, 4:15 PM
Unknown Object (File)
Wed, Oct 8, 9:21 PM
Unknown Object (File)
Wed, Oct 8, 6:03 PM
Unknown Object (File)
Sat, Oct 4, 5:53 PM
Unknown Object (File)
Tue, Sep 30, 8:39 PM

Details

Summary

The error -1 is actually ERESTART in the context of syscall. It is for
kernel mode only and will not be passed to user mode. When the kernel
sees this error it will restart the syscall.

When the the SFP module data is not available, e.g. the SFP module is
not present, the ioctl handler returns ERESTART and kernel will
infinitely retry, thus the userland ifconfig -v ql0 will hang forever
until get interrupted.

Fix that by returning error ENODEV to indicate the SFP module data is
not available.

For the failure of ecore_ptt_acquire(), it appears to be quite safe to
restart, so keep it untouched.

Reported by: Steve Wheeler
See also: https://redmine.pfsense.org/issues/16248
MFC after: 3 days

Test Plan

Unplug the SFP module, and retrieve the SFP module data by ifconfig -v.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

zlei requested review of this revision.Jul 16 2025, 4:44 PM
This revision is now accepted and ready to land.Jul 16 2025, 10:28 PM
This revision was automatically updated to reflect the committed changes.

A bit late, but Steve confirmed this fixed the freeze with ifconfig when the SFP is not plugged in.
Thanks!

In D51351#1173150, @kp wrote:

A bit late, but Steve confirmed this fixed the freeze with ifconfig when the SFP is not plugged in.

That's good !

I forgot to note that I brought a used QLogic QL41212HLCU card so that I can debug and test locally. The card arrives after I made the first patch while hacking PR287445. Later I observed ifconfig hanging and finally figured out the ERESTART HACK. So comes this fast fix :)

CC Franco @franco_opnsense.org .

While searching with the keyword qlnxe I found this report https://forum.opnsense.org/index.php?topic=30278.0 which has much the same symptom. I think that is the very first report of the hanging issue with ifconfig -v, since it was reported at September 12, 2022 and is prior to https://redmine.pfsense.org/issues/16248 .