opnsense-src/sbin/devd/Makefile
John Baldwin 5c59cec2d5 nvmf: Auto-reconnect periodically after a disconnect
Use a timer in the nvmf(4) driver to periodically trigger a devctl
"RECONNECT" notification.  A trigger in the /etc/devd/nvmf.conf file
invokes "nvmecontrol reconnect nvmeX" upon each notification.  This
differs from iSCSI which uses a dedicated daemon (iscsid(8)) to wait
inside a custom ioctl for an iSCSI initiator event to occur, but I
think this design might be simpler.

Similar to nvme-cli, the interval between reconnection attempts is
specified in seconds by the --reconnect-delay argument to the connect
and reconnect commands.  Note that nvme-cli uses -c for short letter
of this command, but that was already taken so nvmecontrol uses -r.
The default is 10 seconds to match Linux.

In addition, a second timeout can be used to force a full detach of a
disconnected the nvmeX device after the controller loss timeout
expires.  The timeout for this is specified in seconds by the
--ctrl-loss-tmo/-l options (identical to nvme-cli).  The default is
600 seconds.

Either of these timers can be disabled by setting the timer to 0.  In
that case, the associated action (devctl notifications or full detach)
will not occur after a disconnect.

Note that this adds a dedicated taskqueue for nvmf tasks instead of
using taskqueue_thread as the controller loss task could deadlock
waiting for the completion of other tasks queued to taskqueue_thread.
(Specifically, tearing down the CAM SIM can trigger
destroy_dev_sched_cb() and waits for the callback to run, but the
callback is scheduled to run in a task on taskqueue_thread.  Possibly,
destroy_dev_sched should be using a dedicated taskqueue.)

Reviewed by:	imp (earlier version)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D50222
2025-07-09 10:19:45 -04:00

83 lines
1.4 KiB
Makefile

.include <src.opts.mk>
WARNS?= 6
PACKAGE=devd
CONFGROUPS= CONFS DEVD
CONFS= devd.conf
DEVD= devmatch.conf
DEVDDIR= /etc/devd
.if ${MK_ACPI} != "no"
DEVD+= asus.conf
.endif
.if ${MK_AUTOFS} != "no"
CONFGROUPS+= AUTOFS
AUTOFSDIR= ${DEVDDIR}
AUTOFS+= autofs.conf
AUTOFSPACKAGE= autofs
.endif
CONFGROUPS+= DHCLIENT
DHCLIENTDIR= ${DEVDDIR}
DHCLIENT+= dhclient.conf
DHCLIENTPACKAGE= dhclient
CONFGROUPS+= POWERPROFILE
POWERPROFILEDIR= ${DEVDDIR}
POWERPROFILE+= power_profile.conf
POWERPROFILEPACKAGE= acpi
CONFGROUPS+= CONSOLE
CONSOLEDIR= ${DEVDDIR}
CONSOLE+= moused.conf syscons.conf
CONSOLEPACKAGE= console-tools
.if ${MK_BLUETOOTH} != "no"
CONFGROUPS+= BLUETOOTH
BLUETOOTHDIR= ${DEVDDIR}
BLUETOOTH+= bluetooth.conf
BLUETOOTHPACKAGE= bluetooth
.endif
.if ${MK_HYPERV} != "no"
CONFGROUPS+= HYPERV
HYPERVDIR=${DEVDDIR}
HYPERV+= hyperv.conf
HYPERVPACKAGE= hyperv-tools
.endif
CONFGROUPS+= NVME
NVMEDIR= ${DEVDDIR}
NVME+= nvmf.conf
NVMEPACKAGE= nvme-tools
.if ${MK_USB} != "no"
DEVD+= uath.conf ulpt.conf
.endif
.if ${MACHINE_ARCH} == "powerpc"
DEVD+= apple.conf
.endif
.if ${MK_ZFS} != "no"
DEVD+= zfs.conf
.endif
PROG_CXX=devd
SRCS= devd.cc token.l parse.y y.tab.h
MAN= devd.8 devd.conf.5
LIBADD= util
YFLAGS+=-v
CFLAGS+=-I. -I${.CURDIR}
CFLAGS.clang += -Wno-missing-variable-declarations
CFLAGS.gcc = -Wno-redundant-decls
CXXFLAGS.gcc = -Wno-redundant-decls
CLEANFILES= y.output y.tab.i
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>