Page MenuHomeFreeBSD

qlnxe: Avoid reinitializing the interface when it is already initialized
ClosedPublic

Authored by zlei on Jan 26 2026, 6:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 14, 2:33 AM
Unknown Object (File)
Tue, Mar 3, 9:48 PM
Unknown Object (File)
Sun, Mar 1, 4:13 PM
Unknown Object (File)
Sun, Feb 22, 10:33 AM
Unknown Object (File)
Feb 14 2026, 4:51 PM
Unknown Object (File)
Feb 14 2026, 4:51 PM
Unknown Object (File)
Feb 14 2026, 6:41 AM
Unknown Object (File)
Feb 14 2026, 6:21 AM
Subscribers

Details

Summary

qlnx_init_locked() unconditionally uninitialize the interface thus is
actually reinitializing the interface. Well the init routine qlnx_init()
is to initialize the interface by net stack when assigned with the first
inet or inet6 address. The ioctl SIOCSIFADDR for the first inet6 address
is handled by ether_ioctl() thus the interface is reinitialized no matter
it was initialized or not.

Add a driver status check for that to avoid reinitializing. Further plan
is removing SIOCSIFADDR ioctl from the driver and let ether_ioctl() handle
it.

MFC after: 1 week

Test Plan
  1. Assign an IPv4 address to ql0, or bring it up via ifconfig ql0 up.
  2. Assign the first IPv6 address to ql0.

Watch /var/log/messages, there should be no ql0: link state changed to DOWN event while assigning the IPv6 address.

Diff Detail

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

Event Timeline

zlei requested review of this revision.Jan 26 2026, 6:38 AM

Light ack as the two init functions seem fine but I have not looked through the entirety to see if there was some reason for stopping the MAC (rdma?) and you should probably look at all the leafs of qlnx_load especially filter setup.

This revision is now accepted and ready to land.Feb 6 2026, 6:22 AM

Light ack as the two init functions seem fine but I have not looked through the entirety to see if there was some reason for stopping the MAC (rdma?) and you should probably look at all the leafs of qlnx_load especially filter setup.

The function qlnx_slowpath_start() is due to enable iWARP or RoCE. It is called on attaching the device ( port ), or error recover, or manually triggered by sysctl qlnx_trigger_dump_sysctl() [1], but not by qlnx_load() . The latter two will also do qlnx_stop() and qlnx_load() to recover the device.

static int
qlnx_slowpath_start(qlnx_host_t *ha)
{
        struct ecore_dev        *cdev;
        struct ecore_pf_params  pf_params;
        int                     rc;

        memset(&pf_params, 0, sizeof(struct ecore_pf_params));
        pf_params.eth_pf_params.num_cons  =
                (ha->num_rss) * (ha->num_tc + 1);

#ifdef QLNX_ENABLE_IWARP
        if (qlnx_vf_device(ha) != 0) {
                if(ha->personality == ECORE_PCI_ETH_IWARP) {
                        device_printf(ha->pci_dev, "setting parameters required by iWARP dev\n");       
                        pf_params.rdma_pf_params.num_qps = 1024;
                        pf_params.rdma_pf_params.num_srqs = 1024;
                        pf_params.rdma_pf_params.gl_pi = ECORE_ROCE_PROTOCOL_INDEX;
                        pf_params.rdma_pf_params.rdma_protocol = ECORE_RDMA_PROTOCOL_IWARP;
                } else if(ha->personality == ECORE_PCI_ETH_ROCE) {
                        device_printf(ha->pci_dev, "setting parameters required by RoCE dev\n");        
                        pf_params.rdma_pf_params.num_qps = 8192;
                        pf_params.rdma_pf_params.num_srqs = 8192;
                        //pf_params.rdma_pf_params.min_dpis = 0;
                        pf_params.rdma_pf_params.min_dpis = 8;
                        pf_params.rdma_pf_params.roce_edpm_mode = 0;
                        pf_params.rdma_pf_params.gl_pi = ECORE_ROCE_PROTOCOL_INDEX;
                        pf_params.rdma_pf_params.rdma_protocol = ECORE_RDMA_PROTOCOL_ROCE;
                }
        }
#endif /* #ifdef QLNX_ENABLE_IWARP */

        cdev = &ha->cdev;
...
}

If there is some reason for stopping the MAC, a pair of SIOCSIFFLAGS ioctls can be issued, say ifconfig ql0 down && ifconfig ql0 up.

[1] Well I'm hacking the qlnx_slowpath_start(), I got kernel panics. From the stack trace, it appears some locks are not freed properly. I'm still investigating on it but I think that is not urgent.