iSCSI: Fast and per-session timeouts

Support per-session configurable ping (SCSI NOP) and login timeouts
similar to what is supported in the Linux iSCSI initiator configuration file.

Reduce iscsi timer granularity to 0.1 sec.
For backwards compatibility, when all timers are selected on integer numbers,
all status messages are unchanged. If the higher granularity is used, the
log messages include sub-second granularity.

The sysctl(3) interface has changed from pure int to string, in order to
support fractional seconds in a human-readable, dotted notation.

Reviewed By: #netapp, #manpages, jhb, pauamma_chezdork.com, siderop1_netapp.com
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D32540
This commit is contained in:
Richard Scheffenegger committed 2026-11-06 22:21:12 +01:00
1 parent e0c6b88706
commit 6129bc4b65
8 files changed
+82 -34

No files matched your search

+6 -2
View File
@@ -357,7 +357,7 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request)
int keepinit = 0;
if (conn->conn_conf.isc_login_timeout > 0) {
keepinit = conn->conn_conf.isc_login_timeout;
log_debugx("session specific LoginTimeout at %d sec",
log_debugx("session specific LoginTimeout at %d ms",
keepinit);
}
if (conn->conn_conf.isc_login_timeout == -1) {
@@ -366,11 +366,13 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request)
if (sysctlbyname("kern.iscsi.login_timeout",
&value, &size, NULL, 0) == 0) {
keepinit = value;
log_debugx("global login_timeout at %d sec",
log_debugx("global login_timeout at %d ms",
keepinit);
}
}
if (keepinit > 0) {
/* setsockopt only supports full seconds */
keepinit = roundup(keepinit, 1000);
if (setsockopt(conn->conn.conn_socket,
IPPROTO_TCP, TCP_KEEPINIT,
&keepinit, sizeof(keepinit)) == -1)
@@ -476,6 +478,8 @@ handoff(struct iscsid_connection *conn)
conn->conn.conn_max_send_data_segment_length;
idh.idh_max_burst_length = conn->conn.conn_max_burst_length;
idh.idh_first_burst_length = conn->conn.conn_first_burst_length;
idh.idh_ping_timeout = conn->conn_conf.isc_ping_timeout;
idh.idh_login_timeout = conn->conn_conf.isc_login_timeout;
error = ioctl(conn->conn_iscsi_fd, ISCSIDHANDOFF, &idh);
if (error != 0)