The branch main has been updated by zlei:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=12fea464070a9061fda874038614ed55011ad59d

commit 12fea464070a9061fda874038614ed55011ad59d
Author:     Zhenlei Huang <z...@freebsd.org>
AuthorDate: 2025-07-17 04:01:16 +0000
Commit:     Zhenlei Huang <z...@freebsd.org>
CommitDate: 2025-07-17 04:01:16 +0000

    qlnxe: Fix error handling of SIOCGI2C ioctl
    
    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 retry
    infinitely, hence the userland `ifconfig -v ql0` will hang forever until
    get interrupted. That is apparently wrong.
    
    Fix that by returning error ENODEV to indicate the SFP module data is
    not available.
    
    As for the case that ecore_ptt_acquire() fails, it appears to be quite
    safe to restart, so keep returning ERESTART.
    
    Reported by:    Steve Wheeler
    See also:       https://redmine.pfsense.org/issues/16248
    Reviewed by:    kbowling
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D51351
---
 sys/dev/qlnx/qlnxe/qlnx_os.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c
index 160534476688..9d23d5df1d2b 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_os.c
+++ b/sys/dev/qlnx/qlnxe/qlnx_os.c
@@ -2780,7 +2780,7 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
 
                if (!p_ptt) {
                        QL_DPRINT1(ha, "ecore_ptt_acquire failed\n");
-                       ret = -1;
+                       ret = ERESTART;
                        break;
                }
 
@@ -2791,7 +2791,7 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
                ecore_ptt_release(p_hwfn, p_ptt);
 
                if (ret) {
-                       ret = -1;
+                       ret = ENODEV;
                        break;
                }
 

Reply via email to